Coupling tools contents
=======================

The ``croco/SCRIPTS/SCRIPTS_COUPLING`` toolbox contains several sub-directories: 

* SCRIPTS_TOOLBOX: contains all the scripts, namelists, and routines
* OASIS_IN: contains base namelists, and compilation file examples 
* CROCO_IN: contains base namelist
* WW3_IN: contains base namelists, and useful files for compilation
* WRF_IN: contains base nameslist, and usesul files for compilation
* TOY_IN: contains the toy mode sources, and base namelists


================================ =============================================================
submitjob.sh                     Script to create and launch job
mynamelist.sh                    Namelist for the run ( models, dt, output,...)
myjob.sh                         Informations about the job (date, job duration,...)
myenv_mypath.sh                  Machine environment and path to models
================================ =============================================================

In ``OASIS_IN``:

================================ ========================================================================
make.MACHINE                     Example files for OASIS compilation on different MACHINES
namcouple.base.*                 |  Namelist files for the different coupled modes in which
                                 |  ``<...>`` will be replaced by ``cpl_nam.sh`` from ``SCRIPTS_TOOLBOX``
namcouple.base.aw.debug          Example of a namelist files with debug options
namcouple.base.aw.nointerp       Example of namelist with given interpolation file
================================ ========================================================================

In ``CROCO_IN``:

==================== ================================================================================
croco.in.base        | Base namelist file for CROCO (timestepping, input, output...), 
                     | in which ``<...>`` will be replaced by ``oce_nam.sh`` from ``SCRIPTS_TOOLBOX``
cppdefs.h.base       | Base cppdefs.h file for CROCO in which coupling options will be 
                     | replaced by ``oce_compile.sh`` from ``SCRIPTS_TOOLBOX``
param.h.base         | Base param.h file for CROCO in which grid size and MPI options will be
                     | replaced by ``oce_compile.sh`` from ``SCRIPTS_TOOLBOX``
jobcomp              Script to compile CROCO, with adapted paths and environment variables
==================== ================================================================================

In ``WRF_IN``:

================================ ==========================================================================
compile.wrf.*                    Jobs to launch ``make_WRF_compil`` on some MACHINES
make_WRF_compil                  Script to compile wrf
configure.namelist.real          Configure file to edit for running real
run_real.bash                    Script to run real (wrf pre-processing)
job.real.*                       Job script to run real
namelist.input.base.complete     | Namelist base in which ``<...>`` will be replaced by ``run_real`` 
                                 | and ``atm_nam.sh`` from ``SCRIPTS_TOOLBOX``
README.namelist                  Readme to know all the namelist options available (also available in WRF)
myoutfields.txt                  | Example of file that can be prescribed in wrf namelist to
                                 |  add/remove variable outputs
**CONFIGURE_WRF/MACHINE**
-----------------------------------------------------------------------------------------------------------
    configure.wrf.coupled        Example of configure file for compiling wrf in coupled mode
    configure.wrf.uncoupled      Example of configure file for compiling wrf in forced mode
================================ ==========================================================================

In ``WW3_IN``:

================================ =============================================================
switch_*                         Switches for the different modes
ww3_grid.inp.base                | Grid input file in which ``<...>`` (timesteps, etc)
                                 | will be replaced by ``wav_getfile.sh`` script
ww3_prnc.inp.*                   prnc input file for prerpating ww3 input files
ww3_strt.inp                     strt input file for running ``ww3_strt``
ww3_shel.inp.base.*              | shel input files for the different modes in which ``<...>``
                                 | (dates, etc) will be replaced by ``wav_getfile.sh``
ww3_ounf.inp.base                ounf input file in which dates will be replaced
ww3_ounp.inp.base                ounp input file in which dates will be replaced
ww3_bounc.inp                    boundary input file for running ``ww3_bounc``
make_WW3_compil                  Script to compile ww3
**modified_ftn**                 Directory with a few ww3 functions modified from v6.07.1
================================ =============================================================

In ``SCRIPTS_TOOLBOX``

================================ =============================================================
\*_nam.sh                        | Update pre-filled namelist with ``mynamelist.sh``
                                 | informations
\*_get*.sh                       Get input files for the models
\*_putfile.sh                    | Retrieve output and restart files and put them where it is
                                 | specified in header_*.sh
chained_job.sh                   | Submit all jobs at the beginning with the following having
                                 | condition on the previous
