Skip to content

Commit cf37902

Browse files
committed
Merge branch 'atmosphere/gwdo_check_fix' into develop (PR #652)
This merge corrects the atmosphere_model's GWDO check to avoid incorrectly halting the model when running a regional simulation entirely over water. Originally, the GWDO check ensured that the GWDO fields were valid by checking to see if the 'var2d' field was not all zero. For global simulations, an all-zero 'var2d' field (with 'config_gwdo_scheme' not set to "off") most likely meant that the user did not interpolate the GWDO fields. However, regional MPAS simulations that were entirely over water would make 'var2d' and other GWDO fields all zero, which would incorrectly trigger this error. Now, the check on 'var2d' will only stop the model if not all grid cells are water (based on the 'ivgtyp' field). * atmosphere/gwdo_check_fix: Fix GWDO check on all water regional simulations
2 parents 4997327 + 594ee57 commit cf37902

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/core_atmosphere/physics/mpas_atmphys_control.F

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@ subroutine physics_compatibility_check(dminfo, blockList, streamManager, ierr)
448448
real (kind=RKIND) :: maxvar2d_local, maxvar2d_global
449449
real (kind=RKIND), dimension(:), pointer :: var2d
450450
integer, pointer :: nCellsSolve
451+
integer, pointer :: iswater_lu
452+
integer, pointer, dimension(:) :: ivgtyp
453+
integer :: all_water, iall_water
451454
character (len=StrKIND), pointer :: gwdo_scheme
452455
type (block_type), pointer :: block
453456
type (mpas_pool_type), pointer :: meshPool
@@ -473,7 +476,22 @@ subroutine physics_compatibility_check(dminfo, blockList, streamManager, ierr)
473476

474477
call mpas_dmpar_max_real(dminfo, maxvar2d_local, maxvar2d_global)
475478

476-
if (maxvar2d_global <= 0.0_RKIND) then
479+
!
480+
! The GWDO check below can fail on regional simulations that are completely above
481+
! water. So, check to see if the simulation is completely above water and do not
482+
! throw the error if it is.
483+
!
484+
call mpas_pool_get_array(sfc_inputPool, 'iswater', iswater_lu)
485+
call mpas_pool_get_array(sfc_inputPool, 'ivgtyp', ivgtyp)
486+
if (all(ivgtyp(1:nCellsSolve) == iswater_lu)) then
487+
all_water = 1 ! All water
488+
else
489+
all_water = 0 ! Land present
490+
end if
491+
492+
call mpas_dmpar_min_int(dminfo, all_water, iall_water)
493+
494+
if (maxvar2d_global <= 0.0_RKIND .and. iall_water /= 1) then
477495
call mpas_log_write('*******************************************************************************', &
478496
messageType=MPAS_LOG_ERR)
479497
call mpas_log_write('The GWDO scheme requires valid var2d, con, oa{1,2,3,4}, and ol{1,2,3,4} fields,', &

0 commit comments

Comments
 (0)