AdvectionBase#
- class fridom.framework.modules.advection.AdvectionBase[source]#
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.
Methods
__init__()advect_state(z, dz)Advect the state vector.
advection(velocity, quantity)Advect a quantity using the given velocity field.
disable()Disable the module.
enable()Enable the module.
is_enabled()Whether the module is enabled or not.
reset()Stop and start the module.
setup(mset[, setup_mode])Set the module up.
start()Start the module.
stop()Stop the module.
update(mz)Update the model state.
Attributes
The background state.
diff_moduleThe differentiation module to be used by this module.
Whether to disable advection by the state vector itself.
gridThe grid of the model settings.
infoReturn a dictionary with information about the time stepper.
interp_moduleThe interpolation module to be used by this module.
is_setupWhether the module is set up.
msetThe model settings.
required_haloThe required halo points for this module.
A scaling factor for the nonlinear terms (default: 1.0).
- name = 'Advection Base'#
- abstract advection(velocity: VectorField, quantity: ScalarField) ScalarField[source]#
Advect a quantity using the given velocity field.
- advect_state(z: VectorField, dz: VectorField) VectorField[source]#
Advect the state vector.
- update(mz: ModelState) ModelState[source]#
Update the model state.
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: bool#
Whether to disable advection by the state vector itself.
Advection by the background state is still enabled.
- property scaling: float#
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.
- property background: VectorField#
The background state.