Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make parameter prt_params%woody integer #864

Merged
merged 4 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ subroutine canopy_spread( currentSite )
do while (associated(currentCohort))
call carea_allom(currentCohort%dbh,currentCohort%n, &
currentSite%spread,currentCohort%pft,currentCohort%c_area)
if( ( int(prt_params%woody(currentCohort%pft)) .eq. itrue ) .and. &
if( ( prt_params%woody(currentCohort%pft) .eq. itrue ) .and. &
(currentCohort%canopy_layer .eq. 1 ) ) then
sitelevel_canopyarea = sitelevel_canopyarea + currentCohort%c_area
endif
Expand Down Expand Up @@ -1348,7 +1348,7 @@ subroutine canopy_summarization( nsites, sites, bc_in )

if(currentCohort%canopy_layer==1)then
currentPatch%total_canopy_area = currentPatch%total_canopy_area + currentCohort%c_area
if( int(prt_params%woody(ft))==itrue)then
if( prt_params%woody(ft) == itrue)then
currentPatch%total_tree_area = currentPatch%total_tree_area + currentCohort%c_area
endif
endif
Expand Down
2 changes: 1 addition & 1 deletion biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2090,7 +2090,7 @@ subroutine EvaluateAndCorrectDBH(currentCohort,delta_dbh,delta_hite)
delta_dbh = 0._r8
delta_hite = 0._r8

if( int(prt_params%woody(currentCohort%pft)) == itrue) then
if( prt_params%woody(currentCohort%pft) == itrue) then

struct_c = currentCohort%prt%GetState(struct_organ, all_carbon_elements)

Expand Down
4 changes: 2 additions & 2 deletions biogeochem/EDLoggingMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ subroutine LoggingMortality_frac( pft_i, dbh, canopy_layer, lmort_direct, &

! transfer of area to secondary land is based on overall area affected, not just logged crown area
! l_degrad accounts for the affected area between logged crowns
if(int(prt_params%woody(pft_i)) == 1)then ! only set logging rates for trees
if(prt_params%woody(pft_i) == itrue)then ! only set logging rates for trees

! direct logging rates, based on dbh min and max criteria
if (dbh >= logging_dbhmin .and. .not. &
Expand Down Expand Up @@ -543,7 +543,7 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
! plants that were impacted. Thus, no direct dead can occur
! here, and indirect are impacts.

if(int(prt_params%woody(pft)) == itrue) then
if(prt_params%woody(pft) == itrue) then
direct_dead = 0.0_r8
indirect_dead = logging_coll_under_frac * &
(1._r8-currentPatch%fract_ldist_not_harvested) * currentCohort%n * &
Expand Down
8 changes: 4 additions & 4 deletions biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ subroutine spawn_patches( currentSite, bc_in)

else
! small trees
if( int(prt_params%woody(currentCohort%pft)) == itrue)then
if( prt_params%woody(currentCohort%pft) == itrue)then


! Survivorship of undestory woody plants. Two step process.
Expand Down Expand Up @@ -918,7 +918,7 @@ subroutine spawn_patches( currentSite, bc_in)
! burned off. Here, we remove that mass, and
! tally it in the flux we sent to the atmosphere

if(int(prt_params%woody(currentCohort%pft)) == itrue)then
if(prt_params%woody(currentCohort%pft) == itrue)then
leaf_burn_frac = currentCohort%fraction_crown_burned
else

Expand Down Expand Up @@ -996,7 +996,7 @@ subroutine spawn_patches( currentSite, bc_in)
! WHat to do with cohorts in the understory of a logging generated
! disturbance patch?

if(int(prt_params%woody(currentCohort%pft)) == itrue)then
if(prt_params%woody(currentCohort%pft) == itrue)then


! Survivorship of undestory woody plants. Two step process.
Expand Down Expand Up @@ -1906,7 +1906,7 @@ subroutine mortality_litter_fluxes(currentSite, currentPatch, &
num_dead = currentCohort%n * min(1.0_r8,currentCohort%dmort * &
hlm_freq_day * fates_mortality_disturbance_fraction)

elseif(int(prt_params%woody(pft)) == itrue) then
elseif(prt_params%woody(pft) == itrue) then

! Understorey trees. The total dead is based on their survivorship
! function, and the total area of disturbance.
Expand Down
4 changes: 2 additions & 2 deletions biogeochem/FatesAllometryMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2373,7 +2373,7 @@ subroutine ForceDBH( ipft, canopy_trim, d, h, bdead, bl )
integer, parameter :: max_counter = 200

! Do reduce "if" calls, we break this call into two parts
if ( int(prt_params%woody(ipft)) == itrue ) then
if ( prt_params%woody(ipft) == itrue ) then

if(.not.present(bdead)) then
write(fates_log(),*) 'woody plants must use structure for dbh reset'
Expand Down Expand Up @@ -2460,7 +2460,7 @@ subroutine ForceDBH( ipft, canopy_trim, d, h, bdead, bl )

if(counter>20)then
write(fates_log(),*) 'dbh counter: ',counter,' is woody: ',&
int(prt_params%woody(ipft))==itrue
(prt_params%woody(ipft) == itrue)

if(int(prt_params%woody(ipft))==itrue)then
warn_msg = 'dbh counter: '//trim(I2S(counter))//' is woody'
Expand Down
14 changes: 7 additions & 7 deletions fire/SFMainMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ subroutine charecteristics_of_fuel ( currentSite )
currentPatch%livegrass = 0.0_r8
currentCohort => currentPatch%tallest
do while(associated(currentCohort))
if( int(prt_params%woody(currentCohort%pft)) == ifalse)then
if( prt_params%woody(currentCohort%pft) == ifalse)then

currentPatch%livegrass = currentPatch%livegrass + &
currentCohort%prt%GetState(leaf_organ, all_carbon_elements) * &
Expand Down Expand Up @@ -376,7 +376,7 @@ subroutine wind_effect ( currentSite, bc_in)

do while(associated(currentCohort))
if (debug) write(fates_log(),*) 'SF currentCohort%c_area ',currentCohort%c_area
if( int(prt_params%woody(currentCohort%pft)) == itrue)then
if( prt_params%woody(currentCohort%pft) == itrue)then
currentPatch%total_tree_area = currentPatch%total_tree_area + currentCohort%c_area
else
total_grass_area = total_grass_area + currentCohort%c_area
Expand Down Expand Up @@ -866,7 +866,7 @@ subroutine crown_scorching ( currentSite )
if (currentPatch%fire == 1) then
currentCohort => currentPatch%tallest;
do while(associated(currentCohort))
if ( int(prt_params%woody(currentCohort%pft)) == itrue) then !trees only
if ( prt_params%woody(currentCohort%pft) == itrue) then !trees only

leaf_c = currentCohort%prt%GetState(leaf_organ, all_carbon_elements)
sapw_c = currentCohort%prt%GetState(sapw_organ, all_carbon_elements)
Expand All @@ -880,7 +880,7 @@ subroutine crown_scorching ( currentSite )
enddo !end cohort loop

do i_pft=1,numpft
if (tree_ag_biomass > 0.0_r8 .and. int(prt_params%woody(i_pft)) == itrue) then
if (tree_ag_biomass > 0.0_r8 .and. prt_params%woody(i_pft) == itrue) then

!Equation 16 in Thonicke et al. 2010 !Van Wagner 1973 EQ8 !2/3 Byram (1959)
currentPatch%Scorch_ht(i_pft) = EDPftvarcon_inst%fire_alpha_SH(i_pft) * (currentPatch%FI**0.667_r8)
Expand Down Expand Up @@ -922,7 +922,7 @@ subroutine crown_damage ( currentSite )

do while(associated(currentCohort))
currentCohort%fraction_crown_burned = 0.0_r8
if ( int(prt_params%woody(currentCohort%pft)) == itrue) then !trees only
if ( prt_params%woody(currentCohort%pft) == itrue) then !trees only
! Flames lower than bottom of canopy.
! c%hite is height of cohort

Expand Down Expand Up @@ -986,7 +986,7 @@ subroutine cambial_damage_kill ( currentSite )
if (currentPatch%fire == 1) then
currentCohort => currentPatch%tallest;
do while(associated(currentCohort))
if ( int(prt_params%woody(currentCohort%pft)) == itrue) then !trees only
if ( prt_params%woody(currentCohort%pft) == itrue) then !trees only
! Equation 21 in Thonicke et al 2010
bt = EDPftvarcon_inst%bark_scaler(currentCohort%pft)*currentCohort%dbh ! bark thickness.
! Equation 20 in Thonicke et al. 2010.
Expand Down Expand Up @@ -1038,7 +1038,7 @@ subroutine post_fire_mortality ( currentSite )
do while(associated(currentCohort))
currentCohort%fire_mort = 0.0_r8
currentCohort%crownfire_mort = 0.0_r8
if ( int(prt_params%woody(currentCohort%pft)) == itrue) then
if ( prt_params%woody(currentCohort%pft) == itrue) then
! Equation 22 in Thonicke et al. 2010.
currentCohort%crownfire_mort = EDPftvarcon_inst%crown_kill(currentCohort%pft)*currentCohort%fraction_crown_burned**3.0_r8
! Equation 18 in Thonicke et al. 2010.
Expand Down
2 changes: 1 addition & 1 deletion main/FatesHistoryInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2510,7 +2510,7 @@ subroutine update_history_dyn(this,nc,nsites,sites)
store_m_net_alloc*n_perm2 / days_per_year / sec_per_day

! Woody State Variables (basal area growth increment)
if ( int(prt_params%woody(ft)) == itrue) then
if ( prt_params%woody(ft) == itrue) then

! basal area [m2/m2]
hio_ba_si_scpf(io_si,scpf) = hio_ba_si_scpf(io_si,scpf) + &
Expand Down
2 changes: 1 addition & 1 deletion parteh/PRTParametersMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module PRTParametersMod

real(r8), allocatable :: c2b(:) ! Carbon to biomass multiplier [kg/kgC]
real(r8), allocatable :: wood_density(:) ! wood density g cm^-3 ...
real(r8), allocatable :: woody(:) ! Does the plant have wood? (1=yes, 0=no)
integer , allocatable :: woody(:) ! Does the plant have wood? (1=yes, 0=no)
real(r8), allocatable :: crown(:) ! fraction of the height of the plant
! that is occupied by crown
real(r8), allocatable :: slamax(:) ! Maximum specific leaf area of plant (at bottom) [m2/gC]
Expand Down
13 changes: 8 additions & 5 deletions parteh/PRTParamsFATESMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,10 @@ subroutine PRTReceivePFT(fates_params)

name = 'fates_woody'
call fates_params%RetrieveParameterAllocate(name=name, &
data=prt_params%woody)
data=tmpreal)
allocate(prt_params%woody(size(tmpreal,dim=1)))
call ArrayNint(tmpreal,prt_params%woody)
deallocate(tmpreal)

name = 'fates_wood_density'
call fates_params%RetrieveParameterAllocate(name=name, &
Expand Down Expand Up @@ -1078,13 +1081,13 @@ subroutine PRTCheckParams(is_master)
! Check if woody plants have a structural biomass (agb) intercept
! ----------------------------------------------------------------------------------
if ( ( prt_params%allom_agb1(ipft) <= tiny(prt_params%allom_agb1(ipft)) ) .and. &
( int(prt_params%woody(ipft)) .eq. 1 ) ) then
( prt_params%woody(ipft) .eq. 1 ) ) then

write(fates_log(),*) 'Woody plants are expected to have a non-zero intercept'
write(fates_log(),*) ' in the diameter to AGB allometry equations'
write(fates_log(),*) ' PFT#: ',ipft
write(fates_log(),*) ' allom_agb1: ',prt_params%allom_agb1(ipft)
write(fates_log(),*) ' woody: ',int(prt_params%woody(ipft))
write(fates_log(),*) ' woody: ',prt_params%woody(ipft)
write(fates_log(),*) ' Aborting'
call endrun(msg=errMsg(sourcefile, __LINE__))

Expand All @@ -1093,7 +1096,7 @@ subroutine PRTCheckParams(is_master)
! Check if non-woody plants have structural biomass (agb) intercept
! ----------------------------------------------------------------------------------
! if ( ( prt_params%allom_agb1(ipft) > tiny(prt_params%allom_agb1(ipft)) ) .and. &
! ( int(prt_params%woody(ipft)) .ne. 1 ) ) then
! ( iprt_params%woody(ipft) .ne. 1 ) ) then
!
! write(fates_log(),*) 'Non-woody plants are expected to have a zero intercept'
! write(fates_log(),*) ' in the diameter to AGB allometry equations'
Expand All @@ -1102,7 +1105,7 @@ subroutine PRTCheckParams(is_master)
! write(fates_log(),*) ' woody tissues (sap and structural dead wood).'
! write(fates_log(),*) ' PFT#: ',ipft
! write(fates_log(),*) ' allom_agb1: ',prt_params%allom_agb1(ipft)
! write(fates_log(),*) ' woody: ',int(prt_params%woody(ipft))
! write(fates_log(),*) ' woody: ',prt_params%woody(ipft)
! write(fates_log(),*) ' Aborting'
! call endrun(msg=errMsg(sourcefile, __LINE__))
!
Expand Down