19 std::vector<double> molecular_weights,
22 m_W(std::move(molecular_weights)),
23 m_electron_index(electron_index)
27 throw std::invalid_argument(
28 "GammaLawThermo: the heavy-pool gamma must be > 1, got " +
29 std::to_string(m_gamma));
33 throw std::invalid_argument(
"GammaLawThermo: molecular_weights is empty.");
35 for (std::size_t k = 0; k < m_W.size(); k++)
39 throw std::invalid_argument(
40 "GammaLawThermo: molecular_weights[" +
42 "] must be > 0, got " +
43 std::to_string(m_W[k]));
46 if (m_electron_index < -1 || m_electron_index >=
static_cast<int>(m_W.size()))
48 throw std::invalid_argument(
49 "GammaLawThermo: electron_index must be -1 (no electron species) or "
50 "a valid species index, got " +
51 std::to_string(m_electron_index));
60 double Te,
const double *Y,
double &p_heavy,
61 double &p_electron)
const
65 p_heavy = rho * heavyMolesPerMass(Y) *
GasConstant * Tg;
66 p_electron = rho * electronMolesPerMass(Y) *
GasConstant * Te;
70 double Tg,
double Te,
const double *Y)
const
77 const double moles_electron = electronMolesPerMass(Y);
78 const double moles_heavy = heavyMolesPerMass(Y);
79 if (!(moles_heavy + moles_electron > 0.0))
81 throw std::invalid_argument(
82 "GammaLawThermo::soundSpeed: mass fractions sum to zero moles.");
84 return std::sqrt(
GasConstant * (m_gamma * moles_heavy * Tg +
92 return Tg *
GasConstant / (m_gamma - 1.0) * heavyMolesPerMass(Y);
97 if (m_electron_index < 0)
99 throw std::invalid_argument(
100 "GammaLawThermo::electronCv: no electron species "
101 "(electron_index = -1); the electron energy row is not solved.");
103 const std::size_t e =
static_cast<std::size_t
>(m_electron_index);
108 double Te,
const double *Y)
const
123 double p_heavy_unit = 0.0;
124 double p_electron_unit = 0.0;
125 pressures(0.0, 0.0, 1.0, Tg, Te, Y, p_heavy_unit,
127 const double p_unit = p_heavy_unit + p_electron_unit;
130 throw std::invalid_argument(
131 "GammaLawThermo::densityFromPressure: the state has no pressure at "
132 "unit density; check the temperatures and mass fractions.");
134 return pressure / p_unit;
138 double heavy_internal_energy_target,
144 const double moles = heavyMolesPerMass(Y);
147 throw std::invalid_argument(
148 "GammaLawThermo::heavyTemperature: no heavy species present.");
158 if (!(heavy_internal_energy_target > 0.0))
160 throw std::runtime_error(
161 "GammaLawThermo::heavyTemperature: heavy internal energy is " +
162 std::to_string(heavy_internal_energy_target) +
163 " J/kg, which no positive temperature can produce. The energy "
164 "row has lost more to the kinetic split than it holds; lower "
165 "cfl or refine the grid.");
167 return heavy_internal_energy_target * (m_gamma - 1.0) / (
GasConstant * moles);
174 double GammaLawThermo::heavyMolesPerMass(
const double *Y)
const
177 for (std::size_t k = 0; k < m_W.size(); k++)
179 if (
static_cast<int>(k) == m_electron_index)
181 moles += Y[k] / m_W[k];
186 double GammaLawThermo::electronMolesPerMass(
const double *Y)
const
188 if (m_electron_index < 0)
190 const std::size_t
e =
static_cast<std::size_t
>(m_electron_index);
191 return Y[
e] / m_W[
e];
Calorically perfect ThermoAccessor: one constant gamma for the heavy pool, ElectronGamma for the elec...
The two-temperature quantities every model in this extension reads back from a PlasmaPhase,...
double soundSpeed(double r, double t, double rho, double Tg, double Te, const double *Y) const override
Sound speed, PHYSICS.md appendix A.4: the frozen two-pool speed , each pool following its own adiaba...
double densityFromPressure(double pressure, double Tg, double Te, const double *Y) const override
Density reproducing a target total pressure at a given temperature pair and composition – the inverse...
double heavyTemperature(double rho, const double *Y, double heavy_internal_energy_target, double Tg_seed) const override
Invert for at fixed density and composition (NUMERICS.md section 8).
GammaLawThermo(double gamma, std::vector< double > molecular_weights, int electron_index)
double electronCv() const override
Electron specific heat at constant volume, per kg of ELECTRONS, .
void pressures(double r, double t, double rho, double Tg, double Te, const double *Y, double &p_heavy, double &p_electron) const override
Per-pool partial pressures, PHYSICS.md equation (G6).
double heavyEnergy(double Tg, const double *Y) const override
Heavy-pool internal energy per kg of MIXTURE, – the basis that makes the conserved variable of equa...
constexpr double e
Elementary charge [C]. Exact (CODATA).
constexpr double ElectronGamma
Ratio of specific heats of the electron pool [-].
double monatomicElectronCv(double electron_molecular_weight)
Electron specific heat at constant volume, per kg of ELECTRONS, .
constexpr double GasConstant
Universal gas constant [J/kmol/K] and Boltzmann's constant [J/K], from units.h rather than Cantera's ...