Skip to content

Commit

Permalink
Merge branch 'andrewdnolan/mali/hydro_regional_stats' into MALI-Dev/d…
Browse files Browse the repository at this point in the history
…evelop

This PR follows #82, which added subglacial hydrology (SGH) quantities to the
global stats analysis member, by adding SGH quantities to the regional stats
analysis member.

This PR also address a bug introduced in #82 where the calculation of
groundingLineFlux and groundingLineMigrationFlux were moved within an
if config_SGH then condition. The bug prevents groundingLineFlux and
groundingLineMigrationFlux from being calculated by global stats unless
the SGH model is turned on, despite these quantities applying to simulations
where SGH is not used.

* MALI-Dev/andrewdnolan/mali/hydro_regional_stats:
  Fix registry typo Matt caught in review.
  Remove `regionVertexMasks` from registry to minimize file size.
  Apply suggestions from code review
  Use `regionEdgeMask` to calculate SGH regional stats defined on edges.
  Deallocate `regionalSumFlotationFraction`.
  Add missing `regionCellMasks` call from SGH regional stats terms
  Add grounded ice mask to `externalWaterInput` term
  Move reduction of `fluxAcrossGroundingLine` outside SGH condition.
  Add support for subglacial hydro quantities in regional stats.
  • Loading branch information
matthewhoffman committed Mar 5, 2024
2 parents f79661c + 29891a6 commit 8d3c556
Show file tree
Hide file tree
Showing 4 changed files with 283 additions and 21 deletions.
5 changes: 5 additions & 0 deletions components/mpas-albany-landice/src/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@
<var name="sfcMassBal"/>
<var name="floatingBasalMassBal"/>
<var name="regionCellMasks"/>
<var name="regionEdgeMasks"/>
<!-- If restart file sizes become too large, eigencalvingParameter,
groundedVonMisesThresholdStress, and floatingVonMisesThresholdStress
could be moved to packages. -->
Expand Down Expand Up @@ -936,6 +937,7 @@
input_interval="initial_only"
runtime_format="single_file">
<var name="regionCellMasks"/>
<var name="regionEdgeMasks"/>
<!--var name="nCellsInRegion"/>
<var name="regionVertexMasks"/>
<var name="nVerticesInRegion"/>
Expand Down Expand Up @@ -1735,6 +1737,9 @@ is the value of that variable from the *previous* time level!
<var name="regionCellMasks" type="integer" dimensions="nRegions nCells" units="unitless" default_value="1"
description="masks set to 1 in cells that fall within a given region and 0 otherwise"
/>
<var name="regionEdgeMasks" type="integer" dimensions="nRegions nEdges" units="unitless" default_value="1"
description="masks set to 1 in edges that fall within a given region and 0 otherwise"
/>
<!--var name="nCellsInRegion" type="integer" dimensions="nRegions" units="unitless"
description="number of cells that fall within a given region"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,41 @@
description="maximum basal speed in the domain"
/>

<!-- stats related to subglacial hydrology -->
<var name="regionalSumSubglacialWaterVolume" type="real" dimensions="nRegions Time" units="m^3"
description="area-integrated subglacial water volume within region"
/>
<var name="regionalSumSubglacialLakeVolume" type="real" dimensions="nRegions Time" units="m^3"
description="area-integrated volume of subglacial lakes within region, defined as water volume exceeding bed bump height"
/>
<var name="regionalSumSubglacialLakeArea" type="real" dimensions="nRegions Time" units="m^2"
description="area-integrated area of subglacial lakes within region"
/>
<var name="regionalSumBasalMeltInput" type="real" dimensions="nRegions Time" units="kg s^{-1}"
description="area-integrated basal meltwater contributing to the subglacial hydrologic system within region"
/>
<var name="regionalSumExternalWaterInput" type="real" dimensions="nRegions Time" units="kg s^{-1}"
description="area-integrated external meltwater contributing to the subglacial hydrologic system within region"
/>
<var name="regionalSumChannelMelt" type="real" dimensions="nRegions Time" units="kg s^{-1}"
description="area-integrated melt rate in the subglacial hydrologic system within region"
/>
<var name="regionalSumDistWaterFluxMarineMargin" type="real" dimensions="nRegions Time" units="kg s^{-1}"
description="area-integrated distributed subglacial water flux across marine boundaries (grounding lines or grounded marine margins) within region"
/>
<var name="regionalSumDistWaterFluxTerrestrialMargin" type="real" dimensions="nRegions Time" units="kg s^{-1}"
description="area-integrated distributed subglacial water flux across terrestrial margins within region"
/>
<var name="regionalSumChnlWaterFluxMarineMargin" type="real" dimensions="nRegions Time" units="kg s^{-1}"
description="area-integrated channelized subglacial water flux across marine boundaries (grounding lines or grounded marine margins) within region"
/>
<var name="regionalSumChnlWaterFluxTerrestrialMargin" type="real" dimensions="nRegions Time" units="kg s^{-1}"
description="area-integrated channelized subglacial water flux across terrestrial margins within region"
/>
<var name="regionalAvgFlotationFraction" type="real" dimensions="nRegions Time" units="none"
description="area-weighted average of the flotation fraction under grounded ice within region"
/>

