solprop.physdata.gases#

The gas species solprop knows about.

Gas names every built-in gas, and every material quantity of it comes from optmat (SEP 3): the linear law, the equation of state and transport, the Kerr coefficient, the Raman response and the ionisation rate all key off it. as_gas() coerces a name, and is_molecule() and is_air() classify one. A model variant is not a separate gas; it is chosen with a MaterialSelection.

Functions

as_gas(gas)

Coerce a gas name to a Gas member.

is_air(material)

Return whether a built-in gas's name means air.

is_molecule(gas)

Return whether the species is molecular rather than a single atom.

Classes

Gas(*values)

A gas species, spelled as its chemical formula.

class solprop.physdata.gases.Gas(*values)[source]#

Bases: StrEnum

A gas species, spelled as its chemical formula.

The members are str subclasses, so Gas.He == "He" and a plain string may be used anywhere a gas is expected; as_gas() performs the conversion and raises MaterialError for anything unknown.

Examples

>>> from solprop.physdata import Gas
>>> Gas.N2O.value
'N2O'
>>> Gas("Ar") is Gas.Ar
True
Air = 'Air'#
Ar = 'Ar'#
CH4 = 'CH4'#
D2 = 'D2'#
H2 = 'H2'#
He = 'He'#
Kr = 'Kr'#
N2 = 'N2'#
N2O = 'N2O'#
Ne = 'Ne'#
O2 = 'O2'#
SF6 = 'SF6'#
Xe = 'Xe'#
solprop.physdata.gases.as_gas(gas)[source]#

Coerce a gas name to a Gas member.

Parameters:
gasGas or str

A Gas member or its exact name, e.g. "He". The lookup is case-sensitive: an explicit error beats a silent coercion.

Returns:
Gas

The matching member.

Raises:
MaterialError

If gas is not one of the known species.

Examples

>>> from solprop.physdata import as_gas
>>> as_gas("Kr")
<Gas.Kr: 'Kr'>
solprop.physdata.gases.is_air(material)[source]#

Return whether a built-in gas’s name means air.

Unlike as_gas(), which is case-sensitive, this accepts the spelling the interface takes for air: "air" in any case, with surrounding whitespace ignored. Any other name, known or not, is simply not air; nothing is refused.

Parameters:
materialGas or str

The name given to the interface.

Returns:
bool

True for Gas.Air and for "air" in any case.

Examples

>>> from solprop.physdata import Gas, is_air
>>> is_air(Gas.Air), is_air(" AIR "), is_air("Ar")
(True, True, False)
solprop.physdata.gases.is_molecule(gas)[source]#

Return whether the species is molecular rather than a single atom.

Air counts as molecular: it is a mixture of diatomic molecules, not a monatomic gas. The predicate is chemical only; which ionisation rate and which Raman response a gas has is optmat’s (solprop.nonlinear.optmat_rates, solprop.nonlinear.optmat_raman).

Parameters:
gasGas or str

A Gas member or its exact name.

Returns:
bool

True for a molecular species, False for a noble gas.

Raises:
MaterialError

If gas is not one of the known species.

Examples

>>> from solprop.physdata import is_molecule
>>> is_molecule("He"), is_molecule("N2"), is_molecule("Air")
(False, True, True)