space
Geometry and variables of the model.
This module contains the objects that are used in Tunax to describe the
geometry of the water column in Grid, the variables of the water
column at one time-step in State and the time-series of the model
computation in Trajectories. These classes can be obtained by the
prefix tunax.space. or directly by tunax..
- class Grid(zr, zw)[source]
One dimensional spatial geometry of a water column.
This mesh is made up of a number of
nzof cells (zr) of potentially varying thickness (hz), separated by interface points (zw) and extending from the ocean surface at a depth of \(0\) to the ocean floor at a depth ofhbot.Note
The constructor
__init__takes onlyzrandzwas as arguments and construct the other attributes from them. The centers of the cellszrare not necessarly the middle between the interfaceszw.- find_index(h)[source]
Find the index of a depth.
Find the index
iso that the depthhis in celli, which means \(z^w_i \leqslant -h \leqslant z^w_{i+1}\) if \(h \leqslant 0\) and \(i=-1\) if \(h>0\).
- classmethod linear(nz, hbot)[source]
Creates a grid with equal thickness cells.
The grid instance will have
nzcells of equal thickness for a depth ofhbot.
- classmethod analytic(nz, hbot, hc, theta=6.5)[source]
Creates a grid of type analytic.
The grid instance will have a depth of
hbotandnzcells of thickness almost equals abovehcand wider under, the strecht parameter being defined bytheta.
- class State(grid, u, v, t, s)[source]
Water column state at one time-step.
This state is defined on a
griddescribing the geometry, and is composed of the variables of the water column : the values of the momentum and the tracers on thisgrid. The call of the constructor build a state on thegridwith all the variables set to \(0\).- Parameters:
grid (Grid) – cf. attribute.
u (Float[Array, 'nz'])
v (Float[Array, 'nz'])
t (Float[Array, 'nz'])
s (Float[Array, 'nz'])
- u
Zonal velocity on the center of the cells \(\left[\text m \cdot \text s^{-1}\right]\).
- Type:
Float[Array, ‘nz’]
- v
Meridional velocity on the center of the cells \(\left[\text m \cdot \text s^{-1}\right]\).
- Type:
Float[Array, ‘nz’]
- classmethod zeros(grid)[source]
Initialize an instance with all variables equals to zero from a grid.
- init_u(hmxl=20.0, u_sfc=0.0)[source]
Initialize zonal velocity with a classical wind stratification.
Return a State object where
uis continuous and linear by part \(u(z) = \begin{cases} 0 & \text{if } z < h_{\text{mxl}}\\ u_{\text{sfc}} \left( 1 - \dfrac z {h_{\text{mxl}}}\right) & \text{else} \end{cases}\)
- init_v(hmxl=20.0, v_sfc=0.0)[source]
Initialize meridional velocity with a classical wind stratification.
Return a State object where
vis continuous and linear by part \(v(z) = \begin{cases} 0 & \text{if } z < h_{\text{mxl}}\\ v_{\text{sfc}} \left( 1 - \dfrac z {h_{\text{mxl}}}\right) & \text{else} \end{cases}\)
- init_t(hmxl=20.0, t_sfc=21.0, strat_t=0.051)[source]
Initialize temperature with a classical tracer stratification.
Return a State object where
tis linear by part and continous \(T(z) = \begin{cases} t_{\text{sfc}} + S_T(z-h_{\text{mxl}}) & \text{if } z < h_{\text{mxl}}\\ t_{\text{sfc}} & \text{else} \end{cases}\)- Parameters:
- Returns:
state – The
selfobject with the the new value of temperature.- Return type:
- init_s(hmxl=20.0, s_sfc=35.0, strat_s=0.013)[source]
Initialize salinity with a classical tracer stratification.
Return a State object where
sis linear by part and continous \(S(z) = \begin{cases} s_{\text{sfc}} + S_S(z-h_{\text{mxl}}) & \text{if } z < h_{\text{mxl}}\\ s_{\text{sfc}} & \text{else} \end{cases}\)- Parameters:
- Returns:
state – The
selfobject with the the new value of temperature.- Return type:
- class Trajectory(grid, time, t, s, u, v)[source]
Define the history of a simulation or an observation.
Contains the timeseries of the momentum and the tracers throught the space of the
gridand thetime.- Parameters:
- time
Time at each steps of observation from the begining of the simulation \([\text s]\).
- Type:
Float[Array, ‘nt’]
- u
Time-serie of zonal velocity \(\left[\text m \cdot \text s^{-1}\right]\).
- Type:
Float[Array, ‘nt nz’]
- v
Time-serie of meridional velocity \(\left[\text m \cdot \text s^{-1}\right]\).
- Type:
Float[Array, ‘nt nz’]