
*********************************
*REALISTIC CONFIGURATION*
*********************************

Example of coastal configuration
********************************

The VILAINE case is an example of a realistic coastal configuration taking into account :

* Tidal circulation
* Wet/dry areas
* River outflows
* Sediment dynamic with MUSTANG


The configuration is included in CROCO as a reference coastal case (see ``cppdefs.h``)



#. Set the environment
   ::

        source ~/croco_env.sh

#. Create a configuration directory:
   ::

        mkdir $confs/VILAINE

#. Copy the input files for compilation from croco sources:
   ::

        cd $confs/VILAINE
        cp $croco/OCEAN/cppdefs.h .
        cp $croco/OCEAN/param.h .
        cp $croco/OCEAN/jobcomp .

#. Edit ``cppdefs.h`` for using BASIN case
   ::

        # define COASTAL

        # undef REGIONAL

   You can also explore the CPP options selected for VILAINE case.

   * which physical parametrizations ?
   * which advection schemes ?

   You can check the VILAINE settings in ``param.h``: 

   * Dimension of the grid ?
   * Number of vertical levels ?


#. Edit the compilation script ``jobcomp``:
   
   see :ref:`tutos_basin`


#. Get the inputs files for the run
   ::
    
      cp /home/datawork-croco/public/ftp/CONFIGS_EXAMPLES/VILAINE/croco.in .
      cp -r /home/datawork-croco/public/ftp/CONFIGS_EXAMPLES/VILAINE/CROCO_FILES .


   Take a look of the input files in CROCO_FILES and check if it's filled 
   out correctly in  ``croco.in`` file 


#. Get the namelist for MUSTANG module 
   ::

      cp -r /home/datawork-croco/public/ftp/CONFIGS_EXAMPLES/VILAINE/MUSTANG_NAMELIST .
      


#. Compile the model in MPI with 28 cpus

   * Edit the ``param.h`` file to choose the number of cpus
   * Check if MPI is activated for the VILAINE case in ``cppdefs.h``
     ::
        
        # define MPI

   * Get the compile batch script and compile
     ::

        cp $CROCO_DIR/batch_comp_datarmor .
        qsub batch_comp_datarmor
        

   * Get the run script to submit your job on Datarmor
     ::
      
        cp $CROCO_DIR/job_croco_mpi.pbs .
        qsub job_croco_mpi.pbs

    
#. Assign a new fill value to land mask cells

   * copy scalars.h
     :: 
    
        cp $croco/OCEAN/scalars.h .

   * edit the file and replace spval
     ::
     
        spval=999.

   * add CPP key FILLVAL in your ``cppdefs.h``
     ::

        define FILLVAL


   * add this key in ``cppdefs.h``` to not add bathymetry on wet dry cells 
     ::

        define ZETA_DRY_IO 


Build a configuration from scratch
**********************************


.. toctree::
   :maxdepth: 1

   tutorial_new_config.rst 

