SpectralDiff#

class fridom.framework.grid.cartesian.spectral_diff.SpectralDiff[source]#

Bases: DiffModule

Differentiation module in spectral space.

Description#

In spectral space, the differentiation of a field is equivalent to a multiplication by the wavenumber and the imaginary unit:

\[u = U e^{ikx} \Rightarrow \partial_x u = ik u\]
__init__() None#

Methods

__init__()

diff(f, axis[, order])

Compute the partial derivative of a field along an axis.

disable()

Enabling the module means that it will be executed at each time step.

div(vec)

Compute the divergence of a vector field.

enable()

Enabling the module means that it will be executed at each time step.

grad(f[, axes])

Compute the gradient of a field.

is_enabled()

Return 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)

Start the module

start()

Start the module

stop()

Stop the module

update(mz)

Update the module

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.

mset

The model settings

name

required_halo

name = 'Spectral Difference'#
setup(mset: ModelSettingsBase) None[source]#

Start the module

Description#

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

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

Compute the partial derivative of a field along an axis.

\[\partial_i^n f\]

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

Parameters#

ffr.FieldVariable

The field to differentiate.

axisint

The axis along which to differentiate.

orderint

The order of the derivative. Default is 1.

Returns#

fr.FieldVariable

The derivative of the field along the specified axis.