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
Stateclass 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:
closure_parameters (ClosureParametersAbstract) – A set of parameters of the closure used to initialize the state.
- grid
Geometry of the water column, should be the same than for the
Stateinstance used in the model.- Type:
- 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 ofClosureStateAbstract), the physicalCaseTracableand the closure parameters (child class ofClosureParametersAbstract). The constructor takes all the attributes as parameters.- parameters_class
A child class of
ClosureParametersAbstractthat defines the constant parameters used in the computation done by the closure, it includes the parameters that may be calibrated.- Type:
- state_class
A child class of
ClosureStateAbstractthat 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
CloStateTis the type reprensenting the instances of the child classes ofClosureStateAbstractandCloParTis the same forClosureParametersAbstract.- Type:
Callable[[State, CloStateT, float, CloParT, CaseTracable], CloStateT]