MPAS-Dev / MPAS

Repository for private MPAS development prior to the MPAS v6.0 release.
Other
4 stars 0 forks source link

Fix incorrect size of 'hlanduse' array in GWDO field computation #1543

Closed mgduda closed 6 years ago

mgduda commented 6 years ago

This merge corrects an incorrect allocation of 'hlanduse' in the GWDO field initialization code for MPAS-Atmosphere.

The 'hlanduse' field used in the computation of some GWDO sub-grid-scale orography statistics was allocated with size nCells. However, this field is accessed as hlanduse(cellsOnCell(i,iCell)), with iCell=1,nCells, leading to out-of-bounds memory references for the outer layer of halo cells. The hlanduse field is now allocated with a "garbage" cell, i.e., it is allocated with size nCells+1.