Difference between revisions of "COD Class Examples"

From WikiROMS
Jump to navigationJump to search
Line 50: Line 50:


==Configuring your working directory files==
==Configuring your working directory files==
Following the instructions above, complete these steps:
For each class example you will go through the following steps to start.


# Copy the '''COD''' example files to your working directory
Refer back to the instructions above for guidance:
# Modify build_bash.sh to run <span class="sandyBrown">ROMS_APPLICATION</span>='''COD_1DMIX'''
 
# Compile the model, i.e. run <span class="blue">build_bash.sh</span>
# Copy the necessary '''COD''' example case files to your working directory.
# Modify your job.sh script to pass the correct input file, i.e. '''roms_cod_1dmix.in''', to the srun command </br> {{note}} '''Notice:''' You must also modify <span class="blue">job.sh</span> to request the appropriate number of '''tasks'''. Review the entries for '''NtileI''' and '''NtileJ''' in <span class="blue">roms_cod_1dmix.in</span> and set the correct values.
# Modify build_bash.sh to set <span class="sandyBrown">ROMS_APPLICATION=</span>, for example '''COD_1DMIX'''
# Submit the job to SLURM
# Compile ROMS, i.e. run <span class="blue">build_bash.sh</span>
# View the output log, i.e. the file named something like '''out.hal0007.12345678.log''' to verify the ru was successful
# Modify your job.sh script to pass the correct input file, for example '''roms_cod_1dmix.in''', to the srun command </br> {{note}} '''Notice:''' You must also modify <span class="blue">job.sh</span> to request the appropriate number of '''tasks'''. Review the entries for '''NtileI''' and '''NtileJ''' in <span class="blue">roms_cod_*.in</span> file and set the correct values.
# Submit the job to SLURM with sbatch
# Check for the creation of the netcdf output files.
# Check for the creation of the netcdf output files.
# View the output and error log files, i.e. the files named something like '''out.hal0007.12345678.log''' and '''err.hal0007.12345678.log''' to verify the run was successful, or diagnose the problem.
In these examples certain parameters are set in <span class="blue">roms_cod_*.in</span> to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.
==Example COD_1DMIX==
===Experimental design===
This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical.
Certain parameters of the configuration set in <span class="blue">roms_cod_1dmix.in</span> allow you to easily vary
# the initial thermal stratification 
# water depth
# Coriolis frequency
# surface heat flux
# surface wind stress
# the magnitude and period of an oscillating body force to emulate tidal velocity fluctuations
These are set in a block of code headed '''Generic User parameters'''
<div class="box">! Generic User parameters, [1:NUSER].</br></br>        NUSER =  8</br>!      user parameters for COD 1DMIX case
!              Coriolis  depth    wind    heat  strat    press    tidal    wave
!                  f      h    stress    flux    dTdz      grad  period  dissip
! simple steady wind
        USER =  1.0d-04  20.0d0  0.06d0  0.0d0  0.5d0    0.0d0  12.42d0  0.01d0</div>

Revision as of 17:55, 30 January 2022

ROMS examples for Coastal Ocean Dynamics

Introduction

The page describes idealized configurations of ROMS that are used in Rutgers course 16:712:503 Coastal Ocean Dynamics to illustrate various aspects of ocean dynamics studied in lectures.

Obtaining the source code for examples

In almost all instances the ROMS files that have been customized for these examples are on the Rutgers OARC Amarel cluster amarel.rutgers.edu in directory /projects/dmcs_1/courses/cod. Users must be a member of group dmcs_1 to access these files.

To get started, copy all the files in /projects/dmcs_1/courses/cod to the working directory where you are locally compiling and running ROMS> This is the directory where you ran the UPWELLING test case.

Verify you are in your working directory with

pwd

Then copy everything with a command like this:

cp /projects/dmcs_1/courses/cod/* .

The * is the wildcard for all files in /projects/dmcs_1/courses/cod, and the dot . signifies that the target directory is the directory you are in.

Later in the class some of these files will be updated, and new files added, and when you copy them you will want to be more selective than using the * wildcard if you don't want to overwrite files you have modified for your own work.

What are these files?

cod_*.h files

Each class example has its own cod_*.h file that will be activated to control compilation by setting ROMS_APPLICATION in your personal build_bash.sh script. For example, for COD_1DMIX, you will edit build_bash.sh to set:

export ROMS_APPLICATION=COD_1DMIX

instead of the case UPWELLING that you had when you first ran ROMS.

Once you have copied the cod_*.h file to your working directory, and modified build_bash.sh, recompile by running the build script as you did before, e.g.

./build_bash.sh -j 4

This will create a new romsM executable file to run the COD example.

ana_*.h files

The analytical files are new versions of files in the ROMS/Functionals subdirectory that you downloaded with svn that have been modified to have blocks of code for each of the class examples. The modifications are marked by C-PreProcessor (CPP) directives such as, for example:

#ifdef COD_1DMIX
...
#endif

which will cause that section of code to be compiled when option COD_1DMIX is defined.

This is the way in which we modify ROMS for our own purposes. We can safely have the code for all the COD examples in one version of each ana_*.h file because the code segments are selectively activated with CPP directives.

Some of the class examples use default settings in the analytical files and do not need special instructions.

cod_*.in files

Each class example has its own roms_cod_*.in file that ROMS will read at run-time. This is equivalent to the file roms_upwelling.in that you used when you first ran ROMS.

The job.sh script you use to submit the class examples to the SLURM scheduler with the command sbatch job.sh will have to be modified (at the srun command) to use the appropriate roms_cod*.in file. For example:

srun --mpi=pmi2 ./romsM roms_cod_1dmix.in

Configuring your working directory files

For each class example you will go through the following steps to start.

Refer back to the instructions above for guidance:

  1. Copy the necessary COD example case files to your working directory.
  2. Modify build_bash.sh to set ROMS_APPLICATION=, for example COD_1DMIX
  3. Compile ROMS, i.e. run build_bash.sh
  4. Modify your job.sh script to pass the correct input file, for example roms_cod_1dmix.in, to the srun command
    Note Notice: You must also modify job.sh to request the appropriate number of tasks. Review the entries for NtileI and NtileJ in roms_cod_*.in file and set the correct values.
  5. Submit the job to SLURM with sbatch
  6. Check for the creation of the netcdf output files.
  7. View the output and error log files, i.e. the files named something like out.hal0007.12345678.log and err.hal0007.12345678.log to verify the run was successful, or diagnose the problem.

In these examples certain parameters are set in roms_cod_*.in to allow you to easily vary the configuration and explore how the ocean responds by re-running the example without recompiling.

Example COD_1DMIX

Experimental design

This example has been configured as a 3x3 horizontal grid points doubly-periodic domain. The restrictive number of horizontal points and the double periodicity causes the solution to degenerate to one that can only vary in the vertical.

Certain parameters of the configuration set in roms_cod_1dmix.in allow you to easily vary

  1. the initial thermal stratification
  2. water depth
  3. Coriolis frequency
  4. surface heat flux
  5. surface wind stress
  6. the magnitude and period of an oscillating body force to emulate tidal velocity fluctuations

These are set in a block of code headed Generic User parameters

! Generic User parameters, [1:NUSER].

NUSER = 8
! user parameters for COD 1DMIX case

! Coriolis depth wind heat strat press tidal wave ! f h stress flux dTdz grad period dissip ! simple steady wind

USER = 1.0d-04 20.0d0 0.06d0 0.0d0 0.5d0 0.0d0 12.42d0 0.01d0