pygetm.vertical_coordinates module
- class pygetm.vertical_coordinates.Adaptive(nz: int, *, ddu: float = 0.0, ddl: float = 0.0, gamma_surf: bool = True, Dgamma: float = 0.0, csigma: float = 0.0, cgvc: float = 1.0, chsurf: float = 0.0, hsurf: float = 0.5, chmidd: float = 0.0, hmidd: float = -4.0, chbott: float = 0.0, hbott: float = -0.25, decay: float = 0.6666666666666666, hpow: int = 3, cneigh: float = 0.0, rneigh: float = 0.25, cNN: float = 0.0, drho: float = 0.3, cSS: float = 0.0, dvel: float = 0.1, chmin: float = 0.0, hmin: float = 0.3, nvfilter: int = 1, vfilter: float = 0.3, nhfilter: int = 1, hfilter: float = 0.4, timescale: float = 14400.0)[source]
Bases:
FromTGridAdaptive vertical coordinates based on Hofmeister et al. (2010) and their GETM implementation
Initial layer thicknesses are based on Generalized Vertical Coordinates (
GVC), parameterized by ddu, ddl, gamma_surf, and Dgamma. This is equivalent to uniform sigma coordinates when both ddu and ddl, are zero, and to zoomed sigma coordinates when Dgamma is zero.- Parameters:
nz – number of layers
ddu – zoom factor at surface (0: no zooming, 2: strong zooming)
ddl – zoom factor at bottom (0: no zooming, 2: strong zooming)
gamma_surf – use layers of constant thickness Dgamma/nz at surface (otherwise, at bottom)
Dgamma – water depth below which to use equal layer thicknesses
csigma – tendency towards equal layer thicknesses (uniform sigma) DEPRECATED: for (zoomed) sigma background, use cgvc>0.0 with Dgamma=0 instead
cgvc – tendency towards Generalized Vertical Coordinates (
GVC), as parameterized by ddu, ddl, gamma_surf, Dgamma. LEAVE AT 1, so that all other tendencies are relative to this background, and tune timescale to adjust the rate of convergencechsurf – tendency to zoom in (prefer thinner layers) towards the surface
hsurf – reference thickness for surface layer (absolute thickness in m if >0, relative to average thickness D/nz if <0)
chmidd – tendency to keep all layers bounded
hmidd – reference thickness for other layers (absolute thickness in m if >0, relative to average thickness D/nz if <0)
chbott – tendency to zoom in (prefer thinner layers) towards the bottom
hbott – reference thickness for bottom layer (absolute thickness in m if >0, relative to average thickness D/nz if <0)
decay – fraction of surface/bottom zooming tendencies (controlled by chsurf, chbott) to preserve for each additional layer away from surface/bottom. It must range between 0 (only apply tendency in targeted layer) and 1 (apply same tendency in all layers)
hpow – exponent for ramp of tendencies focused on reference thicknesses, that is, the tendencies controlled by chsurf, chbott, chmidd.
cneigh – tendency to keep neighbors of similar size
rneigh – relative difference with the thinnest neighbor where size-ratio-limiting tendency reaches its maximum value cneigh
cNN – tendency to zoom in on stable density gradients
drho – local density difference over distance D/nz (average layer thickness) where to stop zooming in further on stable density gradients. There the tendency reaches its maximum value of cNN
cSS – tendency to zoom in on horizontal velocity gradients (shear)
dvel – local difference in horizontal velocity over distance D/nz (average layer thickness) where to stop zooming in further on velocity gradients. There the tendency reaches its maximum value of cSS
chmin – tendency towards equal layer thicknesses in shallow-water regions, maximized when average layer thickness D/nz drops below 2/3 hmin, and reduced to zero when average layer thickness exceeds hmin
hmin – minimum layer thickness (m)
nvfilter – number of vertical filter iterations
vfilter – strength of vertical filter-of-Dgrid [0:~0.5]
nhfilter – number of horizontal filter iterations
hfilter – strength of horizontal filter-of-Dgrid [0:~0.5]
timescale – time scale of grid adaptation (s)
- class pygetm.vertical_coordinates.Base(nz: int)[source]
Bases:
objectBase class. It is responsible for updating layer thicknesses
hnfor all grids provided to initialize
- class pygetm.vertical_coordinates.GVC(nz: int, *, ddl: float = 0.0, ddu: float = 0.0, gamma_surf: bool = True, Dgamma: float = 0.0)[source]
Bases:
PerGridGeneralized Vertical Coordinates
This blends equidistant and surface/bottom-zoomed coordinates as described in Burchard & Petersen (1997). It is designed to keep the thickness of either the surface or bottom layer at a constant value, except in shallow water where all layers are assigned equal thickness.
- Parameters:
nz – number of layers
ddl – zoom factor at bottom (0: no zooming, 2: strong zooming)
ddu – zoom factor at surface (0: no zooming, 2: strong zooming)
gamma_surf – use layers of constant thickness
Dgamma/nzat surface (otherwise, at bottom)Dgamma – water depth below which to use equal layer thicknesses
- class pygetm.vertical_coordinates.PerGrid(nz: int)[source]
Bases:
BaseBase class for vertical coordinate types that apply the same operation to every grid.
- __call__(D: ndarray, out: ndarray | None = None, where: bool | ArrayLike = True)[source]
Calculate layer thicknesses
- Parameters:
D – water depths (m)
out – array to hold layer thicknesses. It must have shape
(nz,) + D.shapewhere – locations where to compute thicknesses (typically: water points). It must be broadcastable to the shape of
D
- class pygetm.vertical_coordinates.Sigma(nz: int, *, ddl: float = 0.0, ddu: float = 0.0)[source]
Bases:
PerGridSigma coordinates with optional zooming towards bottom and surface
- Parameters:
nz – number of layers
ddl – zoom factor at bottom (0: no zooming, 2: strong zooming)
ddu – zoom factor at surface (0: no zooming, 2: strong zooming)
- pygetm.vertical_coordinates.calculate_sigma(nz: int, ddl: float = 0.0, ddu: float = 0.0) ndarray[source]
Return sigma thicknesses (fraction of column depth) of all layers, using a formulation that allows zooming towards the surface and bottom.
- Parameters:
nz – number of layers
ddl – zoom factor at bottom (0: no zooming, 2: strong zooming)
ddu – zoom factor at surface (0: no zooming, 2: strong zooming)