Skip to content

Commit

Permalink
Merge branch 'cbegeman/ocn-fix-loglaw-indices' (PR #6056)
Browse files Browse the repository at this point in the history
Fix bug in stealth feature log-law drag

The indices of kineticEnergyCell in the log-law drag function raised an
error on perlmutter with gnu, mpich debug=on. This PR fixes the
indexing.

Fixes #6055

[BFB]
  • Loading branch information
jonbob committed Dec 15, 2023
2 parents 84d0c03 + c551420 commit 0fd6f76
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions components/mpas-ocean/src/shared/mpas_ocn_vmix.F
Original file line number Diff line number Diff line change
Expand Up @@ -1069,13 +1069,6 @@ subroutine ocn_vel_vmix_tend_implicit_spatially_variable_loglaw(forcingPool, dt,
von_karman_sq / &
(log(1.0_RKIND + &
(zMidEdge/bottom_roughness)))**2))
! For some reason we can use k-1 even when N=Nsurf
kineticEnergyTopOfEdge = 0.5_RKIND * (kineticEnergyCell(k,cell1) + kineticEnergyCell(k,cell2) + &
kineticEnergyCell(k-1,cell1) + kineticEnergyCell(k-1,cell2))
vertViscTopOfEdge(k,iEdge) = max(vertViscTopOfEdge(k,iEdge), &
sqrt(CdTemp(k) * kineticEnergyTopOfEdge) * &
von_karman * (zMidEdge + bottom_roughness) &
)
enddo

! one active layer
Expand All @@ -1084,7 +1077,14 @@ subroutine ocn_vel_vmix_tend_implicit_spatially_variable_loglaw(forcingPool, dt,
/ (1.0_RKIND + dt*CdTemp(N) &
* sqrt(kineticEnergyCell(N,cell1) + kineticEnergyCell(N,cell2)) / layerThickEdgeDrag(N,iEdge) )
else

do k = Nsurf+1, N
kineticEnergyTopOfEdge = 0.5_RKIND * (kineticEnergyCell(k,cell1) + kineticEnergyCell(k,cell2) + &
kineticEnergyCell(k-1,cell1) + kineticEnergyCell(k-1,cell2))
vertViscTopOfEdge(k,iEdge) = max(vertViscTopOfEdge(k,iEdge), &
sqrt(CdTemp(k) * kineticEnergyTopOfEdge) * &
von_karman * (zMidEdge + bottom_roughness) &
)
enddo
! tridiagonal matrix algorithm
C(Nsurf) = -2.0_RKIND*dt*vertViscTopOfEdge(Nsurf+1,iEdge) &
/ (layerThickEdgeMean(Nsurf,iEdge) + layerThickEdgeMean(Nsurf+1,iEdge)) &
Expand Down

0 comments on commit 0fd6f76

Please sign in to comment.