NEMO model

 

Quick Start Guide

The following sequence of command should result in a complete and functionnal installation.

mkdir TRY ; cd TRY

cd EXP00 ; qsub Job_LO1

Compiling NEMO on Darwin 9.7.0: GYRE experiment

Hereafter is my workflow to get running the GYRE experiment as a starter.

After downloading the code (svn_ano), I go under modipsl/util and run:

./model NEMO

without any troubles,  and

../modeles/UTIL/fait_config GYRE

again without troubles.

Then I type gmake under config/GYRE/ and here starts the list of issues listed hereafter.

Note: the compiler I use is gfortran:

>> gfortran -v

Using built-in specs.

Target: i386-apple-darwin9.5.0

Configured with: ../gcc-4.4-20081219/configure --enable-languages=fortran : (reconfigured) ../gcc-4.4-20081219/configure --enable-languages=c,c++,fortran

Thread model: posix

gcc version 4.4.0 20081219 (experimental) (GCC)

My first problem was that I didn't have the netcdf.mod file.

This comes from the fact that, when I compiled my netcdf distrib I didn't include the option '--enable-shared' to build shared libraries and then I didn't have the netcdf.mod file.

I thus recompilated netcdf to have it.

And then, I created an install subdirectory under /usr as root and linked the include and lib folders from netcdf:

cd /usr

sudo mkdir install

cd install

sudo ln -s ~/bin/netcdf/include include

sudo ln -s ~/bin/netcdf/lib lib

sudo vi readme

    these are for NEMO

Then the original keys into the Makefile (generated from the util/AA_make.gdef):

NCDF_INC = /usr/install/include

NCDF_LIB = -L/usr/install/lib -lnetcdf

found what they wanted.

Another solution is to modify in the Darwin lines of the util/AA_make.gdef the NCDF_INC and NCDF_LIB to point to the correct location where you installed netcdf. These are the lines I have now:

#-Q- Darwin   NCDF_INC = /Users/gmaze/bin/netcdf/include

#-Q- Darwin   NCDF_LIB = -L/Users/gmaze/bin/netcdf/lib -lnetcdf

Note that I installed netcdf under my home directory and pointed include and lib toward it. More instructions about that can be found on this webpage under the section "Netcdf config for NEMO under Darwin 9.7.0".

After retyping gmake, libraries are being created.

(cd ../../modeles/IOIPSL/src; make ;)

will creates lib/libioipsl.a and be terminated by IOIPSL is OK

(cd ../../modeles/NEMO/WORK;  make ;)

(cd ../../IOIPSL/src ; make -f Makefile )

IOIPSL is OK

Another problem was about the CPP keys.

I then had a bunch of errors like:

gfortran: key_trabbl_dif: No such file or directory

Using ins_make, the Makefile created didn't get the line prefix=-D, ie prefix to indicate cpp keys was absent, producing the error.

A fix is to modify the BB_make.ldef to manually transform the line:

#-Q- gfortran prefix = -D

into:

prefix = -D

But this is not satisfactory.

Instead, one should notice that by default util/ins_make identify the platform as Darwin but this one is not in the list congif/GYRE/scripts/BB_make.ldef !

Therefore, one solution is to use ins_make with the -t gfortran option or another solution is to add a line (my favorite) into the BB_make.ldef like:

#-Q- Darwin prefix = -D

This last option allows the use of ins_make without any options.

Next problem was a syntax error.

I had the following message:

dynspg.F90:74.9:

         ;              CALL dyn_spg_exp    ( kt )

         1

Error: Semicolon at (1) needs to be preceded by statement

I don't know where does this one come from, put a simple fix is to add some & where it is appropriate. In fact, in the subroutine dynspg.F90 under modele/OPA_SRC/DYN

I replaced the select case (commented here):

      !! SELECT CASE ( nspg )                       ! compute surf. pressure gradient trend and add it to the general trend

      !! !                                                    

      !! CASE (  0 )   ;   CALL dyn_spg_exp    ( kt )              ! explicit

      !! CASE (  1 )   ;   CALL dyn_spg_ts     ( kt )              ! time-splitting

      !! CASE (  2 )   ;   CALL dyn_spg_flt    ( kt, kindic )      ! filtered

      !! CASE (  3 )   ;   CALL dyn_spg_rl     ( kt, kindic )      ! rigid lid

      !! !                                                   

      !! CASE ( -1 )                                       ! esopa: test all possibility with control print

      !!    ;              CALL dyn_spg_exp    ( kt )

      !!    ;              CALL prt_ctl( tab3d_1=ua, clinfo1=' spg0 - Ua: ', mask1=umask, &

      !!       &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )

      !!    ;              CALL dyn_spg_ts     ( kt )

      !!    ;              CALL prt_ctl( tab3d_1=ua, clinfo1=' spg1 - Ua: ', mask1=umask, &

      !!       &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )

      !!    ;              CALL dyn_spg_flt  ( kt, kindic )

      !!    ;              CALL prt_ctl( tab3d_1=ua, clinfo1=' spg2 - Ua: ', mask1=umask, &

      !!       &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )

      !! END SELECT

