Skip to content

8. Generate Open Boundary Conditions

jenjar93 edited this page Oct 5, 2022 · 1 revision

This page shows how to generate open boundary conditions for T, S, U and V using the PyNEMO tool. It is assumed the miniconda package has already been installed (see here), and the tides have already been generated (see here).

1. Update the namelist

For simplicity, the namelist used when generating the full open boundary conditions (i.e. without tides) is namelist.bdy. Check the namelist to ensure there are no dummy variables, all symbolic links are active, and the paths are up to date. Also ensure all paths in the CMEMS.ncml file are correct.

!------------------------------------------------------------------------------
!  unstructured open boundaries
!------------------------------------------------------------------------------
    ln_coords_file = .true.               !  =T : produce bdy coordinates files
    cn_coords_file = 'coordinates.bdy.nc' !  name of bdy coordinates files
                                     !  (if ln_coords_file=.TRUE.)
    ln_mask_file   = .true.               !  =T : read mask from file
    cn_mask_file   = './bdy_mask.nc'            !  name of mask file
                                     !  (if ln_mask_file=.TRUE.)
    ln_dyn2d       = .true.               !  boundary conditions for
                                          !  barotropic fields
    ln_dyn3d       = .true.               !  boundary conditions for
                                          !  baroclinic velocities
    ln_tra         = .true.               !  boundary conditions for T and S
    ln_ice         = .false.              !  ice boundary condition
    nn_rimwidth    = 9                    !  width of the relaxation zone


!------------------------------------------------------------------------------
!  Time information
!------------------------------------------------------------------------------
    nn_year_000     = 1993        !  year start
    nn_year_end     = 1993        !  year end
    nn_month_000    = 08          !  month start (default = 1 is years>1)
    nn_month_end    = 08          !  month end (default = 12 is years>1)
    sn_dst_calendar = 'gregorian' !  output calendar format
    nn_base_year    = 1900        !  base year for time counter

2. Run PyNEMO

Due to the breadth of data, it is advisable to run PyNEMO as a slurm script, e.g. submitpynemo.slurm. Edit the $OBC path and namelist name accordingly.

#!/bin/bash
#SBATCH --job-name=pynemo
#SBATCH --time=00:10:00
#SBATCH --nodes=1
#SBATCH --ntasks=3
#SBATCH --account=n01-SANH
#SBATCH --partition=serial
#SBATCH --qos=serial

source ~/.bashrc
conda activate pynemo
cd $OBC
pynemo -s namelist.bdy

To run the slurm script:

sbatch submitpynemo.slurm 

The generated files should be stored in the OUTPUT directory.

3. Dummy dates

Occasionally, you may need to use dummy dates when running PyNEMO. This is usually the case when generating OBC for January or December, when there is no previous or subsequent data.

PyNEMO requires daily data files for the whole month, including a day before and after. If no data exists for these before/after dates, we can use the CMEMS.ncml files to manually force PyNEMO to read a duplicated date.

For example, the SANH hindcast run starts on the 1st January 1993, which is the beginning of the CMEMS dataset. To "trick" PyNEMO into running, we duplicate the 1st January and rename it to reflect the 31st December:

cp CMEMS_1993_01_01_download.nc CMEMS_1992_12_31_download.nc 

In the CMEMS.ncml, we specify the time stamp for this particular file, so PyNEMO reads it as the 31st December 1992, e.g.:

<netcdf location="/work/n01/n01/$USER/SANH/BOUNDARY_FORCING/CMEMS_data/1993/CMEMS_1992_12_31_download.nc"        coordValue="376932" />

This needs to be repeated with the UV CMEMS files, too.

An example of this edited ncml file is CMEMS_Jan.ncml, found in $GITCLONE/OBC/.