Creating nested domains with DOMAINcfg

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

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 with the same size as ?

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 has the required number of points following what you have defined in your file. You apparently provide and 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 and 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 and 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 file. You can find information about how that here:

Thank you for the explanation.

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

157 366 123 226 3 3 3

The resulted is 635 x 317

When I try to use another values 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
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, be careful: you must provide compliant child grid sizes in your 1_namelist_cfg. You may use the python script that’s does that for you.