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

Functions

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_inner) / spacing.
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].
double maxWaveSpeed (double u_left, double c_left, double u_right, double c_right)
 Rusanov dissipation coefficient at a face: the fastest wave speed that can reach it from either side, NUMERICS.md equation (9)'s \(S_{i+1/2}\).
double rusanovScalarFlux (double r_face, double phi_left, double phi_right, double u_left, double u_right, double wave_speed)
 Rusanov face flux for any node-centred conserved scalar – \(\rho\) and each \(\rho Y_s\).
double rusanovMomentumFlux (double r_face, double rho_left, double u_left, double p_left, double rho_right, double u_right, double p_right, double wave_speed)
 Pressure-inclusive Rusanov face flux for the radial momentum row, NUMERICS.md equation (12):
double rusanovEnergyFlux (double r_face, double E_left, double p_left, double u_left, double E_right, double p_right, double u_right, double wave_speed)
 Pressure-inclusive Rusanov face flux for the total energy row, NUMERICS.md equation (14a) – the face flux, not (14), which is the cell update this feeds:
double faceVelocityFlux (double r_face, double u_left, double u_right)
 Face velocity flux \(G_{i+1/2} = r_{i+1/2}\,\tfrac12(u_{r,i}+u_{r,i+1})\), whose difference gives the electron-pool compression source of NUMERICS.md equation (15).
double momentumGeometricSourceIntegral (double p, double dr)
 Cell-integrated cylindrical momentum source, the second term of NUMERICS.md equation (13):

Function Documentation

◆ annularVolume()

double rizer::numeric::annularVolume ( double r_east,
double r_west )
inline

Annular cell volume per unit axial length between two face radii, 0.5 * (r_east^2 - r_west^2) [m^2].

Parameters
r_eastOuter (east) face radius of the cell [m]
r_westInner (west) face radius of the cell [m] (0 at the axis)

Definition at line 119 of file DiffusiveFlux.h.

◆ faceFlux()

double rizer::numeric::faceFlux ( double r_face,
double coef_face,
double value_inner,
double value_outer,
double spacing )
inline

Conductive/diffusive flux across one radial cell face: r_face * coef_face * (value_outer - value_inner) / spacing.

value_inner/value_outer are ordered by radius, not by which node is "current" at the call site: value_inner is always the value on the smaller-r side of this face, value_outer the value on the larger-r side – regardless of whether the caller is assembling a node's east or west face. Swapping the two flips the sign of the result.

