Jet#
- class fridom.nonhydro.initial_conditions.jet.Jet(mset: ModelSettings, jet_strength=1, jet_width=0.16, pert_strength=0.05, pert_wavenum=5, geo_proj=True)[source]#
Bases:
StateA 3D jet with horizontal and vertical shear.
Description#
Superposition of a zonal jet and a geostrophic perturbation. Following the setup of Chouksey et al. 2022. For very large jet_strengths, convective instabilities can occur.
Parameters#
- msetModelSettings
The model settings.
- jet_strengthfloat
The strength of the zonal jets.
- jet_widthfloat
The width of the zonal jets.
- pert_strengthfloat
The strength of the perturbation.
- pert_wavenumint
The wavenumber of the perturbation.
- geo_projbool
Whether to project the initial condition to the geostrophic subspace.
Examples#
import fridom.nonhydro as nh # Set up the model settings fac = 7 grid = nh.grid.cartesian.Grid( N=(2**fac, 2**fac, 2**(fac-3)), L=(4, 4, 1), periodic_bounds=(True, True, True)) mset = nh.ModelSettings(grid=grid, f0=1, N2=1.0, dsqr=0.2**2, Ro=0.1) mset.time_stepper.dt = 2**(-fac) * 2 mset.setup() # Create the initial conditions model = nh.Model(mset) model.z = nh.initial_conditions.Jet( mset, jet_strength=2, jet_width=0.16, pert_strength=0.1, pert_wavenum=2) model.run(runlen=50.0)
- __init__(mset: ModelSettings, jet_strength=1, jet_width=0.16, pert_strength=0.05, pert_wavenum=5, geo_proj=True)[source]#
Methods
__init__(mset[, jet_strength, jet_width, ...])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
bBuoyancy.
cflThe CFL number.
ekinThe kinetic energy.
epotThe potential 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.
linear_pot_vortLinearized potential vorticity.
local_rossby_numberLocal Rossby number.
msetThe model settings.
pot_vortScaled potential vorticity field.
rel_vortThe relative vorticity.
rel_vort_xX-component of the relative vorticity.
rel_vort_yY-component of the relative vorticity.
rel_vort_zZ-component of the relative vorticity (horizontal vorticity).
tracersThe tracer fields.
uVelocity in the x-direction.
vVelocity in the y-direction.
vector_dimThe vector dimension.
velocityThe velocity vector field.
wVelocity in the z-direction.
xrThe xarray representation of the field.
xrsConvert a slice of the field to an xarray object.