FluxDivergenceBase#

class fridom.nonhydro.modules.advection.flux_divergence_base.FluxDivergenceBase[source]#

Bases: AdvectionBase

Base class for flux divergence advection schemes.

Description#

Assuming that the velocity field is divergence-free, then we can write the advection of the momentum flux tensor as:

\[(\mathbf{u} \cdot \nabla) \mathbf{u} = \nabla \cdot \mathbf{F}\]

where \(\mathbf{F}\) is the momentum flux tensor:

\[\begin{split}\mathbf{F} = \mathbf{u}^T \mathbf{u} = \begin{bmatrix} u^2 & uv & uw \\ uv & v^2 & vw \\ uw & vw & w^2 \end{bmatrix}\end{split}\]

Child classes must implement the compute_momentum_flux_tensor method.

__init__() None#

Methods

__init__()

advect_state(z, dz)

Advect the state vector.

advection(velocity, quantity)

Advect a quantity using the given velocity field.

compute_momentum_flux_tensor(velocity)

Compute the momentum flux tensor.

compute_tracer_advection(velocity, field)

Compute the advection of a tracer 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

background

The background state.

diff_module

The differentiation module to be used by this module.

disable_nonlinear

Whether to disable advection by the state vector itself.

grid

The grid of the model settings.

info

Return a dictionary with information about the time stepper.

interp_module

The interpolation module to be used by this module.

is_setup

Whether the module is set up.

mset

The model settings.

name

required_halo

The required halo points for this module.

scaling

A scaling factor for the nonlinear terms (default: 1.0).

abstract compute_momentum_flux_tensor(velocity: VectorField) tuple[VectorField][source]#

Compute the momentum flux tensor.

Parameters#

velocitynh.VectorField

Velocity field (u, v, w).

Returns#

tuple[nh.VectorField]

Momentum flux tensor (vel*u, vel*v, vel*w).

abstract compute_tracer_advection(velocity: VectorField, field: ScalarField) ScalarField[source]#

Compute the advection of a tracer field.

Parameters#

velocitynh.VectorField

Velocity field (u, v, w).

fieldnh.ScalarField

Tracer field to be advected.

Returns#

nh.ScalarField

Advection term for the tracer field.

advect_state(z: State, dz: State) State[source]#

Advect the state vector.