Pressure evolution in IdealGasReactor

193 views
Skip to first unread message

salim sebai

unread,
May 28, 2021, 6:38:05 PM5/28/21
to Cantera Users' Group
Hello to all, 
I am using the IdealGasReactor to study the reactivity of methane/air combustion. However, I am very confused about the evolution of the pressure in time. I observe that the final pressure is not so high compared to the experimental result, and by changing the initial pressure, we have a linear evolution of P_max which is more or less the double of Pi in all cases. 
According to J.Kee Ref, in the case of a constant pressure reactor, the transient volume can be evaluated from the equation of state. Is this the case for the transient pressure in the case of a constant volume reactor? 

Sincerely 



Pressure evolution IdealGasReactor.png

Bryan Weber

unread,
May 29, 2021, 11:50:16 AM5/29/21
to Cantera Users' Group
Hi,

Yes, the transient pressure can be evaluated from the equation of state. In fact, for an ideal gas, this is exactly how Cantera calculates the pressure. See here: https://github.com/Cantera/cantera/blob/01bf417683a015fe85393273c9f5aab8ebc32a0a/include/cantera/thermo/IdealGasPhase.h#L380-L387, also shown below:

    /**
     * Pressure. Units: Pa.
     * For an ideal gas mixture,
     * \f[ P = n \hat R T. \f]
     */
    virtual doublereal pressure() const {
        return GasConstant * molarDensity() * temperature();
    }

Best,
Bryan

Ray Speth

unread,
May 29, 2021, 11:52:57 AM5/29/21
to Cantera Users' Group
Hi,

As it says in the welcome message for the group, "If you are making a post regarding a problem using Cantera, please provide a minimal, complete, and verifiable example that demonstrates the problem when making your post; in short this means including a code example and input files along with information about your operating system and Cantera version. This will enable other members of the group to efficiently understand the problem and offer suggestions on how to fix it."

Without the information requested above, there's really no way for anyone here to know what you did - what the conditions are for the experiments you mentioned, or what the conditions are for the simulations you ran, so helping you interpret the results of these simulations is basically impossible.

Regards,
Ray

On Friday, May 28, 2021 at 6:38:05 PM UTC-4 sebai...@gmail.com wrote:

salim sebai

unread,
Jun 2, 2021, 5:39:57 AM6/2/21
to Cantera Users' Group
Hi, 
Thank you Bryan. It's exactly what I was searching for. 
Ray, I'm using the cantera's example of a constant pressure reactor.
I have just change the reactor model from IdealGasReactor as shown down. 

""
Constant-Volume, adiabatic kinetics simulation.
Requires: cantera >= 2.5.0, matplotlib >= 2.0
"""

import sys
import cantera as ct

gas = ct.Solution('gri30.yaml')
#gas.TPX = 1001.0, ct.one_atm, 'H2:2,O2:1,N2:3.76'
Pres = [1e5, 2e5, 3e5 ,4e5, 5e5]
for P in Pres :
      gas.TP = 1300.0, P
      gas.set_equivalence_ratio(1,'CH4:1.0', 'O2:1.0, N2:3.76')
      r = ct.IdealGasReactor(gas)

     sim = ct.ReactorNet([r])
     sim.verbose = True
     r.volume = 0.002

    # limit advance when temperature difference is exceeded
     delta_T_max = 20.
     r.set_advance_limit('temperature', delta_T_max)

    dt_max = 20.e-5
    t_end = 100 * dt_max
    states = ct.SolutionArray(gas, extra=['t'])

    print('{:10s} {:10s} {:10s} {:14s}'.format(
    't [s]', 'T [K]', 'P [Pa]', 'u [J/kg]'))
     while sim.time < t_end:
     sim.advance(sim.time + dt_max)
    states.append(r.thermo.state, t=sim.time*1e3)
    print('{:10.3e} {:10.3f} {:10.3f} {:14.6f}'.format(
    sim.time, r.T, r.thermo.P, r.thermo.u))

    # Plot the results if matplotlib is installed.
    # See http://matplotlib.org/ to get it.

    import matplotlib.pyplot as plt
    #plt.clf()
    plt.subplot(1, 3,1)
    plt.plot(states.t, states.P, label='Pi ='+str(P))
    plt.xlabel('Time (ms)')
    plt.ylabel('Pressure (Pa)')
    plt.subplot(1, 3, 2)
    plt.scatter(P, max(states.P) * 1e-5)
    plt.xlabel('Initial pressure (bar)')
    plt.ylabel('Max pressure (bar)')

best reagrds 
Reply all
Reply to author
Forward
0 new messages