closure

Abstractions for defining closures.

A closure is a a set of physical equations which determines the sub-mesh turbulence of the water column at a specific time. The purpose of Tunax is to calibrate the parameters of these equations. This module contains the abstract classes required to define a closure, which is done in the folder closures/. These classes can be obtained by the prefix tunax.closure. or directly by tunax..

class ClosureParametersAbstract[source]

Abstraction for the parameters of a closure.

To define a closure, a class that inherits from this one must be created. This parent class does not impose anything on the child one. The child class should be fill of the parameters involved in the closure which may be calibrated. The child class must be the only place where these parameters are defined for running a forward model : the instance of this class is given to the closure functions to recover the parameters and do the computation. For a run of a calibration, the description of the parameters to calibration is done from the child class. It can also includes parameters that are not dedicated to be calibrated such as physical or mathematical constants. The attributes of this class can be used to avoid the systematic computation of some values which are independent of the time (eg. k-epsilon with the method __post_init__).

class ClosureStateAbstract[source]

Abstraction for the water column state linked to the closure.

To define a closure, a class that inherits rom this one must be created. This parent class imposes a grid and three variables as attributes : these variables are used at each step of the forward model to compute the next step of tracers and momentum. The child class should be fill with other arrays and scalars that may evolve throught time and necessary for the computation of the closure at the next step. The child class is similary to the State class but for the diffusivity part. The __init__ method can be overwrited to fill the variables with initial values. The constructor takes a grid a set of the closure parameters to initialize the state.

Parameters:
grid

Geometry of the water column, should be the same than for the State instance used in the model.

Type:

Grid

akt

Eddy-diffusivity on the interfaces of the cells \(\left[\text m ^2 \cdot \text s ^{-1}\right]\).

Type:

float Array of shape (nz+1)

akv

Eddy-viscosity on the interfaces of the cells \(\left[\text m ^2 \cdot \text s ^{-1}\right]\).

Type:

float Array of shape (nz+1)

class Closure[source]

Implementation of a physical closure for computing eddy-diffusivity.

This class contains the three parts that defines a closure of a vertical physics. These parts will be used in the model to compute the eddy-diffusivity and eddy-viscosity at each time-step from the current water column State, the current water column state of the closure (child class of ClosureStateAbstract), the physical CaseTracable and the closure parameters (child class of ClosureParametersAbstract). The constructor takes all the attributes as parameters.

name

The name of the closure.

Type:

str

parameters_class

A child class of ClosureParametersAbstract that defines the constant parameters used in the computation done by the closure, it includes the parameters that may be calibrated.

Type:

Type[ClosureParametersAbstract]

state_class

A child class of ClosureStateAbstract that defines the state of the water column for the variables used by the closure computation.

Type:

Type[ClosureStateAbstract]

step_fun

Ths function is called at every step of the forward model to compute the eddy-diffusivity before resolving the equation of the tracers and of the momentum.

Parameters:
  • state (State) – Current state of the water column.

  • closure_state (CloStateT) – Current state of the water column for the variables used by the closure.

  • dt (float) – Time-step of the forward model \([\text s]\).

  • closure_params (CloParT) – Values of the parameters used by the closure (time-independant).

  • case_tracable (CaseTracable) – Physical parameters and forcings of the model run.

Returns:

closure_state – State of the water column for the variables used by the closure at the next time-step.

Return type:

CloStateT

Notes

CloStateT is the type reprensenting the instances of the child classes of ClosureStateAbstract and CloParT is the same for ClosureParametersAbstract.

Type:

Callable[[State, CloStateT, float, CloParT, CaseTracable], CloStateT]