Skip to content

Commit

Permalink
Fixed the check on maximum allowable VAI. Updated SAI ratios in defau…
Browse files Browse the repository at this point in the history
…lt files.
  • Loading branch information
rgknox committed Jul 25, 2018
1 parent a004675 commit 4925683
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ subroutine leaf_area_profile( currentSite , snow_depth_si, frac_sno_eff_si)

currentCohort%treesai = tree_sai(currentCohort%pft, currentCohort%dbh, currentCohort%canopy_trim, &
currentCohort%c_area, currentCohort%n, currentCohort%canopy_layer, &
currentPatch%canopy_layer_tlai )
currentPatch%canopy_layer_tlai, currentCohort%treelai )

currentCohort%lai = currentCohort%treelai *currentCohort%c_area/currentPatch%total_canopy_area
currentCohort%sai = currentCohort%treesai *currentCohort%c_area/currentPatch%total_canopy_area
Expand Down
2 changes: 1 addition & 1 deletion biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, dbh, bleaf, bfine

new_cohort%treesai = tree_sai(new_cohort%pft, new_cohort%dbh, new_cohort%canopy_trim, &
new_cohort%c_area, new_cohort%n, new_cohort%canopy_layer, &
patchptr%canopy_layer_tlai )
patchptr%canopy_layer_tlai, new_cohort%treelai )

new_cohort%lai = new_cohort%treelai * new_cohort%c_area/patchptr%area

Expand Down
2 changes: 1 addition & 1 deletion biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ subroutine trim_canopy( currentSite )

currentCohort%treesai = tree_sai(currentCohort%pft, currentCohort%dbh, currentCohort%canopy_trim, &
currentCohort%c_area, currentCohort%n, currentCohort%canopy_layer, &
currentPatch%canopy_layer_tlai )
currentPatch%canopy_layer_tlai, currentCohort%treelai )

currentCohort%nv = ceiling((currentCohort%treelai+currentCohort%treesai)/dinc_ed)

Expand Down
41 changes: 21 additions & 20 deletions biogeochem/FatesAllometryMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -663,36 +663,26 @@ real(r8) function tree_lai( bl, pft, c_area, nplant, cl, canopy_lai)
tree_lai = 0.0_r8
endif ! (leafc_per_unitarea > 0.0_r8)

! here, if the LAI exceeeds the maximum size of the possible array, then we have no way of accomodating it
! at the moments nlevleaf default is 40, which is very large, so exceeding this would clearly illustrate a
! huge error
if(tree_lai > nlevleaf*dinc_ed)then
write(fates_log(),*) 'too much lai' , tree_lai , pft , nlevleaf * dinc_ed
write(fates_log(),*) 'Aborting'
call endrun(msg=errMsg(sourcefile, __LINE__))
endif


return

end function tree_lai

! ============================================================================

real(r8) function tree_sai( pft, dbh, canopy_trim, c_area, nplant, cl, canopy_lai )
real(r8) function tree_sai( pft, dbh, canopy_trim, c_area, nplant, cl, canopy_lai, treelai )

! ============================================================================
! SAI of individual trees is a function of the LAI of individual trees
! ============================================================================

integer, intent(in) :: pft
real(r8), intent(in) :: dbh
real(r8), intent(in) :: canopy_trim
real(r8), intent(in) :: c_area
real(r8), intent(in) :: nplant
integer, intent(in) :: cl ! canopy layer index
real(r8), intent(in) :: canopy_lai(nclmax) ! total leaf area index of
! each canopy layer
integer, intent(in) :: pft
real(r8), intent(in) :: dbh
real(r8), intent(in) :: canopy_trim ! trimming function (0-1)
real(r8), intent(in) :: c_area ! crown area (m2)
real(r8), intent(in) :: nplant ! number of plants
integer, intent(in) :: cl ! canopy layer index
real(r8), intent(in) :: canopy_lai(nclmax) ! total leaf area index of
! each canopy layer
real(r8), intent(in) :: treelai ! tree LAI for checking purposes only

real(r8) :: target_bleaf
real(r8) :: target_lai
Expand All @@ -704,6 +694,17 @@ real(r8) function tree_sai( pft, dbh, canopy_trim, c_area, nplant, cl, canopy_la
tree_sai = EDPftvarcon_inst%allom_sai_scaler(pft) * target_lai


if( (treelai + tree_sai) > (nlevleaf*dinc_ed) )then
write(fates_log(),*) 'The leaf and stem are predicted for a cohort, maxed out the array size'
write(fates_log(),*) 'lai: ',treelai
write(fates_log(),*) 'sai: ',tree_sai
write(fates_log(),*) 'lai+sai: ',treelai+tree_sai
write(fates_log(),*) 'nlevleaf,dinc_ed,nlevleaf*dinc_ed :',nlevleaf,dinc_ed,nlevleaf*dinc_ed
call endrun(msg=errMsg(sourcefile, __LINE__))
end if



return
end function tree_sai

Expand Down
4 changes: 2 additions & 2 deletions parameter_files/fates_params_14pfts.cdl
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,8 @@ data:

fates_allom_lmode = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ;

fates_allom_sai_scaler = 0.05, 0.05, 0.05, 0.05, 0.05, 0.05,
0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05 ;
fates_allom_sai_scaler = 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 ;

fates_allom_smode = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ;

Expand Down
2 changes: 1 addition & 1 deletion parameter_files/fates_params_default.cdl
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ data:

fates_allom_lmode = 1, 1 ;

fates_allom_sai_scaler = 0.05, 0.05 ;
fates_allom_sai_scaler = 0.10, 0.10 ;

fates_allom_smode = 1, 1 ;

Expand Down

0 comments on commit 4925683

Please sign in to comment.