.. _InputsSpeciesDefs:

Species definitions
===================

The following inputs are defined using the prefix ``species``:

+--------------------------+------------------------------------------------------------------------+----------+-----------+
|                          | Description                                                            |   Type   | Default   |
+==========================+========================================================================+==========+===========+
| solve                    | Specified name(s) of the species or None to disable the                | String   |  None     |
|                          | species solver. The name assigned to the species                       |          |           |
|                          | solver is used to specify species inputs.                              |          |           |
+--------------------------+------------------------------------------------------------------------+----------+-----------+
| diffusivity              | Fluid species diffusivity model.                                       | String   |  None     |
|                          |                                                                        |          |           |
|                          | Options:                                                               |          |           |
|                          |                                                                        |          |           |
|                          | * ``constant`` - a constant diffusion coefficient is used for          |          |           |
|                          |   all fluid species.                                                   |          |           |
|                          |                                                                        |          |           |
+--------------------------+------------------------------------------------------------------------+----------+-----------+
| diffusivity.constant     | Constant species diffusivity - required for                            |  Real    |  0        |
|                          | ``constant`` diffusivity model                                         |          |           |
|                          |                                                                        |          |           |
+--------------------------+------------------------------------------------------------------------+----------+-----------+
| specific_heat            | Species specific heat model. This setting only applies if either       | String   |           |
|                          | ``fluid.specific_heat = mixture`` or                                   |          |           |
|                          | ``solids.specific_heat = mixture``                                     |          |           |
|                          |                                                                        |          |           |
|                          | Options (case-insensitive):                                            |          |           |
|                          |                                                                        |          |           |
|                          | * ``constant`` - a constant specific heat is defined for each species  |          |           |
|                          |   and a *mixture* specific heat is computed based on the fluid or      |          |           |
|                          |   particle composition.                                                |          |           |
|                          |                                                                        |          |           |
|                          | * ``NASA7-poly`` - the specific heat of each species is defined by one |          |           |
|                          |   or more polynomials that are a function of temperature, then the     |          |           |
|                          |   *mixture* specific heat is computed based on the fluid or particle   |          |           |
|                          |   composition.                                                         |          |           |
|                          |                                                                        |          |           |
|                          |   NASA7 polynomial format:                                             |          |           |
|                          |                                                                        |          |           |
|                          |      :math:`c_p(T)/R = \sum_{i=0}^4 a_{i}T^{i}`                        |          |           |
|                          |                                                                        |          |           |
+--------------------------+------------------------------------------------------------------------+----------+-----------+
| ignore_discontinuities   | MFIX-Exa asserts that the low and high NASA-7 polynomials are          | Int      | 0         |
|                          | continuous at the 1000K temperature split. However, some polynomials   |          |           |
|                          | do not have valid high temperature coefficients, for example, liquid   |          |           |
|                          | water. By setting this keyword to 1, the simulation will only warn     |          |           |
|                          | that the polynomials are discontinuous. Simulations that use           |          |           |
|                          | discontinuous polynomials and cross between the 1000K temperature      |          |           |
|                          | split may fail when computing temperature from enthalpy.               |          |           |
|                          | Therefore, this option should only be used when the simulation is not  |          |           |
|                          | expected to cross over the transition temperature.                     |          |           |
+--------------------------+------------------------------------------------------------------------+----------+-----------+
| viscosity.molecular      | Molecular viscosity model of species. This setting only applies when   |  String  |           |
|                          | ``fluid.viscosity.molecular = mixture``.                               |          |           |
|                          |                                                                        |          |           |
|                          | Options:                                                               |          |           |
|                          |                                                                        |          |           |
|                          | * ``constant`` - constant viscosity                                    |          |           |
|                          | * ``Sutherland`` :cite:p:`suth1893`                                    |          |           |
|                          | * ``Reid`` :cite:p:`reid87`                                            |          |           |
|                          |                                                                        |          |           |
|                          | See :ref:`viscosity model descriptions <InputsFluidModel>`             |          |           |
|                          | in fluid section.                                                      |          |           |
+--------------------------+------------------------------------------------------------------------+----------+-----------+


The following inputs are defined for each species using the prefix ``species.[species_name]``:

