= Using AGRIF for embedded zooms in NEMO [[PageOutline(2-3)]] Last edition: '''[[Wikinfo(changed_ts)]]''' by '''[[Wikinfo(changed_by)]]''' [[span(Page in progress, style=background-color:lime)]] == Overview AGRIF (Adaptive Grid Refinement In Fortran) is a library that allows the seamless refinement of rectangular regions in NEMO. Activating AGRIF requires the cpp key "key_agrif" to be defined at compilation time. Although this is transparent to users, the way the code is processed during compilation is different from the standard case: a preprocessing stage (the so called "conv" program) translates the actual code so that saved arrays may be be switched in memory space from one domain to an other. An additional text file "AGRIF_FixedGrids.in" is also required at run time. This is where the grid hierarchy is defined. An example of such a file, here taken from the VORTEX test case, is given below: {{{ 1 19 38 19 38 3 3 3 0 }}} The first line indicates the number of zooms (1). The second line contains the starting and ending indexes in both directions on the root grid (19 38 19 38) 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 in the AGRIF_DEMO reference configuration directory (NEMO 4.0 only). Note that rectangular regions must be defined so that they are connected to a single parent grid. Hence, defining for instance overlapping grids with the same refinement ratio will not work properly, boundary data exchange and update being only performed between root and child grids. Knowing the refinement factors and area, a pre-processing tool (NESTING directory in tools) may help to create needed input files (mesh file, restart, climatological and forcing files). The key here to maintain robustness is to ensure volume matching near the child grid interface, a step done by invoking the Agrif_create_bathy.exe program. You may use the namelists provided in the NESTING directory as a guide. These correspond to the namelists used to create AGRIF_DEMO inputs. AGRIF is continuously maintained so that it can be activated with all NEMO components (OPA, sea-ice, TOP). Depending on NEMO version, it is nevertheless not the case so that some options may not be compatible with the use of online grid refinement. Check out the table below to know the status according to the NEMO release you may use. {{{#!td style="border: none;" {{{#!table {{{#!th Component or option compatible with AGRIF }}} {{{#!th NEMO 3.6 }}} {{{#!th NEMO 4.0 }}} |- {{{#!th LIM2 }}} {{{#!th yes }}} {{{#!th - }}} |- {{{#!th LIM3/SI3 }}} {{{#!th no }}} {{{#!th yes }}} |- {{{#!th TOP }}} {{{#!th yes }}} {{{#!th yes }}} |- {{{#!th z* }}} {{{#!th no }}} {{{#!th yes }}} |- {{{#!th Icebergs }}} {{{#!th no }}} {{{#!th no }}} |- {{{#!th Vertical coordinate change in zooms (key_vertical) }}} {{{#!th no }}} {{{#!th yes, but not tested }}} |- {{{#!th Number of ghost cells }}} {{{#!th 1 (hard coded) }}} {{{#!th 3 (parameter) }}} }}} }}} == Available in the 3_6 revision of NEMO [[span(''To be completed'', style=background-color:lime)]] === AGRIF demonstrator in reference configuration * The [wiki:Users/ReferenceConfigurations/ORCA2_LIM3_PISCES global reference configuration includes a demonstrator for using AGRIF in NEMO] == Available in the forthcoming 4.0 The [wiki:Users/Announcement_4.0.beta_release 4.0 beta release is now available] and includes new configurations and test cases with AGRIF, see below: === New reference configuration with AGRIF: AGRIF_DEMO AGRIF_DEMO is based on the [wiki:Users/ReferenceConfigurations/ORCA2_LIM3_PISCES] global 2° configuration but it includes 3 online nested grids that should demonstrate the overall capabilities of AGRIF in a realistic context, including nesting sea ice models. The configuration includes a 1:1 grid in the Pacific and two successively nested grids with odd and even refinement ratios over the Arctic ocean. The finest grid spanning the whole Svalbard archipelago is of particular interest to check that sea ice coupling is done properly. The 1:1 grid, used alone, is used as a benchmark to check that the solution is not corrupted by grid exchanges. Note that since grids interact only at the baroclinic time level, numerically exact results can not be achieved in the 1:1 case. One has to switch to a fully explicit in place of a split explicit free surface scheme in order to retrieve perfect reproducibility. {{{#!td style="border: none;" [[Image(wiki:Users/ModelInterfacing/AGRIF:AGRIF_DEMO.jpg,width=600)]] }}} === New tests cases demonstrating some major features of AGRIF with NEMO: * ICEDYN: This is an East-west + north-south periodic channel. The configuration includes an AGRIF zoom (1:3) in the middle of the basin to test how an ice patch is advected through it but one can also test the advection schemes (Prather and Ultimate-Macho) by removing the key_agrif in the cpp keys. * VORTEX: This test case illustrates the propagation of an anticyclonic eddy over a Beta plan and a flat bottom. It is implemented here with an online refined subdomain (1:3) out of which the vortex propagates. It serves as a benchmark for quantitative estimates of nesting errors as in Debreu et al. (2012), Penven et al. (2006) or Spall and Holland (1991). The animation below illustrates, with two 1:2 successfully nested grids, how the vortex smoothly propagates out of the refined grids. {{{#!td style="border: none;" [[Image(wiki:Users/ModelInterfacing/AGRIF:VORTEX_anim.gif,width=600)]] }}} == AGRIF in NEMO documentation [[span(''To be completed'', style=background-color:lime)]] * general * How to set up a new configuration * ...