Skip to content

Commit

Permalink
PR Cleanup #2
Browse files Browse the repository at this point in the history
Addresses minor cleaning edits following second round of review
  • Loading branch information
alexolinhager committed May 22, 2024
1 parent 435acd5 commit b352169
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@
<!-- state vars -->
<var name="iceThicknessHydro" type="real" dimensions="nCells Time" units="m"
description="ice thickness used by the hydrology model. Same as 'thickness' but with potential differences along domain boundaries that inhibit the formation of local hydropotential minima on boundaries." />
<var name="upperSurfaceHydro" type="real" dimensions="nCells Time" units="m"
description="upper surface used by the hydrology model if config_SGH_use_iceThicknessHydro = .true." />
<var name="waterThickness" type="real" dimensions="nCells Time" units="m"
description="water layer thickness in subglacial hydrology system" />
<var name="waterThicknessOld" type="real" dimensions="nCells Time" units="m"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,10 @@ subroutine li_SGH_init(domain, err)
block => domain % blocklist
do while (associated(block))
call mpas_pool_get_subpool(block % structs, 'mesh', meshPool)
call mpas_pool_get_subpool(block % structs, 'hydro', hydroPool)
call mpas_pool_get_subpool(block % structs, 'geometry', geometryPool)
call mpas_pool_get_subpool(block % structs, 'velocity', velocityPool)
call mpas_pool_get_array(hydroPool, 'waterPressure', waterPressure)
call mpas_pool_get_array(hydroPool, 'deltatSGH', deltatSGH)
call mpas_pool_get_array(hydroPool, 'iceThicknessHydro', iceThicknessHydro)
waterPressure = max(0.0_RKIND, waterPressure)
Expand All @@ -225,7 +222,7 @@ subroutine li_SGH_init(domain, err)
block => block % next
end do
!updates halos for waterPressure
!updates halos for waterPressureSmooth
call mpas_timer_start("halo updates")
call mpas_dmpar_field_halo_exch(domain, 'waterPressureSmooth')
call mpas_timer_stop("halo updates")
Expand Down Expand Up @@ -661,7 +658,7 @@ subroutine li_SGH_solve(domain, err)
call calc_pressure(block, err_tmp)
err = ior(err, err_tmp)
call calc_waterPressureSmooth(block, err_tmp) !adjust ice thickness along boundaries
call calc_waterPressureSmooth(block, err_tmp) !compute smoothed version of waterPressure
err = ior(err,err_tmp)
block => block % next
Expand Down Expand Up @@ -830,7 +827,6 @@ subroutine calc_edge_quantities(block, err)
integer, dimension(:), pointer :: edgeMask
integer, dimension(:,:), pointer :: cellsOnEdge
integer, dimension(:,:), pointer :: edgesOnCell
integer, dimension(:,:), pointer :: cellsOnCell
integer, dimension(:,:), pointer :: verticesOnEdge
integer, dimension(:,:), pointer :: baryCellsOnVertex
real (kind=RKIND), dimension(:,:), pointer :: baryWeightsOnVertex
Expand All @@ -850,10 +846,6 @@ subroutine calc_edge_quantities(block, err)
real (kind=RKIND) :: velSign
integer :: numGroundedCells
integer :: err_tmp
integer :: isMarineMargin
integer :: edgeNum
integer :: iNeighbor
integer :: numCells
err = 0
err_tmp = 0
Expand Down Expand Up @@ -891,7 +883,6 @@ subroutine calc_edge_quantities(block, err)
call mpas_pool_get_array(geometryPool, 'cellMask', cellMask)
call mpas_pool_get_array(meshPool, 'cellsOnEdge', cellsOnEdge)
call mpas_pool_get_array(meshPool, 'edgesOnCell', edgesOnCell)
call mpas_pool_get_array(meshPool, 'cellsOnCell', cellsOnCell)
call mpas_pool_get_array(meshPool, 'edgeSignOnCell', edgeSignOnCell)
call mpas_pool_get_array(hydroPool, 'hydropotentialBaseSlopeTangent', hydropotentialBaseSlopeTangent)
call mpas_pool_get_array(hydroPool, 'hydropotentialSlopeTangent', hydropotentialSlopeTangent)
Expand Down Expand Up @@ -2215,7 +2206,7 @@ subroutine ocean_connection_N(domain)
type (mpas_pool_type), pointer :: geometryPool
real (kind=RKIND), dimension(:), pointer :: bedTopography
real (kind=RKIND), dimension(:), pointer :: effectivePressure
real (kind=RKIND), dimension(:), pointer :: iceThicknessHydro
real (kind=RKIND), dimension(:), pointer :: thickness
real (kind=RKIND), pointer :: rhoi, rhoo
! Calculate N assuming perfect ocean connection
Expand All @@ -2229,9 +2220,9 @@ subroutine ocean_connection_N(domain)
call mpas_pool_get_subpool(block % structs, 'hydro', hydroPool)
call mpas_pool_get_array(geometryPool, 'bedTopography', bedTopography)
call mpas_pool_get_array(hydroPool, 'effectivePressure', effectivePressure)
call mpas_pool_get_array(hydroPool, 'iceThicknessHydro', iceThicknessHydro)
call mpas_pool_get_array(hydroPool, 'iceThicknessHydro', thickness)
effectivePressure = rhoi * gravity * iceThicknessHydro - rhoi * gravity * max(0.0_RKIND, -1.0_RKIND * rhoo/rhoi * bedTopography)
effectivePressure = rhoi * gravity * thickness - rhoi * gravity * max(0.0_RKIND, -1.0_RKIND * rhoo/rhoi * bedTopography)
effectivePressure = max(effectivePressure, 0.0_RKIND) ! This is just to zero out N in the open ocean to avoid confusion
block => block % next
Expand Down Expand Up @@ -2398,7 +2389,6 @@ subroutine calc_iceThicknessHydro(block, err)
real (kind=RKIND), dimension(:), pointer :: thickness
real (kind=RKIND), dimension(:), pointer :: bedTopography
real (kind=RKIND), dimension(:), pointer :: iceThicknessHydro
real (kind=RKIND), dimension(:), pointer :: upperSurfaceHydro
real (kind=RKIND), dimension(:), pointer :: upperSurface
integer, dimension(:,:), pointer :: cellsOnCell
integer, dimension(:), pointer :: cellMask
Expand Down Expand Up @@ -2427,7 +2417,6 @@ subroutine calc_iceThicknessHydro(block, err)
call mpas_pool_get_array(geometryPool, 'bedTopography', bedTopography)
call mpas_pool_get_array(geometryPool, 'cellMask', cellMask)
call mpas_pool_get_array(hydroPool, 'iceThicknessHydro', iceThicknessHydro)
call mpas_pool_get_array(hydroPool, 'upperSurfaceHydro', upperSurfaceHydro)
call mpas_pool_get_array(geometryPool, 'upperSurface', upperSurface)
call mpas_pool_get_array(meshPool, 'nEdgesOnCell', nEdgesOnCell)
call mpas_pool_get_dimension(meshPool, 'nCells', nCells)
Expand Down Expand Up @@ -2499,8 +2488,6 @@ subroutine calc_iceThicknessHydro(block, err)
enddo
endif
upperSurfaceHydro = iceThicknessHydro + bedTopography
end subroutine calc_iceThicknessHydro
!***********************************************************************
Expand Down Expand Up @@ -2679,7 +2666,7 @@ subroutine calc_waterPressureSmooth(block,err)
do jEdge = 1, nEdgesOnCell(iCell)
iNeighbor = cellsOnCell(jEdge,iCell)
if ((li_mask_is_grounded_ice(cellMask(iNeighbor)))) then
if ((li_mask_is_grounded_ice(cellMask(iNeighbor)))) then !only include GROUNDED neighboring cells in smoothing
totalPressure = totalPressure + pressureField(iNeighbor)*areaCell(iNeighbor)
Expand Down

0 comments on commit b352169

Please sign in to comment.