Skip to content

1. Create the input mesh files (for both parent & child domains)

tbrivoal edited this page Nov 22, 2022 · 5 revisions

0. Quick note on AGRIF nomenclature

  • When you use agrif, the files which are used only for the nest(s) are written 1_{filename} for the first nest, 2_{filename} for the second and so on.

1. Retrieve emodnet bathymetry

  • follow the steps:

1: Download emodnet tiles (emodnet 2018 was used for BIZoo, but this should be similar with newer emodnet versions) => https://emodnet.ec.europa.eu/en

2: A tool to merge emodnet tiles is available here. To use the tool:

./1_interp_tiles_on_full_emodnet.sh # interpolate tiles on the full emodnet grid with 
./2_merge_tiles_2018.py merge tiles with 
  • At this point, you should have a netcdf file with the emodnet bathymetry bathy_emodnet_on_EMODNET_2018.nc

2. Create the parent domain_cfg.nc file

NEMO4.X versions now need a file domain_cfg.nc that contains the coordinates of the configuration. The first step is to create it for the parent configuration only (e.g: eNEATL36). To do this, use the DOMAINCFG tool in NEMODIR/tools/DOMAINcfg, compiled without key_agrif (see NEMO4 book for more informations about this step).


3. Create AGRIF_FixedGrids.in file

The AGRIF_FixedGrids.in file contains the information about the position of the nest in the parent grid. The file should contain at least three lines (for 1 zoom, and more if there is several nests) such as (for the BIZoo nest) :

    1
    220 1073 350 1245 3 3 3
    0

The first line indicates the number of zooms (1). The second line contains the starting and ending indices in both directions on the root grid (imin=220 imax=1073 jmin=350 jmax=1245) followed by the space and time refinement factors (3 3 3). The last line is the number of child grid nested in the refined region (0). A more complex example with telescoping grids can be found below and in the AGRIF_DEMO reference configuration directory.


4. First creation of the domain_cfg.nc files for both parent and child grids

  • Follow the steps:

1: Compile the DOMAINCFG tool with the cpp key 'key_agrif' added in cpp_DOMAINcfg.fcm file

2: run the DOMAINCFG tool

  • To run the tool with agrif, you should have one namelist per grid: in our case, one namelist 'namelist_cfg' for the parent grid, and another one 1_namelist_cfg for the child grid.

    • To create the namelists, a tool is available "NEMODIR/tools/DOMAINcfg" : make_namelist.py, the tool creates both namelists
    • You can also find namelists examples here.
  • As it is the first time you create the nest (1_domain_cfg.nc) coordinate file, you need to change some parameters of 1_namelist_cfg such as nn_bathy, cn_topo, cn_bath, cn_lon and cn_lat parameters in &namdom (see example below).

    • if you want the bathymetry to be generated from an external bathymetry dataset such as emodnet, put nn_bathy=1
    • if you already have the bathymetry file on the nest grid and nn_bathy=3 otherwise.
  • In our case, with emodnet, you should have (in &namdom):

ln_read_cfg = .false.   !  Read from a domain_cfg file
nn_bathy    =    2      ! = 0 compute analyticaly
                        ! = 1 read the bathymetry file
                        ! = 2 compute from external bathymetry (should be on a regular grid)
                        ! = 3 compute from parent (if "key_agrif")
cn_topo = 'emodNET_2018.nc' ! Name of the bathymetry file 
cn_bath = 'bathymetry' ! Name of the bathymetry variable in cn_topo
cn_lon = 'lon' ! Name of longitude in cn_topo
cn_lat = 'lat' ! Name of latitude in cn_topo
  • Finally, run the domain cfg tool (a run script is available here).

  • At this point, you should have the two coordinate files created : domain_cfg.nc (parent) and 1_domain_cfg (nest).