Skip to content

Commit

Permalink
Update to MAOOAM v1.3:
Browse files Browse the repository at this point in the history
Changelog with respect to v1.2
------------------------------

Fortran code:

* Redesign of the aotensor initialization procedure to enable optional storage
of the inner products.
* Inner products are *not* stored by default to avoid excessive memory use.
* Fix Makefile for gfortran > 5.4.0.
* Fix bug where linear/constant terms were not treated correctly in 'read' initial conditions mode.

Lua and Fortran code:

* Add a scale-dependent dissipation process and its associated parameters (nuo and nua) which are zero by default.
  • Loading branch information
jodemaey committed Feb 19, 2018
1 parent 6a6e4b5 commit ee7af22
Show file tree
Hide file tree
Showing 190 changed files with 16,179 additions and 15,954 deletions.
20 changes: 11 additions & 9 deletions fortran/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ else
INTEGRATOR = rk2_integrator
TL_AD_INTEGRATOR = rk2_tl_ad_integrator
endif


ifdef RES
ST=_$(RES)
$(warning Code will $(RES) the inner products in arrays! It may induce a huge memory usage!)
endif
# Define relevant compiler options for debug case and normal case for each compiler
# Normal Case:
IFORT_COMPILER_FLAGS = -assume byterecl -O2
Expand Down Expand Up @@ -68,7 +70,7 @@ endif
PROGRAMS = maooam test_tl_ad
MODULES = util.mod params.mod inprod_analytic.mod aotensor_def.mod ic_def.mod $(INTEGRATOR).mod stat.mod tensor.mod tl_ad_tensor.mod $(TL_AD_INTEGRATOR).mod $(IFPORT)
MODULES = util.mod params.mod inprod_analytic$(ST).mod aotensor_def.mod ic_def.mod $(INTEGRATOR).mod stat.mod tensor.mod tl_ad_tensor.mod $(TL_AD_INTEGRATOR).mod $(IFPORT)
MODULE_OBJECTS = $(MODULES:.mod=.o)
TEST_PROGRAMS = test_inprod_analytic test_aotensor
Expand All @@ -92,17 +94,17 @@ test_aotensor.test: test_aotensor
./$< |sort > tests/$<.out
diff tests/$<.out tests/$<.ref && echo PASS: $@ || echo FAIL: $@
%.mod: %.f90
$(COMPILER) $(LD_FLAGS) $(COMPILER_FLAGS) -c $<
%.mod: %.f90
$(COMPILER) $(COMPILER_FLAGS) -c $< $(LD_FLAGS)
%.o: %.f90 $(MODULES)
$(COMPILER) $(LD_FLAGS) $(COMPILER_FLAGS) -c $<
$(COMPILER) $(COMPILER_FLAGS) -c $< $(LD_FLAGS)
%: %.o $(MODULE_OBJECTS)
$(COMPILER) $(LD_FLAGS) $(COMPILER_FLAGS) $^ -o $@
$(COMPILER) $(COMPILER_FLAGS) $^ -o $@ $(LD_FLAGS)
inprod_analytic.mod: params.mod
aotensor_def.mod: tensor.mod inprod_analytic.mod
inprod_analytic$(ST).mod: params.mod util.mod
aotensor_def.mod: tensor.mod inprod_analytic$(ST).mod
$(INTEGRATOR).mod: aotensor_def.mod
ic_def.mod: util.mod aotensor_def.mod
stat.mod: params.mod
Expand Down
47 changes: 35 additions & 12 deletions fortran/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,40 @@ resources.

## Installation ##

The program can be installed with Makefile. We provide configuration files for
The program can be installed with Makefile. We provide configuration options for
two compilers : gfortran and ifort.

By default, gfortran is selected. To select one or the other, simply modify the
Makefile accordingly. 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.
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:

```bash
git clone https://github.com/Climdyn/MAOOAM.git
cd MAOOAM
```
and run:

```bash
make
```
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:

```bash
make RES=store
```

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.

To install, unpack the archive in a folder, and run:
make

Remark: The command "make clean" removes the compiled files.

