Skip to content

Commit

Permalink
Merge branch 'vanroekel/ocean/fix-redi-surface-taper' into next (PR #…
Browse files Browse the repository at this point in the history
…5171)

Fix Redi Surface Taper double counting

Currently the SlopeTriads are tapered at the surface AND tapered in
mpas_ocn_tracer_hmix_redi as well, which is a double counting.  The
tapering in the latter is removed.

In addition to removing the double count in the taper, Redi is reduced
to horizontal mixing in the mixed layer, consistent with other modeling
center implementations and literature (e.g. Ferrari et al 2008). This is
accomplished by setting the Redi taper to zero in the mixed layer, which
disables all terms except the horizontal mixing term.

[NCC]
  • Loading branch information
jonbob committed Sep 28, 2022
2 parents bcafb09 + 42eca04 commit 55bde6a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
5 changes: 5 additions & 0 deletions components/mpas-ocean/src/shared/mpas_ocn_gm.F
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,11 @@ subroutine ocn_GM_compute_Bolus_velocity(statePool, &
slopeTaperDown = 1.0_RKIND + slopeTaperFactor*(slopeTaperDown - 1.0_RKIND)

sfcTaper = min(RediKappaSfcTaper(k, cell1), RediKappaSfcTaper(k, cell2))
if (k < min( indMLD(cell1), indMLD(cell2))) then
sfcTaper = 0.0_RKIND
else
sfcTaper = 1.0_RKIND
end if

sfcTaperUp = 1.0_RKIND + sfcTaperFactor*(sfcTaper - 1.0_RKIND)
sfcTaperDown = 1.0_RKIND + sfcTaperFactor*(sfcTaper - 1.0_RKIND)
Expand Down
4 changes: 2 additions & 2 deletions components/mpas-ocean/src/shared/mpas_ocn_tendency.F
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,8 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, &
layerThickness, zMid, tracerGroup, &
RediKappa, slopeTriadUp, &
slopeTriadDown, dt, isActiveTracer, &
RediKappaSfcTaper, RediKappaScaling,&
rediLimiterCount, tracerGroupTend, err)
RediKappaScaling, rediLimiterCount, &
tracerGroupTend, err)

if (computeBudgets) then
! Finish budget calculation by subtracting before, after
Expand Down
6 changes: 3 additions & 3 deletions components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix.F
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module ocn_tracer_hmix

