Skip to content

Commit

Permalink
Do not add lake water to begwb and endwb, and thus also TWS
Browse files Browse the repository at this point in the history
See ESCOMP#659 (comment) for
details.
  • Loading branch information
billsacks committed Aug 28, 2020
1 parent 5658dde commit a9fa875
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/biogeophys/BalanceCheckMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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, &
Expand Down
2 changes: 1 addition & 1 deletion src/biogeophys/LakeHydrologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 19 additions & 11 deletions src/biogeophys/TotalWaterAndHeatMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
!
Expand All @@ -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))

Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/dyn_subgrid/dynConsBiogeophysMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit a9fa875

Please sign in to comment.