Skip to content

Network

jaff.core.network.Network

The Network class is the most important class in JAFF. It reads a reaction network file, auto-detects its format, validates mass and charge conservation, and assembles the full species and reaction catalogues along with stoichiometry matrices. It also handles optional radiation transport, photochemistry cross-sections, and auxiliary function files.

Constructor

Network(fname, config=None, errors=False, label=None, funcfile=True, duplicate_policy=None, expand_nuclei=True, radiation_props=None, dust_props=None, use_proxy_photoreaction=True, eos_props=None)

Parameters

fname : str or Path
Path to a network file, or the name of a built-in network (a sub-directory of networks/ containing a single .jet file). A built-in network name wins over a same-named path on disk. Supported formats: KIDA, UDFA, PRIZMO, KROME, UCLCHEM, a combination of the above and the .jaff file (Refer to to_jaff for more details).
config : str, Path, or None, optional
Path to a TOML configuration file. When None (default), JAFF looks for jaff.toml in the network file's directory.
errors : bool, optional
Exit on validation errors. Default False.
label : str or None, optional
Network identifier. Defaults to the file stem.
funcfile : bool, str, or Path, optional
Path to .jfunc auxiliary functions file. True (default) scans the network directory; False skips.
duplicate_policy : str or None, optional
Resolve duplicate rate coefficients (same reaction, mechanism, and temperature range): preserve-first, preserve-last, or error. When None (default), the network's jaff.toml value is used, falling back to preserve-first.
expand_nuclei : bool, optional
When True (default), an n_<element>_nuc symbol in rate expressions (e.g. n_H_nuc, n_He_nuc) is expanded to the element-nucleus density sum (weighted by atom count over all species bearing that element). When False, it is left as a free symbol n<element>_nuc (e.g. nh_nuc) instead. Only affects n_<element>_nuc; plain n_X always resolves to species X.
radiation_props : RadiationProps or None, optional
Radiation-field configuration (bands, spectral index, mode, speed of light, background field). None (default) disables radiation transport.
dust_props : DustProps or None, optional
Dust-module configuration (Rv, radiation reductions, photoelectric band edges). None (default) disables the dust module.
use_proxy_photoreaction : bool, optional
Look up photo-reaction cross-sections under the proxy key from Reaction.normalized_proxy_reaction_str(), which strips a trailing x from species names, so CHx/OHx resolve to the CH/OH entries. A custom .jfunc rate still takes precedence over the cross-sections. Default True.
eos_props : EosProps or None, optional
Equation-of-state configuration used by thermodynamics.eos. None (default) uses an ideal gas, EosProps("ideal") with gamma = 1.6666666666667.

Raises

FileNotFoundError
If fname does not exist.

Attributes

Attribute Type Description
label str Human-readable network identifier; defaults to the source file stem
filename Path Resolved absolute path to the source network file
spec NetworkSpec Normalized construction parameters (resolved fname, parsed config dict, funcfile, aux_funcs, ...)
species Species Ordered catalogue of the network's core (real) species; special pseudo-species (_PHOTON, _CR, ...) are excluded
reactions Reactions Ordered catalogue of all reactions in the network
elements Elements Element catalogue derived from all species; used for composition matrices
reactant_matrix ndarray Shape (n_reactions, n_species) stoichiometry matrix for reactants
product_matrix ndarray Shape (n_reactions, n_species) stoichiometry matrix for products
mass_dict dict Mapping from element symbol to mass properties, used for conservation checks
thermodynamics Thermodynamics Thermal equations: eos, dEdt_chemical, dEdt_extra, dEdt_tot, dTdt_chemical, dTdt_extra, dTdt_tot; see thermodynamics
dRad_dt_extra sympy.Basic Extra radiation moment source terms from @function definitions
radiation Radiation or None Radiation field object; None when no radiation bands are specified
symbols NetworkSymbols Canonical symbols, densities (ndens, ntot, rho, n_hnuc), introspection sets and standardize; see symbols