Gas#
- class Gas[source]#
Bases:
MaterialBaseCustomizable gas material defined by its species. The material describes the molecules only; how the species are solved is chosen on
Fluid:FrozenSpeciesSolverfixes the composition (no transport equations are solved),SpeciesTransportSolvertransports the species’ mass fractions. For the constant-gamma standard-air case use theAirpreset 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; seeSpecies.from_library()for the per-field overrides, and constructSpeciesdirectly for anything outside the catalogue.With a
FrozenSpeciesSolverand 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). Setdynamic_viscosityto use your own mixture law or constant instead of the fit.Attributes
- 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
muRefand the runtime viscosity. Only valid with aFrozenSpeciesSolver; 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_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:
- 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_viscosityoverride 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)]