rizer.cantera_ext
C++ Cantera 1-D plasma extension (custom Domain1D models and solvers)
Loading...
Searching...
No Matches
PrescribedPressureThermo.cpp
Go to the documentation of this file.
2
3#include <cmath>
4#include <stdexcept>
5#include <string>
6#include <utility>
7
8namespace rizer
9{
10
11 // ------------------------------------------------------------------------------ //
12 // PrescribedPressureThermo - constructor //
13 // ------------------------------------------------------------------------------ //
14
16 GammaLawThermo backing)
17 : m_pressure(std::move(pressure)), m_backing(std::move(backing))
18 {
19 if (!m_pressure)
20 {
21 throw std::invalid_argument(
22 "PrescribedPressureThermo: pressure function is empty.");
23 }
24 }
25
26 // ------------------------------------------------------------------------------ //
27 // PrescribedPressureThermo - public methods //
28 // ------------------------------------------------------------------------------ //
29
31 double r,
32 double t,
33 double /*rho*/,
34 double /*Tg*/,
35 double /*Te*/,
36 const double * /*Y*/,
37 double &p_heavy,
38 double &p_electron) const
39 {
40 p_heavy = m_pressure(r, t);
41 // The callback is arbitrary caller code and its result is the pressure
42 // every flux at this face is built from, so a non-finite one is rejected
43 // where it enters rather than where it finally shows.
44 if (!std::isfinite(p_heavy))
45 {
46 throw std::runtime_error(
47 "PrescribedPressureThermo::pressures: the prescribed pressure at "
48 "r = " +
49 std::to_string(r) + " m, t = " + std::to_string(t) + " s is " +
50 std::to_string(p_heavy) + " Pa, which is not finite.");
51 }
52 p_electron = 0.0;
53 }
54
56 double r,
57 double t,
58 double rho,
59 double Tg,
60 double Te,
61 const double *Y) const
62 {
63 return m_backing.soundSpeed(r, t, rho, Tg, Te, Y);
64 }
65
66 double PrescribedPressureThermo::heavyEnergy(double Tg, const double *Y) const
67 {
68 return m_backing.heavyEnergy(Tg, Y);
69 }
70
72 {
73 return m_backing.electronCv();
74 }
75
77 double pressure,
78 double Tg,
79 double Te,
80 const double *Y) const
81 {
82 return m_backing.densityFromPressure(pressure, Tg, Te, Y);
83 }
84
86 double rho,
87 const double *Y,
88 double heavy_internal_energy_target,
89 double Tg_seed) const
90 {
91 return m_backing.heavyTemperature(rho, Y, heavy_internal_energy_target, Tg_seed);
92 }
93
94} // namespace rizer
TEST-ONLY ThermoAccessor holding the pressure to a prescribed field p(r, t) and delegating every othe...
Calorically perfect ideal-gas accessor: one constant for the heavy pool, ElectronGamma for the elect...
std::function< double(double r, double t)> PressureFn
Total prescribed pressure as a function of radius [m] and time [s], returning [Pa].
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).
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 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...
PrescribedPressureThermo(PressureFn pressure, GammaLawThermo backing)
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...