From b547d67134c64b1d93dd267ef262bc0db5d5a461 Mon Sep 17 00:00:00 2001 From: Luke Van Roekel Date: Thu, 1 Sep 2022 22:51:21 -0500 Subject: [PATCH 1/3] Fixes 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. --- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 4 +-- .../src/shared/mpas_ocn_tracer_hmix.F | 6 ++--- .../src/shared/mpas_ocn_tracer_hmix_redi.F | 27 +++++++------------ 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index e081df8ae097..c1f2ba9ea391 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -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 diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix.F index 2912f60eeb41..2f333b0ec644 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix.F @@ -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)!{{{ !----------------------------------------------------------------- @@ -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, & @@ -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) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix_redi.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix_redi.F index 47d17483e276..b40bbfbb3548 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix_redi.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix_redi.F @@ -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)!{{{ !----------------------------------------------------------------- ! @@ -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 @@ -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) @@ -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))*0.25_RKIND do iTr = 1, nTracers ! \kappa_2 \nabla \phi on edge @@ -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) @@ -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 @@ -446,8 +437,8 @@ 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, iCell)* & + redi_term3_topOfCell(iTr, k, iCell) - & *RediKappaScaling(k + 1, iCell)*redi_term3_topOfCell(iTr, k + 1, iCell)) end do end do From 98296b4a3e1849e9abb8120ad68201a90d5c1e4d Mon Sep 17 00:00:00 2001 From: Luke Van Roekel Date: Fri, 2 Sep 2022 08:25:10 -0500 Subject: [PATCH 2/3] Removes extra characters --- components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix_redi.F | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix_redi.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix_redi.F index b40bbfbb3548..e027e1e4f588 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix_redi.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_hmix_redi.F @@ -275,7 +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 + RediKappaScaling(k + 1, cell1) + RediKappaScaling(k + 1, cell2)) do iTr = 1, nTracers ! \kappa_2 \nabla \phi on edge @@ -439,7 +439,7 @@ subroutine ocn_tracer_hmix_Redi_tend(meshPool, layerThickness, layerThickEdgeMea tend(iTr, k, iCell) = tend(iTr, k, iCell) + rediKappaCell(iCell)*2.0_RKIND* & (RediKappaScaling(k, iCell)* & redi_term3_topOfCell(iTr, k, iCell) - & - *RediKappaScaling(k + 1, iCell)*redi_term3_topOfCell(iTr, k + 1, iCell)) + RediKappaScaling(k + 1, iCell)*redi_term3_topOfCell(iTr, k + 1, iCell)) end do end do From 42eca04476f559a062cb7d0b17648cd5d242f533 Mon Sep 17 00:00:00 2001 From: Mark Petersen Date: Tue, 20 Sep 2022 14:17:56 -0600 Subject: [PATCH 3/3] Add mixed layer depth check to surface taper --- components/mpas-ocean/src/shared/mpas_ocn_gm.F | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_gm.F b/components/mpas-ocean/src/shared/mpas_ocn_gm.F index 905298d5a092..336a160e3b9f 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_gm.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_gm.F @@ -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)