+---------------------------------------+------------------------------------------------------------------------+----------+-----------+
|                                       | Description                                                            |   Type   | Default   |
+=======================================+========================================================================+==========+===========+
| molecular_weight                      | Molecular weight of species. Required for mixture molecular weight     |  Real    |  0        |
|                                       | model and when including chemical reactions.                           |          |           |
+---------------------------------------+------------------------------------------------------------------------+----------+-----------+
| specific_heat.constant                | Constant species specific heat. Required for all fluid (solids)        |  Real    |  0        |
|                                       | species if the fluid (solids) ``specific_heat = mixture`` and the      |          |           |
|                                       | specific heat model is ``constant``                                    |          |           |
+---------------------------------------+------------------------------------------------------------------------+----------+-----------+
| specific_heat.NASA7.a[i]              | Species specific heat polynomial coefficients. Required for all fluid  |  Real    |  None     |
|                                       | (solids) species if the fluid (solids) ``specific_heat = mixture``     |          |           |
|                                       | and the specific heat model is ``NASA7-poly``                          |          |           |
|                                       |                                                                        |          |           |
|                                       | * Each polynomial is defined by six coefficients (``a0`` ... ``a5``).  |          |           |
|                                       |   Coefficients ``a0`` through ``a4`` are use for computing specific    |          |           |
|                                       |   heat while all six coefficients are used to compute enthalpy.        |          |           |
|                                       |   The seventh coefficient, ``a6``, may be provided for completeness    |          |           |
|                                       |   but is not used as MFIX-Exa presently does not need to compute       |          |           |
|                                       |   entropy.                                                             |          |           |
|                                       |                                                                        |          |           |
|                                       | * By default, two sets of coefficients are required. The coefficients  |          |           |
|                                       |   define two polynomials used to compute the specific heat and         |          |           |
|                                       |   enthalpy across low and high temperatures. The split temperature     |          |           |
|                                       |   (Tsplit) defines the transition from low-to-high polynomials.        |          |           |
|                                       |                                                                        |          |           |
|                                       | * A single polynomial can be used for all temperatures by setting the  |          |           |
|                                       |   split temperature to -1.                                             |          |           |
|                                       |                                                                        |          |           |
|                                       | * Three or more polynomials can be used by defining multiple split     |          |           |
|                                       |   temperatures.                                                        |          |           |
|                                       |                                                                        |          |           |
+---------------------------------------+------------------------------------------------------------------------+----------+-----------+
| specific_heat.NASA7.Tsplit            | Defines the temperature transition between NASA-7 polynomials.         |  Real    |  1000.    |
|                                       |                                                                        |          |           |
|                                       | * Setting ``Tsplit = -1`` signifies that a single polynomial defines   |          |           |
|                                       |   the specific heat and enthalpy for all temperatures.                 |          |           |
|                                       |                                                                        |          |           |
|                                       | * Specifying ``N`` split temperatures where ``N>1``, signifies ``N+1`` |          |           |
|                                       |   polynomials are used to define the specific heat and enthalpy.       |          |           |
|                                       |                                                                        |          |           |
+---------------------------------------+------------------------------------------------------------------------+----------+-----------+
| enthalpy_of_formation                 | Enthalpy of formation of species. Required only when                   |  Real    |  0        |
|                                       | the specific heat model is ``constant`` and chemical reactions         |          |           |
|                                       | are defined.                                                           |          |           |
+---------------------------------------+------------------------------------------------------------------------+----------+-----------+
| viscosity.molecular.constant          | Constant species fluid viscosity.                                      |  Real    |  0        |
|                                       |                                                                        |          |           |
|                                       | A value is required for ``constant`` species viscosity model.          |          |           |
+---------------------------------------+------------------------------------------------------------------------+----------+-----------+
| viscosity.molecular.Sutherland.T_ref  | Sutherland model reference temperature for species.                    |  Real    |  0        |
|                                       |                                                                        |          |           |
|                                       | A value is required for ``Sutherland`` species viscosity model.        |          |           |
+---------------------------------------+------------------------------------------------------------------------+----------+-----------+
| viscosity.molecular.Sutherland.mu_ref | Sutherland model reference viscosity at T_ref for species.             |  Real    |  0        |
|                                       |                                                                        |          |           |
|                                       | A value is required for ``Sutherland`` species viscosity model.        |          |           |
+---------------------------------------+------------------------------------------------------------------------+----------+-----------+
| viscosity.molecular.Sutherland.S      | Sutherland model temperature for species.                              |  Real    |  0        |
|                                       |                                                                        |          |           |
|                                       | A value is required for ``Sutherland`` species viscosity model.        |          |           |
+---------------------------------------+------------------------------------------------------------------------+----------+-----------+
| viscosity.molecular.Reid.A            | Reid model constants for species.                                      |  Real    |  0        |
| viscosity.molecular.Reid.B            |                                                                        |          |           |
| viscosity.molecular.Reid.C            | Values are required for ``Reid`` species viscosity model.              |          |           |
| viscosity.molecular.Reid.D            |                                                                        |          |           |
+---------------------------------------+------------------------------------------------------------------------+----------+-----------+



Example inputs
--------------

Fluid species as passive scalars
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In the following example, two species are defined and assigned to the fluid. We are required
to define the species diffusivity and initial and boundary conditions.  The
``IncompressibleFluid`` constraint is used, and the fluid density and species mass fractions
are defined in the initial and boundary conditions.
The fluid energy equation is not solved, and because we are not updating fluid density, the
local species concentrations do not affect the fluid.


