Skip to content

Commit

Permalink
removing init and c_leaf arguments to assign_cohort_SP_properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoven committed Sep 2, 2021
1 parent a260f31 commit 455617d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
15 changes: 7 additions & 8 deletions biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,8 @@ subroutine satellite_phenology(currentSite, bc_in)
end if

! Call routine to invert SP drivers into cohort properites.
call assign_cohort_SP_properties(currentCohort, currentSite%sp_htop(fates_pft), currentSite%sp_tlai(fates_pft) , currentSite%sp_tsai(fates_pft),currentPatch%area,ifalse,leaf_c)
call assign_cohort_SP_properties(currentCohort, currentSite%sp_htop(fates_pft), currentSite%sp_tlai(fates_pft), &
currentSite%sp_tsai(fates_pft), currentPatch%area)

currentCohort => currentCohort%shorter
end do !cohort loop
Expand All @@ -1458,7 +1459,7 @@ end subroutine satellite_phenology

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

subroutine assign_cohort_SP_properties(currentCohort,htop,tlai,tsai,parea,init,leaf_c)
subroutine assign_cohort_SP_properties(currentCohort,htop,tlai,tsai,parea)

! -----------------------------------------------------------------------------------!
! Takes the daily inputs of leaf area index, stem area index and canopy height and
Expand All @@ -1473,9 +1474,8 @@ subroutine assign_cohort_SP_properties(currentCohort,htop,tlai,tsai,parea,init,l
real(r8), intent(in) :: tsai ! target stem area index from SP inputs
real(r8), intent(in) :: htop ! target tree height from SP inputs
real(r8), intent(in) :: parea ! patch area for this PFT
integer, intent(in) :: init ! are we in the initialization routine? if so do not set leaf_c
real(r8), intent(out) :: leaf_c ! leaf carbon estimated to generate target tlai

real(r8) :: leaf_c ! leaf carbon estimated to generate target tlai
real(r8) :: dummy_n ! set cohort n to a dummy value of 1.0
integer :: fates_pft ! fates pft numer for weighting loop
real(r8) :: spread ! dummy value of canopy spread to estimate c_area
Expand Down Expand Up @@ -1551,13 +1551,12 @@ subroutine assign_cohort_SP_properties(currentCohort,htop,tlai,tsai,parea,init,l
end if
else
write(fates_log(),*) 'SPassign, big error in c_area',currentCohort%c_area-parea,currentCohort%pft
call endrun(msg=errMsg(sourcefile, __LINE__))
end if ! still broken
end if !small error

if(init.eq.ifalse)then
call SetState(currentCohort%prt, leaf_organ, carbon12_element, leaf_c, 1)
endif

call SetState(currentCohort%prt, leaf_organ, carbon12_element, leaf_c, 1)

! assert sai
currentCohort%treesai = tsai

Expand Down
6 changes: 4 additions & 2 deletions main/EDInitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -739,11 +739,13 @@ subroutine init_cohorts( site_in, patch_in, bc_in)
! h,dbh,leafc,n from SP values or from small initial size.

if(hlm_use_sp.eq.itrue)then
init = itrue

! At this point, we do not know the bc_in values of tlai tsai and htop,
! so this is initializing to an arbitrary value for the very first timestep.
! Not sure if there's a way around this or not.
call assign_cohort_SP_properties(temp_cohort, 0.5_r8,0.2_r8, 0.1_r8,patch_in%area,init,c_leaf)
call assign_cohort_SP_properties(temp_cohort, 0.5_r8,0.2_r8, 0.1_r8,patch_in%area)

c_leaf = temp_cohort%prt%GetState(leaf_organ, carbon12_element)

else
temp_cohort%hite = EDPftvarcon_inst%hgt_min(pft)
Expand Down

0 comments on commit 455617d

Please sign in to comment.