29 template <
typename Coefficient>
31 Cantera::span<const double> x, std::size_t component,
32 std::size_t node,
double ghost, Coefficient coef)
34 const std::size_t n_points = domain.nPoints();
35 const double value_here = x[domain.index(component, node)];
37 const double value_east = (node < n_points - 1)
38 ? x[domain.index(component, node + 1)]
40 const double radius_east = domain.faceRadius(node + 1);
41 const double spacing_east = domain.faceSpacing(node + 1);
43 const double coef_east =
44 0.5 * (coef(value_here, node) + coef(value_east, node + 1));
76 template <
typename Coefficient>
78 Cantera::span<const double> x, std::size_t component,
79 std::size_t node,
double ghost, Coefficient coef)
81 const double value_here = x[domain.index(component, node)];
82 const double flux_east =
83 eastFaceFlux(domain, x, component, node, ghost, coef);
84 const double radius_east = domain.faceRadius(node + 1);
86 double flux_west = 0.0;
87 double radius_west = 0.0;
90 const double value_west = x[domain.index(component, node - 1)];
91 radius_west = domain.faceRadius(node);
92 const double coef_west =
93 0.5 * (coef(value_west, node - 1) + coef(value_here, node));
96 value_here, domain.faceSpacing(node));
98 return (flux_east - flux_west) /
122 Cantera::span<const double> x, std::size_t component,
123 std::size_t node,
double ghost)
129 const std::size_t n_points = domain.nPoints();
130 const double value_here = x[domain.index(component, node)];
131 const double value_west = x[domain.index(component, node - 1)];
132 const double gradient_west =
133 (value_here - value_west) / domain.faceSpacing(node);
135 const double value_east = (node < n_points - 1)
136 ? x[domain.index(component, node + 1)]
138 const double gradient_east =
139 (value_east - value_here) / domain.faceSpacing(node + 1);
140 return 0.5 * (gradient_west + gradient_east);
152 double lhsTg,
double lhsTe,
double &dTg,
double &dTe,
153 double *dYdt,
double *scratch)
159 const std::vector<double> &rho = domain.
density();
160 const std::vector<double> &Y_amb = *c.Y_amb;
161 const std::vector<double> &molecular_weights = *c.molecular_weights;
164 if (!c.kappa->empty())
166 dTg += faceDivergence(domain, x, 0, j, c.ambient_temperature,
167 [&](
double T, std::size_t)
168 { return evalAtState(*c.kappa, T,
"radial conduction",
"kappa_H(Tg)",
"K",
169 "Extend the kappa_H_T/kappa_H_v table."); }) /
172 if (!c.kappa_e->empty())
174 dTe += faceDivergence(domain, x, 1, j, c.ambient_temperature,
175 [&](
double T, std::size_t)
176 { return evalAtState(*c.kappa_e, T,
"radial conduction",
"kappa_e(Te)",
"K",
177 "Extend the kappa_e_T/kappa_e_v table."); }) /
180 if (!(c.species_diffusivity > 0.0))
185 const double Tg = x[domain.
index(0, j)];
186 const double Te = x[domain.
index(1, j)];
187 const double We = molecular_weights[c.electron_index];
188 const std::size_t n_points = domain.
nPoints();
200 for (std::size_t k = 0; k < c.n_species; k++)
202 scratch[k] = faceDivergence(
203 domain, x, 2 + k, j, Y_amb[k],
204 [&](
double, std::size_t n)
206 const double density =
207 (n < n_points) ? rho[n] : c.wall_ghost_density;
208 return density * c.species_diffusivity;
214 for (std::size_t k = 0; k < c.n_species; k++)
216 dYdt[k] += scratch[k] / rho[j];
225 dTe += (
GasConstant * Te / We) * scratch[c.electron_index] / lhsTe;
227 double gas_compressibility_sum = 0.0;
228 for (std::size_t k = 0; k < c.n_species; k++)
230 if (k == c.electron_index)
232 gas_compressibility_sum += scratch[k] / molecular_weights[k];
234 dTg +=
GasConstant * Tg * gas_compressibility_sum / lhsTg;
248 const std::vector<double> &species_heat_capacity = *c.species_cp;
249 const double Tg_gradient =
250 centredGradient(domain, x, 0, j, c.ambient_temperature);
251 const double Te_gradient =
252 centredGradient(domain, x, 1, j, c.ambient_temperature);
253 const double Ye_gradient = centredGradient(
254 domain, x, 2 + c.electron_index, j, Y_amb[c.electron_index]);
255 dTe += rho[j] * c.species_diffusivity *
256 species_heat_capacity[c.electron_index] * Ye_gradient *
259 double gas_enthalpy_diffusion_sum = 0.0;
260 for (std::size_t k = 0; k < c.n_species; k++)
262 if (k == c.electron_index)
264 const double Yk_gradient =
265 centredGradient(domain, x, 2 + k, j, Y_amb[k]);
266 gas_enthalpy_diffusion_sum +=
267 species_heat_capacity[k] * Yk_gradient;
269 dTg += rho[j] * c.species_diffusivity * Tg_gradient *
270 gas_enthalpy_diffusion_sum / lhsTg;
276 const double *species_enthalpy)
281 const std::size_t wall_node = domain.
nPoints() - 1;
283 if (!c.kappa->empty())
285 outflow.
conduction -= eastFaceFlux(domain, x, 0, wall_node,
286 c.ambient_temperature,
287 [&](
double T, std::size_t)
288 { return evalAtState(*c.kappa, T,
"radial conduction",
"kappa_H(Tg)",
"K",
289 "Extend the kappa_H_T/kappa_H_v table."); });
291 if (!c.kappa_e->empty())
293 outflow.
conduction -= eastFaceFlux(domain, x, 1, wall_node,
294 c.ambient_temperature,
295 [&](
double T, std::size_t)
296 { return evalAtState(*c.kappa_e, T,
"radial conduction",
"kappa_e(Te)",
"K",
297 "Extend the kappa_e_T/kappa_e_v table."); });
299 if (!(c.species_diffusivity > 0.0))
304 const std::vector<double> &rho = domain.
density();
305 const std::vector<double> &Y_amb = *c.Y_amb;
306 const std::size_t n_points = domain.
nPoints();
308 for (std::size_t k = 0; k < c.n_species; k++)
310 const double mass_inflow = eastFaceFlux(
311 domain, x, 2 + k, wall_node, Y_amb[k],
312 [&](
double, std::size_t n)
314 const double density =
315 (n < n_points) ? rho[n] : c.wall_ghost_density;
316 return density * c.species_diffusivity;
318 outflow.
diffusion -= species_enthalpy[k] * mass_inflow;
Pure-arithmetic primitives for a 1D cylindrical (radial) finite-volume discretization of the diffusiv...
The transient two-temperature radial channel as a Cantera Domain1D: per-node source terms from Plasma...
The two-temperature quantities every model in this extension reads back from a PlasmaPhase,...
The parabolic half of PlasmaChannel1D::eval(): conduction in both pools, Fickian species diffusion,...
Evaluate a PropertyTable at a state, refusing a state outside its range.
size_t index(size_t n, size_t j) const
Transient, two-temperature (Te != Tg), finite-rate reacting 1-D radial plasma channel (custom Cantera...
const std::vector< double > & density() const
Per-node mass density [kg/m^3], length nPoints().
double faceFlux(double r_face, double coef_face, double value_inner, double value_outer, double spacing)
Conductive/diffusive flux across one radial cell face: r_face * coef_face * (value_outer - value_inne...
double annularVolume(double r_east, double r_west)
Annular cell volume per unit axial length between two face radii, 0.5 * (r_east^2 - r_west^2) [m^2].
void addRadialDiffusion(const PlasmaChannel1D &domain, Cantera::span< const double > x, const RadialDiffusionCoefficients &c, std::size_t j, double lhsTg, double lhsTe, double &dTg, double &dTe, double *dYdt, double *scratch)
Add one node's diffusive contributions to the rates the caller holds.
constexpr double GasConstant
Universal gas constant [J/kmol/K] and Boltzmann's constant [J/K], from units.h rather than Cantera's ...
WallEnergyOutflow wallEnergyOutflow(const PlasmaChannel1D &domain, Cantera::span< const double > x, const RadialDiffusionCoefficients &c, const double *species_enthalpy)
What conduction and species diffusion move through the wall face at the state x.
Everything the diffusion block needs that the grid and the state do not carry: the transport coeffici...
Energy leaving through the wall ghost face per unit time, per unit axial length and per radian [W/m] ...
std::vector< double > species_mass
Mass of each species diffusion carries through the ghost face [kg/m/s], length K; empty when species ...
double diffusion
Enthalpy species diffusion carries through the ghost face [W/m].
double conduction
Conduction of both pools against the ghost temperature [W/m].