AdvectionBase#
- class fridom.framework.modules.advection.advection_base.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)advection(velocity, quantity)Advect a quantity using the given velocity field.
disable()Enabling the module means that it will be executed at each time step.
enable()Enabling the module means that it will be executed at each time step.
is_enabled()Return whether the module is enabled or not.
reset()Stop and start the module.
setup(mset)Start the module
start()Start the module
stop()Stop the module
update(mz)Update the module
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.
msetThe model settings
required_haloA scaling factor for the nonlinear terms (default: 1.0)
- name = 'Advection Base'#
- abstract advection(velocity: tuple[FieldVariable], quantity: FieldVariable) FieldVariable[source]#
Advect a quantity using the given velocity field.
- update(mz: ModelState) None[source]#
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.