Skip to content

Commit 4e6fa61

Browse files
committed
Kludge to ignore diagnostic stomatal conductance from mosses.
1 parent bf6cdae commit 4e6fa61

File tree

4 files changed

+161
-17
lines changed

4 files changed

+161
-17
lines changed

biogeochem/EDPatchDynamicsMod.F90

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3191,7 +3191,28 @@ subroutine fuse_2_patches(csite, dp, rp)
31913191
rp%frac_burnt = (dp%frac_burnt*dp%area + rp%frac_burnt*rp%area) * inv_sum_area
31923192
rp%btran_ft(:) = (dp%btran_ft(:)*dp%area + rp%btran_ft(:)*rp%area) * inv_sum_area
31933193
rp%zstar = (dp%zstar*dp%area + rp%zstar*rp%area) * inv_sum_area
3194-
rp%c_stomata = (dp%c_stomata*dp%area + rp%c_stomata*rp%area) * inv_sum_area
3194+
if (dp%IsAllMoss() .or. rp%IsAllMoss()) then
3195+
! We set c_stomata to the unset real value in FatesPlantRespPhotosynthDrive() because mosses
3196+
! are expected to have zero resistance. If exactly one fusing patch is all moss, take
3197+
! c_stomata from that. This is not accurate, but it's only a diagnostic and for
3198+
! one timestep at most (until the next call of FatesPlantRespPhotosynthDrive).
3199+
! TODO:
3200+
! * If keeping fates_unset_r8 kludge in FatesPlantRespPhotosynthDrive(), code up a way
3201+
! to quickly recalculate c_stomata without having to call FatesPlantRespPhotosynthDrive()
3202+
! again.
3203+
! * Otherwise, c_stomata should always have meaningful values, so remove this special
3204+
! handling and just calculate the new value as the area-weighted mean of the donor and
3205+
! recipient patches.
3206+
if (.not. dp%IsAllMoss()) then
3207+
rp%c_stomata = dp%c_stomata
3208+
else if (.not. rp%IsAllMoss()) then
3209+
rp%c_stomata = rp%c_stomata
3210+
else
3211+
rp%c_stomata = fates_unset_r8
3212+
end if
3213+
else
3214+
rp%c_stomata = (dp%c_stomata*dp%area + rp%c_stomata*rp%area) * inv_sum_area
3215+
end if
31953216
rp%c_lblayer = (dp%c_lblayer*dp%area + rp%c_lblayer*rp%area) * inv_sum_area
31963217

31973218
! Radiation

biogeochem/FatesPatchMod.F90

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ module FatesPatchMod
241241
procedure :: FreeMemory
242242
procedure :: Dump
243243
procedure :: CheckVars
244+
procedure :: IsAllMoss
244245

245246
end type fates_patch_type
246247

@@ -1286,6 +1287,33 @@ subroutine CheckVars(this, var_aliases, return_code)
12861287

12871288
end subroutine CheckVars
12881289

1290+
!===========================================================================
1291+
1292+
function IsAllMoss(this)
1293+
!
1294+
! DESCRIPTION:
1295+
! Checks whether all cohorts on patch are moss
1296+
1297+
! ARGUMENTS:
1298+
class(fates_patch_type), intent(inout) :: this
1299+
1300+
! LOCALS:
1301+
type(fates_cohort_type), pointer :: currentCohort ! cohort object
1302+
1303+
! RESULT:
1304+
logical :: IsAllMoss
1305+
1306+
IsAllMoss = .true.
1307+
currentCohort => this%tallest
1308+
do while(associated(currentCohort) .and. IsAllMoss)
1309+
if (prt_params%moss(currentCohort%pft) == ifalse) then
1310+
IsAllMoss = .false.
1311+
end if
1312+
currentCohort => currentCohort%shorter
1313+
end do
1314+
1315+
end function IsAllMoss
1316+
12891317
!===========================================================================
12901318

12911319
end module FatesPatchMod

biogeophys/FatesPlantRespPhotosynthMod.F90

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,9 @@ subroutine FatesPlantRespPhotosynthDrive (nsites, sites,bc_in,bc_out,dtime)
11371137
! the inverse of mean leaf conductance
11381138
r_sb_leaves = 1.0_r8/g_sb_leaves
11391139

1140-
if (r_sb_leaves<bc_in(s)%rb_pa(ifp)) then
1140+
! Mosses have 0 stomatal resistance, so we actually do expect it to be less
1141+
! than boundary layer resistance
1142+
if (r_sb_leaves<bc_in(s)%rb_pa(ifp) .and. .not. currentPatch%IsAllMoss()) then
11411143
write(fates_log(),*) 'Combined canopy resistance was somehow smaller than'
11421144
write(fates_log(),*) 'its boundary layer resistance component'
11431145
write(fates_log(),*) 'r_sb_leaves [s/m]: ',r_sb_leaves
@@ -1165,7 +1167,16 @@ subroutine FatesPlantRespPhotosynthDrive (nsites, sites,bc_in,bc_out,dtime)
11651167
! is what is used in the field usually, so we track that form
11661168
! vmol_cf : s m**2/umol -> s/m (ideal gas conversion) [umol/m3]
11671169

1168-
currentPatch%c_stomata = vmol_cf / r_stomata
1170+
if (currentPatch%IsAllMoss()) then
1171+
! Mosses have 0 stomatal resistance, so 1/r_stomata would be infinite
1172+
! and cause floating-point errors.
1173+
! TODO: Is there a better way to handle this? Conductance has units
1174+
! mol (H2O?) m-2 s-1, so can we just do the stoichiometry to get this based
1175+
! on GPP and respiration?
1176+
currentPatch%c_stomata = fates_unset_r8
1177+
else
1178+
currentPatch%c_stomata = vmol_cf / r_stomata
1179+
end if
11691180

11701181
else !if_any_lai
11711182

0 commit comments

Comments
 (0)