pygetm.operators module

class pygetm.operators.Advection(grid: Grid, scheme: AdvectionScheme = AdvectionScheme.SUPERBEE, split_2d: AdvectionSplit = AdvectionSplit.HALF)[source]

Bases: Advection

apply_3d(u: Array, v: Array, w: Array, timestep: float, var: Array, Ah_u: Array | None = None, Ah_v: Array | None = None, new_h: bool = False, skip_initial_halo_exchange: bool = False, w_var: Array | None = None)[source]
apply_3d_batch(u: Array, v: Array, w: Array, timestep: float, vars: Iterable[Array], Ah_u: Array | None = None, Ah_v: Array | None = None, new_h: bool = False, skip_initial_halo_exchange: bool = False, get_w: Callable[[Array], Array] | None = None)[source]
halo1
halo2
split_2d
property ufirst: bool
class pygetm.operators.AdvectionScheme(*values)[source]

Bases: IntEnum

DEFAULT = 5
HSIMT = 1

Wu & Zhu (2010)

MUSCL = 2
P2_PDM = 3
SPLMAX13 = 4
SUPERBEE = 5
UPSTREAM = 6
class pygetm.operators.AdvectionSplit(*values)[source]

Bases: Enum

FULL = 1

u-v in 2D, u-v-w in 3D

Type:

full splitting (first order in time)

HALF = 2

u/2-v-u/2 in 2D, u/2-v/2-w-v/2-u/2 in 3D

Type:

Strang splitting (second order in time)

HALF_ALWAYS = 3

u/2-v/2-v/2-u/2 in 2D, u/2-v/2-w-v/2-u/2 in 3D

Type:

Strang splitting (second order in time)

class pygetm.operators.VerticalAdvection(grid: Grid, scheme: AdvectionScheme = AdvectionScheme.SUPERBEE)[source]

Bases: VerticalAdvection

__call__(w: Array, w_var: Array, timestep: float, var: Array, new_h: bool = False)[source]

Perform vertical advection on the given variable. This method updates the vertical distribution of the variable based on the vertical velocity of the water and the variable itself.

Parameters:
  • w – Vertical velocity of the water at layer interfaces (m s-1)

  • w_var – Vertical velocity of the variable at interfaces (m s-1). This is the sum of the vertical velocity of the water and of the variable moving through the water (e.g. floating or sinking)

  • timestep – Time step (s)

  • var – Variable to be advected

  • new_h – Whether to start from the grid’s new layer thicknesses (hn) or the old ones (ho, default)

class pygetm.operators.VerticalDiffusion[source]

Bases: VerticalDiffusion