Skip to content

Commit

Permalink
Merge branch 'matthewhoffman/mali/fix-hydro-init-segfault' into MALI-…
Browse files Browse the repository at this point in the history
…Dev/develop

This PR fixes a seg fault occurring when cellMask was used before it was
retrieved from its pool.

* matthewhoffman/mali/fix-hydro-init-segfault:
  Fix segfault in hydro init due to using cellMask before accessing it
  • Loading branch information
matthewhoffman committed Oct 31, 2024
2 parents 07e3abf + d0c3e77 commit 114c373
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,15 @@ subroutine li_SGH_init(domain, err)
call mpas_pool_get_array(hydroPool, 'waterPressure', waterPressure)
call mpas_pool_get_array(hydroPool, 'hydropotential', hydropotential)
call mpas_pool_get_array(hydroPool, 'iceThicknessHydro', iceThicknessHydro)
call mpas_pool_get_array(geometryPool, 'cellMask', cellMask)
call mpas_pool_get_array(geometryPool, 'bedTopography', bedTopography)
waterPressure = max(0.0_RKIND, waterPressure)
where (li_mask_is_grounded_ice(cellMask))
waterPressure = min(waterPressure, rhoi * gravity * iceThicknessHydro)
end where
! set pressure and hydropotential correctly on ice-free land and in ocean
call mpas_pool_get_array(geometryPool, 'cellMask', cellMask)
call mpas_pool_get_array(geometryPool, 'bedTopography', bedTopography)
!
where ((.not. (li_mask_is_grounded_ice(cellMask))) .and. (bedTopography > config_sea_level))
waterPressure = 0.0_RKIND
hydropotential = rho_water * gravity * bedTopography
Expand Down

0 comments on commit 114c373

Please sign in to comment.