Skip to content

Commit

Permalink
Change size of restingThicknessSum from nCells to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
cbegeman committed Oct 27, 2022
1 parent 6c78e3c commit 81180c6
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions components/mpas-ocean/src/shared/mpas_ocn_thick_ale.F
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,12 @@ subroutine ocn_ALE_thickness(verticalMeshPool, SSH, ALE_thickness, &

real (kind=RKIND) :: &
weightSum, &! sum of weights in vertical
columnThickness, &! total thickness from bottomDepth, SSH
restingThicknessSum, &! total resting thickness
restingThicknessDiff, &! total resting thickness
remainder, &! track remainder in mix/max alteration
newThickness ! temp used during min/max adjustment

real (kind=RKIND), dimension(:), allocatable :: &
restingThicknessSum, &! total resting thickness
prelim_ALE_thickness, & ! ALE thickness at new time
min_ALE_thickness_down, & ! thickness alteration in min/max adj
min_ALE_thickness_up ! thickness alteration in min/max adj
Expand Down Expand Up @@ -169,40 +168,38 @@ subroutine ocn_ALE_thickness(verticalMeshPool, SSH, ALE_thickness, &
! restingThickness_times_weights
case (ALEthickProportionThickTimesWgts)

allocate(restingThicknessSum(nCells))

#ifdef MPAS_OPENACC
!xacc parallel loop &
!xacc present(ALE_thickness, SSH, restingThickness, &
!xacc minLevelCell, maxLevelCell, &
!xacc vertCoordMovementWeights) &
!xacc private(k, kMin, kMax, restingThicknessDiff)
!xacc private(k, kMin, kMax, restingThicknessDiff, restingThicknessSum)
#else
!$omp parallel
!$omp do schedule(runtime) &
!$omp private(k, kMin, kMax, restingThicknessDiff)
!$omp private(k, kMin, kMax, restingThicknessDiff, restingThicknessSum)
#endif
do iCell = 1, nCells
kMax = maxLevelCell(iCell)
kMin = minLevelCell(iCell)

restingThicknessSum(iCell) = 0.0_RKIND
restingThicknessSum = 0.0_RKIND
do k = kMin, kMax
restingThicknessSum(iCell) = restingThicknessSum(iCell) &
restingThicknessSum = restingThicknessSum &
+ vertCoordMovementWeights(k) &
* restingThickness(k,iCell)
end do

restingThicknessDiff = restingThicknessSum(iCell) - bottomDepth(iCell)
restingThicknessSum(iCell) = restingThicknessSum(iCell) + 1e-14_RKIND
restingThicknessDiff = restingThicknessSum - bottomDepth(iCell)
restingThicknessSum = restingThicknessSum + 1e-14_RKIND
! Note that restingThickness is nonzero, and remaining
! terms are perturbations about zero.
! This is equation 4 and 6 in Petersen et al 2015,
! but with eqn 6
do k = kMin, kMax
ALE_thickness(k, iCell) = restingThickness(k, iCell) &
+ ( (SSH(iCell) + restingThicknessDiff) * vertCoordMovementWeights(k) * &
restingThickness(k, iCell) ) / restingThicknessSum(iCell)
restingThickness(k, iCell) ) / restingThicknessSum
end do
enddo
#ifndef MPAS_OPENACC
Expand Down

0 comments on commit 81180c6

Please sign in to comment.