5.2. Set up you own test case¶

Example: set up a convection test case: test case that mimic the winter convection happening in the North-Western Mediterranean sea

  1. Create a configuration directory:
    mkdir ~/CONFIGS/CONVECTION
    
  2. Copy the input files from croco sources:
    cd ~/CONFIGS/CONVECTION
    cp ~/croco/croco/OCEAN/cppdefs.h .
    cp ~/croco/croco/OCEAN/param.h .
    cp ~/croco/croco/OCEAN/jobcomp .
    cp ~/croco/croco/OCEAN/croco.in .
    
  3. Edit cppdefs.h, param.h, and croco.in for your new CONVECTION case:

    • Add a dedicated key for this test case CONVECTION (in cppdefs.h)

    • Set up a flat bottom; 2500 m deep (variable depth in ana_grid.F and follow what is performed under the key BASIN, for instance)

    • Set up your grid: 1000x1000x200 grid points (respectively in xi, eta and vertical directions) (parameters LLm0, MMm0, and N in param.h)

    • Specify a length and width of 50km in both directions (xi, eta) (variables Length_XI, Length_ETA in ana_grid.F)

    • Set up an almost cold start with velocity component fields set to white noise (see in ana_initial.F what is performed for other test cases and fill in arrays u,v) around 0.1 mm/s

    • Set up the initial ssh fields to zero (arrays zeta in ana_initial.F)

    • Set up the initial stratification (i.e. the temperature and salinity fields) (in ana_initial.F: array t)

    • Set up the wind stress forcing (svstr, sustr in analytical.F ; you may follow what is set for INNERSHELF; not necessary)

    • Set the permanent heat surface flux (stflx= -500 w/m2 (-500/rho0*Cp) in analytical.F in subroutine ana_stflux_tile)

    Warning

    In cppdefs.h define your own cpp key CONVECTION, which might be a clone of the key BASIN ; in case we add the salinity (concerning the BASIN case), do not forget to add the keys ANA_SSFLUX and ANA_BSFLUX .

    Warning

    In croco.in in case we add (with respect to the BASIN case) the salinity do not forget to modify the number of tracers written 2*T and the number of Akt (2*.1.0e-6)

    Warning

    In croco.in we adjust the time step and ndtfast to reach the stability

  4. Edit the compilation script jobcomp:
    # set source, compilation and run directories
    #
    SOURCE=~/croco/croco/OCEAN
    SCRDIR=./Compile
    RUNDIR=`pwd`
    ROOT_DIR=$SOURCE/..
    
    #
    # 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:
    ./jobcomp > jobcomp.log
    

    If compilation is successful, you should have a croco executable in your directory.

  6. Run the model:
    • Classical launch command is (but should probably be launched in a dedicated submission job in clusters… see next item):

      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

  7. If you want to try another mixing parameterization:
    • Add in cppdefs.h, in your CONVECTION case, the following cpp keys dedicated to the closure:

    #define GLS_MIXING
    
    • In croco.in add this lines for GLS history and averages fields

    gls_history_fields:   TKE  GLS  Lscale
                           F     F    F
    gls_averages:   TKE  GLS  Lscale
                    F     F    F
    
    • Recompile, and re-run the model

  8. If you want to add stflux as tanh signal:
    • in analytical.F:

      real*4 r2,RR2
      !  Set kinematic surface heat flux [degC m/s] at horizontal
      !  RHO-points.
      !
          r2= 10**2
          ic = LLm0/2.
          jc = MMm0/2.
          do j=JstrR,JendR
            do i=IstrR,IendR
              RR2 =  (i+iminmpi-ic)*(i+iminmpi-ic)+(jminmpi-jc)*(jminmpi-jc)
              stflx(i,j,itemp)=(-200. -200. * tanh((r2-RR2)/1000.))/rho0/Cp
            enddo
          enddo
      
    • Recompile and re-run the model.