</var_struct>

<streams>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ subroutine li_compute_global_stats(domain, memberName, timeLevel, err)
basalMeltInput(iCell) * areaCell(iCell)

! External water input
blockSumExternalWaterInput = blockSumExternalWaterInput + externalWaterInput(iCell) * areaCell(iCell)
blockSumExternalWaterInput = blockSumExternalWaterInput + &
real(li_mask_is_grounded_ice_int(cellMask(iCell)),RKIND) * externalWaterInput(iCell) * areaCell(iCell)

! Lake Volume
if (waterThickness(iCell) > bedBumpMax) then
Expand All @@ -461,13 +462,14 @@ subroutine li_compute_global_stats(domain, memberName, timeLevel, err)

end do ! end loop over cells

if (config_SGH) then
! Loop over edges
do iEdge = 1, nEdgesSolve
! Loop over edges
do iEdge = 1, nEdgesSolve

! Flux across GL, units = kg/yr
blockGLflux = blockGLflux + fluxAcrossGroundingLine(iEdge) * dvEdge(iEdge) &
* scyr * rhoi ! convert from m^2/s to kg/yr

! Flux across GL, units = kg/yr
blockGLflux = blockGLflux + fluxAcrossGroundingLine(iEdge) * dvEdge(iEdge) &
* scyr * rhoi ! convert from m^2/s to kg/yr
if (config_SGH) then

! Channel Melt
blockSumChannelMelt = blockSumChannelMelt + abs(channelMelt(iEdge) * dcEdge(iEdge))
Expand All @@ -484,8 +486,9 @@ subroutine li_compute_global_stats(domain, memberName, timeLevel, err)
! Meltwater discharge in channels across terrestrial margin
blockSumChannelTerrestrialMeltFlux = blockSumChannelTerrestrialMeltFlux + abs( hydroTerrestrialMarginMask(iEdge) * channelDischarge(iEdge) * rho_water)

end do ! end loop over edges
endif
endif ! is SGH is turned on
end do ! end loop over edges

block => block % next
end do ! end loop over blocks

Expand Down Expand Up @@ -530,9 +533,9 @@ subroutine li_compute_global_stats(domain, memberName, timeLevel, err)
sums(13) = blockSumCalvingFlux
sums(14) = blockSumFaceMeltingFlux
sums(15) = blockSumVAF
sums(16) = blockGLflux
sums(17) = blockGLMigrationflux
if (config_SGH) then
sums(16) = blockGLflux
sums(17) = blockGLMigrationflux
sums(18) = blockSumSubglacialWaterVolume
sums(19) = blockSumBasalMeltInput
sums(20) = blockSumExternalWaterInput
Expand All @@ -546,7 +549,7 @@ subroutine li_compute_global_stats(domain, memberName, timeLevel, err)
sums(28) = blockSumFlotationFraction
nVars = 28
else
nVars = 15
nVars = 17
endif

call mpas_dmpar_sum_real_array(dminfo, nVars, sums(1:nVars), reductions(1:nVars))
Expand Down Expand Up @@ -574,9 +577,9 @@ subroutine li_compute_global_stats(domain, memberName, timeLevel, err)
call mpas_pool_get_array(globalStatsAMPool, 'avgSubshelfMelt', avgSubshelfMelt)
call mpas_pool_get_array(globalStatsAMPool, 'totalCalvingFlux', totalCalvingFlux)
call mpas_pool_get_array(globalStatsAMPool, 'totalFaceMeltingFlux', totalFaceMeltingFlux)
call mpas_pool_get_array(globalStatsAMPool, 'groundingLineFlux', groundingLineFlux)
call mpas_pool_get_array(globalStatsAMPool, 'groundingLineMigrationFlux', groundingLineMigrationFlux)
if (config_SGH) then
call mpas_pool_get_array(globalStatsAMPool, 'groundingLineFlux', groundingLineFlux)
call mpas_pool_get_array(globalStatsAMPool, 'groundingLineMigrationFlux', groundingLineMigrationFlux)
call mpas_pool_get_array(globalStatsAMPool, 'totalSubglacialWaterVolume', totalSubglacialWaterVolume)
call mpas_pool_get_array(globalStatsAMPool, 'totalBasalMeltInput', totalBasalMeltInput)
call mpas_pool_get_array(globalStatsAMPool, 'totalExternalWaterInput', totalExternalWaterInput)
Expand Down Expand Up @@ -605,9 +608,9 @@ subroutine li_compute_global_stats(domain, memberName, timeLevel, err)
totalCalvingFlux = reductions(13)
totalFaceMeltingFlux = reductions(14)
volumeAboveFloatation = reductions(15)
groundingLineFlux = reductions(16)
groundingLineMigrationFlux = reductions(17)
if (config_SGH) then
groundingLineFlux = reductions(16)
groundingLineMigrationFlux = reductions(17)
totalSubglacialWaterVolume = reductions(18)
totalBasalMeltInput = reductions(19)
totalExternalWaterInput = reductions(20)
Expand Down
Loading

0 comments on commit 8d3c556

Please sign in to comment.