subroutine ocn_tracer_hmix_tend(meshPool, layerThickEdgeMean, layerThickness, zMid, tracers, &
RediKappa, slopeTriadUp, slopeTriadDown, dt, isActiveTracer, &
RediKappaSfcTaper, RediKappaScaling, rediLimiterCount, tend, err)!{{{
RediKappaScaling, rediLimiterCount, tend, err)!{{{


!-----------------------------------------------------------------
Expand All @@ -99,7 +99,7 @@ subroutine ocn_tracer_hmix_tend(meshPool, layerThickEdgeMean, layerThickness, zM
layerThickness, &!< Input: thickness at centers
zMid !< Input: Z coordinate at the center of a cell
real (kind=RKIND), dimension(:,:), intent(in), optional :: &
RediKappaSfcTaper, RediKappaScaling !< Input: vertical structure of GM/Redi limiter
RediKappaScaling !< Input: vertical structure of GM/Redi limiter

real (kind=RKIND), dimension(:,:,:), intent(in) :: &
slopeTriadUp, slopeTriadDown, &
Expand Down Expand Up @@ -153,7 +153,7 @@ subroutine ocn_tracer_hmix_tend(meshPool, layerThickEdgeMean, layerThickness, zM
if (config_use_Redi) then
call ocn_tracer_hmix_Redi_tend(meshPool, layerThickness, layerThickEdgeMean, zMid, tracers, &
RediKappa, dt, isActiveTracer, &
slopeTriadUp, slopeTriadDown, RediKappaSfcTaper, &
slopeTriadUp, slopeTriadDown, &
RediKappaScaling, rediLimiterCount, tend, err1)
endif
err = ior(err1, err2)
Expand Down
29 changes: 10 additions & 19 deletions components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix_redi.F
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module ocn_tracer_hmix_Redi

subroutine ocn_tracer_hmix_Redi_tend(meshPool, layerThickness, layerThickEdgeMean, zMid, tracers, &
RediKappa, dt, isActiveTracer, slopeTriadUp, slopeTriadDown, &
RediKappaSfcTaper, RediKappaScaling, rediLimiterCount, tend, err)!{{{
RediKappaScaling, rediLimiterCount, tend, err)!{{{

!-----------------------------------------------------------------
!
Expand All @@ -91,7 +91,6 @@ subroutine ocn_tracer_hmix_Redi_tend(meshPool, layerThickness, layerThickEdgeMea
real(kind=RKIND), dimension(:, :), intent(in) :: &
layerThickEdgeMean, &!< Input: mean thickness at edge
zMid, &!< Input: Z coordinate at the center of a cell
RediKappaSfcTaper, &!< Input: vertical structure of GM/Redi limiter
RediKappaScaling, &
layerThickness

Expand Down Expand Up @@ -238,14 +237,10 @@ subroutine ocn_tracer_hmix_Redi_tend(meshPool, layerThickness, layerThickEdgeMea

k = minLevelEdgeBot(iEdge)
kappaRediEdgeVal = 0.25_RKIND*(RediKappaScaling(k, cell1) + RediKappaScaling(k, cell2) + &
RediKappaScaling(k + 1, cell1) + RediKappaScaling(k + 1, cell2))* &
0.25_RKIND*(RediKappaSfcTaper(k, cell1) + RediKappaSfcTaper(k, cell2) + &
RediKappaSfcTaper(k + 1, cell1) + RediKappaSfcTaper(k + 1, cell2))
RediKappaScaling(k + 1, cell1) + RediKappaScaling(k + 1, cell2))
k = 1
kappaRediEdgeVal = 0.25_RKIND*(RediKappaScaling(k, cell1) + RediKappaScaling(k, cell2) + &
RediKappaScaling(k + 1, cell1) + RediKappaScaling(k + 1, cell2))* &
0.25_RKIND*(RediKappaSfcTaper(k, cell1) + RediKappaSfcTaper(k, cell2) + &
RediKappaSfcTaper(k + 1, cell1) + RediKappaSfcTaper(k + 1, cell2))
RediKappaScaling(k + 1, cell1) + RediKappaScaling(k + 1, cell2))

do iTr = 1, nTracers
tracer_turb_flux = tracers(iTr, k, cell2) - tracers(iTr, k, cell1)
Expand Down Expand Up @@ -280,9 +275,7 @@ subroutine ocn_tracer_hmix_Redi_tend(meshPool, layerThickness, layerThickEdgeMea
do k = minLevelEdgeBot(iEdge) + 1, maxLevelEdgeTop(iEdge) - 1

kappaRediEdgeVal = 0.25_RKIND*(RediKappaScaling(k, cell1) + RediKappaScaling(k, cell2) + &
RediKappaScaling(k + 1, cell1) + RediKappaScaling(k + 1, cell2))*0.25_RKIND* &
(RediKappaSfcTaper(k, cell1) + RediKappaSfcTaper(k, cell2) + &
RediKappaSfcTaper(k + 1, cell1) + RediKappaSfcTaper(k + 1, cell2))
RediKappaScaling(k + 1, cell1) + RediKappaScaling(k + 1, cell2))

do iTr = 1, nTracers
! \kappa_2 \nabla \phi on edge
Expand Down Expand Up @@ -319,9 +312,7 @@ subroutine ocn_tracer_hmix_Redi_tend(meshPool, layerThickness, layerThickEdgeMea

k = maxLevelEdgeTop(iEdge)
kappaRediEdgeVal = 0.25_RKIND*(RediKappaScaling(k, cell1) + RediKappaScaling(k, cell2) + &
RediKappaScaling(k + 1, cell1) + RediKappaScaling(k + 1, cell2))* &
0.25_RKIND*(RediKappaSfcTaper(k, cell1) + RediKappaSfcTaper(k, cell2) + &
RediKappaSfcTaper(k + 1, cell1) + RediKappaSfcTaper(k + 1, cell2))
RediKappaScaling(k + 1, cell1) + RediKappaScaling(k + 1, cell2))

do iTr = 1, nTracers
tracer_turb_flux = tracers(iTr, k, cell2) - tracers(iTr, k, cell1)
Expand Down Expand Up @@ -376,8 +367,8 @@ subroutine ocn_tracer_hmix_Redi_tend(meshPool, layerThickness, layerThickEdgeMea
! 2.0 in next line is because a dot product on a C-grid
! requires a factor of 1/2 to average to the cell center.
flux_term3 = rediKappaCell(iCell)*2.0_RKIND* &
(RediKappaSfcTaper(k, iCell)*RediKappaScaling(k, iCell)*fluxRediZTop(iTr, k) &
* invAreaCell - RediKappaSfcTaper(k + 1, iCell)*RediKappaScaling(k + 1, iCell) &
(RediKappaScaling(k, iCell)*fluxRediZTop(iTr, k) &
* invAreaCell - RediKappaScaling(k + 1, iCell) &
*fluxRediZTop(iTr, k + 1) * invAreaCell)

redi_term3(iTr, k, iCell) = redi_term3(iTr, k, iCell) + flux_term3
Expand Down Expand Up @@ -446,9 +437,9 @@ subroutine ocn_tracer_hmix_Redi_tend(meshPool, layerThickness, layerThickEdgeMea
do k = minLevelCell(iCell), maxLevelCell(iCell)
do iTr = 1, ntracers
tend(iTr, k, iCell) = tend(iTr, k, iCell) + rediKappaCell(iCell)*2.0_RKIND* &
(RediKappaSfcTaper(k, iCell)*RediKappaScaling(k, iCell)* &
redi_term3_topOfCell(iTr, k, iCell) - RediKappaSfcTaper(k + 1, iCell) &
*RediKappaScaling(k + 1, iCell)*redi_term3_topOfCell(iTr, k + 1, iCell))
(RediKappaScaling(k, iCell)* &
redi_term3_topOfCell(iTr, k, iCell) - &
RediKappaScaling(k + 1, iCell)*redi_term3_topOfCell(iTr, k + 1, iCell))
end do
end do

Expand Down

0 comments on commit 55bde6a

Please sign in to comment.