Tool Box
Contents
Pre-processing Tools
newstart
start2archive
visualization tools
other third party scripts and tools
TO BE COMPLETED
Post-processing tools
zrecast
TO BE COMPLETED
mass stream function
The mass stream function (and the total angular momentum) can be computed from a diagfi.nc or a stats.nc, using the streamfunction.F90 script. The script is located at
trunk/LMDZ.GENERIC/utilities
To compile the script, open the compile file in the same directory and do the following:
- Replace "pgf90" with your favorite fortran compiler
- replace "/distrib/local/netcdf/pgi_7.1-6_32/lib" with the lib address and directory that contains your NetCDF library (file libnetcdf.a).
- Replace "/distrib/local/netcdf/pgi_7.1-6_32/include" with the address of the directory that contains the NetCDF include file (netcdf.inc).
- You can mess with the compiling options but it is not mandatory.
Once the script is compiled, copy it in the same directory as your .nc file and run
./streamfunction.e
The script will ask you for the name of your .nc file, and will run and produce a new nameofyourfile_stream.nc file.
Be careful : In this new file, all fields are temporally and zonally averaged.
If you want to use python instead of fortran, you can take a look at this repo. It hosts a tool to perform dynamical analysis of GCM simulations (and therefore, it computes the mass stream function and a lot of other stuff), but it is tailored for Dynamico only.
Continuing Simulations
At the end of a simulation, the model generates restart files (files 'restart.nc' and 'restartfi.nc') which contain the final state of the model. The 'restart.nc' and 'restartfi.nc' files have the same format as the 'start.nc' and 'startfi.nc' files, respectively.
These files can in fact be used as initial states to continue the simulation, using the following renaming command lines:
mv restart.nc start.nc
mv restartfi.nc startfi.nc
Running a simulation with these start files will in fact resume the simulation from where the previous run ended.
bash scripts
We have set up very simple bash scripts to automatize the launching of chain simulations. Here is an example:
#!/bin/bash
###########################################################################
# Script to perform several chained LMD Mars GCM simulations
# SET HERE the maximum total number of simulations
nummax=100
###########################################################################
echo "---------------------------------------------------------"
echo "STARTING LOOP RUN"
echo "---------------------------------------------------------"
dir=`pwd`
machine=`hostname`
address=`whoami`
# Look for file "num_run" which should contain
# the value of the previously computed season
# (defaults to 0 if file "num_run" does not exist)
if [[ -r num_run ]] ; then
echo "found file num_run"
numold=`cat num_run`
else
numold=0
fi
echo "numold is set to" ${numold}
# Set value of current season
(( numnew = ${numold} + 1 ))
echo "numnew is set to" ${numnew}
# Look for initialization data files (exit if none found)
if [[ ( -r start${numold}.nc && -r startfi${numold}.nc ) ]] ; then
\cp -f start${numold}.nc start.nc
\cp -f startfi${numold}.nc startfi.nc
else
if (( ${numold} == 99999 )) ; then
echo "No run because previous run crashed ! (99999 in num_run)"
exit
else
echo "Where is file start"${numold}".nc??"
exit
fi
fi
# Run GCM
mpirun -np 8 gcm_64x48x26_phystd_para.e < diagfi.def > lrun${numnew}
# Check if run ended normaly and copy datafiles
if [[ ( -r restartfi.nc && -r restart.nc ) ]] ; then
echo "Run seems to have ended normaly"
\mv -f restart.nc start${numnew}.nc
\mv -f restartfi.nc startfi${numnew}.nc
else
if [[ -r num_run ]] ; then
\mv -f num_run num_run.crash
else
echo "No file num_run to build num_run.crash from !!"
# Impose a default value of 0 for num_run
echo 0 > num_run.crash
fi
echo 99999 > num_run
exit
fi
# Copy other datafiles that may have been generated
if [[ -r diagfi.nc ]] ; then
\mv -f diagfi.nc diagfi${numnew}.nc
fi
if [[ -r diagsoil.nc ]] ; then
\mv -f diagsoil.nc diagsoil${numnew}.nc
fi
if [[ -r stats.nc ]] ; then
\mv -f stats.nc stats${numnew}.nc
fi
if [[ -f profiles.dat ]] ; then
\mv -f profiles.dat profiles${numnew}.dat
\mv -f profiles.hdr profiles${numnew}.hdr
fi
# Prepare things for upcoming runs by writing
# value of computed season in file num_run
echo ${numnew} > num_run
# If we are over nummax : stop
if (( $numnew + 1 > $nummax )) ; then
exit
else
\cp -f run_gnome exe_mars
./exe_mars
fi
Visualization software
Panoply
ncview
paraview
planetoplot
python scripts
TO BE COMPLETED