## Ideal Gas Reactor¶

This page shows the derivation of the governing equations used in Cantera's Ideal Gas Reactor model.

More information on the Ideal Gas Reactor class can be found here.

## Ideal Gas Reactor¶

An Ideal Gas Reactor is defined by the four state variables:

• $$m$$, the mass of the reactor's contents (in kg)

• $$V$$, the reactor volume (in m3)

• $$T$$, the temperature (in K)

• $$Y_k$$, the mass fractions for each species (dimensionless)

The total mass of the reactor's contents changes as a result of flow through the reactor's inlets and outlets, and production of homogeneous phase species on ReactorSurface() objects:

\begin{equation*} \frac{dm}{dt} = \sum_{in} \dot{m}_{in} - \sum_{out} \dot{m}_{out} + \dot{m}_{wall} \tag{1} \end{equation*}

Where the subscripts in and out refer to the sum of the corresponding property over all inlets and outlets respectively. A dot above a variable signifies a time derivative.

The reactor volume changes as a function of time due to the motion of one or more Wall() objects:

\begin{equation*} \frac{dV}{dt} = \sum_w f_w A_w v_w(t) \tag{2} \end{equation*}

Where $$f_w = \pm 1$$ indicates the facing of the wall (whether moving the wall increases or decreases the volume of the reactor), $$A_w$$ is the surface area of the wall, and $$v_w(t)$$ is the velocity of the wall as a function of time.

In case of the Ideal Gas Reactor Model, the reactor temperature $$T$$ is used instead of the total internal energy $$U$$ as a state variable. For an ideal gas, we can rewrite the total internal energy in terms of the mass fractions and temperature:

\begin{equation*} U = m \sum_k Y_k u_k(T) \end{equation*}
\begin{equation*} \frac{dU}{dt} = u \frac{dm}{dt} + m c_v \frac{dT}{dt} + m \sum_k u_k \frac{dY_k}{dt} \end{equation*}

Substituting the corresponding derivatives yields an equation for the temperature:

\begin{equation*} m c_v \frac{dT}{dt} = - p \frac{dV}{dt} + \dot{Q} + \sum_{in} \dot{m}_{in} \left( h_{in} - \sum_k u_k Y_{k,in} \right) - \frac{p V}{m} \sum_{out} \dot{m}_{out} - \sum_k \dot{m}_{k,gen} u_k \tag{3} \end{equation*}

While this form of the energy equation is somewhat more complicated, it significantly reduces the cost of evaluating the system Jacobian, since the derivatives of the species equations are taken at constant temperature instead of constant internal energy.

The rate at which species $$k$$ is generated through homogeneous phase reactions is $$V \dot{\omega}_k W_k$$, and the total rate at which species $$k$$ is generated is:

\begin{equation*} \dot{m}_{k,gen} = V \dot{\omega}_k W_k + \dot{m}_{k,wall} \end{equation*}

The rate of change in the mass of each species is:

\begin{equation*} \frac{d(mY_k)}{dt} = \sum_{in} \dot{m}_{in} Y_{k,in} - \sum_{out} \dot{m}_{out} Y_k + \dot{m}_{k,gen} \end{equation*}

Expanding the derivative on the left hand side and substituting the equation for $$dm/dt$$, the equation for each homogeneous phase species is:

\begin{equation*} m \frac{dY_k}{dt} = \sum_{in} \dot{m}_{in} (Y_{k,in} - Y_k)+ \dot{m}_{k,gen} - Y_k \dot{m}_{wall} \tag{4} \end{equation*}

Equations 1-4 are the governing equations for an Ideal Gas Reactor.