.. code-block:: bash
   :caption: Snippet of inputs defining species as passive tracers. This is not a complete input file.

   mfix.constraint = IncompressibleFluid

   mfix.advect_density  = 0
   mfix.advect_enthalpy = 0
   mfix.solve_species   = 1


   # Species model settings
   # -----------------------------------------------------------------------
   species.solve  =  N2  O2

   species.diffusivity = constant
   species.diffusivity.constant  = 1.9e-5


   # Fluid model settings
   # -----------------------------------------------------------------------
   fluid.solve = fluid

   fluid.viscosity.molecular = constant
   fluid.viscosity.molecular.constant = 2.0e-5

   fluid.species =  N2  O2

   # Initial Conditions
   # -----------------------------------------------------------------------
   ic.regions = full-domain

   ic.full-domain.fluid.volfrac   =  1.0
   ic.full-domain.fluid.density   =  1.0

   ic.full-domain.fluid.velocity  =  0.0  0.0  0.0

   ic.full-domain.fluid.species.N2   =  0.77
   ic.full-domain.fluid.species.O2   =  0.23

   # Boundary Conditions
   # -----------------------------------------------------------------------
   bc.regions = inlet  outlet

   bc.inlet = mi
   bc.inlet.fluid.volfrac  =  1.0
   bc.inlet.fluid.density  =  1.0

   bc.inlet.fluid.velocity =  1.0e-8  0.0  0.0

   bc.inlet.fluid.species.N2   =  0.77
   bc.inlet.fluid.species.O2   =  0.23

   bc.outlet = po
   bc.outlet.fluid.pressure =  0.


Fluid as mixture
^^^^^^^^^^^^^^^^

In this example, the fluid is treated as a mixture of two species and the
``IdealGasOpenSystem`` constraint is used. Because we are solving the
energy equation, the fluid thermal conductivity is provided and the
specific heats for both species are needed. The species specific heat
model is set to ``NASA7-poly``; therefore 12 coefficients (6 low-temperature range
coefficients and 6 high-temperature range coefficients) are defined for each species.
Additionally, species molecular weights are provided to compute the mixture
molecular weights needed to evaluate the ideal-gas equation of state.

Fluid temperature is specified by the initial and boundary conditions, and unlike
the previous example, density is no longer provided. Instead, the ideal gas
equation of state is used to compute density from temperature, fluid composition,
and the thermodynamic pressure.  The thermodynamic pressure is taken as the
outflow boundary condition pressure which is set here to 1 atmosphere.

.. code-block:: bash
   :caption: Snippet of inputs defining fluid as a mixture with ``NASA7-poly`` specific heat model. This is not a complete input file.

   mfix.constraint = IdealGasOpenSystem

   mfix.advect_density  = 1
   mfix.solve_species   = 1
   mfix.advect_enthalpy = 1

   # Species model settings
   # -----------------------------------------------------------------------
   species.solve  =  N2  O2

   species.diffusivity = constant
   species.diffusivity.constant  = 1.9e-5

   species.specific_heat = NASA7-poly

   # Oxygen
   species.O2.molecular_weight = 31.99880e-3
   species.O2.specific_heat.NASA7.a0    =  3.78245636E+00    3.66096065E+00
   species.O2.specific_heat.NASA7.a1    = -2.99673416E-03    6.56365811E-04
   species.O2.specific_heat.NASA7.a2    =  9.84730201E-06   -1.41149627E-07
   species.O2.specific_heat.NASA7.a3    = -9.68129509E-09    2.05797935E-11
   species.O2.specific_heat.NASA7.a4    =  3.24372837E-12   -1.29913436E-15
   species.O2.specific_heat.NASA7.a5    = -1.06394356E+03   -1.21597718E+03

   # Nitrogen
   species.N2.molecular_weight = 28.01340e-3
   species.N2.specific_heat.NASA7.a0    =  3.53100528E+00    2.95257637E+00
   species.N2.specific_heat.NASA7.a1    = -1.23660988E-04    1.39690040E-03
   species.N2.specific_heat.NASA7.a2    = -5.02999433E-07   -4.92631603E-07
   species.N2.specific_heat.NASA7.a3    =  2.43530612E-09    7.86010195E-11
   species.N2.specific_heat.NASA7.a4    = -1.40881235E-12   -4.60755204E-15
   species.N2.specific_heat.NASA7.a5    = -1.04697628E+03   -9.23948688E+02


   # Fluid model settings
   # -----------------------------------------------------------------------
   fluid.solve = fluid

   fluid.viscosity.molecular = constant
   fluid.viscosity.molecular.constant = 2.0e-5

   fluid.thermal_conductivity = constant
   fluid.thermal_conductivity.constant = 0.026

   fluid.specific_heat = mixture

   fluid.species =  N2  O2

   # Initial Conditions
   # -----------------------------------------------------------------------
   ic.regions = full-domain

   ic.full-domain.fluid.volfrac   =  1.0

   ic.full-domain.fluid.velocity  =  0.0  0.0  0.0

   ic.full-domain.fluid.species.N2  =  0.77
   ic.full-domain.fluid.species.O2  =  0.23

   ic.full-domain.fluid.temperature = 300.0

   # Boundary Conditions
   # -----------------------------------------------------------------------
   bc.regions = inlet  outlet

   bc.inlet = mi
   bc.inlet.fluid.volfrac  =  1.0

   bc.inlet.fluid.velocity =  1.0e-8  0.0  0.0

   bc.inlet.fluid.species.N2   = 0.77
   bc.inlet.fluid.species.O2   = 0.23

   bc.inlet.fluid.temperature = 300.0

   bc.outlet = po
   bc.outlet.fluid.pressure =  101325.
