2. Build domain configuration file - NOC-MSM/SEAsia GitHub Wiki

To create a new configuration a domain configuration file must be created that defines the grid. This only needs to be done once for a new configuration. This includes bathymetry, depth and horizontal grid discretisation.

Make tools

Edit make_paths.sh as necessary, then execute

cd SCRIPTS
. ./make_paths.sh
. ./make_directories.sh
. ./make_tools.sh

Make coordinates file

Start with a coordinates file from a parent NEMO simulation (E.g. Global 1/12deg ORCA). This parent coordinates file is saved in the DOWNLOADS folder and renamed coordinates_ORCA_R12.nc. This file stores the horizontal grid information.

The following script simply crops out the area of interest, preserving the resolution. (This should be done in a fresh kernel as the required nco tools can clash with other modules previously used.)

. ./make_coordinates_from_parent_SEAsia.sh

The output is a coordinates.nc file.

For more complex problems, such as mesh refinement, the AGRIF tool can be used. This AGRIF NESTING tool is used to generate child grid horizontal coordinates from the parent grid. To control this one needs to figure out the indices of the child domain start and end, and also the resolution scale factor. This information is edited in the BUILD_CFG/DOMAIN/namelist.input file. An outline workflow is given (and commented out) in the above script.

Make bathymetry file

This is managed by the

./make_bathymetry_from_parent_SEAsia.sh

script, which extracts the chosen subdomain from the parent model bathymetry file.

Here the SCRIP tool is used to interpolate a supplied bathymetry file onto the specified target coordinates.

Minor modifications can then be applied to the output bathymetry to open straits, set a minimum depth, or handle spurious land or inland lakes. E.g. adjust_bathymetry_SEAsia.sh (Execute this is a fresh shell as it might otherwise result in a conflict with the modules previously used or yet to be used.)

The output is a $DOMAIN/bathy_meter.nc file.

Make the domain configuration file

Finally generate the domain_cfg.nc file using the coordinates.nc, bathy_meter.nc. This is done in the tools directory using make_domain_cfg.sh script. The tools used are the DOMAINcfg and REBUILD_NEMO tools. The DOMAINcfg tool is submitted as a slurm job.

If making changes to the configuration, these are controlled by the namelist_cfg file. Ensure this has the appropriate parameters and number of lat,lon,depth levels etc set.

For example the lateral size of the domain can be extracted from bathy_meter.nc using ncdump -h bathy_meter.nc, then namelist can be edited accordingly e.g.:

vi namelist_cfg
   ...
   jpidta      =     681   !  1st lateral dimension ( >= jpi )
   jpjdta      =     551   !  2nd    "         "    ( >= jpj )
   jpkdta      =      31   !  number of levels      ( >= jpk )
   ...

When ready, run:

cd SCRIPTS
. ./make_domain_cfg.sh

creating $DOMAIN/domain_cfg_SEAsia.nc

⚠️ **GitHub.com Fallback** ⚠️