by this one (I highlighted the & I added):

      SELECT CASE ( nspg )                       ! compute surf. pressure gradient trend and add it to the general trend

      !                                                    

      CASE (  0 )   ;   CALL dyn_spg_exp    ( kt )              ! explicit

      CASE (  1 )   ;   CALL dyn_spg_ts     ( kt )              ! time-splitting

      CASE (  2 )   ;   CALL dyn_spg_flt    ( kt, kindic )      ! filtered

      CASE (  3 )   ;   CALL dyn_spg_rl     ( kt, kindic )      ! rigid lid

      !                                                   

      CASE ( -1 )   &                                    ! esopa: test all possibility with control print

         ;              CALL dyn_spg_exp    ( kt )&

         ;              CALL prt_ctl( tab3d_1=ua, clinfo1=' spg0 - Ua: ', mask1=umask, &

            &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )&

         ;              CALL dyn_spg_ts     ( kt )&

         ;              CALL prt_ctl( tab3d_1=ua, clinfo1=' spg1 - Ua: ', mask1=umask, &

            &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )&

         ;              CALL dyn_spg_flt  ( kt, kindic )&

         ;              CALL prt_ctl( tab3d_1=ua, clinfo1=' spg2 - Ua: ', mask1=umask, &

            &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )

      END SELECT

which solved the compiling error.

I know this is not satisfactory to modify a core routine of the code, but right now this is the only fix I found.

Last error was about some undefined symbols all related to the netcdf library.

I had some stuff like:

Undefined symbols:

  "___netcdf_MOD_nf90_inq_varid", referenced from:

      ___iom_nf90_MOD_iom_nf90_varid in libopa.a(iom_nf90.o)

I eventually found the error here.

When I compiled netcdf I enabled the shared library option (see netcdf install on this page). This causes to create a libnetcdf.a AND a libnetcdff.a (note the double f for Fortran). This one has to be included in the compilation options. It can be done by modyfing the util/AA_make.gdef file line about the Netcdf library as:

#-Q- Darwin   NCDF_LIB = -L/Users/gmaze/bin/netcdf/lib -lnetcdf -lnetcdff

And this solved the error, and gmake gave me:

OPA model is OK

Victory !

Running the config GYRE

Now that I have the executable opa, it is useless to run the util/ins_job because there's no queuing system on my macbook.

I simply duplicate the config/GYRE/EXP00 into config/GYRE/EXP0:

cd config/GYRE/

mkdir EXP01

cp EXP00/* EXP01

then I go into it and copy the executable:

cd EXP01

cp ../../../bin/opa .

You eventually simply run the model !

time ./opa

314.552u 3.885s 5:38.38 94.1%   0+0k 0+44io 0pf+0w

Meaning with my 2HGz Intel core 2 duo (2GB 1067 Mhz DDR3) the classic config takes 5 mins 38 sec to run...

Recap config for Darwin 9.7.0 and netcdf 4.0.1

To recap, here are the files I modified and tuned to be able to run NEMO, GYRE config on my macbook:

util/AA_make.gdef

congif/GYRE/scripts/BB_make.ldef

modele/OPA_SRC/DYN/dynspg.F90

You can get them at the bottom of this page.

The workflow is thus as follow, from the modipsl folder:

cd util

./model NEMO

../modeles/UTIL/fait_config GYRE

./ins_make ; # (the prog should recognize the Platform as Darwin)

cd ../config/GYRE

gmake

ls -l ../../bin/*

the executable opa is located under ../../bin/opa

Tricks

When running the util/model NEMO command, the default svn user is nemo_user, inducing a bunch of return key pressing and typing your username and password for each components ....

To avoid this, simply replace nemo_user into the util/mod.def file by your username at line:

#-S- 7 svn --username nemo_user http://forge.ipsl.jussieu.fr/nemo/svn

And you're all set to update your code in a sec !

Detailled Guide

Rq: you can find the the Nemo book v3 at the bottom of this page.

Flow chart of the model

Docs PDF

Netcdf config for NEMO under Darwin 9.7.0

After downloading the netcdf 4.0.1 source files at UCAR, I untar the package under ~/bin/netcdf-4.0.1

The reason why I want to install netcdf under my home directory is that when moving to a linux machine from my lab's network I want to be able to install it on my own without having to rely on share folders I'll never know where they're located...

then I create a build subfolder:

cd ~/bin/netcdf-4.0.1

mkdir build

and launch the configure script as:

./configure --prefix=/Users/gmaze/bin/netcdf-4.0.1/build --enable-docs-install --enable-shared

I finished by:

make

and

make install

Then under my ~/bin I create a dynamic link to the build folder:

cd ~/bin

ln -s netcdf-4.0.1/build netcdf

and the command:

ls ~/bin/netcdf/*

give me:

/Users/gmaze/bin/netcdf/bin:

nc-config ncdump    ncgen

/Users/gmaze/bin/netcdf/include:

NETCDF.mod    TYPESIZES.mod ncvalues.h    netcdf.h      netcdf.hh     netcdf.inc    netcdfcpp.h

/Users/gmaze/bin/netcdf/lib:

libnetcdf.4.dylib     libnetcdf.dylib       libnetcdf_c++.4.dylib libnetcdf_c++.dylib   libnetcdff.4.dylib    libnetcdff.dylib      pkgconfig

libnetcdf.a           libnetcdf.la          libnetcdf_c++.a       libnetcdf_c++.la      libnetcdff.a          libnetcdff.la

/Users/gmaze/bin/netcdf/share:

doc  info man

which is all I need to run NEMO