Preprocessing of the grids

This part describes how to generate the grids and make the bathymetries consistent. Parentgrid and the childgrids must be coherent where they overlap to avoid numerical casualties.

1.Build grids with BMGTOOLS

  1. Build of the grids

The first step is to build the grids with the user graphical interface of BMGTOOLS.

The user define the boundaries of his Parentgrid and can embed one or several childgrids with the Agrif nesting method. Then a text file called Agrif_Fixed.in describe the different agrif grids and will be read by the model.

Description of Agrif_Fixed.in

1
*number of childgrid in the mother grid*
423 486 241 306 5 5 5 0
*index of western boundary of the childgrid in the mother grid,eastern index, southern index, northern index, x-refinement coef, y-refinement coef, time refinement coef, z refinement coef
1
*number of childgrid in the previous childgrid*
114 178 243 286 5 5 5 0
0

The z refinement coefficient is not used in MARS so it should be set to 0.

The time refinement coefficient should be not necessary equal to the spatial refinement coefficients

Exemple of Agrif_Fixed.in file for the seven zooms of MANGAE2500

7
564 615 394 455 5 5 5 1  ! pdc
494 576 367 403 5 5 5 1  ! seine
421 497 333 395 5 5 5 1  ! armor
345 426 291 368 5 5 5 1  ! finis
423 486 241 306 5 5 5 1  ! loire
479 520 145 250 5 5 5 1  ! gironde
436 500 101 149 5 5 5 1  ! adour
0
0
0
0
0
0
0
_images/visus_zooms.png

Exemple of Agrif_Fixed.in file for 2 embedded zooms in MANGAE2500

1
423 486 241 306 5 5 0 0
1
114 178 243 286 5 5 0 0
0
_images/agrif_zoom2.png
  1. Bathymetry interpolation

This step is the same as classic configuration. Scattered or gridded data are interpolated on the differents grids.

Two options are possible :

  • use of interp_bathy (cargen interpolator for soundings or SCRIP for mnt)
  • use of interp_sondes with the krigeage algorithm for soundings

see the documentation for more precisions: http://wwz.ifremer.fr/mars3d/Les-outils/BathyMeshGridTOOLS

2.Treatments of the bathymetries

This part use a python script (make_bathy_final.py) which does the same thing as the routine bathy.F90 The user should activate the key_bathy_final in the makefile.

The user has to customize this scripts with the list of the grids to treat and activate the corresponding process described below. The river section is not generic and should be taken as a template to make its own treatments.

Steps of the script :

  • apply the Roms filter if needed
  • apply a Hanning filter if needed
  • adding mean sea level to the water depth
  • redefine H0 from HX and HY
  • compute goulet and govlet for rivers

dependences :

  • save_hxhy_orig.py
  • tools_fortran.f90

prerequisites:

The following treatments must be done on all the grid from BMGTOOLS

::
ncatted -h -a history,global,o,c,”Version 1.0 from INTER_BATHYn” $file ncatted -h -a history,global,a,c,”Modifications of _FillValue of Hx,Hy and H0 for MARS3D usen” $file ncatted -h -a _FillValue,H0,o,f,-999. $file ncatted -h -a _FillValue,HX,o,f,-999.01 $file ncatted -h -a _FillValue,HY,o,f,-999.01 $file ncatted -h -a _FillValue,H0_raw,o,f,-999. $file ncatted -h -a _FillValue,HX_raw,o,f,-999. $file ncatted -h -a _FillValue,HY_raw,o,f,-999. $file

use :

python make_bathy_final.py 1 0  # for the first grid of the list
python make_bathy_final.py 2 0  # for the second grid

3.Connect the grids

Here is the most important part of the preprocessing in Agrif. The bathymetry of the Parentgrid should be consistent with the childgrids. The script connect_topo.f90 is in charge of that.

Steps of the program :

  • Look for connections meshes (borders along 3 meshes between the parent grid and the childgrid)
  • Interpolate the Parent Grid bathymetry to the same resolution of the Child grid
  • On this Parent grid at high resolution, some treatments are performed :
    • Where child grid does not overlap the bathymetry is the same
    • Inside the area (excluding 3 points of the borders) of each Child grid the bathymetry of the Child grid is taken
    • Along the borders of the Child grid (excluding land of course) a smooth is performed between the bathymetry of the Parent grid and the one of the child grid
  • At the end both of Parent and Child grids are modified

dependences:

  • module_netcdf_utils.f90
  • module_error.f90
  • interp.f90

prerequisites:

  • The bathymetries files should come from make_bathy_final step.
  • The Agrif_Fixed.in file is needed and should be in the directory where the program is launched

use:

  • One parent and one child grid :

    ./connect_topo parent_grid.nc child_grid.nc
    
  • One parent and several child grids :

    ./connect_topo parent_grid.nc child_grid1.nc child_grid2.nc ... child_gridn.nc
    
  • One mother grid, one child and one grand child :

    ./connect_topo child_grid.nc grand_child_grid.nc
    ./connect_topo parent_grid.nc child_grid.nc