MARS environnement : List of useful commands

Useful commands do for more details
mkconfdir (without ranks) creates all directories required for the implementation of a configuration mkconfdir without ranks
mkconfdir (with ranks) creates all directories required for the implementation of a configuration mkconfdir with ranks
gmake install sets the reference code into the directory of compilation command gmake install
gmake compiles with user’s routines command gmake
gmake clean cleans ‘*’.o and ‘*’.f command gmake clean
gmake cleaninst empties the directory of compilation (useful when you want to remove a user’s routine) command gmake cleaninst
gmake update [“OLDREV=XXX” “NEWREV=YYY”] sets the reference code into the directory of compilation and updates user’s routines from revision XXX to revision YYY command gmake update
getfile WORK/routine.F90 allows the user to modify the reference code source command getfile
rmfile routine.F90 remove a file from MARS_CONFIG/CONF/CONF-CASE. command rmfile
cmpfile routine.F90 Easy way for making either a diff between a file in the MARS_CONFIG/CONF/CONF-CASE directory and the corresponding file in the HOMEMARS directory. command cmpfile

All these commands are launched from the directory MARS_CONFIG/conf/conf-case, location where the user prepares the code he will run.

mkconfdir without ranks

  • This command creates all directories required for the implementation of a configuration
  • Usage without ranks :
mkconfdir CONF CASE
CONF for geographic configuration
CASE for one case of this configuration)
  • What it does :
      1. Create empty directories, the makefile and Makefile.datarmor files in $UDIR/CONF/CONF-CASE
        . empty directories : INC, PHYS, TRAJ, BIOLO, SEDIM, SWAN, AGRIF . The makefile file manages the MARS environment and calls to Makefile.datarmor for compilation . Makefile. where user chooses cpp keys and compiling option
      1. Create empty directory in $CDIR/WCONF-CASE
      1. Create directories $RDIR/CONF/CONF-CASE and $RDIR/CONF/inputs

        . in $RDIR/CONF/CONF-CASE :
        • default namelist files (para...txt),
        • output.dat file, (where the user defines the output files)
        • script and batchs, (to run the executable)
        • batch_connect and connect.exe files (to gather MPI output files if l_out_nc4par=.false.)
        . in $RDIR/CONF/inputs :
        • examples of files ‘*’.dat (to give the formats of the files managing rivers, outflows, variables, trajectories…)
        • example of head.CONF file

mkconfdir with ranks

  • This command creates all directories required for the implementation of a configuration
  • Usage WITH ranks :
mkconfdir CONF CASE RANK

CONF for geographic configuration CASE for one case of this configuration RANK : number of ranks

  • What it does :
      1. Create empty directories, the makefile and Makefile.datarmor files in $UDIR/CONF/CONF-CASE
        . empty directories : INC, PHYS, TRAJ, BIOLO, SEDIM, SWAN, AGRIF . The makefile file manages the MARS environment and calls to Makefile.datarmor for compilation . Makefile. where user chooses cpp keys and compiling option
      1. Create empty directory in $CDIR/WCONF-CASE
      1. Create directories $RDIR/CONF/CONF-CASE ; $RDIR/CONF/CONF-CASE/rank_0,rank_1,rank_2 and $RDIR/CONF/inputs

        . in $RDIR/CONF/CONF-CASE :
        • default namelist files (paramain.txt and paracom.txt)
        . in $RDIR/CONF/CONF-CASE/rank_0,rank_1,rank_2 :
        • output.dat file, (where the user defines the output files)
        • script and batchs, (to run the executable)
        • batch_connect and connect.exe files (to gather MPI output files if l_out_nc4par=.false.)
        . in $RDIR/CONF/inputs :
        • examples of files ‘*’.dat (to give the formats of the files managing rivers, outflows, variables, trajectories…)
        • example of head.CONF file

command gmake install

  • This command sets the reference code into the directory of compilation
  • Usage :
cd $UDIR/CONF/CONF-CASE
gmake install
  • This command copies the reference MARS code in $CDIR/WCONF-CASE and creates a link to the directory WORK in $UDIR/CONF/CONF-CASE*
  • All routines are available from WORK directory.
  • But NEVER go or work directly under this WORK directory

command gmake

  • This command prepares the code, compiles it and copy the executable to $RDIR
  • Usage :
cd $UDIR/CONF/CONF-CASE
gmake
  • Copy modified user’s routines in $CDIR (where there are now reference code + modified user’s routines)
  • Creates smallf90 directory in $UDIR and in $CDIR (link between them)
  • Compiles the code to get the executable (exe in $CDIR => mars_exe in $RDIR)
  • smallf90 is a link $CDIR, NEVER work under this directory smallf90.
  • In smallf90, the user can see all routines used when compiling (after pre-processing)

command gmake clean

  • This command cleans ‘*’.o and ‘*’.f

command gmake cleaninst

  • This command empties the directory of compilation (useful when you want to remove a user’s routine)

command gmake update

  • This command sets the reference code into the directory of compilation and updates user’s routines from revision XXX to revision YYY
  • Usage :
gmake update ["OLDREV=XXX" "NEWREV=YYY"]

command getfile

  • This command allows the user to modify the reference code source
  • Usage :
cd $UDIR/CONF/CONF-CASE
getfile WORK/routine.F90
  • gets a routine and saves it at the correct location in MARS_CONFIG/CONF/CONF-CASE.
  • Then, this routine can be modified by the user directly from the directory MARS_CONFIG/CONF/CONF-CASE (links are automatically made)
  • After the modification of the routine by the user, You have to compile the code again by gmake which takes into account the modified routine

command rmfile

  • This command removes a file from MARS_CONFIG/CONF/CONF-CASE and restores the removed file from the REFERENCES (HOMEMARS,REF_CONFIG),
  • Usage :
cd $UDIR/CONF/CONF-CASE
rmfile routine.F90
  • After asking for confirmation (twice), it deletes the local link to routine.F90 and moves the file from its actual position to the .trash directory (this directory is created if it doesn’t exist). It is the user responsability to empty the .trash directory !

command cmpfile

  • This command visualize differences between user’s routine and reference code.
  • Usage :
cd $UDIR/CONF/CONF-CASE
cmpfile routine.F90**
  • Easy way for making either a diff between a file in the MARS_CONFIG/CONF/CONF-CASE directory and the corresponding file in the HOMEMARS directory.
  • Default option launches tkdiff wheter -t option produces a diff -bic listing. It can be used as template for personnal improvement.