SpectralDiff#
- class fridom.framework.grid.cartesian.spectral_diff.SpectralDiff[source]#
Bases:
DiffModuleDifferentiation 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()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_moduleThe differentiation module to be used by this module.
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.
is_setupWhether the module is set up.
msetThe model settings.
required_haloThe required halo points for this module.
- name = 'Spectral Difference'#
- 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.