Gas#

class Gas[source]#

Bases: MaterialBase

Customizable gas material defined by its species. The material describes the molecules only; how the species are solved is chosen on Fluid: FrozenSpeciesSolver fixes the composition (no transport equations are solved), SpeciesTransportSolver transports the species’ mass fractions. For the constant-gamma standard-air case use the Air preset instead.

Common species are available from a curated library, so the per-species data need not be typed out by hand:

>>> n2 = fl.Species.from_library("N2")
>>> n2.mass_fraction = 0.767
>>> o2 = fl.Species.from_library("O2")
>>> o2.mass_fraction = 0.233
>>> fl.Gas(name="air", species=[n2, o2])

The library covers N2, O2, Ar, He, H2, CO, CO2, CH4, H2O; see Species.from_library() for the per-field overrides, and construct Species directly for anything outside the catalogue.

With a FrozenSpeciesSolver and more than one species the solver receives a single Sutherland law: its reference viscosity is Wilke’s mixture value at the freestream reference temperature (exact there) and its constant is fitted to Wilke’s rule over the species’ NASA-9 temperature range. The fit is within 0.02% for N2/O2 air and within about 2% for any pair of library species, but a single Sutherland law cannot follow Wilke’s rule exactly when the species’ constants differ widely (e.g. H2O against N2). Set dynamic_viscosity to use your own mixture law or constant instead of the fit.

Attributes

name: str#

Name identifying this gas (e.g. ‘methane-air’, ‘N2/He mix’).

prandtl_number: float#

Laminar Prandtl number. Default is 0.72.

Default:

0.72

turbulent_prandtl_number: float#

Turbulent Prandtl number. Default is 0.9.

Default:

0.9

species: list[Species]#

Species making up the gas, with their NASA-9 coefficients, molecular weights, Sutherland laws, Schmidt numbers and reference mass fractions. Reference mass fractions must sum to 1.0. Viscosity is Wilke-mixed from the per-species Sutherland laws.

dynamic_viscosity: Sutherland | Viscosity.NonNegativeFloat64, optional#

Optional mixture viscosity model or constant value used instead of the Sutherland law fitted to Wilke’s rule from the per-species laws. Applies to both the freestream muRef and the runtime viscosity. Only valid with a FrozenSpeciesSolver; transported species form viscosity from the local composition.

Default:

None

Properties

gas_constant: SpecificHeatCapacity.PositiveFloat64#

Mixture gas constant R_mix = R_u * sum_s(Y_s / W_s) at the reference composition.

Methods

validate_mass_fractions_sum_to_one()[source]#

Validate that reference mass fractions sum to 1 and re-normalize if within tolerance.

validate_unique_species_names()[source]#

Validate that all species have unique names.

validate_temperature_ranges_match()[source]#

Validate all species have matching temperature range boundaries.

get_specific_heat_ratio(temperature)[source]#

Specific heat ratio gamma at T: the mass+mole-weighted mixture value at the reference composition.

Parameters:

temperature (Annotated[Any, BeforeValidator(func=~flow360_schema.framework.physical_dimensions.composers._create_validator.<locals>.validate, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~flow360_schema.framework.physical_dimensions.composers._create_serializer.<locals>.serialize, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={'type': 'object', 'properties': {'value': {'$ref': 'https://flexcompute.com/schemas/1.0.0/Float64.json', '$units': 'kelvin'}, 'display_unit': {'type': 'string'}}, 'required': ['value'], 'additionalProperties': False}, mode=None)])

Return type:

Annotated[float, Gt(gt=0)]

get_pressure(density, temperature)[source]#

Ideal-gas pressure: p = rho * R * T.

