STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
feedtwin.props.species Namespace Reference

Classes

class  SpeciesSpec

Functions

SpeciesSpec register_species (SpeciesSpec spec)
SpeciesSpec _register (SpeciesSpec spec)
SpeciesSpec get_species (str name)
list[str] registered_species ()
None _ensure_loaded ()
list[SpeciesSpec] load_species_file (Path path)
SpeciesSpec _spec_from_toml (str name, dict[str, Any] body)
tuple[str,...] _str_tuple (str species, str key, Any value)

Variables

tuple DEFAULT_CHAIN = ("bicubic", "heos")
 _SPECIES_FILE = Path(__file__).with_name("species.toml")
bool _LOADED = False

Detailed Description

Which fluids exist, declared as data.

The species table lives in ``species.toml``, not in Python. Adding a propellant
is an edit to a data file; it is never a new branch in a function. That is the
difference between a simulator that supports four fluids and one that supports
whatever you point it at, and it is cheap only if it is done on day one --
retrofitting a fluid registry after fifty ``if fluid == "lox"`` sites have
accumulated is the expensive version of this decision.

Anything the equation of state already knows -- molar mass, critical point,
triple point -- is deliberately *not* declared here. Duplicating it would create
a second source of truth that silently disagrees with the first.

Runtime registration is supported too, so a project can add a species without
editing this package::

    from feedtwin.props import register_species, SpeciesSpec

    register_species(SpeciesSpec(name="nitrous", backend_fluid="NitrousOxide"))

Function Documentation

◆ _ensure_loaded()

None feedtwin.props.species._ensure_loaded ( )
protected

Definition at line 115 of file species.py.

References load_species_file().

Referenced by get_species(), register_species(), and registered_species().

◆ _register()

SpeciesSpec feedtwin.props.species._register ( SpeciesSpec spec)
protected
Register without loading the shipped table -- used by the loader itself.

Definition at line 91 of file species.py.

Referenced by load_species_file(), and register_species().

◆ _spec_from_toml()

SpeciesSpec feedtwin.props.species._spec_from_toml ( str name,
dict[str, Any] body )
protected

Definition at line 145 of file species.py.

References _str_tuple().

Referenced by load_species_file().

◆ _str_tuple()

tuple[str, ...] feedtwin.props.species._str_tuple ( str species,
str key,
Any value )
protected

Definition at line 165 of file species.py.

Referenced by _spec_from_toml().

◆ get_species()

SpeciesSpec feedtwin.props.species.get_species ( str name)
Resolve a name or alias to its species. Case-insensitive.

Definition at line 100 of file species.py.

References _ensure_loaded().

◆ load_species_file()

list[SpeciesSpec] feedtwin.props.species.load_species_file ( Path path)
Load a species table from a TOML file and register everything in it.

Public so a project can layer its own table on top of the shipped one --
later definitions replace earlier ones by name.

Definition at line 126 of file species.py.

References _register(), and _spec_from_toml().

Referenced by _ensure_loaded().

◆ register_species()

SpeciesSpec feedtwin.props.species.register_species ( SpeciesSpec spec)
Add or replace a species. Aliases are indexed case-insensitively.

Registrations layer *on top of* the shipped table: it is loaded first if it
has not been already, so adding a species never removes one.

Definition at line 81 of file species.py.

References _ensure_loaded(), and _register().

◆ registered_species()

list[str] feedtwin.props.species.registered_species ( )
Canonical names of every declared species, sorted.

Definition at line 109 of file species.py.

References _ensure_loaded().

Variable Documentation

◆ _LOADED

bool feedtwin.props.species._LOADED = False
protected

Definition at line 78 of file species.py.

◆ _SPECIES_FILE

feedtwin.props.species._SPECIES_FILE = Path(__file__).with_name("species.toml")
protected

Definition at line 39 of file species.py.

◆ DEFAULT_CHAIN

tuple feedtwin.props.species.DEFAULT_CHAIN = ("bicubic", "heos")

Definition at line 37 of file species.py.