GaussianWaveMaker#
- class fridom.nonhydro.modules.forcings.gaussian_wave_maker.GaussianWaveMaker(position: tuple[float | None], width: tuple[float | None], frequency: float, amplitude: float, variable: str = 'u')[source]#
Bases:
ModuleA Gaussian wave maker that forces the u-component of the velocity field.
Description#
Creates a gaussian source term of the form:
\[M(\boldsymbol{x}) = \prod_{i=1}^{3} \exp\left(-\frac{(x_i - p_i)^2}{w_i^2}\right)\]\[S(\boldsymbol{x}, t) = A \sin(2\pi f t) M(\boldsymbol{x})\]where \(A\) is the amplitude, \(x_i\) is the x coordinate, \(p_i\) is the position, \(w_i\) is the width and \(f\) is the frequency of the wave maker. The source term is added to the u-component of the velocity field:
\[\partial_t u \leftarrow \partial_t u + S(\boldsymbol{x}, t)\]Parameters#
- positiontuple[float | None]
The position of the wave maker (center of the gaussian). The wave maker is constant over axis with position[axis]=None.
- widthtuple[float | None]
The width of the wave maker (width of the gaussian). The wave maker is constant over axis with width[axis]=None.
- frequencyfloat
The frequency of the wave maker.
- amplitudefloat
The amplitude of the wave maker.
- variablestr
The variable to force. (Default: “u”)
- __init__(position: tuple[float | None], width: tuple[float | None], frequency: float, amplitude: float, variable: str = 'u') None[source]#
Methods
__init__(position, width, frequency, amplitude)add_source_term(dz, time)Add the source term to the u-component of the velocity 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
diff_moduleThe differentiation module to be used by this module.
gridThe grid of the model settings.
Return 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.
Examples using
fridom.nonhydro.modules.forcings.GaussianWaveMaker#- name = 'Gaussian Wave Maker'#
- add_source_term(dz: State, time: float) State[source]#
Add the source term to the u-component of the velocity field.
- update(mz: ModelState) ModelState[source]#
Update the model state.
Description#
This method is called by the model at each time step. Child classes should overwrite this method to update the module. Make sure to decorate the method with the @module_method decorator.
Parameters#
- mzfr.ModelState
The model state at the current time step.
Returns#
- fr.ModelState
The updated model state.