5.1. BASIN#
Create a configuration directory:
mkdir ~/CONFIGS/BASIN
Copy the input files for compilation from croco sources:
cd ~/CONFIGS/BASIN cp ~/croco/croco/OCEAN/cppdefs.h . cp ~/croco/croco/OCEAN/param.h . cp ~/croco/croco/OCEAN/jobcomp .
Edit
cppdefs.h
for using BASIN case# define BASIN # undef REGIONAL You can also explore the CPP options selected for BASIN case. You can check the BASIN settings in ``param.h``.
Edit the compilation script
jobcomp
:# set source, compilation and run directories # SOURCE=~/croco/croco/OCEAN SCRDIR=./Compile RUNDIR=`pwd` ROOT_DIR=$SOURCE/.. # # determine operating system # OS=`uname` echo "OPERATING SYSTEM IS: $OS" # # compiler options # FC=$FC # # set MPI directories if needed # MPIF90=$MPIF90 MPIDIR=$(dirname $(dirname $(which $MPIF90) )) MPILIB="-L$MPIDIR/lib -lmpi -limf -lm" MPIINC="-I$MPIDIR/include" # set NETCDF directories # #----------------------------------------------------------- # Use : #-lnetcdf : version netcdf-3.6.3 -- #-lnetcdff -lnetcdf : version netcdf-4.1.2 -- #-lnetcdff : version netcdf-fortran-4.2-gfortran -- #----------------------------------------------------------- # #NETCDFLIB="-L/usr/local/lib -lnetcdf" #NETCDFINC="-I/usr/local/include" NETCDFLIB=$(nf-config --flibs) NETCDFINC=-I$(nf-config --includedir)
Compile the model:
By using classical launch command (on individual computers):
./jobcomp > jobcomp.log
OR by using a batch script (e.g. PBS) to launch the model (in clusters): For DATARMOR:
cp $CROCO_DIR/job_comp_datarmor.pbs . qsub job_comp_datarmor.pbs
If compilation is successful, you should have a
croco
executable in your directory.You will also find a
Compile
directory containing the model source files:.F
files: original model source files that have been copied from$croco/OCEAN
_.f
files: pre-compiled files in which only parts defined by cpp-keys are kept.o
object files
Copy the namelist input file for BASIN case:
cp ~/croco/croco/TEST_CASES/croco.in.Basin croco.in
Eventually edit it.
Run the model:
./croco croco.in > croco.out
If your run is successful you should obtain the following files:
basin_rst.nc # restart file basin_his.nc # instantaneous output file
Have a look at the results:
ncview basin_his.nc
Test: some questions:
What is the size of the grid (see param.h)?
What are the name of the horizontal directions?
What is the spatial resolution in both horizontal directions?
How many vertical levels do you have?
How are the vertical levels distributed (look for the cpp key
NEW_S_COORD
)?What are the initial dynamical conditions (see both cppdefs.h and croco.in)?
What do the air-sea exchanges look like?
Re-run this case in parallel on 4 CPUs:
To run in parallel, your first need to edit
cppdefs.h
,param.h
, and to recompile.Edit
cppdefs.h
:
# define MPI
Edit
param.h
:
#ifdef MPI integer NP_XI, NP_ETA, NNODES parameter (NP_XI=2, NP_ETA=2, NNODES=NP_XI*NP_ETA) parameter (NPP=1) parameter (NSUB_X=1, NSUB_E=1)
Note
MPI tiles should be at least 20x20 points.
Recompile.
Run the model in parallel:
By using classical launch command (on individual computers):
mpirun -np NPROCS croco croco.in
where NPROCS is the number of CPUs you want to allocate.
mpirun -np NPROCS
is a typical mpi command, but it may be adjusted to your MPI compiler and machine settings.OR by using a batch script (e.g. PBS) to launch the model (in clusters), examples are provided:
cp ~/croco/croco_tools/job_croco_mpi.pbs .
Edit
job_croco_mpi.pbs
according to your MPI settings inparam.h
and launch the run:qsub job_croco_mpi.pbs
Warning
NPROCS needs to be consistent to what you indicated in
param.h
during compilation