rizer.cantera_ext
C++ Cantera 1-D plasma extension (custom Domain1D models and solvers)
Loading...
Searching...
No Matches
rizer::CanteraThermo Class Reference

ThermoAccessor backed by a PlasmaPhase. More...

#include <CanteraThermo.h>

Inheritance diagram for rizer::CanteraThermo:
rizer::ThermoAccessor

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

Detailed Description

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.

Constructor & Destructor Documentation

◆ CanteraThermo()

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.

Parameters
[in]mechCantera mechanism (YAML) path
[in]phasePhase name within mech; must be a PlasmaPhase with "e-"
Exceptions
std::invalid_argumentif the phase is not a PlasmaPhase, and so carries no electron temperature.

Definition at line 20 of file CanteraThermo.cpp.

Member Function Documentation

◆ densityFromPressure()

double rizer::CanteraThermo::densityFromPressure ( double pressure,
double Tg,
double Te,
const double * Y ) const
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.

Parameters
[in]pressureTarget total pressure \(p_\mathrm{H}+p_\mathrm{e}\) [Pa]
[in]TgHeavy-pool temperature [K], at least 200 K
[in]TeElectron temperature [K], at least 200 K
[in]YSpecies mass fractions [-], length nSpecies()
Returns
Mixture mass density reproducing pressure [kg/m^3]
Exceptions
std::invalid_argumentif 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.

◆ electronCv()

double rizer::CanteraThermo::electronCv ( ) const
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.

Returns
Electron \(c_v\) [J/kg of electrons/K]

Implements rizer::ThermoAccessor.

Definition at line 91 of file CanteraThermo.cpp.

◆ electronIndex()

std::size_t rizer::CanteraThermo::electronIndex ( ) const
inline

Index of the electron species, the one heavyEnergy() leaves out.

Returns
Species index [-]

Definition at line 166 of file CanteraThermo.h.

◆ heavyEnergy()

double rizer::CanteraThermo::heavyEnergy ( double Tg,
const double * Y ) const
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.

Parameters
[in]TgHeavy-pool temperature [K], at least 200 K
[in]YSpecies mass fractions [-], length nSpecies()
Returns
Heavy-pool internal energy [J/kg of mixture]

Implements rizer::ThermoAccessor.

Definition at line 80 of file CanteraThermo.cpp.

◆ heavyTemperature()

double rizer::CanteraThermo::heavyTemperature ( double rho,
const double * Y,
double heavy_internal_energy_target,
double Tg_seed ) const
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.

Parameters
[in]rhoMixture mass density [kg/m^3], unused
[in]YSpecies mass fractions [-], length nSpecies()
[in]heavy_internal_energy_targetTarget \(e_\mathrm{H}\) [J/kg of mixture]
[in]Tg_seedPrevious \(T_\mathrm{H}\) [K], the Newton seed; clamped into the bracket before the first step
Returns
Heavy-pool temperature reproducing the target energy [K]
Exceptions
std::runtime_erroron 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.

◆ nSpecies()

std::size_t rizer::CanteraThermo::nSpecies ( ) const
inline

Number of species in the loaded phase.

Returns
Species count [-]

Definition at line 162 of file CanteraThermo.h.

◆ pressures()

void rizer::CanteraThermo::pressures ( double r,
double t,
double rho,
double Tg,
double Te,
const double * Y,
double & p_heavy,
double & p_electron ) const
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.

Parameters
[in]r,tUnused here; the interface carries them for the prescribed-field test accessors
[in]rhoMixture mass density [kg/m^3]
[in]TgHeavy-pool temperature [K], at least 200 K
[in]TeElectron temperature [K], at least 200 K
[in]YSpecies mass fractions [-], length nSpecies()
[out]p_heavyHeavy-pool partial pressure [Pa]
[out]p_electronElectron partial pressure [Pa]

Implements rizer::ThermoAccessor.

Definition at line 48 of file CanteraThermo.cpp.

◆ soundSpeed()

double rizer::CanteraThermo::soundSpeed ( double r,
double t,
double rho,
double Tg,
double Te,
const double * Y ) const
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.

Parameters
[in]r,tUnused here; the interface carries them for the prescribed-field test accessors
[in]rhoMixture mass density [kg/m^3]
[in]TgHeavy-pool temperature [K], at least 200 K
[in]TeElectron temperature [K], at least 200 K
[in]YSpecies mass fractions [-], length nSpecies()
Returns
Frozen two-pool sound speed [m/s]
Exceptions
std::runtime_errorif 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.

◆ stateProperties()

StateProperties rizer::CanteraThermo::stateProperties ( double r,
double t,
double rho,
double Tg,
double Te,
const double * Y ) const
overridevirtual

The four state functions from one state-setting, rather than the three the default composition performs.

Parameters
[in]r,tUnused here; the interface carries them for the prescribed-field test accessors
[in]rhoMixture mass density [kg/m^3]
[in]TgHeavy-pool temperature [K], at least 200 K
[in]TeElectron temperature [K], at least 200 K
[in]YSpecies mass fractions [-], length nSpecies()
Returns
The two partial pressures, the sound speed and e_H

Reimplemented from rizer::ThermoAccessor.

Definition at line 184 of file CanteraThermo.cpp.


The documentation for this class was generated from the following files: