.. _FGM: SU2 DataMiner Configuration for FGM =================================== .. contents:: :depth: 2 The following functions are used to access the options used specifically for FGM applications in *SU2 DataMiner*. Reaction Mechanism and Transport Model -------------------------------------- For Cantera flamelet calculations, a chemical kinetics model and a diffusion model have to be provided. Installation of Cantera comes with several popular chemical kinetics models such as *gri30*, but custom kinetics files can be used, as long as they are accessible from the current file location. An error will be raised if the provided kinetics file cannot be accessed. .. autofunction:: Common.DataDrivenConfig.Config_FGM.SetReactionMechanism .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetReactionMechanism 1D chemistry simulations in Cantera can be performed with two options for the multi-component diffusion model: "unity-Lewis" or "multicomponent". When selecting "multicomponent", species diffusion fluxes are calculated using the Fick diffusion law, so the effects of differential and preferential diffusion are modeled. These effects are relevant in lean, premixed hydrogen flames. For flames where preferential and differential diffusion are less relevant, as is the case for methane-air flames for example, the "unity-Lewis" option is more appropriate. With the option "unity-Lewis", the diffusion coefficient of all species is equal to the thermal diffusivity. Preferential diffusion will automatically be enabled within the configuration when selecting the "multicomponent" transport model. For more information on the settings regarding the preferential diffusion model, see :ref:`this section `. .. autofunction:: Common.DataDrivenConfig.Config_FGM.SetTransportModel .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetTransportModel Flamelet Types -------------- *SU2 DataMiner* currently supports the generation of adiabatic flamelets (free flames), burner-stabilized flamelets, and chemical equilibrium data. Details on the setup for each type of flamelet simulation can be found :ref:`on this page `. Adiabatic flamelets are one-dimensional detailed chemistry solutions of premixed reactants without strain. More information about adiabatic flame simulations can be found on the `this web page `_. Information on whether adiabatic flamelets are included in the manifold can be accessed through the following options. .. autofunction:: Common.DataDrivenConfig.Config_FGM.RunFreeFlames .. autofunction:: Common.DataDrivenConfig.Config_FGM.GenerateFreeFlames Burner-stabilized flamelets are one-dimensional detailed chemistry solutions of non-adiabatic flat flames. They differ from adiabatic flames by the inflow condition, which is modeled as a porous medium which acts as a heat sink. More information about burner-stabilized flame simulations in Cantera can be found on the `Cantera web page `_. By reducing the flow rate, the total enthalpy is reduced, enabling the generation of thermochemical data over a wide range of enthalpy. This is particularly useful when modeling non-adiabatic flames with FGM simulations or cooling flows over heat exchangers. Information on the inclusion of burner-stabilized flamelets in the manifold can be accessed through the following options. .. autofunction:: Common.DataDrivenConfig.Config_FGM.RunBurnerFlames .. autofunction:: Common.DataDrivenConfig.Config_FGM.GenerateBurnerFlames The final type of data in the manifold supported by *SU2 DataMiner* is chemical equilibrium data. Chemical equilibrium data are generated by calculating thermochemical fluid properties of the premixed reactants and equilibrated reaction products for specific mixtures over a range of temperatures and enthalpy. These data are used to calculate the physics-informed penalty terms while training ML-FGM networks and populate the manifold in high-progress variable, low enthalpy regions. The following options provide information on whether chemical equilibrium data are included in the manifold. .. autofunction:: Common.DataDrivenConfig.Config_FGM.RunEquilibrium .. autofunction:: Common.DataDrivenConfig.Config_FGM.GenerateEquilibrium Flamelet Manifold Bounds and Resolution --------------------------------------- Flamelets and chemical equilibrium data are generated within a user-defined range of mixtures and reactant temperatures. The mixture composition of the reactants can be defined through the mixture fraction or the equivalence ratio through the following functions. .. autofunction:: Common.DataDrivenConfig.Config_FGM.DefineMixtureStatus .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetMixtureStatus The limits of the reactant mixture composition within which flamelets are generated can be accessed through the following functions. When the reactant composition is defined through the mixture fraction, the limits should be between 0.0 and 1.0, and they should be positive if the reactant composition is defined through the equivalence ratio. .. autofunction:: Common.DataDrivenConfig.Config_FGM.SetMixtureBounds .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetMixtureBounds Flamelet data are generated for a number of reactant mixture compositions linearly spaced between the lower and upper limit. The number of mixture compositions for which flamelet data are generated can be accessed with the following functions. .. autofunction:: Common.DataDrivenConfig.Config_FGM.SetNpMix .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetNpMix Similarly to the reactant mixture composition, limits can be imposed on the reactant temperature for which flamelets and chemical equilibrium data are generated. The values should be provided in Kelvins. .. autofunction:: Common.DataDrivenConfig.Config_FGM.SetUnbTempBounds .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetUnbTempBounds For each reactant mixture composition, a number of flamelet solutions of each type are generated. For each reactant mixture composition, adiabatic flamelets are generated with the reactant temperature varying between the upper and lower limits for the reactant temperature. Burner-stabilized flamelets are generated with the mass flow rate varying between 100% and 1% of an adiabatic flamelet with the same reactant mixture composition and the reactant temperature set to the lower limit. More information on flamelet generation within *SU2 DataMiner* can be found :ref:`here `. The number of adiabatic and burner-stabilized flamelets that are generated for each reactant mixture composition can be accessed with the following options. .. autofunction:: Common.DataDrivenConfig.Config_FGM.SetNpTemp .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetNpTemp FGM Controlling Variables ------------------------- The themophysical and thermochemical state data in the flamelet manifold is projected onto the FGM controlling variables, for which transport equations are solved in SU2, and are defined as inputs to the artificial neural networks or look-up table. The FGM controlling variables can be accessed through the following functions. The progress variable is recognized as `ProgressVariable`, the total enthalpy as `EnthalpyTot`, and the mixture fraction as `MixtureFraction`. The progress variable should always be included in the controlling variables. The mixture fraction :math:`Z` is formulated according to the definition by :ref:`Bilger ` as .. math:: Z = \frac{q - q_O}{q_F - q_O} where .. math:: q = \sum_{i=0}^{N_{\mathrm{s}}} \frac{2\nu_\mathrm{C}^i + \frac{1}{2}\nu_\mathrm{H}^i-\nu_\mathrm{O}^i}{W_{M,i}}Y_i. :math:`q_O` and :math:`q_F` are evaluated for the pure fuel and oxidizer and :math:`\nu_\mathrm{C}^i` ,:math:`\nu_\mathrm{H}^i` , and :math:`\nu_\mathrm{O}^i` are the elemental components of carbon, hydrogen, and oxygen, respectively in species :math:`i`. For the application of modeling non-adiabatic, premixed flames without preferential and differential diffusion, such as in premixed methane-air flames, only including the progress variable and total enthalpy is sufficient. For partially premixed flames or premixed flames with preferential diffusion, the mixture fraction should be included in the list of FGM controlling variables. More information about the preferential diffusion model can be found in :ref:`the next section `. .. autofunction:: Common.DataDrivenConfig.Config_FGM.SetControllingVariables .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetControllingVariables The progress variable, :math:`c`, is defined as .. math:: c= \sum_{i=0}^{N_{\mathrm{s}}}\alpha_i Y_i where :math:`Y_i` is the mass fraction of species :math:`i`, :math:`N_{\mathrm{s}}` the number of species in the mixture, and :math:`\alpha_i` a coefficient. The species and coefficient values of the progress variable can be accessed through the following functions. .. autofunction:: Common.DataDrivenConfig.Config_FGM.SetProgressVariableDefinition .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetProgressVariableSpecies .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetProgressVariableWeights By default, the coefficients of the progress variable are calculated as the weighted reactants and major products according to .. math:: \alpha_i = \frac{Y_{i, P} - Y_{i, R}}{W_{M,i}}, where :math:`Y_{i, R}` is the species mass fraction in a stoichiometric mixture of the reactants, :math:`Y_{i, P}` the species mass fraction in a stoichiometric mixture of stable reaction products, and :math:`W_{M,i}` the molecular weight of the species. .. autofunction:: Common.DataDrivenConfig.Config_FGM.SetDefaultProgressVariable *SU2 DataMiner* also has automated methods for calculating the coefficients of the progress variable, which are documented :ref:`here `. To set up FGM simulations in SU2, the user needs to write the values of the FGM controlling variables in the SU2 configuration file to define the initial condition and for inflow boundary conditions. The following function calculates the values of the FGM controlling variables for a given equivalence ratio and temperature. .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetUnburntScalars .. _PREFDIF_SETTINGS: Differential Diffusion ---------------------- The effects of preferential and differential diffusion affect the burning rate of lean, (partially) premixed flames with a high hydrogen content. In the SU2 FGM solver, the effects of preferential diffusion are modeled according to the model developed by :ref:`Mukundakumar et. al `. According to this model, the effects of preferential diffusion are modeled by modifying the diffusion term in the transport equations of the progress variable, the total enthalpy, and the mixture fraction. The functions listed in this section allow the user to access the preferential diffusion terms. The preferential diffusion scalars are calculated when preferential diffusion is enabled in the *SU2 DataMiner* configuration, which can be done with the following functions. .. autofunction:: Common.DataDrivenConfig.Config_FGM.EnablePreferentialDiffusion .. autofunction:: Common.DataDrivenConfig.Config_FGM.PreferentialDiffusion When preferential diffusion is enabled, the solution of the FGM controlling variables is calculated in SU2 with the following transport equations .. math:: \frac{\partial (\rho c)}{\partial t} + \nabla \cdot (\rho c \mathbf{u}) - \nabla \cdot \left(D \nabla \beta_c\right) = \dot{\omega}_c .. math:: \frac{\partial (\rho h_\mathrm{t})}{\partial t} + \nabla \cdot (\rho h_\mathrm{t} \mathbf{u}) - \nabla \cdot \left(\beta_{h_\mathrm{t}, 1} \nabla T + D \nabla \beta_{h_\mathrm{t}, 2}\right) = 0 .. math:: \frac{\partial (\rho Z)}{\partial t} + \nabla \cdot (\rho Z \mathbf{u}) - \nabla \cdot \left(D \nabla \beta_Z\right) = 0 in which the :math:`\beta-` terms which appear in the third term on the left hand side are refered to as preferential diffusion scalars. The derivation of these terms can be found in :ref:`Mukundakumar et. al `. The preferential diffusion model in :ref:`Mukundakumar et. al ` was developed under the assumption of constant, non-equal species Lewis numbers. The values of the species Lewis numbers are used to calculate the values of the preferential diffusion scalars. The average species Lewis numbers, :math:`\overline{\mathrm{Le}_i}`, are calculated in *SU2 DataMiner* as the average between the reactants and products of a mixture with a user-defined composition and temperature. .. math:: \overline{\mathrm{Le}_i} = \frac{\mathrm{Le}_{i, R} + \mathrm{Le}_{i, P}}{2} Here, :math:`\mathrm{Le}_{i, R}` is the value of the species Lewis number evaluated for a mixture of reactants at a fixed equivalence ratio and temperature and :math:`\mathrm{Le}_{i, P}` the species Lewis number for the mixture of stable reaction products calculated at a constant enthalpy and pressure. The mixture and reactant temperature at which the average species Lewis numbers are evaluated can be specified by the user with the following function. .. autofunction:: Common.DataDrivenConfig.Config_FGM.SetAverageLewisNumbers The values of the average species Lewis numbers can be retrieved with .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetConstSpecieLewisNumbers The values of the preferential diffusion scalars can be calcualted from flamelet data with .. autofunction:: Common.DataDrivenConfig.Config_FGM.ComputeBetaTerms Passive Variables ----------------- The variables that are read from the flamelet manifold data include 1. Thermodynamic variables: - Temperature :math:`T` - Specific heat at constant pressure :math:`c_p` 2. Transport variables: - Viscosity :math:`\mu` - Thermal conductivity :math:`k` - Thermal diffusivity :math:`D` - Mean molecular weight :math:`W_M` 3. Progress variable source term :math:`\dot{\omega}_c` 4. Preferential diffusion scalars (when preferential diffusion is enabled): - Progress variable :math:`\beta_c` - Specific heat :math:`\beta_{h,1}` - Enthalpy of formation :math:`\beta_{h,2}` - Mixture fraction :math:`\beta_Z` 5. Passive variables: - Passive scalars such as the heat release rate - Chemical source terms of species for which transport is calculated by SU2 The chemical source terms of any transported species will be retrieved from the flamelet data when they are defined by the user. .. autofunction:: Common.DataDrivenConfig.Config_FGM.SetPassiveSpecies .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetPassiveSpecies Any additional passive quantities can be included in the manifold through the following functions. By default, the heat release rate :math:`\dot{Q}` is included in the list of passive quantities. .. autofunction:: Common.DataDrivenConfig.Config_FGM.SetLookUpVariables .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetLookUpVariables Output Group Management ----------------------- *SU2 DataMiner* supports the training of multi-task neural networks for ML-FGM applications. Here, the thermodynamic variables, transport variables, and other quantities are distributed over the output of several multi-task neural networks, termed groups. The variables in each group are assigned to the nodes in the output layer of a single network. By default, all quantities are evaluated by separate networks (single-task neural networks), but using multi-task neural networks reduces the number of networks required to be trained and evaluated during FGM simulations, reducing computational cost. The composition of the output groups can be manually adapted and accessed with the following functions .. autofunction:: Common.DataDrivenConfig.Config_FGM.AddOutputGroup .. autofunction:: Common.DataDrivenConfig.Config_FGM.DefineOutputGroup .. autofunction:: Common.DataDrivenConfig.Config_FGM.RemoveOutputGroup .. autofunction:: Common.DataDrivenConfig.Config_FGM.ClearOutputGroups .. autofunction:: Common.DataDrivenConfig.Config_FGM.DisplayOutputGroups .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetNMLPOutputGroups .. autofunction:: Common.DataDrivenConfig.Config_FGM.GetMLPOutputGroup *SU2 DataMiner* also has an automated method which groups the FGM dependent variables based on affinity, which is documentated :ref:`here `. References ---------- .. _reluarticle: Richard H.R Hahnloser et al. “Digital selection and analogue amplification coexist in a cortex-inspired silicon circuit”. In: Nature 405 (June 2000), pp. 947-951. .. _eluarticle: Djork-Arné Clevert, Thomas Unterthiner, and Sepp Hochreiter. “Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs)”. In: (Feb. 2016). URL:http://arxiv.org/abs/1511.07289 .. _geluarticle: Dan Hendrycks and Kevin Gimpel. “Gaussian Error Linear Units (GELUs)”. In:(June 2023). URL: http://arxiv.org/abs/1606.08415. .. _canterafreeflames : https://cantera.org/dev/python/onedim.html#freeflame .. _pdiffmodel: Nithin Mukundakumar et al. “A new preferential diffusion model applied to FGM simulations of hydrogen flames”. In: Combustion Theory and Modelling 25.7 (2021), pp. 1245-1267. ISSN: 17413559. DOI: 10.1080/13647830.2021.1970232. URL:https://doi.org/10.1080/13647830.2021.1970232. .. _turbulentcombustion: `N. Peters. Turbulent Combustion. 1990, pp. 221-231. ISBN: 9780511612701. DOI:10.1142/9789814293778_0006.`