FELiCS.Equation.Reactions.c2sm2#

Module Contents#

Classes#

C2SM2

C2SM2 class representing 2S-CM2 chemical reaction mechanism for a two-step combustion model.

class FELiCS.Equation.Reactions.c2sm2.C2SM2(YCH4_lim, P)#

C2SM2 class representing 2S-CM2 chemical reaction mechanism for a two-step combustion model.

This class encapsulates the thermochemical and kinetic properties of a simplified methane combustion mechanism involving key species and two global reactions.

Initialize the C2SM2 object

Parameters:
  • YCH4_lim (float) – The threshold value for the methane mass fraction.

  • P (int) – Polynomial degree for finite element approximation.

Variables:
  • YCH4_lim (float) – The threshold value for YCH4.

  • P (int) – The order of basis functions used in FEniCS.

  • janaf (Janafopenfoam) – Object for evaluating thermochemical properties using JANAF polynomials.

  • N2 (Janafspecie) – Instance representing nitrogen.

  • CO2 (Janafspecie) – Instance representing carbon dioxide.

  • O2 (Janafspecie) – Instance representing oxygen.

  • CH4 (Janafspecie) – Instance representing methane.

  • CO (Janafspecie) – Instance representing carbon monoxide.

  • H2O (Janafspecie) – Instance representing water vapor.

  • AR (Janafspecie) – Instance representing argon.

  • h0r_1 (float) – Standard-state enthalpy of reaction 1.

  • h0r_2 (float) – Standard-state enthalpy of reaction 2.

  • s0r_1 (float) – Standard-state entropy of reaction 1.

  • s0r_2 (float) – Standard-state entropy of reaction 2.

  • A1 (float) – Pre-exponential factor for reaction 1.

  • A2 (float) – Pre-exponential factor for reaction 2.

  • Ta1 (float) – Activation temperature for reaction 1.

  • Ta2 (float) – Activation temperature for reaction 2.

  • pa (float) – Reference pressure in N/m².

  • R (float) – Universal gas constant (consistent with JANAF data).

  • R_mol (float) – Molar gas constant (J/mol·K).

  • n_CH4_1 (float) – Stoichiometric coefficient of CH4 in reaction 1.

  • n_O2_1 (float) – Stoichiometric coefficient of O2 in reaction 1.

  • n_CO_1 (float) – Stoichiometric coefficient of CO in reaction 1.

  • n_H2O_1 (float) – Stoichiometric coefficient of H2O in reaction 1.

  • n_CO_2 (float) – Stoichiometric coefficient of CO in reaction 2.

  • n_O2_2 (float) – Stoichiometric coefficient of O2 in reaction 2.

  • n_CO2_2 (float) – Stoichiometric coefficient of CO2 in reaction 2.

  • nu_CH4_1 (float) – Kinetic exponent of CH4 in reaction 1.

  • nu_O2_1 (float) – Kinetic exponent of O2 in reaction 1.

  • nu_CO_1 (float) – Kinetic exponent of CO in reaction 1.

  • nu_H2O_1 (float) – Kinetic exponent of H2O in reaction 1.

  • nu_CO_2 (float) – Kinetic exponent of CO in reaction 2.

  • nu_O2_2 (float) – Kinetic exponent of O2 in reaction 2.

  • nu_CO2_2 (float) – Kinetic exponent of CO2 in reaction 2.

  • Q1dT (float or Expression) – Sensitivity of reaction 1 rate with respect to temperature.

  • Q1drho (float or Expression) – Sensitivity of reaction 1 rate with respect to density.

  • Q1dYCH4 (float or Expression) – Sensitivity of reaction 1 rate with respect to CH4 mass fraction.

  • Q1dYO2 (float or Expression) – Sensitivity of reaction 1 rate with respect to O2 mass fraction.

  • Q2dT (float or Expression) – Sensitivity of reaction 2 rate with respect to temperature.

  • Q2drho (float or Expression) – Sensitivity of reaction 2 rate with respect to density.

  • Q2dYCO (float or Expression) – Sensitivity of reaction 2 rate with respect to CO mass fraction.

  • Q2dYO2 (float or Expression) – Sensitivity of reaction 2 rate with respect to O2 mass fraction.

  • Q2dYCO2 (float or Expression) – Sensitivity of reaction 2 rate with respect to CO2 mass fraction.

computeSensitivities(T, rho, Y_CH4, Y_CO, Y_O2, Y_CO2)#

Compute all the sensitivities of the progress rates and store them.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_CO (float) – Mass fraction of CO.

  • Y_O2 (float) – Mass fraction of O2.

  • Y_CO2 (float) – Mass fraction of CO2.

Returns:

Returns True when sensitivities are computed.

Return type:

bool

deltaGT02_(T)#

Compute the standard-state Gibbs function change for reversible reaction 2.

Parameters:

T (float) – Temperature.

Returns:

Expression for the Gibbs function change.

Return type:

Expression

Kf1_(T)#

Compute the forward rate of reaction 1.

Parameters:

T (float) – Temperature.

Returns:

Expression for the forward rate of reaction 1.

Return type:

Expression

Kf2_(T)#

Compute the forward rate of reaction 2.

Parameters:

T (float) – Temperature.

Returns:

Expression for the forward rate of reaction 2.

Return type:

Expression

Kp2_(T)#

Compute the equilibrium constant for reaction 2.

Parameters:

T (float) – Temperature.

Returns:

Expression for the equilibrium constant for reaction 2.

Return type:

Expression

Kc2_(T)#

Compute the concentration equilibrium constant for reaction 2.

Parameters:

T (float) – Temperature.

Returns:

Expression for the concentration equilibrium constant for reaction 2.

Return type:

Expression

Kr2_(T)#

Compute the reverse rate of reaction 2.

Parameters:

T (float) – Temperature.

Returns:

Expression for the reverse rate of reaction 2.

Return type:

Expression

Q1_(T, rho, Y_CH4, Y_O2)#

Compute the rate of progress of reaction 1.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_O2 (float) – Mass fraction of O2.

Returns:

Expression for the rate of progress of reaction 1.

Return type:

Expression

Q2f_(T, rho, Y_CO, Y_O2)#

Compute the forward rate of progress of reaction 2.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CO (float) – Mass fraction of CO.

  • Y_O2 (float) – Mass fraction of O2.

Returns:

Expression for the forward rate of progress of reaction 2.

Return type:

Expression

Q2r_(T, rho, Y_CO2)#

Compute the reverse rate of progress of reaction 2.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CO2 (float) – Mass fraction of CO2.

Returns:

Expression for the reverse rate of progress of reaction 2.

Return type:

Expression

Q2_(T, rho, Y_CO, Y_O2, Y_CO2)#

Compute the rate of progress of reaction 2.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CO (float) – Mass fraction of CO.

  • Y_O2 (float) – Mass fraction of O2.

  • Y_CO2 (float) – Mass fraction of CO2.

Returns:

Expression for the rate of progress of reaction 2.

Return type:

Expression

Q_(T, rho, Y_CH4, Y_CO, Y_O2, Y_CO2)#

Compute the heat-release rate of both reactions combined.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_CO (float) – Mass fraction of CO.

  • Y_O2 (float) – Mass fraction of O2.

  • Y_CO2 (float) – Mass fraction of CO2.

Returns:

Expression for the combined heat-release rate.

Return type:

Expression

Q(T, rho, Y_CH4, Y_CO, Y_O2, Y_CO2)#

Return the heat release rate as a Function.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_CO (float) – Mass fraction of CO.

  • Y_O2 (float) – Mass fraction of O2.

  • Y_CO2 (float) – Mass fraction of CO2.

Returns:

Projected heat release rate function.

Return type:

Function

dQ(fluc)#

Return the fluctuations in heat release.

Parameters:

fluc (object) – Object containing fluctuation data for temperature, density, and species mass fractions.

Returns:

A tuple containing the total fluctuation in heat release and a list of individual fluctuations.

Return type:

tuple

rrCH4_(T, rho, Y_CH4, Y_O2)#

Compute the reaction rate of CH4.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_O2 (float) – Mass fraction of O2.

Returns:

Expression for the reaction rate of CH4.

Return type:

Expression

rrH2O_(T, rho, Y_CH4, Y_O2)#

Compute the reaction rate of H2O.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_O2 (float) – Mass fraction of O2.

Returns:

Expression for the reaction rate of H2O.

Return type:

Expression

rrO2_(T, rho, Y_CH4, Y_CO, Y_O2, Y_CO2)#

Compute the reaction rate of O2.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_CO (float) – Mass fraction of CO.

  • Y_O2 (float) – Mass fraction of O2.

  • Y_CO2 (float) – Mass fraction of CO2.

Returns:

Expression for the reaction rate of O2.

Return type:

Expression

rrCO_(T, rho, Y_CH4, Y_CO, Y_O2, Y_CO2)#

Compute the reaction rate of CO.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_CO (float) – Mass fraction of CO.

  • Y_O2 (float) – Mass fraction of O2.

  • Y_CO2 (float) – Mass fraction of CO2.

Returns:

Expression for the reaction rate of CO.

Return type:

Expression

rrCO2_(T, rho, Y_CO, Y_O2, Y_CO2)#

Compute the reaction rate of CO2.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CO (float) – Mass fraction of CO.

  • Y_O2 (float) – Mass fraction of O2.

  • Y_CO2 (float) – Mass fraction of CO2.

Returns:

Expression for the reaction rate of CO2.

Return type:

Expression

sO2dT_(T)#

Compute the sensitivity of entropy of O2 with respect to T.

Parameters:

T (float) – Temperature.

Returns:

Expression for the sensitivity of entropy of O2.

Return type:

Expression

sCOdT_(T)#

Compute the sensitivity of entropy of CO with respect to T.

Parameters:

T (float) – Temperature.

Returns:

Expression for the sensitivity of entropy of CO.

