pub struct FvModels { /* private fields */ }Expand description
A collection of source terms, applied together to an equation.
Upstream’s fvModels. Held by a solver and handed each equation in turn.
Implementations§
Source§impl FvModels
impl FvModels
Sourcepub fn models_mut(&mut self) -> &mut [FvModel]
pub fn models_mut(&mut self) -> &mut [FvModel]
Mutable access, needed because stateful models advance their internal state when applied.
Sourcepub fn contributes_to(&self, field: &str) -> bool
pub fn contributes_to(&self, field: &str) -> bool
Whether any attached model contributes to field.
Lets a solver skip assembling a source it would then discard.
Source§impl FvModels
impl FvModels
Sourcepub fn correct(
&mut self,
temperature: &VolScalarField,
vof_phase_fraction: Option<&VolScalarField>,
)
pub fn correct( &mut self, temperature: &VolScalarField, vof_phase_fraction: Option<&VolScalarField>, )
Advance every stateful model, once per timestep — upstream’s
fvModels::correct().
Only VofSolidificationMelting needs this: its solid fraction is
driven by a VoF phase fraction that no equation assembly ever sees, so
upstream updates it from a dedicated solver call rather than lazily from
addSup. SolidificationMelting updates itself lazily instead (it
reads only the temperature, which every addSup already has), and
guards against doing so twice in one step; calling this does not disturb
that.
vof_phase_fraction is the VoF condensed-phase fraction [-]. Passing
None while a VofSolidificationMelting model is attached leaves its
solid fraction frozen — legal, but almost certainly a wiring mistake, so
it is worth asserting against in a case setup.
Sourcepub fn advance_time(&mut self)
pub fn advance_time(&mut self)
Roll every stateful model’s history forward and re-arm its once-per-timestep guards.
Call once per completed timestep, after the equations have been
solved. Both phase-change models discretise their latent-heat source as
a first-order Euler rate against the previous step’s phase fraction, so
omitting this does not merely stale the source — for
SolidificationMelting it also leaves the once-per-step guard set,
freezing the liquid fraction for the rest of the run.
Sourcepub fn add_source_scalar(
&mut self,
field: &str,
rho: &VolScalarField,
temperature: &VolScalarField,
dt: f64,
eqn: &mut FvMatrix,
)
pub fn add_source_scalar( &mut self, field: &str, rho: &VolScalarField, temperature: &VolScalarField, dt: f64, eqn: &mut FvMatrix, )
Add every applicable model’s contribution to a scalar equation.
field names the solved field, rho is the density used by models that
need it (pass a uniform field of ones for an incompressible equation,
which is upstream’s geometricOneField), and dt the timestep in
seconds.
Placement into the matrix follows the convention documented at module
level: the explicit part goes to source, the implicit coefficient to
the diagonal with its sign flipped, both scaled by the cell volume.
Sourcepub fn add_source_vector(
&mut self,
field: &str,
rho: &VolScalarField,
temperature: &VolScalarField,
velocity: &VolVectorField,
phase_fraction: Option<&VolScalarField>,
dt: f64,
eqn: &mut FvVectorMatrix,
)
pub fn add_source_vector( &mut self, field: &str, rho: &VolScalarField, temperature: &VolScalarField, velocity: &VolVectorField, phase_fraction: Option<&VolScalarField>, dt: f64, eqn: &mut FvVectorMatrix, )
Add every applicable model’s contribution to a vector equation.
As add_source_scalar, for a momentum
equation. phase_fraction is the optional solidifying-phase fraction
[-] used by SolidificationPorosity models built with
with_phase_fraction;
pass None when no model needs one, which is upstream’s default
alpha none.