New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Users/ModelInterfacing/AGRIF (diff) – NEMO

Changes between Version 8 and Version 9 of Users/ModelInterfacing/AGRIF


Ignore:
Timestamp:
2018-08-31T11:53:28+02:00 (6 years ago)
Author:
jchanut
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Users/ModelInterfacing/AGRIF

    v8 v9  
    1111== Overview 
    1212 
    13 AGRIF (Adaptive Grid Refinement In Fortran) is a library that allows the seamless refinement of rectangular regions in NEMO. Activating AGRIF requires to append the cpp key "key_agrif" at compilation time:  
     13AGRIF (Adaptive Grid Refinement In Fortran) is a library that allows the seamless space and time refinement over rectangular regions in NEMO. Refinement factors can be odd or even (usually lower than 5 to maintain stability). Interaction between grid is "Two-ways" in the sense that the parent grid feeds the child grid open boundaries and the child grid provides volume averages of prognostic variables once a given number of time step is completed. 
     14This pages provides guidelines how to use AGRIF in NEMO. For a more technical description of the library itself, please refer to the following page: [http://agrif.imag.fr]. 
     15 
     16== Compilation 
     17Activating AGRIF requires to append the cpp key "key_agrif" at compilation time:  
    1418{{{ 
    1519./makenemo add_key "key_agrif" 
     
    1721Although 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.  
    1822 
    19 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:  
     23 
     24== Definition of grid hierarchy 
     25An additional text file "AGRIF_FixedGrids.in" is 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:  
    2026{{{ 
    21271 
     
    23290 
    2430}}} 
    25 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 below and in the AGRIF_DEMO reference configuration directory (NEMO 4.0 only).  
    26  
    27 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. 
    28  
    29 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.  
    30  
    31 == AGRIF Compatibility from NEMO 3.6 to NEMO 4.0  
     31The first line indicates the number of zooms (1). The second line contains the starting and ending indices 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 below and in the cfgs/AGRIF_DEMO/EXPREF reference configuration directory (NEMO 4.0 only).  
     32 
     33Note that rectangular regions must be defined so that they are connected to a single parent grid. Hence, defining overlapping grids with the same refinement ratio will not work properly, boundary data exchange and update being only performed between root and child grids. Use of east-west periodic or north-fold boundary conditions is not allowed in child grids either. Defining for instance a circumpolar zoom in a global model is therefore not possible.  
     34 
     35== Preprocessing 
     36Knowing the refinement factors and area, a pre-processing tool (utils/tools/NESTING directory) may help to create needed input files (mesh file, restart, climatological and forcing files). The key 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 utils/tools/NESTING directory as a guide. These correspond to the namelists used to create AGRIF_DEMO inputs.  
     37 
     38== Namelist options 
     39Each child expects to read its own namelist so that different numerical choices can be made (these should be stored in the form 1_namelist_cfg, 2_namelist_cfg, etc... according to their rank in the grid hierarchy). Consistent time steps and number of steps with the chosen time refinement have to be provided. Specific to AGRIF is the following block: 
     40{{{ 
     41!----------------------------------------------------------------------- 
     42&namagrif      !  AGRIF zoom                                            ("key_agrif") 
     43!----------------------------------------------------------------------- 
     44   ln_spc_dyn    = .true.  !  use 0 as special value for dynamics 
     45   rn_sponge_tra = 2880.   !  coefficient for tracer   sponge layer [m2/s] 
     46   rn_sponge_dyn = 2880.   !  coefficient for dynamics sponge layer [m2/s] 
     47   ln_chk_bathy  = .false. !  =T  check the parent bathymetry 
     48/ 
     49}}} 
     50where sponge layer coefficients have to be chosen according to the child grid mesh size. 
     51 
     52== Available in the forthcoming 4.0 
     53The [wiki:Users/Announcement_4.0.beta_release 4.0 beta release is now available] and includes new capabilities, configurations and test cases with AGRIF: 
     54 
     55=== New capabilities from NEMO 3.6 to NEMO 4.0  
    3256AGRIF is continuously maintained so that it could 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. 
    3357 
     
    117141      |- 
    118142      {{{#!th 
     143        East-west periodic and/or north fold bcs in zooms 
     144      }}} 
     145      {{{#!th 
     146        no 
     147      }}} 
     148      {{{#!th 
     149        no 
     150      }}} 
     151      |- 
     152      {{{#!th 
    119153        Online timing 
    120154      }}} 
     
    158192  }}} 
    159193 
    160  * Important notice concerning the change of ghost cells number: 
    161 The default number of ghost cells (i.e. the number of cells that serve as open boundary data provision) has been increased from 1 to 3 in NEMO 4.0. This allows to properly handle boundary conditions for numerical scheme that have a discretization order greater than 2. On the user point of view this does not change anything except in the definition of level 1 grids in the AGRIF_FixedGrids.in file. In order to retrieve exactly the position of a nested grid in NEMO 4.0 one has to shift indices by 2 points to the south-west. Taking the VORTEX example above for NEMO 4.0, the "old" NEMO 3.6 corresponding file would contain: 
     194 * [[span(''Important notice concerning the change of ghost cells number:'', style=background-color:yellow)]] 
     195The default number of ghost cells (i.e. the number of cells that serve as open boundary data provision) has been increased from 1 to 3 in NEMO 4.0. This allows to properly handle boundary conditions for numerical schemes that have a discretization order greater than 2. On the user point of view this does not change anything++ except in the definition of level 1 grids in the AGRIF_FixedGrids.in file. In order to retrieve exactly the position of a nested grid in NEMO 4.0 one has to shift indices by 2 points to the south-west. Taking the VORTEX example above for NEMO 4.0, the "old" NEMO 3.6 corresponding file would contain: 
    162196{{{ 
    1631971 
     
    1651990 
    166200}}} 
    167 Of course, output files are now greater by 4 points in each direction. 
    168  
    169 == Available in the forthcoming 4.0 
    170 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: 
     201++ Of course, output files are now greater by 4 points in each direction. 
    171202=== New reference configuration with AGRIF: AGRIF_DEMO  
    172203 
    173 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.    
     204AGRIF_DEMO is based on the [wiki:Users/ReferenceConfigurations/ORCA2_LIM3_PISCES] global 2° configuration but it includes 3 online nested grids that 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.    
    174205  {{{#!td style="border: none;" 
    175206    [[Image(wiki:Users/ModelInterfacing/AGRIF:AGRIF_DEMO.jpg,width=600)]] 
     
    188219 
    189220=== New tests cases demonstrating some major features of AGRIF with NEMO: 
    190  * ICEDYN:  
     221 * tests/ICEDYN:  
     222 
     223[[span(''Clement to add an illustration here ?'', style=background-color:lime)]] 
     224 
    191225This 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. 
    192226 
    193  * VORTEX: 
     227 * tests/VORTEX: 
    194228This 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.  
    195229  
     
    197231    [[Image(wiki:Users/ModelInterfacing/AGRIF:VORTEX_anim.gif,width=600)]] 
    198232  }}} 
    199  
    200 == AGRIF in NEMO documentation 
    201 [[span(''To be completed'', style=background-color:lime)]] 
    202  
    203 * general 
    204 * How to set up a new configuration 
    205 * ...