Skip to main content

FvModels

Struct FvModels 

Source
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

Source

pub fn new() -> Self

An empty collection — a solver with no optional sources.

Source

pub fn push(&mut self, model: FvModel)

Attach a model.

Source

pub fn models(&self) -> &[FvModel]

The attached models.

Source

pub fn models_mut(&mut self) -> &mut [FvModel]

Mutable access, needed because stateful models advance their internal state when applied.

Source

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

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for FvModels

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FvModels

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FvModels

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.