11. Running with interannual forcing#

11.1. Run after classical interannual pre-processing#

Before running you should prepare your interannual inputs files following the Interannual Preprocessing tutorial of croco_tools (https://croco-ocean.gitlabpages.inria.fr/croco_tools/ ) or croco_pytools (https://croco-ocean.gitlabpages.inria.fr/croco_pytools/ ) documentations.

To run a plurimonth simulation, we provide the following scripts in ~/croco/croco/SCRIPTS/Plurimonths_scripts:

  • run_croco_inter.bash: Plurimonth run with interannual forcing

  • run_croco.bash: Plurimonth run with climatological/cycling forcing. It is a simplified version of run_croco_inter.bash which is not described below.

These scripts:

  • get the grid, the forcing, the initial and the boundary files

  • run the model for 1 month

  • store the output files in a specific form: e.g. croco_avg_Y????M?.nc

  • replace the initial file by the restart file (croco_rst.nc) which has been generated at the end of the month

  • re-launch the model for next month

A dedicated namelist input file is also requested and provided ~/croco/croco/OCEAN/croco_inter.in

All these files are already copied to your configuration directory if you have used create_config.bash. Otherwise, copy them from the source directory to your configuration directory.

  1. Edit run_croco_inter.bash: Paths should already be correct.

    #
    # Name used for the input files. For example croco_grd.nc
    MODEL=croco
    
    # Scratch directory where the model is run
    SCRATCHDIR=`pwd`/SCRATCH
    
    # Input directory where the croco_inter.in input file is located
    INPUTDIR=`pwd`/CROCO_IN  # prod architecture
    #INPUTDIR=`pwd`          # dev architecture
    
    # AGRIF input file which defines the position of child grids
    AGRIF_FILE=AGRIF_FixedGrids.in
    
    # Directory where the croco input NetCDF files (croco_grd.nc, ...) are stored
    MSSDIR=`pwd`/CROCO_FILES
    
    # Directory where the croco output and restart NetCDF files (croco_his.nc, ...) are stored
    MSSOUT=$SCRATCHDIR
    
    # CROCO executable
    CODFILE=croco
    

    Warning

    check INPUTDIR depending on the architecture you choosed (prod or dev architecture)

    Number of MPI CPUs and command for running

    # number of processors for MPI run
    NBPROCS=4
    
    # command for running the mode : ./ for sequential job, mpirun -np NBPROCS for mpi run
    # WARNING: for mpi run command, it is needed to add a space at the end and take care about ./
    RUNCMD='./'
    #RUNCMD="mpirun -np $NBPROCS ./"
    #RUNCMD="$MPI_LAUNCH ./"
    #RUNCMD='srun ./'
    #RUNCMD="mpiexec -np ${NBPROCS} ./"
    

    Define environment variables for OPENMP

    OMP_SCHEDULE=static
    OMP_NUM_THREADS=2
    OMP_DYNAMIC=false
    OMP_NESTED=false
    KMP_LIBRARY=throughput
    KMP_STACKSIZE=2m
    KMP_DUPLICATE_LIB_OK=TRUE
    

    Type of forcings

    # Define which type of inputs are used
    #
    BULK_FILES=1
    FORCING_FILES=0
    CLIMATOLOGY_FILES=0
    BOUNDARY_FILES=1
    RUNOFF_FILES=0
    TIDE_FILES=0
    ONLINE_FILES=0
    ONLINEFREQ=4
    ONLINEPATH="../DATA/CFSR_Benguela_LR" # we recommend using an absolute path
    

    Names of forcings

    # Atmospheric bulk file suffix (croco_blk_ATMOS_BULK_Y????M??.nc) - NOT USED IF ONLINE
    ATMOS_BULK=ERA5
    # Atmospheric forcing file suffix (croco_frc_ATMOS_FRC_Y????M??.nc) - NOT USED IF BULK or ONLINE
    ATMOS_FRC=QSCAT
    # Oceanic boundary and initial files suffix (croco_ini_OGCM_Y????M??.nc and croco_bry_OGCM_Y????M??.nc)
    OGCM=SODA
    # Runoff file sufix (croco_runoff_RUNOFF_Y????M??.nc)
    RUNOFF=DAI
    # Tide file suffix (croco_frc_TIDE_FRC.nc)
    TIDE_FRC=tpxo7_croco
    

    Time step settings

    # Model time step [seconds]
    DT=3600
    # Number of barotropic time steps within one baroclinic time step [number], NDTFAST in croco.in
    NFAST=60
    

    Agrif nesting settings

    # Number total of grid levels (1: No child grid)
    NLEVEL=1
    # AGRIF nesting refinement coefficient
    AGRIF_REF=3
    

    Dates settings (according to crocotools_param.m for Matlab tools or *.ini files for Python tools)

    # Start and End year
    NY_START=2005
    NY_END=2005
    # Start and End month
    NM_START=1
    NM_END=3
    # Set month format at 1 or 2 digits (for input and output files): "%01d" = 1 digit/ "%02d" = 2 digit
    MTH_FORMAT="%02d"
    #  Time Schedule  -  TIME_SCHED=0 --> yearly files
    #                    TIME_SCHED=1 --> monthly files
    TIME_SCHED=1
    
    # Number of year that are considered to be part of the spin-up (i.e. 365 days per year)
    NY_SPIN=0
    

    Outputs settings

    # Output frequency [days] - case 1 : No USE_CALENDAR - DEFAULT
    #   average
    ND_AVG=3
    #   history (if = -1 set equal to NUMTIMES, the end of each month/year)
    ND_HIS=-1
    #   restart (if = -1 set equal to NUMTIMES, the end of each month/year)
    ND_RST=-1
    
    # Output frequency [hours] - case 2 : USE_CALENDAR - USED ONLY IF USE_CALENDAR
    #
    USE_CALENDAR=1
    #
    #  average (in hours)
    NHAVG_UC=$((24))
    #  history (in hours, if = -1 set equal t NUMTIMES*DT/3600, the end of each month/year)
    NHHIS_UC=-1
    #  restart (in hours, if = -1 set equal to NUMTIMES*DT/3600, the end of each month/year)
    NHRST_UC=-1
    

    Restart settings

    #  Restart file - RSTFLAG=0 --> No Restart
    #                 RSTFLAG=1 --> Restart
    RSTFLAG=0
    #  Exact restart - EXACT_RST=0 --> Exact restart OFF
    #                - EXACT_RST=1 --> Exact restart ON
    EXACT_RST=0
    
  2. Launch the simulation Copy the adequate job script

    cp ~/croco/croco/SCRIPTS/example_job_run_croco_inter.pbs .
    

    Check the MPI settings and launch the job

    qsub example_job_run_croco_inter.pbs
    
  3. Check at your outputs: You should have

    croco_his_Y2000M1.nc
    croco_his_Y2000M2.nc
    croco_his_Y2000M3.nc
    croco_avg_Y2000M1.nc
    croco_avg_Y2000M2.nc
    croco_avg_Y2000M3.nc
    croco_rst.nc
    

    Warning

    If you have an error while you run did not BLOW UP, maybe it is because you have define LOGFILE in your cppdefs.h. For using run_croco_inter.in it should be undef.

11.2. Alternative method: online interpolation of atmospheric bulk forcing#

Instead of pre-processing your atmospheric bulk forcing, you can use online interpolation of atmospheric bulk forcing.

To do so:

  1. Your atmospheric files need to be in a format readable by CROCO: At the moment the following forcing are implemented for online interpolation:

    • In Matlab croco_tools :

      • CFSR data pre-formatted using the script Process_CFSR_files_for_CROCO.sh available in croco_tools

      • ERAI data pre-formatted using reformat_ECMWF.m (used in make_ECMWF.m in the croco_tools)

      • AROME data formatted in Meteo France framework

    • In Python croco_pytools:

      • ERAI data pre-formatted using download_era5.py

  2. Edit cppdefs.h In Surface forcing section

    #  define ONLINE
    #  ifdef ONLINE
    #   undef  AROME
    #   undef  ERA_ECMWF
    #  endif
    

    Note

    for ONLINE interpolation, default is CFSR format. AROME and ERA_ECMWF are also available by defining the cpp-keys.

  3. Re-compile the model First copy your old executable to keep it, then re-compile

    cp croco croco.bck
    ./jobcomp > jobcomp.log.online
    
  4. Link or copy the CFSR files to your DATA directory

    mkdir DATA/CFSR_Benguela_LR/
    #ln -s ~/DATA/METEOROLOGICAL_FORCINGS/CFSR/BENGUELA/CROCO_format/*2005*.nc DATA/CFSR_Benguela_LR/.
    cp ~/DATA/METEOROLOGICAL_FORCINGS/CFSR/BENGUELA/CROCO_format/*2005*.nc DATA/CFSR_Benguela_LR/.
    
  5. Check and eventually edit croco_inter.in last section

    online:    byear  bmonth recordsperday byearend bmonthend / data path
               NYONLINE   NMONLINE      4             2011     3
              ../DATA/CFSR_Benguela_LR/
    
  6. Re-run the model

    qsub example_job_run_croco_inter.sh
    

    Note

    In case of errors while using ONLINE, it is probably associated to time issues: check the time in your CFSR input files, and check your time origin Yorig.