advection#
Module: fridom.nonhydro.modules.advection
Modules
Advection modules for 1D, 2D, and 3D fluid simulations.
- class fridom.nonhydro.modules.advection.AdvectionBase#
Bases:
ModuleBase class for advection schemes.
Description#
This class implements the base interface for 1D, 2D, and 3D advection schemes. For that, it is assumed that the velocity field is stored in the state vector as the components u, v, and w. Child classes must implement the advection method to calculate the advection term:
\[\mathcal{A}(\boldsymbol{v}, q) = -\boldsymbol{v} \cdot \nabla q\]where \(q\) is the quantity to be advected and \(\boldsymbol{v}\) is the velocity field, which is the sum of the velocity field in the state vector and the background velocity field, stored in the background attribute. This update routine of this module adds the advection term multiplied by the nonlinear scaling factor to the tendency term of all fields that are not flagged with NO_ADV:
\[\partial_t q \leftarrow \partial_t q + \rho \mathcal{A}(\boldsymbol{v}, q)\]where \(\rho\) is the nonlinear scaling factor.
- name = 'Advection Base'#
- abstract advection(velocity: tuple[FieldVariable], quantity: FieldVariable) FieldVariable#
Advect a quantity using the given velocity field.
- update(mz: ModelState) None#
Update the module
Description#
This method is called by the model at each time step. Child classes should overwrite this method to update the module. Make sure to decorate the method with the @module_method decorator.
Parameters#
- mzfr.ModelState
The model state at the current time step.
Returns#
- fr.ModelState
The updated model state.
- property disable_nonlinear#
Whether to disable advection by the state vector itself.
Advection by the background state is still enabled.
- property scaling#
A scaling factor for the nonlinear terms (default: 1.0)
Description#
Some modules require to scale the nonlinear terms, as for example the optimal balance projection (
fridom.framework.projection.OptimalBalance). This parameter provides an interface to set this scaling factor.
- log_level: fr.config.LogLevel | None#
- timer: fr.timing_module.TimingModule | None#
- class fridom.nonhydro.modules.advection.CenteredAdvection#
Bases:
AdvectionBaseCentered advection scheme.
Description#
For the centered advection scheme, we assume that the velocity field is divergence-free. The advection term can then be written as:
\[\mathcal{A}(\boldsymbol{v}, q) = -\boldsymbol{v} \cdot \nabla q = - \nabla \cdot (\boldsymbol{v} q)\]where \(q\) is the quantity to be advected and \(\boldsymbol{v}\) is the velocity field. The flux divergence \(\nabla \cdot (\boldsymbol{v} q)\) is calculated using forward or backward differences. For that the flux is interpolated to the cell faces of the quantity \(q\):
Position of the quantity q ↓ | x | x | x | ↑ Position of the flux Fx- name = 'Centered Advection'#
- advection(velocity: tuple[FieldVariable], quantity: FieldVariable) FieldVariable#
Advect a quantity using the given velocity field.
- log_level: fr.config.LogLevel | None#
- timer: fr.timing_module.TimingModule | None#