Return type:

Expression

sCO2dT_(T)#

Compute the sensitivity of entropy of CO2 with respect to T.

Parameters:

T (float) – Temperature.

Returns:

Expression for the sensitivity of entropy of CO2.

Return type:

Expression

Kf1dT_(T)#

Compute the sensitivity of Kf1 with respect to T.

Parameters:

T (float) – Temperature.

Returns:

Expression for the sensitivity of Kf1.

Return type:

Expression

Kp2dT_(T)#

Compute the sensitivity of Kp2 with respect to T.

Parameters:

T (float) – Temperature.

Returns:

Expression for the sensitivity of Kp2.

Return type:

Expression

Kc2dT_(T)#

Compute the sensitivity of Kc2 with respect to T.

Parameters:

T (float) – Temperature.

Returns:

Expression for the sensitivity of Kc2.

Return type:

Expression

Kf2dT_(T)#

Compute the sensitivity of Kf2 with respect to T.

Parameters:

T (float) – Temperature.

Returns:

Expression for the sensitivity of Kf2.

Return type:

Expression

Kr2dT_(T)#

Compute the sensitivity of Kr2 with respect to T.

Parameters:

T (float) – Temperature.

Returns:

Expression for the sensitivity of Kr2.

Return type:

Expression

Q1dT_(T, rho, Y_CH4, Y_O2)#

Compute the sensitivity of Q1 with respect to T.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_O2 (float) – Mass fraction of O2.

Returns:

Expression for the sensitivity of Q1.

Return type:

Expression

Q1drho_(T, rho, Y_CH4, Y_O2)#

Compute the sensitivity of Q1 with respect to rho.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_O2 (float) – Mass fraction of O2.

Returns:

Expression for the sensitivity of Q1.

Return type:

Expression

Q1dYCH4_(T, rho, Y_CH4, Y_O2)#

Compute the sensitivity of Q1 with respect to Y_CH4.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_O2 (float) – Mass fraction of O2.

Returns:

Expression for the sensitivity of Q1.

Return type:

Expression

Q1dYO2_(T, rho, Y_CH4, Y_O2)#

Compute the sensitivity of Q1 with respect to Y_O2.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_O2 (float) – Mass fraction of O2.

Returns:

Expression for the sensitivity of Q1.

Return type:

Expression

Q2dT_(T, rho, Y_CO, Y_O2, Y_CO2)#

Compute the sensitivity of Q2 with respect to T.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CO (float) – Mass fraction of CO.

  • Y_O2 (float) – Mass fraction of O2.

  • Y_CO2 (float) – Mass fraction of CO2.

Returns:

Expression for the sensitivity of Q2.

Return type:

Expression

Q2drho_(T, rho, Y_CO, Y_O2, Y_CO2)#

Compute the sensitivity of Q2 with respect to rho.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CO (float) – Mass fraction of CO.

  • Y_O2 (float) – Mass fraction of O2.

  • Y_CO2 (float) – Mass fraction of CO2.

Returns:

Expression for the sensitivity of Q2.

Return type:

Expression

Q2dYCO_(T, rho, Y_O2)#

Compute the sensitivity of Q2 with respect to Y_CO.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_O2 (float) – Mass fraction of O2.

Returns:

Expression for the sensitivity of Q2.

Return type:

Expression

Q2dYO2_(T, rho, Y_CO, Y_O2)#

Compute the sensitivity of Q2 with respect to Y_O2.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CO (float) – Mass fraction of CO.

  • Y_O2 (float) – Mass fraction of O2.

Returns:

Expression for the sensitivity of Q2.

Return type:

Expression

Q2dYCO2_(T, rho)#

Compute the sensitivity of Q2 with respect to Y_CO2.

Parameters:
  • T (float) – Temperature.

  • rho (float) – Density.

  • Y_CO2 (float) – Mass fraction of CO2.

Returns:

Expression for the sensitivity of Q2.

Return type:

Expression

Wmix(Y_CH4, Y_CO, Y_O2, Y_CO2, Y_H2O)#

Compute the molecular weight of the mixture.

Parameters:
  • Y_CH4 (float) – Mass fraction of CH4.

  • Y_CO (float) – Mass fraction of CO.

  • Y_O2 (float) – Mass fraction of O2.

  • Y_CO2 (float) – Mass fraction of CO2.

  • Y_H2O (float) – Mass fraction of H2O.

Returns:

Molecular weight of the mixture.

Return type:

float

add_source_to_weak_form(weakform, dQ_threshold=None)#

Add reaction source terms to the weak form equations.

This method adds contributions from reaction source terms to the energy and species equations within a variational formulation. If a heat release threshold is specified, the source terms are only added where the mean heat release exceeds that threshold.

Parameters:
  • weakform (object) – The weak form object containing relevant fields and test functions for the formulation.

  • dQ_threshold (float, optional) – Minimum mean heat release rate required for the reaction source term to be applied.

Returns:

eq_stiffness – The updated weak form including the added reaction source terms.

Return type:

object