Skip to content

Commit 658064e

Browse files
committed
Updated some comments, added back protections on patch canopy areas exceeding 1 during the output boundary condition preparations.
1 parent c357399 commit 658064e

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

biogeochem/EDCanopyStructureMod.F90

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr)
318318
! !LOCAL VARIABLES:
319319
type(ed_cohort_type), pointer :: currentCohort,copyc
320320
integer :: i_cwd ! Index for CWD pool
321-
real(r8) :: cc_loss
321+
real(r8) :: cc_loss ! cohort crown area loss in demotion (m2)
322322
real(r8) :: lossarea
323323
real(r8) :: newarea
324324
real(r8) :: demote_area
@@ -638,7 +638,7 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
638638
integer :: exceedance_counter
639639
real(r8) :: remainder_area
640640
real(r8) :: remainder_area_hold
641-
real(r8) :: cc_gain
641+
real(r8) :: cc_gain ! cohort crown area gain in promotion (m2)
642642
real(r8) :: arealayer_current ! area (m2) of the current canopy layer
643643
real(r8) :: arealayer_below ! area (m2) of the layer below the current layer
644644

@@ -1628,9 +1628,11 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out)
16281628
! currentPatch%total_canopy_area/currentPatch%area is fraction of this patch cover by plants
16291629
! currentPatch%area/AREA is the fraction of the soil covered by this patch.
16301630

1631-
bc_out(s)%canopy_fraction_pa(ifp) = currentPatch%total_canopy_area/AREA
1631+
bc_out(s)%canopy_fraction_pa(ifp) = &
1632+
min(1.0_r8,currentPatch%total_canopy_area/currentPatch%area)*(currentPatch%area/AREA)
16321633

1633-
bare_frac_area = (1.0_r8-currentPatch%total_canopy_area/currentPatch%area)*(currentPatch%area/AREA)
1634+
bare_frac_area = (1.0_r8 - min(1.0_r8,currentPatch%total_canopy_area/currentPatch%area)) * &
1635+
(currentPatch%area/AREA)
16341636

16351637
total_patch_area = total_patch_area + bc_out(s)%canopy_fraction_pa(ifp) + bare_frac_area
16361638

@@ -1674,8 +1676,10 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out)
16741676
call endrun(msg=errMsg(sourcefile, __LINE__))
16751677
end if
16761678

1677-
write(fates_log(),*) 'imprecise patch areas in update_hlm_dynamics',total_patch_area
1678-
1679+
if(DEBUG) then
1680+
write(fates_log(),*) 'imprecise patch areas in update_hlm_dynamics',total_patch_area
1681+
end if
1682+
16791683
currentPatch => sites(s)%oldest_patch
16801684
ifp = 0
16811685
do while(associated(currentPatch))

biogeochem/EDPatchDynamicsMod.F90

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module EDPatchDynamicsMod
3636
use FatesConstantsMod , only : ha_per_m2
3737
use FatesConstantsMod , only : days_per_sec
3838
use FatesConstantsMod , only : years_per_day
39+
use FatesConstantsMod , only : nearzero
3940

4041

4142
! CIME globals
@@ -730,9 +731,14 @@ subroutine check_patch_area( currentSite )
730731

731732
if ( abs(areatot-area) > area_error_fail ) then
732733
write(fates_log(),*) 'Patch areas do not sum to 10000 within tolerance'
733-
write(fates_log(),*) 'Total area: ': areatot,'absolute error: ',areatot-area
734+
write(fates_log(),*) 'Total area: ',areatot,'absolute error: ',areatot-area
734735
call endrun(msg=errMsg(sourcefile, __LINE__))
735736
end if
737+
738+
if(debug) then
739+
write(fates_log(),*) 'Total patch area precision being fixed, adjusting'
740+
write(fates_log(),*) 'largest patch. This may have slight impacts on carbon balance.'
741+
end if
736742

737743
largestPatch%area = largestPatch%area + (area-areatot)
738744

0 commit comments

Comments
 (0)