Upwind#

class fridom.framework.modules.flux_functions.upwind.Upwind[source]#

Bases: FluxFunctionBase

Upwind flux function.

Description#

Let’s assume we have a flux from which we want to compute the divergence

\[\partial_x F \quad \text{where } F = u q\]

with the advection velocity \(u\) and the advected quantity \(q\). Let’s assume we have two estimations of the flux \(F_L\) and \(F_R\) where \(F_L\) is a flux which is biased to the left (e.g. for its computation was more influenced by values on the left side of the cell) and \(F_R\) is a flux which is biased to the right. The upwind flux is computed by selecting the flux based on the sign of the velocity \(u\):

\[\begin{split}F = \begin{cases} F_L & \text{if } u \ge 0 \\ F_R & \text{if } u < 0 \end{cases}\end{split}\]
__init__() None#

Methods

__init__()

compute(flux_left, flux_right, velocity)

Compute the flux function.

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

diff_module

The differentiation module to be used by this module.

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.

name = 'Upwind'#
compute(flux_left: ScalarField, flux_right: ScalarField, velocity: ScalarField) ScalarField[source]#

Compute the flux function.

Parameters#

flux_leftfr.ScalarField

The flux field which is biased to the left.

flux_rightfr.ScalarField

The flux field which is biased to the right.

velocityfr.ScalarField

The velocity field.

Returns#

fr.ScalarField

The computed flux function.