Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix potential array OOB error when computing the ol1 and ol2 GWDO fields
For MPAS grid cells that are small enough that the dimensions of their bounding boxes (nx and ny) in the 30" terrain dataset are less than four, loop bounds of 0 may be used in the computation of the ol1 and ol2 GWDO fields. A lower bound of zero would result in an access below the allocated lower bound for the 'box' array in the mpas_init_atm_gwd module, while an upper bound of zero (with a positive lower bound) would result in a division by zero (as 'nt' would never be incremented). The correction applied in this commit is to enforce a lower bound of 1 to both upper and lower loop bounds in the computation of ol1 and ol2. The resulting ol1 and ol2 fields may not contain correct values, but it's likely the YSU GWDO scheme will not be very active for such small grid cells anyway.
- Loading branch information