Forcing Terms

Wavemakers, sponges and other terms that may be part of the forcing of the barotropic PV equation.

Base Class Operations

All predefined forcing terms inherit from rhs.RHS, which provides addition and multiplication operators to combine individual terms into a more complicated right hand side:

class barotropic.rhs.RHS

Bases: object

RHS forcing term base class that implements arithmetic operators.

Forcing terms should inherit from this class so they can be added and multiplied easily.

__add__(other)
__mul__(other)

Orographic Forcing

While an actual bottom orography is not part of the barotropic framework, (pseudo-)orographic forcing can be approximated. All orographic terms inherit from a common base class:

class barotropic.rhs.Orography(lon, lat, orography, scale_height=10000.0, wind=('act', 1.0), fcor_ref=None)

Bases: RHS

Pseudo-orographic forcing based on a given gridded orography.

Parameters:
  • lon (array) – Longitudes of orography grid.

  • lat (array) – Latitudes of orography grid.

  • orography (array) – Height of the orography in m on the lon-lat grid defined by lon and lat.

  • scale_height (number) – Scale height in m.

  • wind ((str, number)) –

    Wind used to evaluate the forcing. Options:

    • (“act”, factor): The actual 2D-wind is used, scaled by the given factor.

    • (“zon”, factor): The zonal-mean zonal wind is used, scaled by the given factor. The meridional wind component is set to 0.

    • (“sbr”, maxval): A constant solid body rotation wind profile is used with the given maximum wind speed at the equator. This can be useful to define a constant orography-based wavemaker for simple experiments.

  • fcor_ref (None | number) – If None, the actual coriolis parameter values are used to calculate the forcing, otherwise the given value (in 1/s) is used as a constant everywhere.

The forcing is calculated as -f/H * u·∇h where f is the coriolis parameter in 1/s, H the scale height, u the horizontal wind and h is the height of the orography.

This is class only supports time-invariant fields of orography. The height field must be given on a lon-lat grid. The orography is linearly interpolated to the required grid when the forcing is evaluated by the model. lons and orography should be prepared such that the 0° column exists at both 0° and 360° to ensure that the interpolation does not yield NaN-values at the periodic boundary.

Other orographic forcing terms can inherit from this class and should only have to implement the orography method.

orography(grid)

Interpolated orography.

Parameters:

grid (Grid) – Interpolation target grid.

Returns:

Orography in m.

Pre-defined orographic features:

class barotropic.rhs.GaussianMountain(height=1500, center=(30.0, 45.0), stdev=(7.5, 20.0), **orog_kwargs)

Bases: Orography

Gaussian-shaped pseudo-orography.

Parameters:
  • height (number) – Height of the mountain in m.

  • center ((number, number)) – Center (λ,φ) of the mountain in degrees.

  • stdev (number | (number, number)) – Standard deviation in degrees, either as single value for both directions, or a tuple of values for different mountain widths in lon and lat.

  • orog_kwargs – Arguments given to the Orography base class constructor.

orography(grid)

Interpolated orography.

Parameters:

grid (Grid) – Interpolation target grid.

Returns:

Orography in m.

class barotropic.rhs.ZonalSineMountains(height=1500, center_lat=45.0, stdev_lat=10.0, wavenumber=4, **orog_kwargs)

Bases: Orography

Sinusoidal pseudo-orography in the zonal direction.

Parameters:
  • height (number) – Peak height of the mountains in m.

  • center_lat (number) – Central latitude of the mountain chain.

  • stdev_lat (number) – Standard deviation governing the meridional extent of the mountains in m.

  • wavenumber (int) – Number of crest-valley-pairs in the zonal direction.

  • orog_kwargs – Arguments given to the Orography base class constructor.

orography(grid)

Interpolated orography.

Parameters:

grid (Grid) – Interpolation target grid.

Returns:

Orography in m.

Relaxation

class barotropic.rhs.LinearRelaxation(rate, reference_pv, mask=None)

Bases: RHS

Linear relaxation towards a reference PV state.

Parameters:
  • rate (number) – Relaxation rate in 1/s.

  • reference_pv (array) – PV field that is relaxed toward.

  • mask (array) – Does nothing at the moment.

Implements rate * (reference_pv - pv).

Other

class barotropic.rhs.TimedOffSwitch(tend)

Bases: RHS

Turn off another forcing term after a specified amount of time.

Parameters:

tend (number | datetime) – Return 1 until this switch-off time is reached after which return 0 forever.

Returns:

Term for multiplication with other RHS terms.