From a9fa8754cf01e39a129ba62369358e2e10219e48 Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Fri, 28 Aug 2020 11:10:14 -0600 Subject: [PATCH] Do not add lake water to begwb and endwb, and thus also TWS See https://github.com/ESCOMP/CTSM/issues/659#issuecomment-682867045 for details. --- src/biogeophys/BalanceCheckMod.F90 | 2 +- src/biogeophys/LakeHydrologyMod.F90 | 2 +- src/biogeophys/TotalWaterAndHeatMod.F90 | 30 +++++++++++++++--------- src/dyn_subgrid/dynConsBiogeophysMod.F90 | 2 +- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 index 65f102a548..69f7cdb167 100644 --- a/src/biogeophys/BalanceCheckMod.F90 +++ b/src/biogeophys/BalanceCheckMod.F90 @@ -216,7 +216,7 @@ subroutine BeginWaterBalanceSingle(bounds, & call ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & waterstate_inst, lakestate_inst, & - subtract_dynbal_baselines = .false., & + add_lake_water_and_subtract_dynbal_baselines = .false., & water_mass = begwb(bounds%begc:bounds%endc)) call waterstate_inst%CalculateTotalH2osno(bounds, num_nolakec, filter_nolakec, & diff --git a/src/biogeophys/LakeHydrologyMod.F90 b/src/biogeophys/LakeHydrologyMod.F90 index c078e958e1..f6f83d8956 100644 --- a/src/biogeophys/LakeHydrologyMod.F90 +++ b/src/biogeophys/LakeHydrologyMod.F90 @@ -650,7 +650,7 @@ subroutine LakeHydrology(bounds, & call ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & b_waterstate_inst, lakestate_inst, & - subtract_dynbal_baselines = .false., & + add_lake_water_and_subtract_dynbal_baselines = .false., & water_mass = endwb(bounds%begc:bounds%endc)) do j = 1, nlevgrnd diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 index 3bec595bf0..9cb1d948d6 100644 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/biogeophys/TotalWaterAndHeatMod.F90 @@ -143,7 +143,7 @@ end subroutine ComputeWaterMassNonLake !----------------------------------------------------------------------- subroutine ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & waterstate_inst, lakestate_inst, & - subtract_dynbal_baselines, & + add_lake_water_and_subtract_dynbal_baselines, & water_mass) ! ! !DESCRIPTION: @@ -159,9 +159,12 @@ subroutine ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & class(waterstate_type) , intent(in) :: waterstate_inst type(lakestate_type) , intent(in) :: lakestate_inst + ! Whether to (1) add lake water/ice to total accounting, and (2) subtract + ! dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass + ! ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When https://github.com/ESCOMP/CTSM/issues/658 ! is resolved, remove this argument, always assuming it's true. - logical, intent(in) :: subtract_dynbal_baselines ! whether to subtract dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass + logical, intent(in) :: add_lake_water_and_subtract_dynbal_baselines real(r8) , intent(inout) :: water_mass( bounds%begc: ) ! computed water mass (kg m-2) ! @@ -181,7 +184,7 @@ subroutine ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & filter_lakec = filter_lakec, & waterstate_inst = waterstate_inst, & lakestate_inst = lakestate_inst, & - subtract_dynbal_baselines = subtract_dynbal_baselines, & + add_lake_water_and_subtract_dynbal_baselines = add_lake_water_and_subtract_dynbal_baselines, & liquid_mass = liquid_mass(bounds%begc:bounds%endc), & ice_mass = ice_mass(bounds%begc:bounds%endc)) @@ -388,7 +391,7 @@ end subroutine AccumulateSoilLiqIceMassNonLake !----------------------------------------------------------------------- subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & waterstate_inst, lakestate_inst,& - subtract_dynbal_baselines, & + add_lake_water_and_subtract_dynbal_baselines, & liquid_mass, ice_mass) ! ! !DESCRIPTION: @@ -408,9 +411,12 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & type(lakestate_type) , intent(in) :: lakestate_inst + ! Whether to (1) add lake water/ice to total accounting, and (2) subtract + ! dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass + ! ! BUG(wjs, 2019-03-12, ESCOMP/ctsm#659) When https://github.com/ESCOMP/CTSM/issues/658 ! is resolved, remove this argument, always assuming it's true. - logical, intent(in) :: subtract_dynbal_baselines ! whether to subtract dynbal_baseline_liq and dynbal_baseline_ice from liquid_mass and ice_mass + logical, intent(in) :: add_lake_water_and_subtract_dynbal_baselines real(r8) , intent(inout) :: liquid_mass( bounds%begc: ) ! computed liquid water mass (kg m-2) real(r8) , intent(inout) :: ice_mass( bounds%begc: ) ! computed ice mass (kg m-2) @@ -449,11 +455,13 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & ice_mass(c) = ice_mass(c) + h2osoi_ice(c,j) end do end do - - ! Lake water content - call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, & - lakestate_inst, liquid_mass, ice_mass) - + + if (add_lake_water_and_subtract_dynbal_baselines) then + ! Lake water content + call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, & + lakestate_inst, liquid_mass, ice_mass) + end if + ! Soil water content of the soil under the lake do j = 1, nlevgrnd do fc = 1, num_lakec @@ -463,7 +471,7 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & end do end do - if (subtract_dynbal_baselines) then + if (add_lake_water_and_subtract_dynbal_baselines) then ! Subtract baselines set in initialization do fc = 1, num_lakec c = filter_lakec(fc) diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 index d8bb809bba..9dc9b46002 100644 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ b/src/dyn_subgrid/dynConsBiogeophysMod.F90 @@ -645,7 +645,7 @@ subroutine dyn_water_content(bounds, & call ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & waterstate_inst, & lakestate_inst, & - subtract_dynbal_baselines = .true., & + add_lake_water_and_subtract_dynbal_baselines = .true., & liquid_mass = liquid_mass_col(bounds%begc:bounds%endc), & ice_mass = ice_mass_col(bounds%begc:bounds%endc))