|
rizer.cantera_ext
C++ Cantera 1-D plasma extension (custom Domain1D models and solvers)
|
ThermoAccessor backed by a PlasmaPhase. More...
#include <CanteraThermo.h>
Public Member Functions | |
| CanteraThermo (const std::string &mech, const std::string &phase) | |
| Loads the phase alone, never its reactions: the accessor evaluates thermo only, and a mechanism's reactions may name rate types that only rizer's registration makes parseable. | |
| void | pressures (double r, double t, double rho, double Tg, double Te, const double *Y, double &p_heavy, double &p_electron) const override |
| PlasmaPhase::electronPressure(), and the total less that. | |
| double | soundSpeed (double r, double t, double rho, double Tg, double Te, const double *Y) const override |
| \(\gamma_\mathrm{H}\) summed over the heavy species alone, \(\gamma_\mathrm{e}\) from the fixed ElectronGamma, over the same partial-pressure split pressures() makes. | |
| double | heavyEnergy (double Tg, const double *Y) const override |
| Cantera's mixture internal energy less the electron's contribution, on the per kg of MIXTURE basis the interface asks for. | |
| double | electronCv () const override |
| \(\tfrac32 R/W_\mathrm{e}\) exactly: no thermo lookup and no state, so it is the same number at every node and every step. | |
| double | densityFromPressure (double pressure, double Tg, double Te, const double *Y) const override |
| PlasmaPhase::setPressure() read back through density(). | |
| double | heavyTemperature (double rho, const double *Y, double heavy_internal_energy_target, double Tg_seed) const override |
| Damped Newton on \(e_\mathrm{H}(T_\mathrm{H})\) = target, seeded with Tg_seed and confined to [200 K, 1e5 K]. | |
| StateProperties | stateProperties (double r, double t, double rho, double Tg, double Te, const double *Y) const override |
| The four state functions from one state-setting, rather than the three the default composition performs. | |
| std::size_t | nSpecies () const |
| Number of species in the loaded phase. | |
| std::size_t | electronIndex () const |
| Index of the electron species, the one heavyEnergy() leaves out. | |
| Public Member Functions inherited from rizer::ThermoAccessor | |
| virtual | ~ThermoAccessor ()=default |
ThermoAccessor backed by a PlasmaPhase.
Every method sets the phase state from (rho, Tg, Te, Y) and reads the answer back, so the equation of state is Cantera's own (PHYSICS.md (G6)) rather than a second copy of it.
r and t are ignored: a production accessor has no field to look up. They exist on the interface for the prescribed-field test accessors.
Definition at line 36 of file CanteraThermo.h.
| rizer::CanteraThermo::CanteraThermo | ( | const std::string & | mech, |
| const std::string & | phase ) |
Loads the phase alone, never its reactions: the accessor evaluates thermo only, and a mechanism's reactions may name rate types that only rizer's registration makes parseable.
| [in] | mech | Cantera mechanism (YAML) path |
| [in] | phase | Phase name within mech; must be a PlasmaPhase with "e-" |
| std::invalid_argument | if the phase is not a PlasmaPhase, and so carries no electron temperature. |
Definition at line 20 of file CanteraThermo.cpp.
|
overridevirtual |
PlasmaPhase::setPressure() read back through density().
That setter is the exact inverse of the pressure() that pressures() splits, \(\rho = p\bar W/(R\,T_\mathrm{mean})\) at the same mean temperature, so no inversion is written here.
| [in] | pressure | Target total pressure \(p_\mathrm{H}+p_\mathrm{e}\) [Pa] |
| [in] | Tg | Heavy-pool temperature [K], at least 200 K |
| [in] | Te | Electron temperature [K], at least 200 K |
| [in] | Y | Species mass fractions [-], length nSpecies() |
| std::invalid_argument | if the density that comes back is not positive, which means the pressure, the temperatures or the mass fractions handed in do not describe a gas. |
Implements rizer::ThermoAccessor.
Definition at line 96 of file CanteraThermo.cpp.
|
overridevirtual |
\(\tfrac32 R/W_\mathrm{e}\) exactly: no thermo lookup and no state, so it is the same number at every node and every step.
Implements rizer::ThermoAccessor.
Definition at line 91 of file CanteraThermo.cpp.
|
inline |
Index of the electron species, the one heavyEnergy() leaves out.
Definition at line 166 of file CanteraThermo.h.
|
overridevirtual |
Cantera's mixture internal energy less the electron's contribution, on the per kg of MIXTURE basis the interface asks for.
Sets the state it evaluates, at unit density: an ideal gas's internal energy depends on temperature and composition only, so the density is there to make the phase state valid and cannot reach the answer. Neither can the electron temperature, which enters the mixture energy and leaves again with the term that is subtracted.
| [in] | Tg | Heavy-pool temperature [K], at least 200 K |
| [in] | Y | Species mass fractions [-], length nSpecies() |
Implements rizer::ThermoAccessor.
Definition at line 80 of file CanteraThermo.cpp.
|
overridevirtual |
Damped Newton on \(e_\mathrm{H}(T_\mathrm{H})\) = target, seeded with Tg_seed and confined to [200 K, 1e5 K].
Energy and slope come from a single state-setting through heavyEnergyAndCv(), and a step leaving the bracket is damped back onto it rather than trusted.
rho is unused: the heavy-pool energy is density-independent, so the inversion is too.
| [in] | rho | Mixture mass density [kg/m^3], unused |
| [in] | Y | Species mass fractions [-], length nSpecies() |
| [in] | heavy_internal_energy_target | Target \(e_\mathrm{H}\) [J/kg of mixture] |
| [in] | Tg_seed | Previous \(T_\mathrm{H}\) [K], the Newton seed; clamped into the bracket before the first step |
| std::runtime_error | on a non-positive heavy heat capacity, on a step that stops moving while the relative energy residual is still above 1e-6 (the target lies outside the bracket for this composition, and a bracket edge is not an answer), or on 100 iterations without convergence. |
Implements rizer::ThermoAccessor.
Definition at line 117 of file CanteraThermo.cpp.
|
inline |
Number of species in the loaded phase.
Definition at line 162 of file CanteraThermo.h.
|
overridevirtual |
PlasmaPhase::electronPressure(), and the total less that.
Cantera computes one total from \(p=n_\mathrm{tot}k_\mathrm{B} T_\mathrm{mean}\) with \(T_\mathrm{mean}\) the mole-fraction-weighted mean of the two pool temperatures, and the electron partial pressure separately as \(n_\mathrm{e}k_\mathrm{B}T_\mathrm{e}\). Their difference is \(n_\mathrm{H}k_\mathrm{B}T_\mathrm{H}\) identically, so both pool relations hold against the one total the phase reports.
| [in] | r,t | Unused here; the interface carries them for the prescribed-field test accessors |
| [in] | rho | Mixture mass density [kg/m^3] |
| [in] | Tg | Heavy-pool temperature [K], at least 200 K |
| [in] | Te | Electron temperature [K], at least 200 K |
| [in] | Y | Species mass fractions [-], length nSpecies() |
| [out] | p_heavy | Heavy-pool partial pressure [Pa] |
| [out] | p_electron | Electron partial pressure [Pa] |
Implements rizer::ThermoAccessor.
Definition at line 48 of file CanteraThermo.cpp.
|
overridevirtual |
\(\gamma_\mathrm{H}\) summed over the heavy species alone, \(\gamma_\mathrm{e}\) from the fixed ElectronGamma, over the same partial-pressure split pressures() makes.
The mixture's own cp_mass/cv_mass is NOT \(\gamma_\mathrm{H}\): it carries the electron, whose capacity per kg of electrons is \(\tfrac52 R/W_\mathrm{e}\), large enough that a mass fraction of \(10^{-7}\) still contributes a percent of the mixture value.
| [in] | r,t | Unused here; the interface carries them for the prescribed-field test accessors |
| [in] | rho | Mixture mass density [kg/m^3] |
| [in] | Tg | Heavy-pool temperature [K], at least 200 K |
| [in] | Te | Electron temperature [K], at least 200 K |
| [in] | Y | Species mass fractions [-], length nSpecies() |
| std::runtime_error | if the mixture has no heavy pool to carry an acoustic wave, i.e. a non-positive heavy heat capacity. |
Implements rizer::ThermoAccessor.
Definition at line 62 of file CanteraThermo.cpp.
|
overridevirtual |
The four state functions from one state-setting, rather than the three the default composition performs.
| [in] | r,t | Unused here; the interface carries them for the prescribed-field test accessors |
| [in] | rho | Mixture mass density [kg/m^3] |
| [in] | Tg | Heavy-pool temperature [K], at least 200 K |
| [in] | Te | Electron temperature [K], at least 200 K |
| [in] | Y | Species mass fractions [-], length nSpecies() |
Reimplemented from rizer::ThermoAccessor.
Definition at line 184 of file CanteraThermo.cpp.