Parameters:
  • density (Annotated[Any, BeforeValidator(func=~flow360_schema.framework.physical_dimensions.composers._create_validator.<locals>.validate, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~flow360_schema.framework.physical_dimensions.composers._create_serializer.<locals>.serialize, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={'type': 'object', 'properties': {'value': {'$ref': 'https://flexcompute.com/schemas/1.0.0/PositiveFloat64.json', '$units': 'kilogram/meter^3'}, 'display_unit': {'type': 'string'}}, 'required': ['value'], 'additionalProperties': False}, mode=None)])

  • temperature (Annotated[Any, BeforeValidator(func=~flow360_schema.framework.physical_dimensions.composers._create_validator.<locals>.validate, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~flow360_schema.framework.physical_dimensions.composers._create_serializer.<locals>.serialize, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={'type': 'object', 'properties': {'value': {'$ref': 'https://flexcompute.com/schemas/1.0.0/Float64.json', '$units': 'kelvin'}, 'display_unit': {'type': 'string'}}, 'required': ['value'], 'additionalProperties': False}, mode=None)])

Return type:

Annotated[Any, BeforeValidator(func=~flow360_schema.framework.physical_dimensions.composers._create_validator.<locals>.validate, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~flow360_schema.framework.physical_dimensions.composers._create_serializer.<locals>.serialize, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={‘type’: ‘object’, ‘properties’: {‘value’: {‘$ref’: ‘https://flexcompute.com/schemas/1.0.0/PositiveFloat64.json’, ‘$units’: ‘pascal’}, ‘display_unit’: {‘type’: ‘string’}}, ‘required’: [‘value’], ‘additionalProperties’: False}, mode=None)]

get_speed_of_sound(temperature)[source]#

Speed of sound: sqrt(gamma * R * T).

Parameters:

temperature (Annotated[Any, BeforeValidator(func=~flow360_schema.framework.physical_dimensions.composers._create_validator.<locals>.validate, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~flow360_schema.framework.physical_dimensions.composers._create_serializer.<locals>.serialize, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={'type': 'object', 'properties': {'value': {'$ref': 'https://flexcompute.com/schemas/1.0.0/Float64.json', '$units': 'kelvin'}, 'display_unit': {'type': 'string'}}, 'required': ['value'], 'additionalProperties': False}, mode=None)])

Return type:

Annotated[Any, BeforeValidator(func=~flow360_schema.framework.physical_dimensions.composers._create_validator.<locals>.validate, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~flow360_schema.framework.physical_dimensions.composers._create_serializer.<locals>.serialize, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={‘type’: ‘object’, ‘properties’: {‘value’: {‘$ref’: ‘https://flexcompute.com/schemas/1.0.0/PositiveFloat64.json’, ‘$units’: ‘meter/second’}, ‘display_unit’: {‘type’: ‘string’}}, ‘required’: [‘value’], ‘additionalProperties’: False}, mode=None)]

get_dynamic_viscosity(temperature)[source]#

Dynamic viscosity at T: Wilke mixture viscosity at the reference composition, or the dynamic_viscosity override when one is set.

Parameters:

temperature (Annotated[Any, BeforeValidator(func=~flow360_schema.framework.physical_dimensions.composers._create_validator.<locals>.validate, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~flow360_schema.framework.physical_dimensions.composers._create_serializer.<locals>.serialize, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={'type': 'object', 'properties': {'value': {'$ref': 'https://flexcompute.com/schemas/1.0.0/Float64.json', '$units': 'kelvin'}, 'display_unit': {'type': 'string'}}, 'required': ['value'], 'additionalProperties': False}, mode=None)])

Return type:

Annotated[Any, BeforeValidator(func=~flow360_schema.framework.physical_dimensions.composers._create_validator.<locals>.validate, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~flow360_schema.framework.physical_dimensions.composers._create_serializer.<locals>.serialize, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={‘type’: ‘object’, ‘properties’: {‘value’: {‘$ref’: ‘https://flexcompute.com/schemas/1.0.0/NonNegativeFloat64.json’, ‘$units’: ‘pascal*second’}, ‘display_unit’: {‘type’: ‘string’}}, ‘required’: [‘value’], ‘additionalProperties’: False}, mode=None)]