Creating nested domains with DOMAINcfg

I use DOMAINcfg to create initial conditions for nested domains, e.g. domain_cfg.nc and 1_domain_cfg.nc files.
I found that 1_domain_cfg.nc is bigger than 1_coordinates.nc and 1_bathy_meter.nc by 4 points.
For example,
1_bathy_meter.nc and 1_coordinates.nc are 631 x 313 points but 1_domain_cfg.nc is 635 x 317 points.
Also, it seems that area in 1_domain_cfg.nc is shifted to the south-west by 5 points so that
(6,6)-point in 1_domain_cfg.nc coincides with (1,1)-point in 1_coordinates.nc.

I use the following options 1_namelist_cfg

!-----------------------------------------------------------------------
&namagrif      !  AGRIF zoom                                            ("key_agrif")
!-----------------------------------------------------------------------
   ln_vert_remap = .false. ! volume conserving update
   ln_remove_closedseas = .true. ! Fill lakes inside zoom
   npt_connect   = 4
   npt_copy      = 2
/

My questions are:

  1. What does parameters npt_connect and npt_copy mean ?
  2. Is it possible to create 1_domain_cfg.nc with the same size as 1_coordinates.nc ?

npt_copy and npt_connect are numbers of coarse grid points.

  • npt_copy refers to the width of a zone right inside the child grid where the child bathymetry is exactly set to the parent one (so basically it is constant by blocks of nrafx X nrafy child grid points).
  • npt_connect refers to the width of a “connecting zone” right after the “copy zone” where the child bathymetry is linearly blended with the parent bathymetry.

These do not change neither the child grid size nor the grid positioning. You should not change these (the npt_copy parameter in particular that matches the “sponge zone” used in NEMO.)

The 1_domain_cfg.nc has the required number of points following what you have defined in your AGRIF_FixedGrids.in file. You apparently provide 1_bathy_meter.nc and 1_coordinates.nc files that do not comply with the expected size. The code should not allow this, even if it does.

My questions:

  1. How did you get your 1_bathy_meter.nc and 1_coordinates.nc files ? From the previous NESTING_TOOLS ? If so, grid positioning over the parent grid has changed: It would be normal to have a shift.

  2. What is your refinement factor ?

If you extract your 1_bathy_meter.nc and 1_coordinates.nc files from a global grid, the right way to go is extract the zone that exactly matches the lon/lat coordinates you have in your 1_domain_cfg.nc file. You can find information about how that here:
https://sites.nemo-ocean.io/user-guide/zooms.html#how-do-i-retrieve-the-exact-zoom-positioning-over-the-parent-grid

Thank you for the explanation.

I use NEMO for coupled modelling with WRF.
I prepare 1_ bathy_meter.nc and 1_coordinates.nc myself so that the nested domain in NEMO matches the nested domain in WRF.
My refinement factor is 3.
1_bathy_meter.nc and 1_coordinates.nc are both 631 x 313
I use AGRIF_FixedGrids.in

1
157 366 123 226 3 3 3
0

The resulted 1_domain_cfg.nc is 635 x 317

When I try to use another values in AGRIF_FixedGrids.in (for example, 158 366 124 226), DOMAINcfg fails with a message

 AGRIF boundaries and ghost cells:
 lk_west T
 lk_east T
 lk_south T
 lk_north T
 nbghostcells_y_s           4
 nbghostcells_y_n           4
 nbghostcells_x_w           4
 nbghostcells_x_e           4
 nbcellsx =          624
 nbcellsy =          306
 Ni0glo =          631
 Ni0glo should be:  632
  ===>>> : E R R O R
          ===========
 STOP
mpp_init: Agrif children requires Ni0glo == nbcellsx + nbghostcells_x_w + nbghostcells_x_e

It seems to me that the size of a nested domain in NEMO must be 3 nx + 8, 3 ny + 8
So it is impossible to create a nested domain, which is 631 x 313.
Am I correct?

You’re right. BTW, if changing values in AGRIF_FixedGrids.in, be careful: you must provide compliant child grid sizes in your 1_namelist_cfg. You may use the make_namelist.py python script that’s does that for you.