BASIN

5.1. BASIN#

  1. Create a configuration directory:

    mkdir ~/CONFIGS/BASIN
    
  2. 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 .
    
  3. 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``.
    
  4. 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)
    
  5. 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

  6. Copy the namelist input file for BASIN case:

    cp ~/croco/croco/TEST_CASES/croco.in.Basin croco.in
    

    Eventually edit it.

  7. 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
    
  8. Have a look at the results:

    ncview basin_his.nc
    
  9. 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?

  10. 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 in param.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