Species#

class Species[source]#

Bases: Flow360BaseModel

A chemical species of a gas mixture.

The same Species serves both species treatments on Fluid: with a FrozenSpeciesSolver the composition is fixed when the simulation parameters are built, while a SpeciesTransportSolver transports each species as a mass-fraction field. The full set of thermodynamic and transport properties needed for the multi-species path is therefore required at construction time:

  • NASA-9 polynomial for cp(T), h(T), s(T) (frozen-composition / non-reacting regime; see the data-source citation in any library entry for the validity window).

  • Molecular weight, to form the mixture gas constant R_mix = R_u * sum_s(Y_s / W_s).

  • Per-species Sutherland viscosity model, blended into the mixture viscosity via Wilke’s rule.

  • Laminar Schmidt number (defaults to DEFAULT_SCHMIDT_NUMBER), used by the constant-Schmidt Fickian diffusion closure.

The mass_fraction value defines this species’ contribution to the reference mixture composition. With a FrozenSpeciesSolver that composition is the one the solver runs with; with a SpeciesTransportSolver the translator emits it as referenceStateNondim and the actual mass fraction varies in space and time.

Attributes

name: str#

Species name (e.g., ‘N2’, ‘O2’, ‘H2O’)

nasa_9_coefficients: NASA9Coefficients#

NASA 9-coefficient polynomial for this species’ thermodynamic data.

mass_fraction: float#

Reference mass fraction of this species in the mixture, within [0, 1]; zero is legal (e.g. a species only injected through a boundary). Mass fractions across all species of a Gas must sum to 1.0. Boundary and initial-condition compositions are set separately, on the boundary models and the Fluid initial condition’s species_mass_fractions.

molecular_weight: MolarMass.PositiveFloat64#

Molecular weight (molar mass) of this species, e.g. 28.0134 * u.g / u.mol. Used to form the mixture gas constant R_mix = R_u * sum_s(Y_s / W_s). Any per-mole equivalent is accepted (g/mol, kg/mol, kg/kmol). Absolute units matter only at the Python layer: the translator collapses each species’ W_s into a dimensionless inverseMolecularWeightRatioToReference = W_ref / W_s before the solver sees it, so the value the solver consumes is unit-agnostic.

dynamic_viscosity: Sutherland#

Per-species Sutherland viscosity model, used by Wilke’s rule to form the mixture dynamic viscosity.

schmidt_number: float#

Laminar Schmidt number Sc_s = mu / (rho * D_s) for this species, used by the constant-Schmidt Fickian diffusion model. Defaults to 0.7.

Default:

0.7

Additional Constructors

classmethod from_library(name)[source]#

Look up a species in the curated library and return an independent copy.

Returns a fresh Species carrying the library’s NASA-9 polynomial, molecular weight, and Sutherland viscosity, with mass_fraction set to a 1.0 placeholder. Override any field by assigning to the returned object’s attribute; Species has validate_assignment=True so the field validators re-run on each assignment.

Parameters:

name (str) – Canonical library species name (e.g. "N2", "O2", "H2O"). See the library module docstring for the full roster.

Returns:

An independent deep copy of the library entry. Mutating the returned object does not affect the library or any subsequent call.

Return type:

Species

Raises:

ValueError – If name is not in the library. The error message lists all available species names.

Examples

>>> n2 = Species.from_library("N2")
>>> n2.mass_fraction = 0.767
>>> o2 = Species.from_library("O2")
>>> o2.mass_fraction = 0.233
>>> o2.schmidt_number = 0.72
>>> # Custom Sutherland override for a special application:
>>> h2o = Species.from_library("H2O")
>>> h2o.mass_fraction = 0.05
>>> h2o.dynamic_viscosity = Sutherland(
...     reference_viscosity=1.2e-5 * u.Pa * u.s,
...     reference_temperature=350 * u.K,
...     effective_temperature=900 * u.K,
... )

Methods

preprocess(**kwargs)[source]#

Convert all dimensioned fields to flow360 base unit system, recursively.

Copy-on-write: returns self when no value in the subtree required conversion, skipping the pydantic re-validation rebuild for unchanged nodes.