Parameters
r_faceFace radius [m]
coef_faceFace transport coefficient, already averaged by the caller (e.g. the arithmetic mean of the two neighbouring nodes' kappa/kappa_e/rho*D) [W/m/K for Tg/Te conduction, kg/m/s for species diffusion]
value_innerSolution value on the smaller-r side of the face, in the component's own unit ([K] for Tg/Te, [-] for Y_k)
value_outerSolution value on the larger-r side of the face, same unit as value_inner
spacingRadial spacing across the face (node-to-node, or node-to-ghost at a wall) [m]

Definition at line 109 of file DiffusiveFlux.h.

◆ faceVelocityFlux()

double rizer::numeric::faceVelocityFlux ( double r_face,
double u_left,
double u_right )
inline

Face velocity flux \(G_{i+1/2} = r_{i+1/2}\,\tfrac12(u_{r,i}+u_{r,i+1})\), whose difference gives the electron-pool compression source of NUMERICS.md equation (15).

This is a difference of the VELOCITY flux, not of the mass flux the continuity row already computes. Reusing the mass flux yields the Eulerian rate where the source calls for the material one; the two differ by \(-(p_\mathrm{e}/\rho)\,u_r\,\partial\rho/\partial r\), an O(1) term that does not shrink with dr and that spuriously heats one side of a contact discontinuity and cools the other (appendix A.2).

Only the electron row needs it. The total-energy row (14) is a pure flux difference, and the heavy pool has no row of its own: it is recovered as total minus kinetic minus electron, which hands it \(-p_\mathrm{H} \vec\nabla\cdot\vec u\) exactly.

Parameters
[in]r_faceFace radius [m]
[in]u_leftRadial velocity on the smaller-r side [m/s]
[in]u_rightRadial velocity on the larger-r side [m/s]
Returns
Face velocity flux [m^2/s]

Definition at line 199 of file EulerFlux.h.

◆ maxWaveSpeed()

double rizer::numeric::maxWaveSpeed ( double u_left,
double c_left,
double u_right,
double c_right )
inline

Rusanov dissipation coefficient at a face: the fastest wave speed that can reach it from either side, NUMERICS.md equation (9)'s \(S_{i+1/2}\).

Parameters
[in]u_leftRadial velocity on the smaller-r side of the face [m/s]
[in]c_leftSound speed on the smaller-r side [m/s]
[in]u_rightRadial velocity on the larger-r side [m/s]
[in]c_rightSound speed on the larger-r side [m/s]
Returns
Maximum local wave speed [m/s]

Definition at line 67 of file EulerFlux.h.

◆ momentumGeometricSourceIntegral()

double rizer::numeric::momentumGeometricSourceIntegral ( double p,
double dr )
inline

Cell-integrated cylindrical momentum source, the second term of NUMERICS.md equation (13):

\[ \int \frac{p}{r}\,r\,\mathrm{d}r = \int p\,\mathrm{d}r \approx p_i\,dr_i \]

Returns the INTEGRAL over the cell, never the pointwise \(p/r\). The \(1/r\) cancels against the \(r\,\mathrm{d}r\) weight inside the exact integral, before any approximation, which is why the axis cell stays finite where a pointwise \(p_i/r_i\) at \(r_0=0\) would not. Callers divide by the cell volume, exactly as they do with the flux difference.

**dr is the face span \(r_{i+1/2}-r_{i-1/2}\), never the cell's physical width.** The two coincide in cylindrical geometry but not in the planar entry point, where every face radius is 1: there the face span is zero, so this returns zero and matches the flux difference \(p(1-1)\), leaving a state at rest undisturbed. Passing the physical width instead - \(V_i\), which NUMERICS.md section "Full system, planar - Sod shock tube" sets to \(dr_i\) in planar mode - would return \(p_i\) against a zero flux difference and accelerate gas out of that state at rest.

Parameters
[in]pCell total pressure [Pa]
[in]drFace span, r_{i+1/2} - r_{i-1/2} [m]; zero in planar mode
Returns
Cell-integrated geometric source [kg/s^2]

Definition at line 226 of file EulerFlux.h.

◆ rusanovEnergyFlux()

double rizer::numeric::rusanovEnergyFlux ( double r_face,
double E_left,
double p_left,
double u_left,
double E_right,
double p_right,
double u_right,
double wave_speed )
inline

Pressure-inclusive Rusanov face flux for the total energy row, NUMERICS.md equation (14a) – the face flux, not (14), which is the cell update this feeds:

\[ F^{E}_{i+1/2} = r_{i+1/2}\left[ \tfrac12\big(u_{r,i}(\rho E+p)_i + u_{r,i+1}(\rho E+p)_{i+1}\big) - \tfrac12 S_{i+1/2}\big((\rho E)_{i+1}-(\rho E)_i\big)\right] \]

The advected quantity is the total energy \(\rho E\) while the transported one is the ENTHALPY \(\rho E + p\): the \(pu_r\) between them is the compression work, carried across the face instead of applied as a \(-p\,\vec\nabla\cdot\vec u\) source inside the cell. That is what makes the row a pure flux difference, so the interior faces telescope and total energy is conserved to round-off.

The dissipation acts on the conserved \(\rho E\), NOT on \(\rho E + p\) - the same distinction rusanovMomentumFlux() draws for \(\rho u_r\). Dissipating \(\rho E+p\) would put a spurious energy flux on every face where the pressure varies, including where the gas is at rest and the advective part vanishes.

This row carries BOTH pools, which is what PHYSICS.md (G9) conserves. The two-temperature structure is kept by the electron internal-energy row (13) alongside it, which is a plain rusanovScalarFlux() with its own compression source; the heavy pool is recovered by subtraction.

Parameters
[in]r_faceFace radius [m] (1 in planar mode, 0 at the axis)
[in]E_leftTotal energy density on the smaller-r side [J/m^3]
[in]p_leftTotal pressure on the smaller-r side [Pa]
[in]u_leftRadial velocity on the smaller-r side [m/s]
[in]E_rightTotal energy density on the larger-r side [J/m^3]
[in]p_rightTotal pressure on the larger-r side [Pa]
[in]u_rightRadial velocity on the larger-r side [m/s]
[in]wave_speedDissipation coefficient from maxWaveSpeed() [m/s]
Returns
Energy face flux [J/m/s], already multiplied by r_face

Definition at line 170 of file EulerFlux.h.

◆ rusanovMomentumFlux()

double rizer::numeric::rusanovMomentumFlux ( double r_face,
double rho_left,
double u_left,
double p_left,
double rho_right,
double u_right,
double p_right,
double wave_speed )
inline

Pressure-inclusive Rusanov face flux for the radial momentum row, NUMERICS.md equation (12):

\[ F^{mom}_{i+1/2} = r_{i+1/2}\left[ \tfrac12\big((\rho u_r^2+p)_i+(\rho u_r^2+p)_{i+1}\big) - \tfrac12 S_{i+1/2}\big((\rho u_r)_{i+1}-(\rho u_r)_i\big)\right] \]

This carries \(r_\mathrm{face}(\rho u_r^2 + p)\), NOT an upwinded scalar. Substituting a plain scalar flux here reproduces exactly the bug NUMERICS.md section 5.2 warns about: a momentum row with no pressure term at all. The dissipation acts on the conserved momentum \(\rho u_r\), not on the velocity.

Parameters
[in]r_faceFace radius [m]
[in]rho_leftDensity on the smaller-r side [kg/m^3]
[in]u_leftRadial velocity on the smaller-r side [m/s]
[in]p_leftTotal pressure on the smaller-r side [Pa]
[in]rho_rightDensity on the larger-r side [kg/m^3]
[in]u_rightRadial velocity on the larger-r side [m/s]
[in]p_rightTotal pressure on the larger-r side [Pa]
[in]wave_speedDissipation coefficient from maxWaveSpeed() [m/s]
Returns
Momentum face flux [kg/s^2], so that dividing its difference by the cell volume [m^2] gives the required kg/m^2/s^2

Definition at line 123 of file EulerFlux.h.

◆ rusanovScalarFlux()

double rizer::numeric::rusanovScalarFlux ( double r_face,
double phi_left,
double phi_right,
double u_left,
double u_right,
double wave_speed )
inline

Rusanov face flux for any node-centred conserved scalar – \(\rho\) and each \(\rho Y_s\).

NUMERICS.md equation (9):

\[ F^{\phi}_{i+1/2} = r_{i+1/2}\left[ \tfrac12\big(u_{r,i}\phi_i + u_{r,i+1}\phi_{i+1}\big) - \tfrac12 S_{i+1/2}\,(\phi_{i+1}-\phi_i)\right] \]

The first term is the plain average of the two neighbouring fluxes, the second the dissipation. \(r_{i+1/2}\) multiplies the whole blend, average and dissipation alike.

The pool energies do not come through here: their flux carries a pressure term, so they use rusanovEnergyFlux() below.

Parameters
[in]r_faceFace radius [m] (1 in planar mode, 0 at the axis)
[in]phi_leftConserved value on the smaller-r side (its own unit)
[in]phi_rightConserved value on the larger-r side, same unit
[in]u_leftRadial velocity on the smaller-r side [m/s]
[in]u_rightRadial velocity on the larger-r side [m/s]
[in]wave_speedDissipation coefficient from maxWaveSpeed() [m/s]
Returns
Face flux, already multiplied by r_face (phi's unit times m^2/s)

Definition at line 93 of file EulerFlux.h.