Skip to content

Commit 9ae322a

Browse files
authored
Merge pull request #349 from ckoven/parprof
Some radiation profile updates: clumping, SAI changes, and diagnostics
2 parents a29f894 + d55d039 commit 9ae322a

File tree

8 files changed

+330
-139
lines changed

8 files changed

+330
-139
lines changed

biogeochem/EDCanopyStructureMod.F90

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ module EDCanopyStructureMod
1010
use EDPftvarcon , only : EDPftvarcon_inst
1111
use FatesAllometryMod , only : carea_allom
1212
use EDCohortDynamicsMod , only : copy_cohort, terminate_cohorts, fuse_cohorts
13-
use EDCohortDynamicsMod , only : tree_lai
14-
use EDCohortDynamicsMod , only : tree_sai
13+
use FatesAllometryMod , only : tree_lai
14+
use FatesAllometryMod , only : tree_sai
1515
use EDtypesMod , only : ed_site_type, ed_patch_type, ed_cohort_type, ncwd
1616
use EDTypesMod , only : nclmax
1717
use EDTypesMod , only : nlevleaf
@@ -930,9 +930,10 @@ subroutine canopy_summarization( nsites, sites, bc_in )
930930
call sizetype_class_index(currentCohort%dbh,currentCohort%pft, &
931931
currentCohort%size_class,currentCohort%size_by_pft_class)
932932

933-
call carea_allom(currentCohort%dbh,currentCohort%n, &
934-
sites(s)%spread,currentCohort%pft,currentCohort%c_area)
935-
currentCohort%treelai = tree_lai(currentCohort)
933+
call carea_allom(currentCohort%dbh,currentCohort%n,sites(s)%spread,&
934+
currentCohort%pft,currentCohort%c_area)
935+
currentCohort%treelai = tree_lai(currentCohort%bl, currentCohort%status_coh, &
936+
currentCohort%pft, currentCohort%c_area, currentCohort%n )
936937

937938
canopy_leaf_area = canopy_leaf_area + currentCohort%treelai *currentCohort%c_area
938939

@@ -1097,8 +1098,11 @@ subroutine leaf_area_profile( currentSite , snow_depth_si, frac_sno_eff_si)
10971098
ft = currentCohort%pft
10981099
cl = currentCohort%canopy_layer
10991100

1100-
currentCohort%treelai = tree_lai(currentCohort)
1101-
currentCohort%treesai = tree_sai(currentCohort)
1101+
currentCohort%treelai = tree_lai(currentCohort%bl, currentCohort%status_coh, currentCohort%pft, &
1102+
currentCohort%c_area, currentCohort%n )
1103+
currentCohort%treesai = tree_sai(currentCohort%dbh, currentCohort%pft, currentCohort%canopy_trim, &
1104+
currentCohort%c_area, currentCohort%n)
1105+
11021106
currentCohort%lai = currentCohort%treelai *currentCohort%c_area/currentPatch%total_canopy_area
11031107
currentCohort%sai = currentCohort%treesai *currentCohort%c_area/currentPatch%total_canopy_area
11041108

biogeochem/EDCohortDynamicsMod.F90

Lines changed: 5 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module EDCohortDynamicsMod
3636
use FatesAllometryMod , only : h_allom
3737
use FatesAllometryMod , only : carea_allom
3838
use FatesAllometryMod , only : StructureResetOfDH
39+
use FatesAllometryMod , only : tree_lai, tree_sai
3940
! CIME globals
4041
use shr_log_mod , only : errMsg => shr_log_errMsg
4142
!
@@ -51,8 +52,6 @@ module EDCohortDynamicsMod
5152
public :: sort_cohorts
5253
public :: copy_cohort
5354
public :: count_cohorts
54-
public :: tree_lai
55-
public :: tree_sai
5655

5756
logical, parameter :: DEBUG = .false. ! local debug flag
5857

