Jet#
- class fridom.shallowwater.initial_conditions.jet.Jet(mset: ModelSettings, wavenum: int = 2, waveamp: float = 0.1, pos: float = 0.5, width: float = 0.1, geo_proj: bool = True)[source]#
Bases:
StateTwo opposing instable jets.
Description#
An instable jet setup with a small pressure perturbation on top of it. The jet is given by:
\[u = \exp\left(-\left(\frac{y - p L_y}{\sigma L_y}\right)^2\right)\]where \(L_y\) is the domain length in the y-direction, \(p\) is the relative position of the jet and \(\sigma\) is the relative width of the jet. The perturbation is given by:
\[p = A \sin \left( \frac{2 \pi}{L_x} k_p x \right)\]where \(A\) is the amplitude of the perturbation and \(k_p\) is the wavenumber of the perturbation. When geo_proj is set to True, the initial condition is projected to the geostrophic subspace using the geostrophic eigenvectors.
Parameters#
- msetModelSettings
The model settings.
- wavenumint
The relative wavenumber of the perturbation.
- waveampfloat
The amplitude of the perturbation.
- posfloat
The relative position of the jet in the y-direction
- widthfloat
The relative width of the jet.
- geo_projbool
Whether to project the initial condition to the geostrophic subspace.
- __init__(mset: ModelSettings, wavenum: int = 2, waveamp: float = 0.1, pos: float = 0.5, width: float = 0.1, geo_proj: bool = True)[source]#
Methods
__init__(mset[, wavenum, waveamp, pos, ...])abs()Map the field by taking the absolute value (\(|f|\)).
apply_elementwise(vector_field, op)Apply an operation elementwise to the vector field.
apply_water_mask()Apply a water mask to the field.
conj()Compute the complex conjugate.
cumulative_integral(axis[, direction])Compute the cumulative integral along an axis.
diff(axis[, order])Compute the partial derivative along an axis.
div()Compute the divergence.
dot(other)Compute the dot product with another field.
extend(topo)Extend the field in the specified directions.
fft([padding])Perform a Fast Fourier Transform (FFT) on the field.
from_netcdf(mset, path)Create a field from a NetCDF file.
from_xarray(mset, ds)Create a field from an xarray object.
grad([axes])Compute the gradient.
has_nan()Check if the field contains NaN values.
ifft([padding])Perform an Inverse Fast Fourier Transform (IFFT) on the field.
integrate([axes])Global integral of the Field in specified axes.
laplacian([axes])Compute the Laplacian.
max([axes])Maximum value of the Field over the whole domain.
mean([axes])Global mean of the Field in specified axes.
min([axes])Minimum value of the Field over the whole domain.
norm_l2()Calculate the L2 norm of the field.
norm_of_diff(other)Norm of difference between two vector fields.
project(p_vec, q_vec)Project a Vector Field onto a (spectral) vector.
set_random([seed])Set the field to random values.
sum([axes])Sum of the Field over the whole domain in the specified axes.
sync()Synchronize the field across all MPI ranks and apply boundary conditions.
to_netcdf(path)Save the field to a NetCDF file.
Attributes
cflThe CFL number.
ekinVertically integrated kinetic energy.
epotVertically integrated kinetic energy.
etotThe total energy.
field_listThe list of scalar fields.
fieldsThe dictionary of scalar fields.
gridThe grid object.
infoDictionary with information about the field.
is_constantFlag indicating whether the field is constant.
is_spectralFlag indicating whether the field is in spectral space.
local_rossby_numberLocal Rossby number.
msetThe model settings.
pPressure \(p\).
pot_vortScaled potential vorticity field.
rel_vortRelative vorticity.
spectral_ekinSpectral kinetic energy density.
tracersThe tracer fields.
uVelocity in the x-direction.
vVelocity in the y-direction.
vector_dimThe vector dimension.
velocityVelocity vector.
xrThe xarray representation of the field.
xrsConvert a slice of the field to an xarray object.
Examples using
fridom.shallowwater.initial_conditions.Jet#