Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Redi Surface Taper double counting #5171

Merged
merged 3 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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