FiniteDifferences#

class fridom.framework.grid.cartesian.finite_differences.FiniteDifferences[source]#

Bases: DiffModule

__init__() None[source]#

Methods

__init__()

diff(f, axis[, order])

Compute the partial derivative of a field along an axis.

disable()

Disable the module.

div(vec)

Compute the divergence of a vector field.

enable()

Enable the module.

grad(f[, axes])

Compute the gradient of a field.

is_enabled()

Whether the module is enabled or not.

laplacian(f[, axes])

Compute the Laplacian of a scalar field.

reset()

Stop and start the module.

setup(mset)

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 = 'Finite Differences'#
setup(mset: ModelSettingsBase) None[source]#

Set the module up.

Description#

This method is called by the ModelSettings.setup() and sets the ModelSettings as well as the differentiation and interpolation modules.

Parameters#

msetfr.ModelSettingsBase

The model settings object.

setup_modeLiteral[“default”, “forced”]

The setup mode. If the setup mode is “default” and the module is already setup, the method will return. If the setup mode is “forced”, the module will be setup again.

diff(f: ScalarField, axis: int, order: int = 1) ScalarField[source]#

Compute the partial derivative of a field along an axis.

\[\partial_i^n f\]

with axis \(i\) and order \(n\).

Parameters#

ffr.ScalarField

The field to differentiate.

axisint

The axis along which to differentiate.

orderint

The order of the derivative. Default is 1.

Returns#

fr.ScalarField

The derivative of the field along the specified axis.