For Windows users, a minimalistic GNU development environment
Expand All @@ -59,8 +81,6 @@ initialization.
* rk2_integrator.f90 : A module which contains the Heun integrator for the model equations.
* rk4_integrator.f90 : A module which contains the RK4 integrator for the model equations.
* Makefile : The Makefile.
* gfortran.mk : Gfortran compiler options file.
* ifort.mk : Ifort compiler options file.
* params.f90 : The model parameters module.
* tl_ad_tensor.f90 : Tangent Linear (TL) and Adjoint (AD) model tensors definition module
* rk2_tl_ad_integrator.f90 : Heun Tangent Linear (TL) and Adjoint (AD) model integrators module
Expand Down Expand Up @@ -97,6 +117,9 @@ The modeselection.nml namelist can then be filled :
* Note that the variables of the model are numbered according to the chosen
order of the blocks.

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
Expand All @@ -116,7 +139,7 @@ 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](./doc/html/md_tl_ad_doc.html).
documented [here](./doc/html/md_doc_tl_ad_doc.html).


------------------------------------------------------------------------
Expand Down
9 changes: 4 additions & 5 deletions fortran/aotensor_def.f90
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ END SUBROUTINE func
CALL func(theta(1),0,0,(Cpa / (1 - atmos%a(1,1) * sig0)))
DO i = 1, natm
DO j = 1, natm
CALL func(psi(i),psi(j),0,-(((atmos%c(i,j) * betp) / atmos%a(i,i))) - (kd * kdelta(i,j)) / 2)
CALL func(psi(i),psi(j),0,-(((atmos%c(i,j) * betp) / atmos%a(i,i))) -&
&(kd * kdelta(i,j)) / 2 + atmos%a(i,j)*nuap)
CALL func(theta(i),psi(j),0,(atmos%a(i,j) * kd * sig0) / (-2 + 2 * atmos%a(i,i) * sig0))
CALL func(psi(i),theta(j),0,(kd * kdelta(i,j)) / 2)
CALL func(theta(i),theta(j),0,(-((sig0 * (2. * atmos%c(i,j) * betp +&
Expand All @@ -167,8 +168,8 @@ END SUBROUTINE func
CALL func(A(i),theta(j),0,-(ocean%K(i,j)) * dp / (ocean%M(i,i) + G))
END DO
DO j = 1, noc
CALL func(A(i),A(j),0,-((ocean%N(i,j) * betp + ocean%M(i&
&,i) * (rp + dp) * kdelta(i,j))) / (ocean%M(i,i) + G))
CALL func(A(i),A(j),0,-((ocean%N(i,j) * betp + ocean%M(i,i) * (rp + dp) * kdelta(i,j)&
& - ocean%M(i,j)**2*nuop)) / (ocean%M(i,i) + G))
DO k = 1, noc
CALL func(A(i),A(j),A(k),-(ocean%C(i,j,k)) / (ocean%M(i,i) + G))
END DO
Expand Down Expand Up @@ -224,8 +225,6 @@ SUBROUTINE init_aotensor

CALL simplify(aotensor)

CALL deallocate_inprod ! Clean the inner product tensors

END SUBROUTINE init_aotensor
END MODULE aotensor_def

Expand Down
43 changes: 33 additions & 10 deletions fortran/doc/gen_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,35 @@ 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. 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, and run:
make
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:

```bash
git clone https://github.com/Climdyn/MAOOAM.git
cd MAOOAM
```
and run:

```bash
make
```
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:

```bash
make RES=store
```

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.

Expand All @@ -61,8 +83,6 @@ initialization.
* rk2_integrator.f90 : A module which contains the Heun integrator for the model equations.
* rk4_integrator.f90 : A module which contains the RK4 integrator for the model equations.
* Makefile : The Makefile.
* gfortran.mk : Gfortran compiler options file.
* ifort.mk : Ifort compiler options file.
* params.f90 : The model parameters module.
* tl_ad_tensor.f90 : Tangent Linear (TL) and Adjoint (AD) model tensors definition module
* rk2_tl_ad_integrator.f90 : Heun Tangent Linear (TL) and Adjoint (AD) model integrators module
Expand Down Expand Up @@ -98,6 +118,9 @@ The modeselection.nml namelist can then be filled :
* Note that the variables of the model are numbered according to the chosen
order of the blocks.

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
Expand All @@ -117,7 +140,7 @@ 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](./md_tl_ad_doc.html).
documented [here](./md_doc_tl_ad_doc.html).


------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion fortran/doc/html/LICENSE_8txt.html
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ <h2 class="groupheader">Variable Documentation</h2>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Jan 5 2017 15:58:39 by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Mon Feb 19 2018 16:12:31 by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion fortran/doc/html/annotated.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Jan 5 2017 15:58:41 by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Mon Feb 19 2018 16:12:32 by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion fortran/doc/html/aotensor__def_8f90.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Jan 5 2017 15:58:39 by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Mon Feb 19 2018 16:12:31 by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
Expand Down
25 changes: 13 additions & 12 deletions fortran/doc/html/aotensor__def_8f90_source.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion fortran/doc/html/classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Jan 5 2017 15:58:41 by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Mon Feb 19 2018 16:12:32 by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
Expand Down
2 changes: 1 addition & 1 deletion fortran/doc/html/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Jan 5 2017 15:58:42 by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Mon Feb 19 2018 16:12:32 by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
Expand Down
26 changes: 13 additions & 13 deletions fortran/doc/html/functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,23 @@
<div class="contents">
<div class="textblock">Here is a list of all data types members with links to the data types they belong to:</div><ul>
<li>a
: <a class="el" href="structinprod__analytic_1_1atm__tensors.html#af50962da7a48c98d8b118dee9cc16dcd">inprod_analytic::atm_tensors</a>
: <a class="el" href="structinprod__analytic_1_1atm__tensors.html#abb8c2b843f31f85eadf4c183b9bbfc35">inprod_analytic::atm_tensors</a>
</li>
<li>b
: <a class="el" href="structinprod__analytic_1_1atm__tensors.html#aa6b446e5bd3e7ea7278f1c1cad7f46cf">inprod_analytic::atm_tensors</a>
: <a class="el" href="structinprod__analytic_1_1atm__tensors.html#a427a3462d211c39009bb85e0cfe4a59b">inprod_analytic::atm_tensors</a>
</li>
<li>c
: <a class="el" href="structinprod__analytic_1_1atm__tensors.html#a6f560bb68ce7081409034cb755e7a164">inprod_analytic::atm_tensors</a>
, <a class="el" href="structinprod__analytic_1_1ocean__tensors.html#a146670849488f50eff7b1937077a67ff">inprod_analytic::ocean_tensors</a>
: <a class="el" href="structinprod__analytic_1_1atm__tensors.html#a1fcb71de592cf7d87e8c7e13e445832c">inprod_analytic::atm_tensors</a>
, <a class="el" href="structinprod__analytic_1_1ocean__tensors.html#a0601d4c16c2f7d9e8789619ac9e25311">inprod_analytic::ocean_tensors</a>
</li>
<li>d
: <a class="el" href="structinprod__analytic_1_1atm__tensors.html#a00e06ac193f03e4dcd337439cc489f78">inprod_analytic::atm_tensors</a>
: <a class="el" href="structinprod__analytic_1_1atm__tensors.html#a0641c2984e3cf9eff629771519162b05">inprod_analytic::atm_tensors</a>
</li>
<li>elems
: <a class="el" href="structtensor_1_1coolist.html#a49ece7bfa6e6e37b4223a1c63b5c7839">tensor::coolist</a>
</li>
<li>g
: <a class="el" href="structinprod__analytic_1_1atm__tensors.html#a9b4ecfbc139ac739d5ec82b087e421a5">inprod_analytic::atm_tensors</a>
: <a class="el" href="structinprod__analytic_1_1atm__tensors.html#a4543ab64bfdcdb2aac1f2d9b1af2ee36">inprod_analytic::atm_tensors</a>
</li>
<li>h
: <a class="el" href="structinprod__analytic_1_1atm__wavenum.html#aa7df1690e97e43365ca0c2b1222924b5">inprod_analytic::atm_wavenum</a>
Expand All @@ -122,15 +122,15 @@
: <a class="el" href="structtensor_1_1coolist__elem.html#a0ed51fd9ddc1c2168d8c138eb5da5f66">tensor::coolist_elem</a>
</li>
<li>k
: <a class="el" href="structinprod__analytic_1_1ocean__tensors.html#a1ab0d8f229b274e954a53cc1ce40cac1">inprod_analytic::ocean_tensors</a>
: <a class="el" href="structinprod__analytic_1_1ocean__tensors.html#a9715c83158697198ef484b0bc549bcc3">inprod_analytic::ocean_tensors</a>
, <a class="el" href="structtensor_1_1coolist__elem.html#a368c80ca537d7c5d6e1fbba8a85dec38">tensor::coolist_elem</a>
</li>
<li>m
: <a class="el" href="structinprod__analytic_1_1atm__wavenum.html#a72be0a86c5f5801b88ebf78506523bd2">inprod_analytic::atm_wavenum</a>
, <a class="el" href="structinprod__analytic_1_1ocean__tensors.html#a6f8f8b2b4ef239db0a9f751d7e8452e8">inprod_analytic::ocean_tensors</a>
, <a class="el" href="structinprod__analytic_1_1ocean__tensors.html#a9f72e3b14a98a50209f86b01626f6c53">inprod_analytic::ocean_tensors</a>
</li>
<li>n
: <a class="el" href="structinprod__analytic_1_1ocean__tensors.html#a5087e225a596aee2d668f6282dd6a019">inprod_analytic::ocean_tensors</a>
: <a class="el" href="structinprod__analytic_1_1ocean__tensors.html#a2ccccfae8fb93871f6d7d81d90676b19">inprod_analytic::ocean_tensors</a>
</li>
<li>nelems
: <a class="el" href="structtensor_1_1coolist.html#aac72e7727f1b161da2b9d54e25eb7aae">tensor::coolist</a>
Expand All @@ -144,14 +144,14 @@
, <a class="el" href="structinprod__analytic_1_1ocean__wavenum.html#a0738c305f503d7864a9073c5cea352ab">inprod_analytic::ocean_wavenum</a>
</li>
<li>o
: <a class="el" href="structinprod__analytic_1_1ocean__tensors.html#abab4899297820e7a92cc8d363a91ed13">inprod_analytic::ocean_tensors</a>
: <a class="el" href="structinprod__analytic_1_1ocean__tensors.html#a1002c698464fe4761ac8f0c53908c796">inprod_analytic::ocean_tensors</a>
</li>
<li>p
: <a class="el" href="structinprod__analytic_1_1atm__wavenum.html#a5a938641d8939931bc4eb71499298a6a">inprod_analytic::atm_wavenum</a>
, <a class="el" href="structinprod__analytic_1_1ocean__wavenum.html#a3170ff1b2a81b58ae81527a964682c06">inprod_analytic::ocean_wavenum</a>
</li>
<li>s
: <a class="el" href="structinprod__analytic_1_1atm__tensors.html#ad95a5329b72aae59807e7cdf043ab52c">inprod_analytic::atm_tensors</a>
: <a class="el" href="structinprod__analytic_1_1atm__tensors.html#a27edca850b0482aea4aac985ec64124d">inprod_analytic::atm_tensors</a>
</li>
<li>typ
: <a class="el" href="structinprod__analytic_1_1atm__wavenum.html#a1c12be211e96c5a773aae4c2146a3792">inprod_analytic::atm_wavenum</a>
Expand All @@ -160,13 +160,13 @@
: <a class="el" href="structtensor_1_1coolist__elem.html#ac569057f08f5f8ea171b87aa7b9dd428">tensor::coolist_elem</a>
</li>
<li>w
: <a class="el" href="structinprod__analytic_1_1ocean__tensors.html#ae4875d9d3ea854b3b7b57e0c07a07ede">inprod_analytic::ocean_tensors</a>
: <a class="el" href="structinprod__analytic_1_1ocean__tensors.html#ad14f4b5bea84f71ecb4f6665b15e78f1">inprod_analytic::ocean_tensors</a>
</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Jan 5 2017 15:58:42 by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Mon Feb 19 2018 16:12:32 by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
Expand Down
Loading

0 comments on commit ee7af22

Please sign in to comment.