Skip to content

Commit

Permalink
Use tracer ratio when counting lake water
Browse files Browse the repository at this point in the history
This is needed for water tracer masses to be counted correctly
  • Loading branch information
billsacks committed Sep 1, 2020
1 parent a9fa875 commit 52105c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
19 changes: 12 additions & 7 deletions src/biogeophys/TotalWaterAndHeatMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ end subroutine AccumulateSoilLiqIceMassNonLake

!-----------------------------------------------------------------------
subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, &
waterstate_inst, lakestate_inst,&
waterstate_inst, lakestate_inst, &
add_lake_water_and_subtract_dynbal_baselines, &
liquid_mass, ice_mass)
!
Expand All @@ -410,7 +410,6 @@ subroutine ComputeLiqIceMassLake(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
!
Expand Down Expand Up @@ -459,7 +458,10 @@ subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, &
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)
lakestate_inst, &
tracer_ratio = waterstate_inst%info%get_ratio(), &
liquid_mass = liquid_mass(bounds%begc:bounds%endc), &
ice_mass = ice_mass(bounds%begc:bounds%endc))
end if

! Soil water content of the soil under the lake
Expand All @@ -486,7 +488,7 @@ end subroutine ComputeLiqIceMassLake

!-----------------------------------------------------------------------
subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, &
lakestate_inst, liquid_mass, ice_mass)
lakestate_inst, tracer_ratio, liquid_mass, ice_mass)
!
! !DESCRIPTION:
! Accumulate lake water mass of lake columns, separated into liquid and ice.
Expand All @@ -501,6 +503,7 @@ subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, &
integer , intent(in) :: num_c ! number of column points in column filter (should not include lake points; can be a subset of the no-lake filter)
integer , intent(in) :: filter_c(:) ! column filter (should not include lake points; can be a subset of the no-lake filter)
type(lakestate_type) , intent(in) :: lakestate_inst
real(r8) , intent(in) :: tracer_ratio ! for water tracers, standard ratio of this tracer to bulk water (1 for bulk water)
real(r8) , intent(inout) :: liquid_mass( bounds%begc: ) ! accumulated liquid mass (kg m-2)
real(r8) , intent(inout) :: ice_mass( bounds%begc: ) ! accumulated ice mass (kg m-2)
!
Expand All @@ -524,12 +527,14 @@ subroutine AccumulateLiqIceMassLake(bounds, num_c, filter_c, &
do j = 1, nlevlak
do fc = 1, num_c
c = filter_c(fc)
! calculate lake liq and ice content per lake layer first
h2olak_liq = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j))
! Lake water volume isn't tracked explicitly, so we calculate it from lake
! depth. Because it isn't tracked explicitly, we also don't have any water
! tracer information, so we assume a fixed, standard tracer ratio.
h2olak_liq = dz_lake(c,j) * denh2o * (1 - lake_icefrac(c,j)) * tracer_ratio

! use water density rather than ice density because lake layer depths are not
! adjusted when the layer freezes
h2olak_ice = dz_lake(c,j) * denh2o * lake_icefrac(c,j)
h2olak_ice = dz_lake(c,j) * denh2o * lake_icefrac(c,j) * tracer_ratio

liquid_mass(c) = liquid_mass(c) + h2olak_liq
ice_mass(c) = ice_mass(c) + h2olak_ice
Expand Down
5 changes: 3 additions & 2 deletions src/dyn_subgrid/dynConsBiogeophysMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ subroutine dyn_water_content_set_baselines(bounds, natveg_and_glc_filterc, &

! Calculate the total water volume of the lake column
call AccumulateLiqIceMassLake(bounds, num_lakec, filter_lakec, lakestate_inst, &
liquid_mass = lake_liquid_mass_col(bounds%begc:bounds%endc), &
ice_mass = lake_ice_mass_col(bounds%begc:bounds%endc))
tracer_ratio = waterstate_inst%info%get_ratio(), &
liquid_mass = lake_liquid_mass_col(bounds%begc:bounds%endc), &
ice_mass = lake_ice_mass_col(bounds%begc:bounds%endc))

do fc = 1, num_lakec
c = filter_lakec(fc)
Expand Down

0 comments on commit 52105c4

Please sign in to comment.