@@ -153,9 +152,11 @@ subroutine create_cohort(patchptr, pft, nn, hite, dbh, &
153152
! Assign canopy extent and depth
154153
call carea_allom(new_cohort%dbh,new_cohort%n,new_cohort%siteptr%spread,new_cohort%pft,new_cohort%c_area)
155154

156-
new_cohort%treelai = tree_lai(new_cohort)
155+
new_cohort%treelai = tree_lai(new_cohort%bl, new_cohort%status_coh, new_cohort%pft, &
156+
new_cohort%c_area, new_cohort%n)
157157
new_cohort%lai = new_cohort%treelai * new_cohort%c_area/patchptr%area
158-
new_cohort%treesai = 0.0_r8 !FIX(RF,032414)
158+
new_cohort%treesai = tree_sai(new_cohort%dbh, new_cohort%pft, new_cohort%canopy_trim, &
159+
new_cohort%c_area, new_cohort%n)
159160

160161
! Put cohort at the right place in the linked list
161162
storebigcohort => patchptr%tallest
@@ -1232,82 +1233,6 @@ function count_cohorts( currentPatch ) result ( backcount )
12321233
endif
12331234

12341235
end function count_cohorts
1235-
1236-
! =====================================================================================
1237-
1238-
real(r8) function tree_lai( cohort_in )
1239-
1240-
! ============================================================================
1241-
! LAI of individual trees is a function of the total leaf area and the total canopy area.
1242-
! ============================================================================
1243-
1244-
type(ed_cohort_type), intent(inout) :: cohort_in
1245-
1246-
real(r8) :: leafc_per_unitarea ! KgC of leaf per m2 area of ground.
1247-
real(r8) :: slat ! the sla of the top leaf layer. m2/kgC
1248-
1249-
if( cohort_in%bl < 0._r8 .or. cohort_in%pft == 0 ) then
1250-
write(fates_log(),*) 'problem in treelai',cohort_in%bl,cohort_in%pft
1251-
endif
1252-
1253-
if( cohort_in%status_coh == 2 ) then ! are the leaves on?
1254-
slat = 1000.0_r8 * EDPftvarcon_inst%slatop(cohort_in%pft) ! m2/g to m2/kg
1255-
leafc_per_unitarea = cohort_in%bl/(cohort_in%c_area/cohort_in%n) !KgC/m2
1256-
if(leafc_per_unitarea > 0.0_r8)then
1257-
tree_lai = leafc_per_unitarea * slat !kg/m2 * m2/kg = unitless LAI
1258-
else
1259-
tree_lai = 0.0_r8
1260-
endif
1261-
else
1262-
tree_lai = 0.0_r8
1263-
endif !status
1264-
cohort_in%treelai = tree_lai
1265-
1266-
! here, if the LAI exceeeds the maximum size of the possible array, then we have no way of accomodating it
1267-
! at the moments nlevleaf default is 40, which is very large, so exceeding this would clearly illustrate a
1268-
! huge error
1269-
if(cohort_in%treelai > nlevleaf*dinc_ed)then
1270-
write(fates_log(),*) 'too much lai' , cohort_in%treelai , cohort_in%pft , nlevleaf * dinc_ed
1271-
endif
1272-
1273-
return
1274-
1275-
end function tree_lai
1276-
1277-
! ============================================================================
1278-
1279-
real(r8) function tree_sai( cohort_in )
1280-
1281-
! ============================================================================
1282-
! SAI of individual trees is a function of the total dead biomass per unit canopy area.
1283-
! ============================================================================
1284-
1285-
type(ed_cohort_type), intent(inout) :: cohort_in
1286-
1287-
real(r8) :: bdead_per_unitarea ! KgC of leaf per m2 area of ground.
1288-
real(r8) :: sai_scaler
1289-
1290-
sai_scaler = EDPftvarcon_inst%allom_sai_scaler(cohort_in%pft)
1291-
1292-
if( cohort_in%bdead < 0._r8 .or. cohort_in%pft == 0 ) then
1293-
write(fates_log(),*) 'problem in treesai',cohort_in%bdead,cohort_in%pft
1294-
endif
1295-
1296-
bdead_per_unitarea = cohort_in%bdead/(cohort_in%c_area/cohort_in%n) !KgC/m2
1297-
tree_sai = bdead_per_unitarea * sai_scaler !kg/m2 * m2/kg = unitless LAI
1298-
1299-
cohort_in%treesai = tree_sai
1300-
1301-
! here, if the LAI exceeeds the maximum size of the possible array, then we have no way of accomodating it
1302-
! at the moments nlevleaf default is 40, which is very large, so exceeding this would clearly illustrate a
1303-
! huge error
1304-
if(cohort_in%treesai > nlevleaf*dinc_ed)then
1305-
write(fates_log(),*) 'too much sai' , cohort_in%treesai , cohort_in%pft , nlevleaf * dinc_ed
1306-
endif
1307-
1308-
return
1309-
1310-
end function tree_sai
13111236

13121237
! ============================================================================
13131238

biogeochem/EDPhysiologyMod.F90

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ module EDPhysiologyMod
1717
use FatesInterfaceMod, only : bc_in_type
1818
use EDCohortDynamicsMod , only : zero_cohort
1919
use EDCohortDynamicsMod , only : create_cohort, sort_cohorts
20-
use EDCohortDynamicsMod , only : tree_lai
21-
use EDCohortDynamicsMod , only : tree_sai
20+
use FatesAllometryMod , only : tree_lai
21+
use FatesAllometryMod , only : tree_sai
2222

2323
use EDTypesMod , only : numWaterMem
2424
use EDTypesMod , only : dl_sf, dinc_ed
@@ -185,7 +185,10 @@ subroutine trim_canopy( currentSite )
185185
trimmed = 0
186186
ipft = currentCohort%pft
187187
call carea_allom(currentCohort%dbh,currentCohort%n,currentSite%spread,currentCohort%pft,currentCohort%c_area)
188-
currentCohort%treelai = tree_lai(currentCohort)
188+
currentCohort%treelai = tree_lai(currentCohort%bl, currentCohort%status_coh, currentCohort%pft, &
189+
currentCohort%c_area, currentCohort%n )
190+
currentCohort%treesai = tree_sai(currentCohort%dbh, currentCohort%pft, currentCohort%canopy_trim, &
191+
currentCohort%c_area, currentCohort%n)
189192
currentCohort%nv = ceiling((currentCohort%treelai+currentCohort%treesai)/dinc_ed)
190193
if (currentCohort%nv > nlevleaf)then
191194
write(fates_log(),*) 'nv > nlevleaf',currentCohort%nv,currentCohort%treelai,currentCohort%treesai, &

biogeochem/FatesAllometryMod.F90

Lines changed: 88 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,13 @@ module FatesAllometryMod
8686
use EDPFTvarcon , only : EDPftvarcon_inst
8787
use FatesConstantsMod, only : r8 => fates_r8
8888
use FatesConstantsMod, only : i4 => fates_int
89+
use FatesConstantsMod, only : g_per_kg
90+
use FatesConstantsMod, only : cm2_per_m2
91+
use FatesConstantsMod, only : kg_per_Megag
8992
use shr_log_mod , only : errMsg => shr_log_errMsg
9093
use FatesGlobals , only : fates_log
9194
use FatesGlobals , only : endrun => fates_endrun
95+
use EDTypesMod , only : nlevleaf, dinc_ed
9296

9397
implicit none
9498

@@ -98,6 +102,8 @@ module FatesAllometryMod
98102
public :: bagw_allom ! Generic AGWB (above grnd. woody bio) wrapper
99103
public :: blmax_allom ! Generic maximum leaf biomass wrapper
100104
public :: bleaf ! Generic actual leaf biomass wrapper
105+
public :: tree_lai ! Calculate tree-level LAI from actual leaf biomass
106+
public :: tree_sai ! Calculate tree-level SAI from target leaf biomass
101107
public :: bsap_allom ! Generic sapwood wrapper
102108
public :: bbgw_allom ! Generic coarse root wrapper
103109
public :: bfineroot ! Generic actual fine root biomass wrapper
@@ -494,6 +500,87 @@ subroutine bleaf(d,ipft,canopy_trim,bl,dbldd)
494500
return
495501
end subroutine bleaf
496502

503+
! =====================================================================================
504+
505+
real(r8) function tree_lai( bl, status_coh, pft, c_area, n )
506+
507+
! ============================================================================
508+
! LAI of individual trees is a function of the total leaf area and the total canopy area.
509+
! ============================================================================
510+
511+
real(r8), intent(in) :: bl ! plant leaf biomass [kg]
512+
integer, intent(in) :: status_coh ! growth status of plant (2 = leaves on , 1 = leaves off)
513+
integer, intent(in) :: pft
514+
real(r8), intent(in) :: c_area ! areal extent of canopy (m2)
515+
real(r8), intent(in) :: n ! number of individuals in cohort per 'area' (10000m2 default)
516+
517+
real(r8) :: leafc_per_unitarea ! KgC of leaf per m2 area of ground.
518+
real(r8) :: slat ! the sla of the top leaf layer. m2/kgC
519+
520+
if( bl < 0._r8 .or. pft == 0 ) then
521+
write(fates_log(),*) 'problem in treelai',bl,pft
522+
endif
523+
524+
slat = g_per_kg * EDPftvarcon_inst%slatop(pft) ! m2/g to m2/kg
525+
leafc_per_unitarea = bl/(c_area/n) !KgC/m2
526+
if(leafc_per_unitarea > 0.0_r8)then
527+
tree_lai = leafc_per_unitarea * slat !kg/m2 * m2/kg = unitless LAI
528+
else
529+
tree_lai = 0.0_r8
530+
endif
531+
532+
533+
! here, if the LAI exceeeds the maximum size of the possible array, then we have no way of accomodating it
534+
! at the moments nlevleaf default is 40, which is very large, so exceeding this would clearly illustrate a
535+
! huge error
536+
if(tree_lai > nlevleaf*dinc_ed)then
537+
write(fates_log(),*) 'too much lai' , tree_lai , pft , nlevleaf * dinc_ed
538+
write(fates_log(),*) 'Aborting'
539+
call endrun(msg=errMsg(sourcefile, __LINE__))
540+
endif
541+
542+
return
543+
544+
end function tree_lai
545+
546+
! ============================================================================
547+
548+
real(r8) function tree_sai( dbh, pft, canopy_trim, c_area, n )
549+
550+
! ============================================================================
551+
! SAI of individual trees is a function of the target leaf biomass
552+
! ============================================================================
553+
554+
real(r8),intent(in) :: dbh
555+
integer, intent(in) :: pft
556+
real(r8),intent(in) :: canopy_trim
557+
real(r8), intent(in) :: c_area ! areal extent of canopy (m2)
558+
real(r8), intent(in) :: n ! number of individuals in cohort per 'area' (10000m2 default)
559+
560+
real(r8) :: leafc_per_unitarea ! KgC of target leaf per m2 area of ground.
561+
real(r8) :: sai_scaler
562+
real(r8) :: b_leaf
563+
564+
sai_scaler = g_per_kg * EDPftvarcon_inst%allom_sai_scaler(pft) ! m2/g to m2/kg
565+
566+
call bleaf(dbh,pft,canopy_trim,b_leaf)
567+
568+
leafc_per_unitarea = b_leaf/(c_area/n) !KgC/m2
569+
570+
tree_sai = leafc_per_unitarea * sai_scaler !kg/m2 * m2/kg = unitless SAI
571+
572+
! here, if the LAI exceeeds the maximum size of the possible array, then we have no way of accomodating it
573+
! at the moments nlevleaf default is 40, which is very large, so exceeding this would clearly illustrate a
574+
! huge error
575+
if(tree_sai > nlevleaf*dinc_ed)then
576+
write(fates_log(),*) 'too much sai' , tree_sai , pft , nlevleaf * dinc_ed
577+
write(fates_log(),*) 'Aborting'
578+
call endrun(msg=errMsg(sourcefile, __LINE__))
579+
endif
580+
581+
return
582+
583+
end function tree_sai
497584

498585
! ============================================================================
499586
! Generic sapwood biomass interface
@@ -804,9 +891,7 @@ end subroutine bbgw_const
804891

805892
subroutine bsap_deprecated(d,h,dhdd,bleaf,dbleafdd,ipft,bsap,dbsapdd)
806893

807-
use FatesConstantsMod, only : g_per_kg
808-
use FatesConstantsMod, only : cm2_per_m2
809-
use FatesConstantsMod, only : kg_per_Megag
894+
810895

811896
! -------------------------------------------------------------------------
812897
! -------------------------------------------------------------------------
@@ -853,10 +938,6 @@ end subroutine bsap_deprecated
853938

854939
subroutine bsap_dlinear(d,h,dhdd,bleaf,dbleafdd,ipft,bsap,dbsapdd)
855940

856-
use FatesConstantsMod, only : g_per_kg
857-
use FatesConstantsMod, only : cm2_per_m2
858-
use FatesConstantsMod, only : kg_per_Megag
859-
860941
! -------------------------------------------------------------------------
861942
! Calculate sapwood biomass based on leaf area to sapwood area
862943
! proportionality. In this function, the leaftosapwood area is a function
@@ -1685,7 +1766,6 @@ subroutine StructureResetOfDH( bdead, ipft, canopy_trim, d, h )
16851766
! T
16861767
! ============================================================================
16871768

1688-
16891769
use FatesConstantsMod , only : calloc_abs_error
16901770
! Arguments
16911771

0 commit comments

Comments
 (0)