How to create AGRIF nest for coupling ?
---------------------------------------

To make grids for a multi level cpl simulation you will need to use:
	- make_grid_from_WRF.m 
	- find_childgrid_inparentgrid.m

The strategy is to build croco grids from WRF and then find the CROCO nested 
grid in the parent using "find_childgrid_inparentgrid.m". Then you will be 
able to create ini, bry files for CROCO nest by using AGRIF tools.

To give you more intel, WRF nests generated by WPS are matching on C-points
(corners). By using "make_grid_from_WRF.m" you create a CROCO grid where
C-points (WRF) and Psi-points (CROCO) are matching. If you want to have 
exactly subdivision in C-points the refinement coefficient need to be an odd
number (1,3,..). Then, as the C-points for the WRF parents are matching CROCO
Psi-points, C-points for the nest will also match CROCO parent Psi-points. 
Then by redoing "make_grid_from_WRF" with WRF nested grid, your CROCO child
Psi-points will match WRF nested grid BUT also CROCO parent Psi-points. 

This allows, for CROCO, to look for the child grid into parent grid the same 
way it is done when using AGRIF tools by running "find_childgrid_inparentgrid.m".
Once your child grid is found ( check for grd_pos variable in the netcdf), 
you can use "nestgui.m", import both parent and child grid, and create ini, bry,
croco.in.1, AGRIF_FixedGrids.in.

Example:
------- 

You have already run WPS and have 2 domains d01 and d02 with 3 as refinement coef
In make_grid_from_WRF.m:
    - Put the path to geo_em.d01.nc in "wrf_file"
    - Put the path and name of your output grid (croco_grd.nc if a parent)
    - Select a refinement coefficient ( 3 in our case)

Run make_grid_from_WRF.m ---> generate croco_grd.nc 
As refinement coefficient is common for d02 and croco_grd.nc, every C/Psi-points
will match.

To create the nest, in make_grid_from_WRF.m:
    - Put the path to geo_em.d02.nc in "wrf_file"
    - Put the path and name of your output grid (croco_grd.nc.1 for first child)
    - Select a refinement coefficient ( 3 in our case)

Run make_grid_from_WRF.m ---> generate croco_grd.nc.1
As d02 and CROCO prt are matching, the refinement coef between CROCO prt/chd is 3.

For finding chd in prt, in find_childgrid_inparentgrid.m:
    - Put your parent file full path ( croco_grd.nc)
    - Put your children file full path (croco_grd.nc.1 )

Run find_childgrid_inparentgrid.m ---> your will find grd_pos in croco_grd.nc.1

Now you can use nestgui.m 


