:py:mod:`FELiCS.Equation.Reactions.TwoStepReaction` =================================================== .. py:module:: FELiCS.Equation.Reactions.TwoStepReaction Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: FELiCS.Equation.Reactions.TwoStepReaction.TwoStepReaction .. py:class:: TwoStepReaction(ModelName) Represents a two-step methane-air combustion reaction mechanism. This class models two-step chemical reactions, adapted for BFER or 2S_CH4_CM2 models, and provides methods for reading reaction data, computing mean fields, and evaluating reaction rates. See CERFACS for model reference https://www.cerfacs.fr/cantera/mechanisms/meth.php **Initialize the TwoStepReaction object** :param ModelName: Name of the reaction model to use. :type ModelName: :py:class:`str` :ivar mixtureDirectory: Directory name for mixture data. :vartype mixtureDirectory: :py:class:`str` :ivar speciesDirectory: Directory name for species data. :vartype speciesDirectory: :py:class:`str` :ivar p0: Reference pressure. :vartype p0: :py:class:`float` :ivar R: Universal gas constant. :vartype R: :py:class:`float` :ivar n_CH4_1: Stoichiometric prefactor for CH4 in reaction 1. :vartype n_CH4_1: :py:class:`float` or :py:obj:`None` :ivar n_O2_1: Stoichiometric prefactor for O2 in reaction 1. :vartype n_O2_1: :py:class:`float` or :py:obj:`None` :ivar n_CO_1: Stoichiometric prefactor for CO in reaction 1. :vartype n_CO_1: :py:class:`float` or :py:obj:`None` :ivar n_CO_2: Stoichiometric prefactor for CO in reaction 2. :vartype n_CO_2: :py:class:`float` or :py:obj:`None` :ivar n_O2_2: Stoichiometric prefactor for O2 in reaction 2. :vartype n_O2_2: :py:class:`float` or :py:obj:`None` :ivar n_CO2_2: Stoichiometric prefactor for CO2 in reaction 2. :vartype n_CO2_2: :py:class:`float` or :py:obj:`None` :ivar nu_CH4_1: Kinematic exponent for CH4 in reaction 1. :vartype nu_CH4_1: :py:class:`float` or :py:obj:`None` :ivar nu_O2_1: Kinematic exponent for O2 in reaction 1. :vartype nu_O2_1: :py:class:`float` or :py:obj:`None` :ivar nu_CO_2: Kinematic exponent for CO in reaction 2. :vartype nu_CO_2: :py:class:`float` or :py:obj:`None` :ivar nu_O2_2: Kinematic exponent for O2 in reaction 2. :vartype nu_O2_2: :py:class:`float` or :py:obj:`None` :ivar nu_CO2_2: Kinematic exponent for CO2 in reaction 2. :vartype nu_CO2_2: :py:class:`float` or :py:obj:`None` :ivar A1: Pre-exponential factor for reaction 1. :vartype A1: :py:class:`float` or :py:obj:`None` :ivar Ta1: Activation temperature for reaction 1. :vartype Ta1: :py:class:`float` or :py:obj:`None` :ivar beta1: Temperature exponent for reaction 1. :vartype beta1: :py:class:`float` or :py:obj:`None` :ivar h1: Heat of reaction for reaction 1. :vartype h1: :py:class:`float` or :py:obj:`None` :ivar A2: Pre-exponential factor for reaction 2. :vartype A2: :py:class:`float` or :py:obj:`None` :ivar Ta2: Activation temperature for reaction 2. :vartype Ta2: :py:class:`float` or :py:obj:`None` :ivar beta2: Temperature exponent for reaction 2. :vartype beta2: :py:class:`float` or :py:obj:`None` :ivar h2: Heat of reaction for reaction 2. :vartype h2: :py:class:`float` or :py:obj:`None` :ivar WO2: Molar mass of O2. :vartype WO2: :py:class:`float` or :py:obj:`None` :ivar WH2O: Molar mass of H2O. :vartype WH2O: :py:class:`float` or :py:obj:`None` :ivar WCH4: Molar mass of CH4. :vartype WCH4: :py:class:`float` or :py:obj:`None` :ivar WCO: Molar mass of CO. :vartype WCO: :py:class:`float` or :py:obj:`None` :ivar WCO2: Molar mass of CO2. :vartype WCO2: :py:class:`float` or :py:obj:`None` :ivar WN2: Molar mass of N2. :vartype WN2: :py:class:`float` or :py:obj:`None` :ivar Q1: Reaction progress rate for reaction 1. :vartype Q1: :py:class:`object` or :py:obj:`None` :ivar Q2f: Forward reaction progress rate for reaction 2. :vartype Q2f: :py:class:`object` or :py:obj:`None` :ivar Q2r: Reverse reaction progress rate for reaction 2. :vartype Q2r: :py:class:`object` or :py:obj:`None` :ivar Q2: Total reaction progress rate for reaction 2. :vartype Q2: :py:class:`object` or :py:obj:`None` :ivar K2f: Forward reaction rate constant for reaction 2. :vartype K2f: :py:class:`object` or :py:obj:`None` :ivar K2r: Reverse reaction rate constant for reaction 2. :vartype K2r: :py:class:`object` or :py:obj:`None` :ivar lnexpInEqui_h: Linearized enthalpy term for equilibrium constant in reaction 2. :vartype lnexpInEqui_h: :py:class:`object` or :py:obj:`None` :ivar expInEqui: Exponential term for equilibrium constant in reaction 2. :vartype expInEqui: :py:class:`object` or :py:obj:`None` :ivar Equi: Equilibrium constant for reaction 2. :vartype Equi: :py:class:`object` or :py:obj:`None` :ivar i_rho: Index for density in solution variables. :vartype i_rho: :py:class:`int` or :py:obj:`None` :ivar i_CH4: Index for CH4 in solution variables. :vartype i_CH4: :py:class:`int` or :py:obj:`None` :ivar i_O2: Index for O2 in solution variables. :vartype i_O2: :py:class:`int` or :py:obj:`None` :ivar i_CO2: Index for CO2 in solution variables. :vartype i_CO2: :py:class:`int` or :py:obj:`None` :ivar i_CO: Index for CO in solution variables. :vartype i_CO: :py:class:`int` or :py:obj:`None` :ivar T: Temperature field. :vartype T: :py:class:`object` or :py:obj:`None` :ivar Y_CH4_limited: Limited CH4 mass fraction. :vartype Y_CH4_limited: :py:class:`object` or :py:obj:`None` :ivar epsilon: Correction for base flow CH4. :vartype epsilon: :py:class:`float` :ivar reactionName: Name of the reaction. :vartype reactionName: :py:class:`str` .. py:method:: ReadReactionDict(ModelName) Reads reaction parameters and species data from files and updates class attributes. :param ModelName: Name of the reaction model to use. :type ModelName: :py:class:`str` .. admonition:: Notes This method sets stoichiometric prefactors, kinematic exponents, reaction constants, and molar masses based on the provided model name. .. py:method:: computeMeanField(MF, ele) Computes the mean field reaction rates and equilibrium constants. :param MF: Dictionary containing mean flow properties. :type MF: :py:class:`dict` :param ele: Function space for interpolation. :type ele: :py:class:`dolfinx.fem.FunctionSpace` :returns: * **Q1** (:py:class:`object`) -- Mean field for reaction 1. * **Q2f** (:py:class:`object`) -- Forward mean field for reaction 2. * **Q2r** (:py:class:`object`) -- Reverse mean field for reaction 2. .. admonition:: Notes This method also computes equilibrium constants and related fields for reaction 2. .. py:method:: addReaction(MF, testf, trialf, solutionList, ele) Adds the reaction terms to the weak form for both reaction steps. :param MF: Dictionary containing mean flow properties. :type MF: :py:class:`dict` :param testf: List of test functions. :type testf: :py:class:`list` :param trialf: Dictionary of trial functions. :type trialf: :py:class:`dict` :param solutionList: List of solution variable names. :type solutionList: :py:class:`list` of :py:class:`str` :param ele: Function space for interpolation. :type ele: :py:class:`dolfinx.fem.FunctionSpace` :returns: **reaction_term** -- Weak form expression representing the reaction contributions. :rtype: :py:class:`ufl.Form` .. admonition:: Notes The method computes the indices for relevant variables and constructs the weak form using the reaction rates and heat release for both steps. .. py:method:: dQ1_(MF, trialf) Computes the fluctuation of the reaction rate for the first reaction step. :param MF: Dictionary containing mean flow properties. :type MF: :py:class:`dict` :param trialf: Dictionary of trial functions. :type trialf: :py:class:`dict` :returns: **dQ1** -- Fluctuation of the reaction rate for reaction 1. :rtype: :py:class:`float` .. py:method:: dQ2f_(MF, trialf) Computes the fluctuation of the forward reaction rate for the second reaction step. :param MF: Dictionary containing mean flow properties. :type MF: :py:class:`dict` :param trialf: Dictionary of trial functions. :type trialf: :py:class:`dict` :returns: **dQ2f** -- Fluctuation of the forward reaction rate for reaction 2. :rtype: :py:class:`float` .. py:method:: dQ2r_(MF, trialf) Computes the fluctuation of the reverse reaction rate for the second reaction step. :param MF: Dictionary containing mean flow properties. :type MF: :py:class:`dict` :param trialf: Dictionary of trial functions. :type trialf: :py:class:`dict` :returns: **dQ2r** -- Fluctuation of the reverse reaction rate for reaction 2. :rtype: :py:class:`float` .. py:method:: dK2fdT_(T) Computes the temperature derivative of the forward reaction rate constant for reaction 2. :param T: Temperature field. :type T: :py:class:`object` :returns: **dK2fdT** -- Expression for the temperature derivative of the forward rate constant. :rtype: :py:class:`object` .. py:method:: dK2rdT_(T) Computes the temperature derivative of the reverse reaction rate constant for reaction 2. :param T: Temperature field. :type T: :py:class:`object` :returns: **dK2rdT** -- Expression for the temperature derivative of the reverse rate constant. :rtype: :py:class:`object` .. py:method:: dEquidT_(T) Computes the temperature derivative of the equilibrium constant for reaction 2. :param T: Temperature field. :type T: :py:class:`object` :returns: **dEquidT** -- Expression for the temperature derivative of the equilibrium constant. :rtype: :py:class:`object` .. py:method:: dexpInEquidT_(T) Computes the temperature derivative of the exponential part of the equilibrium constant for reaction 2. :param T: Temperature field. :type T: :py:class:`object` :returns: **dexpInEquidT** -- Expression for the temperature derivative of the exponential part of the equilibrium constant. :rtype: :py:class:`object` .. py:method:: postHeatRelaese(MF, prho, pCH4, pO2, pCO, pCO2, ele) Evaluates the fluctuation of heat release in post-processing. :param MF: Dictionary containing mean flow properties. :type MF: :py:class:`dict` :param prho: Perturbation in density. :type prho: :py:class:`float` :param pCH4: Perturbation in CH4 mass fraction. :type pCH4: :py:class:`float` :param pO2: Perturbation in O2 mass fraction. :type pO2: :py:class:`float` :param pCO: Perturbation in CO mass fraction. :type pCO: :py:class:`float` :param pCO2: Perturbation in CO2 mass fraction. :type pCO2: :py:class:`float` :param ele: Function space for interpolation. :type ele: :py:class:`dolfinx.fem.FunctionSpace` :returns: **heat_release_field** -- Projected fluctuation heat release field. :rtype: :py:class:`object` .. py:method:: postdQ1_(MF, prho, pO2, pCH4, ele) Computes the fluctuation of the reaction rate for the first reaction step in post-processing. :param MF: Dictionary containing mean flow properties. :type MF: :py:class:`dict` :param prho: Perturbation in density. :type prho: :py:class:`float` :param pO2: Perturbation in O2 mass fraction. :type pO2: :py:class:`float` :param pCH4: Perturbation in CH4 mass fraction. :type pCH4: :py:class:`float` :param ele: Function space for interpolation. :type ele: :py:class:`dolfinx.fem.FunctionSpace` :returns: **dQ1** -- Fluctuation of the reaction rate for reaction 1. :rtype: :py:class:`float` .. py:method:: postdQ2f_(MF, prho, pCO, pO2) Computes the fluctuation of the forward reaction rate for the second reaction step in post-processing. :param MF: Dictionary containing mean flow properties. :type MF: :py:class:`dict` :param prho: Perturbation in density. :type prho: :py:class:`float` :param pCO: Perturbation in CO mass fraction. :type pCO: :py:class:`float` :param pO2: Perturbation in O2 mass fraction. :type pO2: :py:class:`float` :returns: **dQ2f** -- Fluctuation of the forward reaction rate for reaction 2. :rtype: :py:class:`float` .. py:method:: postdQ2r_(MF, prho, pCO2) Computes the fluctuation of the reverse reaction rate for the second reaction step in post-processing. :param MF: Dictionary containing mean flow properties. :type MF: :py:class:`dict` :param prho: Perturbation in density. :type prho: :py:class:`float` :param pCO2: Perturbation in CO2 mass fraction. :type pCO2: :py:class:`float` :returns: **dQ2r** -- Fluctuation of the reverse reaction rate for reaction 2. :rtype: :py:class:`float` .. py:method:: testM() Prints the maximum reaction rates of the base flow for diagnostic purposes. .. admonition:: Notes This method outputs the maximum values of reaction rates for reaction 1, reaction 2 forward, and reaction 2 inverse.