Hi people,
I want to do a sensitivity analysis for the combustion of ammonia with respect to temperature, pressure and equivalence ratio. That means that I am looking for the most sensitive 10 reactions with respect to temperature,pressure and equivalence ratio. For the beginning I used the sensitivity script of cantera but there are some lines which I dont get what they are doing. For example in the script they define tolerances for the solution and for the sensitivty coefficient:
sim.rtol = 1.0e-6
sim.atol = 1.0e-15
sim.rtol_sensitivity = 1.0e-6
sim.atol_sensitivity = 1.0e-6
What do these tolerances mean?
Furthermore I dont quite understand how I can set the range of temperature, pressure or equivalence ratio. My understanding is that in order to calculate a sensitivity with respect to temperature one has to vary the temperature in order to see how the different reaction rates will change. Does anyone know where I can set these ranges?
This is the sensitivty script of cantera:
gas = ct.Solution('gri30.yaml')
temp = 1500.0
pres = ct.one_atm
gas.TPX = temp, pres, 'CH4:0.1, O2:2, N2:7.52'
r = ct.IdealGasConstPressureReactor(gas, name='R1')
sim = ct.ReactorNet([r])
# enable sensitivity with respect to the rates of the first 10
# reactions (reactions 0 through 9)
for i in range(10):
r.add_sensitivity_reaction(i)
# set the tolerances for the solution and for the sensitivity coefficients
sim.rtol = 1.0e-6
sim.atol = 1.0e-15
sim.rtol_sensitivity = 1.0e-6
sim.atol_sensitivity = 1.0e-6
states = ct.SolutionArray(gas, extra=['t', 's2', 's3'])
for t in np.arange(0, 2e-3, 5e-6):
sim.advance(t)
s2 = sim.sensitivity('OH', 2) # sensitivity of OH to reaction 2
s3 = sim.sensitivity('OH', 3) # sensitivity of OH to reaction 3
states.append(r.thermo.state, t=1000*t, s2=s2, s3=s3)
print('{:10.3e} {:10.3f} {:10.3f} {:14.6e} {:10.3f} {:10.3f}'.format(
sim.time, r.T, r.thermo.P, r.thermo.u, s2, s3))
Thank you for your answer!
Kind regards,
Tjabbo