=========================================================================
Environment
===========

Sur les machines sun.

csh
setenv LMDGCM ~/LMDZ4.beta
setenv IOIPSLDIR /u/hourdin/IOIPSLmaf/src       # IOIPSL software
setenv NCDFLIB /distrib/local/lib        # for Netcdf
setenv NCDFINC -I/distrib/local/include  # for Netcdf
set cdpath=( $cdpath $LMDGCM/libf )
set path=( $path $LMDGCM )

bash
export LMDGCM=~/LMDZ4.beta
export IOIPSLDIR=/u/hourdin/IOIPSLmaf/src       # IOIPSL software
export NCDFLIB=/distrib/local/lib        # for Netcdf
export NCDFINC=-I/distrib/local/include  # for Netcdf
PATH=$PATH:$LMDGCM
CDPATH=$CDPATH:$LMDGCM/libf



=========================================================================
Choose a directory for the first simulation
===========================================

mkdir  /donnees/monlogin/SIM
cd /donnees/monlogin/SIM


Compile
=======

The compilation is done with makegcm command.

Brief manual for makegcm :
++++++++++++++++++++++++++

makegcm [Options] prog

What the makegcm command does :
------------------------------
1. compiles a series of sub-routines located in sub-directories of
$LMDGCM/libf.
The subroutines are archived as fortran libraries on
$LMDGCM/libo

2. Then, makegcm compiles the program prog.F which is located by default
in
$LMDGCM/libf/dyn3d
and 
links it with the compiled libraries.

With the makegcm command, you can have in parallel different
versions of the model, compiled with different options, dimensions, etc
..

Important options :
-------------------
-d imxjmxlm  where im, jm, and lm are resp. the nombre of longitudes, latitudes
             and vertical layer. 

-p PHYS    to select the physical package.
           The model will then be compiled using the routines inb
            $LMDGCM/libf/phyPHYS

-debug    compile with debuggin. May be available on SUN workstations only.


Example :
---------

makegcm -d 48x32x19 gcm
will compile 
$LMDGCM/libf/dyn3d/gcm.F and link it with the routines in
$LMDGCM/libf/dyn3d,phylolo with 100 longitudes, 80 latitudes and 19
layers.

The output of the compilation is an executable file named
gcm.e


=========================================================================
 Start a new simulation
========================


mkdir /u/rslmd/SIM
cd /u/rslmd/SIM

First compile 3 programms
-------------------------

$LMDGCM/makegcm [options] create_etat0_limit  # to create start files
$LMDGCM/makegcm [options] gcm # gcm


For applications with nudging or if you want to visualize a zoomed grid :
$LMDGCM/makegcm [options] grilles_gcm_netcdf  # to create a nc file containing the grid


If successful , you should end up with
create_etat0_limit.e
gcm.e

and possibly
grilles_gcm_netcdf.e

Then get default files
----------------------
cp  /u/lmdz/LMDZ4.beta/DEFAULTS/*def .
those *.def files contain parameters for the model.
* run.def
 -> main parameters (number of simulated days) and names of the other .def files
  nday : number of days for the simulation
* gcm.def
 -> for the dynamics
  day_step : number of step per day. time-step = 86400./day_step seconds.
      a finer grid requires smaller time-steps -> larger day_step
  Definition of the zoom
  longitude of the center
  clon=-60
  latitude of the center
  clat=-25
  zooming factor in longitude
  grossismx=4.
  same in latitude
  grossismy=4.
  do not change it (hyperbolic function for the zoom)
  fxyhypb=y
  extension in longitude of the zoomed region (fraction of the total grdi)
  dzoomx=0.17
  extension in latitude of the zoomed region
  dzoomy=0.20
  steepness of the transition at the x boundaries of the zoomed region
  taux=3.
  steepness of the transition at the y boundaries of the zoomed region
  tauy=3.
  Flag  for the convection ( 2 for Tiedtke, 3 for Kerry Emanuel)
  iflag_con=3

* physiq.def
  other parameters for the physical package


Scripts :
---------

cp /u/lmdz/LMDZ4.beta/SCRIPTS/init.x .
cp /u/lmdz/LMDZ4.beta/grille.x .


Choose a grid.
-------------
Execute grille.x changing gcm.def if you want
grille.x
executes grilles_gcm_netcdf.e
which reads parameters for the zoom in gcm.def
and plots the grid
  

Initialise
----------
init.x
will execute 
create_etat0_limit.e
which will create three files :
start.nc      Initial state for the dynamics
startphy.nc   Initial state for the physics
limit.nc      Boundary conditions (SST, ....), one state per day in the ryear


gcm.e
will create
histmth.nc    periodicity specified by "ecritphy" in gcm.def (1. means once a day)



Visualiser les fichiers histmth.nc avec les logiciels ferret ou
grads.

Si probleme a l'ouverture de histmth.nc sous grads,
executer la commande
probleme ... sparsing time coordinate ...
ncatted -O -a units,time_counter,o,c,"days since 1-1-1" histmth.nc