![]() |
A Modular Arbitrary-Order Ocean-Atmosphere Model -- Stochastic implementation
|
(c) 2013-2018 Lesley De Cruz and Jonathan Demaeyer
See LICENSE.txt for license information.
This software is provided as supplementary material with:
for the MAOOAM original code, and with
for the stochastic part.
Please cite both articles if you use (a part of) this software for a publication.
The authors would appreciate it if you could also send a reprint of your paper to lesle, y.de cruz@ mete o.bejonat and han. demae yer@ meteo .besvn@m. eteo .be
Consult the MAOOAM code repository for updates, and our website for additional resources.
A pdf version of this manual is available here.
The program can be installed with Makefile. We provide configuration files for two compilers : gfortran and ifort.
By default, gfortran is selected. To select one or the other, simply modify the Makefile accordingly or pass the COMPILER flag to make
. If gfortran is selected, the code should be compiled with gfortran 4.7+ (allows for allocatable arrays in namelists). If ifort is selected, the code has been tested with the version 14.0.2 and we do not guarantee compatibility with older compiler version.
To install, unpack the archive in a folder or clone with git:
and run:
By default, the inner products of the basis functions, used to compute the coefficients of the ODEs, are not stored in memory. If you want to enable the storage in memory of these inner products, run make with the following flag:
Depending on the chosen resolution, storing the inner products may result in a huge memory usage and is not recommended unless you need them for a specific purpose.
Remark: The command "make clean" removes the compiled files.
The model tendencies are represented through a tensor called aotensor which includes all the coefficients. This tensor is computed once at the program initialization.
The following files are part of the MAOOAM model alone:
with the addition of the files:
which belong specifically to the stochastic implementation.
The user first has to fill the params.nml and int_params.nml namelist files according to their needs. Indeed, model and integration parameters can be specified respectively in the params.nml and int_params.nml namelist files. Some examples related to already published article are available in the params folder.
The modeselection.nml namelist can then be filled :
The Makefile allows to change the integrator being used for the time evolution. The user should modify it according to its need. By default a RK2 scheme is selected.
Finally, the IC.nml file specifying the initial condition should be defined. To obtain an example of this configuration file corresponding to the model you have previously defined, simply delete the current IC.nml file (if it exists) and run the program :
./maooam
It will generate a new one and start with the 0 initial condition. If you want another initial condition, stop the program, fill the newly generated file and restart :
./maooam
It will generate two files :
The tangent linear and adjoint models of MAOOAM are provided in the tl_ad_tensor, rk2_tl_ad_integrator and rk4_tl_ad_integrator modules. It is documented here.
The user first has to fill the MAOOAM model namelist files according to their needs (see the previous section). Additional namelist files for the fine tuning of the parameterization must then be filled, and some "definition" files (with the extension .def) must be provided. An example is provided with the code.
Full details over the parameterization options and definition files are available here.
The program "maooam_stoch" will generate the evolution of the full stochastic dynamics with the command:
./maooam_stoch
or any other dynamics if specified as an argument (see the header of maooam_stoch.f90). It will generate two files :
The program "maooam_MTV" will generate the evolution of the MTV parameterization evolution, with the command:
./maooam_MTV
It will generate three files :
The program "maooam_WL" will generate the evolution of the MTV parameterization evolution, with the command:
./maooam_WL
It will generate three files :
As the system of differential equations is at most bilinear in \(z_j\) ( \(j=1..n\)), \(\boldsymbol{z}\) being the array of variables, it can be expressed as a tensor contraction :
\[ \frac{d z_i}{dt} = \sum_{j,k=0}^{ndim} \, \mathcal{T}_{i,j,k} \, z_k \; z_j \]
with \(z_0 = 1\).
The tensor aotensor_def::aotensor is the tensor \(\mathcal{T}\) that encodes the differential equations is composed so that:
Ideally, the tensor aotensor_def::aotensor is composed as an upper triangular matrix (in the last two coordinates).
The tensor for this model is composed in the aotensor_def module and uses the inner products defined in the inprod_analytic module.
A stochastic version of MAOOAM and two stochastic parameterization methods (MTV and WL) are provided with this code.
The stochastic version of MAOOAM is given by
\[ \frac{d \boldsymbol{z}}{dt} = f(\boldsymbol{z})+ \boldsymbol{q} \cdot \boldsymbol{dW} (t)\]
where \(\boldsymbol{dW}\) is a vector of standard Gaussian White noise and where several choice for \(f(\boldsymbol{z})\) are available. For instance, the default choice is to use the full dynamics:
\[ f(\boldsymbol{z}) = \sum_{j,k=0}^{ndim} \, \mathcal{T}_{i,j,k} \, z_k \; z_j . \]
The implementation uses the tensorial framework described above and add some noise to it. This stochastic version is further detailed here.
The MTV parameterization for MAOOAM is given by
\[ \frac{d\boldsymbol{x}}{dt} = F_x(\boldsymbol{x}) + \frac{1}{\delta} R(\boldsymbol{x}) + G(\boldsymbol{x}) + \sqrt{2} \,\, \boldsymbol{\sigma}(\boldsymbol{x}) \cdot \boldsymbol{dW} \]
where \(\boldsymbol{x}\) is the set of resolved variables and \(\boldsymbol{dW}\) is a vector of standard Gaussian White noise. \(F_x\) is the set of tendencies of resolved system alone and \(\delta\) is the timescale separation parameter.
The WL parameterizations for MAOOAM is given by
\[\frac{d\boldsymbol{x}}{dt} = F_x(\boldsymbol{x}) + \varepsilon \, M_1(\boldsymbol{x}) + \varepsilon^2 \, M_2(\boldsymbol{x},t) + \varepsilon^2 \, M_3 (\boldsymbol{x},t)\]
where \(\varepsilon\) is the resolved-unresolved components coupling strenght and where the different terms \(M_i\) account for different effect.
The implementation for these two approaches uses the tensorial framework described above, with the addition of new tensors to account for the terms \(R,G,\sigma,M_1,M_2,M_3\). They are detailed more completely here.
The authors would like to thank Kris for help with the lua2fortran project. It has greatly reduced the amount of (error-prone) work.
No animals were harmed during the coding process.