.. _doc.agrif.code: Presentation of the library --------------------------- The library is described and fully documented on this website : http://www-ljk.imag.fr/MOISE/AGRIF/ Another doc is available here :download:`AGRIF ` *Here is a short introduction taken from the site:* AGRIF is a Fortran 90 package for the integration of full adaptive mesh refinement (AMR) features within a multidimensional finite difference model written in the Fortran language. Its main objective is to simplify the integration of these capacities in an existing model with almost no changes in this one. The package mainly consists into two parts: * it first provides some model-independent Fortran 90 procedures implementing the different parts of an AMR process:time integration of the grid hierarchy, refinement procedure, and more; * the analysis of a configuration file written by the user provides the Fortran model-dependent code. The model dependent and independent parts are then linked into a library containing all the necessary procedures to integrate the AMR capacities in a finite difference model. The main characteristic of AGRIF is to implement the Berger-Oliger's AMR method concerning the time integration of the grid hierarchy and the mesh refinement procedure. It is about: * the time integration of the grid hierarchy: the root grid is integrated before the fine grids, allowing to provide them with some boundary conditions; * the mesh refinement procedure; * the points detection and the clustering. Agrif : How does it work ? -------------------------- 1. Grid refinement .. image:: FIG/AGRIF/schema_agrif.jpg 2. Temporal scheme .. image:: FIG/AGRIF/agrif_time_scheme.jpg Integration in MARS model -------------------------- To integrate the library in the source code, the user needs : * to write a configuration file which contains model’s description. This file is read by the CONV during the code compilation, * A file where fixed grids are defined (*mars_agrif.in*), * The file Agrif_User.F90 which contains users subroutines, * The file agrif2model.F90, which make the link between the model and the agrif library (this file should not be modify). * *Agrif_User.F90* : * allocation and declaration of variables * initialisation of each child grid from the Parent grid * update of the parent grid from the child grids * The modules which manage the interpolation and the apply of boundary conditions on the child grids are : * *agrifssh.F90* for sea surface height * *agrifcu.F90* and *agrifv.F90* for barotropic velocity * *agrifcuz.F90* and *agrifvz.F90* for baroclinic velocity * *agrifts.F90* for temperature and salinity * *agrifsub.F90* for substances * *agrifturb.F90* for KZ and NZ * The module *updateagrif.F90* contains subroutines to perform update from child to parent grids * The module *makegridsconnection.F90* manage connexion in Childgrids overlaping areas Grids management in AGRIF --------------------------------------------------------------- Agrif_Declare_Variable ++++++++++++++++++++++ TO COMPLETE Agrif_Declare_Variable((/stag/),(/first index/),(/’dim’/),(/ibegin/),(/iend/),variable id) * **stag** : Position of the variable in the cell : 1 (noncentered) or 2 (centered) * **first index** : array index of the first point in the reference grid * **dim** : ’x’, ’y’, ’z’ or ’N’ (’N’ means no refinement in that direction) * **variable id** is an integer