caldat.sh                        Return the calendar date and time given julian date
julday.sh                        | Calculate the Julian Day Number for a given month, day,
                                 | and year
caltools.sh                      Compute dates for the experiment
getversion.sh                    Return model's version used (and write it in the log file)
**MACHINE**
----------------------------------------------------------------------------------------------
    header.MACHINE               | Job header for different machines,
                                 | paths toward model's executables, input directories,
                                 | namelist but also execution, output and restart directories
    launch.MACHINE               | Script to create app.conf file for launching coupled runs 
                                 | with MPMD (multiple executables launch on HPC clusters)
    myenv.MACHINE*               | Necessary modules on the different MACHINES to compile and
                                 | run the models
**NAMELIST**
----------------------------------------------------------------------------------------------
    namelist_*                   | Different namelists which are concatenated, in 
                                 | create_config, to build ``mynamelist.sh``
**PATHS**
----------------------------------------------------------------------------------------------
    path_*.sh                    Script used in ``create_config`` to build ``myenv_mypath.sh``
**OASIS_SCRIPTS**
----------------------------------------------------------------------------------------------
create_oasis_grids_for_wrf.sh    | Script to create grids.nc and masks.nc files for
                                 | OASIS for WRF (useful only if you are using a version of WRF
                                 | in which the oasis function is not implemented. In the wrf-croco 
                                 | fork the function is implemented and this script is not used). 
create_oasis_restart_from_cal... | Script to create restart files for OASIS from calm condition
                                 | This script is called in ``cpl_getrst.sh``
create_oasis_restart_from_pre... | Script to create restart files for OASIS from pre-existing
                                 | model files. This script can be called in 
                                 | ``cpl_getrst.sh``
create_oasis_toy_files.sh        | Script to create files that will be used by the toy model
                                 | to mimic another model.
from_*.sh                        Useful functions called by the previous scripts
to_wrf_stag_grid.sh              Useful functions called by the previous scripts
mpmdconf_create.sh               | script to create required config file to run multiple 
                                 | executables on HPC clusters 
================================ =============================================================

.. note:: 
    MPMD (Multiple Program Multiple Data) is supported on some machines. 
    Different executables are launched and communicate with each other using 
    MPI; all MPI processes are included within the same MPI_COMM_WORLD 
    communicator. This execution method uses a text file (call here app.conf) 
    which contains the mapping between MPI processes and executables


The ``croco_tools/Coupling_tools`` toolbox contains:

================================ =============================================================
**CROCO**
----------------------------------------------------------------------------------------------
README_preprocess_croco          Readme to use croco_tools classic pre-processing (in matlab)
README_nest_cpl                  Readme to prepare nests in coupled runs
make_grid_from_WRF.m             | Script to generate a grid for CROCO from WRF grid with 
                                 | eventually a refinement coefficient
find_childgrid_inparentgrid.m    | Script to Find the position of a nested grid in the parent 
                                 | before using AGRIF tools
job_prepro_matlab.pbs            Example job to run matlab preprocessing on a supercomputer
prepro_*.m                       Example scripts used by the job script
**WW3**
----------------------------------------------------------------------------------------------
make_ww3_grd_input_i..._grd.m    | Script to generate coord. and bathy. file for WW3 from
                                 | croco_grd.nc file
script_make_CFSR_wind_for_ww3.sh Script to create wind input file for WW3 from CFSR
script_make_WRF_wind_for_ww3.sh  Script to create wind input file for WW3 from WRF
script_make_CROCO_current....sh  Script to create current and level input files for WW3
UV2T.sh                          | Useful functioni to change from U,V to T grid, used in 
                                 | above-mentionned scripts
**WRF_WPS**
----------------------------------------------------------------------------------------------
    README_download_CFSR_data    Some useful readme for WPS
    README_wps                   Some useful readme for WPS
    README.Vtable                Some useful readme for WPS
    configure.namelist.wps       Configure file to edit for running WPS
    Vtable.CFSR_sfc_flxf06       Vtables for CFSR data
    Vtable.CFSR_press_pgbh06     Vtables for CFSR data
    Vtable.GDAS_4soillevel_my    Vtable for GFS/GDAS data
    METGRID.TBL.GDAS             Table for Metgrid
    job.wps.*                    Job scripts to run WPS pre-processing
    run_wps.bash                 Script to run wps (wrf pre-processing)
    **CONFIGRE_WPS**             Examples of configure files for compiling WPS
================================ =============================================================

