Regridding in GEOS-Chem
On this page, we shall describe how GEOS-Chem regrids data from one resolution to another.
The MAP_A2A algorithm
GEOS-Chem uses the regridding software MAP_A2A from S-J Lin. MAP_A2A is an area-preserving mapping scheme. For example, if you have a quantity such as kg/m2/s or W/m2, MAP_A2A will multiply by the area on the input grid, then regrid, and divide by the area on the output grid, such that the total quantity is preserved.
Using MAP_A2A to regrid GMAO met fields
Claire Carouge tested the MAP_A2A algorithm to ensure that it would work properly when we regrid the "raw" GMAO met field data into a form that GEOS-Chem can read. Her comments follow:
Claire Carouge wrote:
There are two types of physical quantities:
- A quantity whose value doesn't change with the grid cell size.
- A quantity whose value changes with the grid cell size.
For example, if you have a uniformly distributed atmosphere and a grid and you increase the resolution by 2 (grid cells are 4 times smaller), then temperature, velocities, concentrations, pressure won't change at each grid cell but the mass will be smaller for each grid cell. So mass is an extensive variable and the others are intensives.
The MAP_A2A algorithm is set up to regrid extensive quantities. So in order for us to use it to regrid winds, we must first multiply the winds by the pressure on the input grid in order to create an extensive uantity (e.g. a "mass flux"). Then we must divide by the pressure on the output grid to convert back to a wind.
In other regridding routines, (e.g. NCREGRID), you can specify if the quantity you are regridding is intensive or extensive, and it will do the regridding accordingly. I've been looking at the MAP\_A2A regridding algorithm to answer two different questions:
Why does it look so complicated? Apparently we are using a more elaborate regridding algorithm than NCREGRID. It probably has some nice qualities that NCREGRID hasn't.
Is the treatment of the poles coherent with TPCORE? In the regridding algorithm, there is some special treatment on the poles. This is due to the fact, the algorithm is based on the calculation of the slopes between neighbor grid cells. So we need different values from neighbor grid cells. The problem with the poles is to define the grid cells j-1 (resp. j+1) at the South Pole (resp. North Pole). The method used in the regridding algorithm is the same than the one used in tpcore: to access the grid cell j-1 at South Pole you need to go southward. If you start from the cell, i=1 then you arrive in the cell i=im/2+1 (sphere). So in the code the values are "crossed" at the poles. Also, they don't take the j=1 grid cells but the j=2 because the poles are supposed to be only one circular grid cell, so the points (i=1, j=1) and (i=im/2+1, j=1) are supposed to be the same grid cell. So the cell j-1 is the cell (i=im/2+1, j=2) ...
In addition, the wind values for the pole grid cells are averaged at the end. This is also coherent with tpcore as we consider the poles are one circular grid cell.
So I think everything is done correctly in the regridding. The differences we see (between NCREGRID and MAP_A2A) are explained by the differences in algorithms used but we can't say one is better than the other.
--Bob Y. 15:32, 28 August 2012 (EDT)
Using MAP_A2A within GEOS-Chem
Prasad Kasibhatla and Matt Coooper implemented the MAP_A2A code into GEOS-Chem (tested w/ 1-month benchmark v9-01-03k). They started with the version of MAP_A2A that was used to regrid the GMAO met fields and removed sections of code that would not normally get executed. The MAP_A2A routines were placed into GEOS-Chem module GeosUtil/regrid_a2a_mod.F90. The MAP_A2A code is called by driver routine DO_REGRID_A2A.
--Bob Y. 15:32, 28 August 2012 (EDT)
In GEOS-Chem v9-01-03, we have added the following updates to the MAP_A2A regridding scheme:
The driver routine DO_REGRID_A2A now reads the grid input information (i.e. longitude edges and sines of latitude edges) from netCDF files. This replaces the original implementation, which read from ASCII files.
Important DO loops in routines DO_REGRID_A2A, XMAP and YMAP (all in GeosUtil/regrid_a2a_mod.F90) have now been parallelized with OpenMP directives.
The QSUM and SUM variables in routines XMAP and YMAP have been changed from REAL*4 to REAL*8. This eliminates some minor numerical noise past the 6th decimal place.
--Bob Y. 15:33, 28 August 2012 (EDT)
Previous issues that have are now resolved
Bug fixes for the MAP_A2A regridding algorithm
This update was tested in the 1-month benchmark simulation v9-01-03n and approved on 08 Jun 2012.
Lee Murray found a typo in the latlon_geos1x1.txt file used for the MAP_A2A regridding algorithm.
Lee Murray wrote:
- There is definitely an error in the erroneous missing of 0.5°W in the latlon_geos1x1.txt file. This led to inherent inconsistencies in how latlon_geos1x1.txt and latlon_generic.txt were indexed by GEOS-Chem, since latlon_geos1x1 made up for the missing longitude edge by doubling up both 180.5°W/179.5°E and 179.5°W/180.5°E. latlon_generic.txt only repeats 180°W/180°E.
Several bugs were also fixed in the MAP_A2A regridding code to ensure consistency in the use of IM and JM, the number of longitude and latitude centers on the input grid.
Prasad Kasibhatla wrote:
- I think we are all on the same page, but just to make sure here is what I suggest we agree on:
- (1) That the calling sequence for DO_REGRID_A2A be:
- IM = number of grid boxes in E-W direction (not number of lon edges)
- JM = number of grid boxes in N-S direction (not number of lat edges)
- so that the dimension of INGRID is (IM,JM) and IM+1 and JM+1 are number of lon edges and number of lat edges, respectively.
- (2) That the calling sequence for MAP_A2A be
CALL MAP_A2A( IM, JM, INLON, INSIN, INGRID, & IIPAR, JJPAR, LON2, SIN2, OUTGRID, 0, 0)
- where INLON, INSIN, and INGRID are dimensioned IM+1, JM+1, and (IM,JM), respectively, and LON2, SIN2, and OUTGRID are dimensioned IIPAR+1, JJPAR+1, and (IIPAR, JJPAR), respectively.
- So, for example, when the input grid is a generic 1x1 grid, and the output grid is the geos 1x1 grid:
IM=360 JM=180 INLON(1)=-180 INLON(361)=180 INSIN(1)=-1 INSIN(181)=1 LON2(1)=-180.5 LON2(361)=179.5 SIN2(1)=-1 SIN2(181)=1
One last suggestion - if possible, change variable names LON2 and </tt>SIN2<?tt> to OUTLON and OUTSIN.
--Melissa Payer 11:44, 8 June 2012 (EDT)
NOTE: Before the release of v9-01-03 (maybe in v9-01-03o), we will convert the latlon_geos_1x1.txt and latlon_generic.1x1.txt to netCDF for better compatibility with the Grid-independent GEOS-Chem modifications.
--Bob Y. 15:39, 28 August 2012 (EDT)
None reported at this time.--Bob Y. 15:33, 28 August 2012 (EDT)