Skip to content

Commit

Permalink
Merge pull request #514 from rgknox/consolidated-pft-file
Browse files Browse the repository at this point in the history
consolidation of parameter files
  • Loading branch information
rgknox authored Apr 10, 2019
2 parents c7fa7c2 + 518c862 commit 82498d5
Show file tree
Hide file tree
Showing 8 changed files with 633 additions and 3,819 deletions.
13 changes: 8 additions & 5 deletions main/EDMainMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ module EDMainMod
use EDtypesMod , only : ed_site_type
use EDtypesMod , only : ed_patch_type
use EDtypesMod , only : ed_cohort_type
use EDTypesMod , only : do_ed_phenology
use EDTypesMod , only : AREA
use FatesConstantsMod , only : itrue,ifalse
use FatesConstantsMod , only : primaryforest, secondaryforest
Expand Down Expand Up @@ -135,11 +134,15 @@ subroutine ed_ecosystem_dynamics(currentSite, bc_in)


call ed_total_balance_check(currentSite, 0)

if (do_ed_phenology) then

! We do not allow phenology while in ST3 mode either, it is hypothetically
! possible to allow this, but we have not plugged in the litter fluxes
! of flushing or turning over leaves for non-dynamics runs
if (hlm_use_ed_st3.eq.ifalse) then
call phenology(currentSite, bc_in )
end if


if (hlm_use_ed_st3.eq.ifalse) then ! Bypass if ST3
call fire_model(currentSite, bc_in)

Expand Down Expand Up @@ -346,7 +349,6 @@ subroutine ed_integrate_state_variables(currentSite, bc_in )

currentSite%flux_in = currentSite%flux_in + currentCohort%npp_acc * currentCohort%n


leaf_c = currentCohort%prt%GetState(leaf_organ, all_carbon_elements)
currentCohort%treelai = tree_lai(leaf_c, currentCohort%pft, currentCohort%c_area, currentCohort%n, &
currentCohort%canopy_layer, currentPatch%canopy_layer_tlai, &
Expand All @@ -356,7 +358,8 @@ subroutine ed_integrate_state_variables(currentSite, bc_in )
currentPatch%canopy_layer_tlai, currentCohort%treelai,currentCohort%vcmax25top,6 )


! Conducte Maintenance Turnover (parteh)
! Conduct Maintenance Turnover (parteh)

call currentCohort%prt%CheckMassConservation(ft,3)
call PRTMaintTurnover(currentCohort%prt,ft,currentSite%is_drought)
call currentCohort%prt%CheckMassConservation(ft,4)
Expand Down
12 changes: 0 additions & 12 deletions main/EDTypesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,6 @@ module EDTypesMod
! its leaves and should not be trying to allocate
! towards any growth.

! Switches that turn on/off ED dynamics process (names are self explanatory)
! IMPORTANT NOTE!!! THESE SWITCHES ARE EXPERIMENTAL.
! THEY SHOULD CORRECTLY TURN OFF OR ON THE PROCESS, BUT.. THERE ARE VARIOUS
! ASPECTS REGARDING DIAGNOSING RATES AND HOW THEY ARE REPORTED WHEN THESE
! PROCESSES ARE OFF THAT NEED TO BE DISCUSSED AND CONSIDERED.
! TO-DO: THESE SHOULD BE PARAMETERS IN THE FILE OR NAMELIST - ADDING THESE
! WAS OUTSIDE THE SCOPE OF THE VERY LARGE CHANGESET WHERE THESE WERE FIRST
! INTRODUCED (RGK 03-2017)

logical, parameter :: do_ed_phenology = .true.


! Flag to turn on/off salinity effects on the effective "btran"
! btran stress function.

Expand Down
67 changes: 36 additions & 31 deletions main/FatesHistoryInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1887,51 +1887,50 @@ subroutine update_history_dyn(this,nc,nsites,sites)
hio_npp_stor_si_scpf(io_si,scpf) = hio_npp_stor_si_scpf(io_si,scpf) + &
store_c_net_alloc*n_perm2

! Woody State Variables (basal area and number density and mortality)
! Woody State Variables (basal area growth increment)
if (EDPftvarcon_inst%woody(ft) == 1) then

hio_m1_si_scpf(io_si,scpf) = hio_m1_si_scpf(io_si,scpf) + ccohort%bmort*ccohort%n
hio_m2_si_scpf(io_si,scpf) = hio_m2_si_scpf(io_si,scpf) + ccohort%hmort*ccohort%n
hio_m3_si_scpf(io_si,scpf) = hio_m3_si_scpf(io_si,scpf) + ccohort%cmort*ccohort%n
hio_m7_si_scpf(io_si,scpf) = hio_m7_si_scpf(io_si,scpf) + &
(ccohort%lmort_direct+ccohort%lmort_collateral+ccohort%lmort_infra) * ccohort%n
hio_m8_si_scpf(io_si,scpf) = hio_m8_si_scpf(io_si,scpf) + ccohort%frmort*ccohort%n

hio_m1_si_scls(io_si,scls) = hio_m1_si_scls(io_si,scls) + ccohort%bmort*ccohort%n
hio_m2_si_scls(io_si,scls) = hio_m2_si_scls(io_si,scls) + ccohort%hmort*ccohort%n
hio_m3_si_scls(io_si,scls) = hio_m3_si_scls(io_si,scls) + ccohort%cmort*ccohort%n
hio_m7_si_scls(io_si,scls) = hio_m7_si_scls(io_si,scls) + &
(ccohort%lmort_direct+ccohort%lmort_collateral+ccohort%lmort_infra) * ccohort%n
hio_m8_si_scls(io_si,scls) = hio_m8_si_scls(io_si,scls) + &
ccohort%frmort*ccohort%n

!C13 discrimination
if(gpp_cached + ccohort%gpp_acc_hold > 0.0_r8)then

hio_c13disc_si_scpf(io_si,scpf) = ((hio_c13disc_si_scpf(io_si,scpf) * gpp_cached) + &
(ccohort%c13disc_acc * ccohort%gpp_acc_hold)) / (gpp_cached + ccohort%gpp_acc_hold)
else
hio_c13disc_si_scpf(io_si,scpf) = 0.0_r8
endif



! basal area [m2/ha]
hio_ba_si_scpf(io_si,scpf) = hio_ba_si_scpf(io_si,scpf) + &
0.25_r8*3.14159_r8*((dbh/100.0_r8)**2.0_r8)*ccohort%n

! also by size class only
hio_ba_si_scls(io_si,scls) = hio_ba_si_scls(io_si,scls) + &
0.25_r8*3.14159_r8*((dbh/100.0_r8)**2.0_r8)*ccohort%n

! number density [/ha]
hio_nplant_si_scpf(io_si,scpf) = hio_nplant_si_scpf(io_si,scpf) + ccohort%n


! growth increment
hio_ddbh_si_scpf(io_si,scpf) = hio_ddbh_si_scpf(io_si,scpf) + &
ccohort%ddbhdt*ccohort%n

end if

hio_m1_si_scpf(io_si,scpf) = hio_m1_si_scpf(io_si,scpf) + ccohort%bmort*ccohort%n
hio_m2_si_scpf(io_si,scpf) = hio_m2_si_scpf(io_si,scpf) + ccohort%hmort*ccohort%n
hio_m3_si_scpf(io_si,scpf) = hio_m3_si_scpf(io_si,scpf) + ccohort%cmort*ccohort%n
hio_m7_si_scpf(io_si,scpf) = hio_m7_si_scpf(io_si,scpf) + &
(ccohort%lmort_direct+ccohort%lmort_collateral+ccohort%lmort_infra) * ccohort%n
hio_m8_si_scpf(io_si,scpf) = hio_m8_si_scpf(io_si,scpf) + ccohort%frmort*ccohort%n

hio_m1_si_scls(io_si,scls) = hio_m1_si_scls(io_si,scls) + ccohort%bmort*ccohort%n
hio_m2_si_scls(io_si,scls) = hio_m2_si_scls(io_si,scls) + ccohort%hmort*ccohort%n
hio_m3_si_scls(io_si,scls) = hio_m3_si_scls(io_si,scls) + ccohort%cmort*ccohort%n
hio_m7_si_scls(io_si,scls) = hio_m7_si_scls(io_si,scls) + &
(ccohort%lmort_direct+ccohort%lmort_collateral+ccohort%lmort_infra) * ccohort%n
hio_m8_si_scls(io_si,scls) = hio_m8_si_scls(io_si,scls) + &
ccohort%frmort*ccohort%n

!C13 discrimination
if(gpp_cached + ccohort%gpp_acc_hold > 0.0_r8)then
hio_c13disc_si_scpf(io_si,scpf) = ((hio_c13disc_si_scpf(io_si,scpf) * gpp_cached) + &
(ccohort%c13disc_acc * ccohort%gpp_acc_hold)) / (gpp_cached + ccohort%gpp_acc_hold)
else
hio_c13disc_si_scpf(io_si,scpf) = 0.0_r8
endif

! number density [/ha]
hio_nplant_si_scpf(io_si,scpf) = hio_nplant_si_scpf(io_si,scpf) + ccohort%n


hio_agb_si_scls(io_si,scls) = hio_agb_si_scls(io_si,scls) + &
total_c * ccohort%n * EDPftvarcon_inst%allom_agb_frac(ccohort%pft) * AREA_INV

Expand Down Expand Up @@ -3206,6 +3205,12 @@ subroutine update_history_hydraulics(this,nc,nsites,sites,dt_tstep)
if(hlm_use_ed_st3.eq.ifalse) then
do scpf=1,nlevsclass*numpft
if( abs(hio_nplant_si_scpf(io_si, scpf)-ncohort_scpf(scpf)) > 1.0E-8_r8 ) then
write(fates_log(),*) 'numpft:',numpft
write(fates_log(),*) 'nlevsclass:',nlevsclass
write(fates_log(),*) 'scpf:',scpf
write(fates_log(),*) 'io_si:',io_si
write(fates_log(),*) 'hio_nplant_si_scpf:',hio_nplant_si_scpf(io_si, scpf)
write(fates_log(),*) 'ncohort_scpf:',ncohort_scpf(scpf)
write(fates_log(),*) 'nplant check on hio_nplant_si_scpf fails during hydraulics history updates'
call endrun(msg=errMsg(sourcefile, __LINE__))
end if
Expand Down
9 changes: 9 additions & 0 deletions main/FatesRestartInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ module FatesRestartInterfaceMod
integer, private :: ir_canopy_trim_co
integer, private :: ir_size_class_lasttimestep_co
integer, private :: ir_dbh_co
integer, private :: ir_g_sb_laweight_co
integer, private :: ir_height_co
integer, private :: ir_laimemory_co
integer, private :: ir_nplant_co
Expand Down Expand Up @@ -804,6 +805,10 @@ subroutine define_restart_vars(this, initialize_variables)
units='0/1', flushval = flushone, &
hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_isnew_co )

call this%set_restart_var(vname='fates_gsblaweight',vtype=cohort_r8, &
long_name='ed cohort - leaf-area weighted total stomatal+blayer conductance', &
units='[m/s]*[m2]', flushval = flushzero, &
hlms='CLM:ALM', initialize=initialize_variables, ivar=ivar, index = ir_g_sb_laweight_co)

! Mixed dimension variables using the cohort vector
! -----------------------------------------------------------------------------------
Expand Down Expand Up @@ -1468,6 +1473,7 @@ subroutine set_restart_vectors(this,nc,nsites,sites)
rio_canopy_trim_co => this%rvars(ir_canopy_trim_co)%r81d, &
rio_size_class_lasttimestep => this%rvars(ir_size_class_lasttimestep_co)%int1d, &
rio_dbh_co => this%rvars(ir_dbh_co)%r81d, &
rio_g_sb_laweight_co => this%rvars(ir_g_sb_laweight_co)%r81d, &
rio_height_co => this%rvars(ir_height_co)%r81d, &
rio_laimemory_co => this%rvars(ir_laimemory_co)%r81d, &
rio_nplant_co => this%rvars(ir_nplant_co)%r81d, &
Expand Down Expand Up @@ -1654,6 +1660,7 @@ subroutine set_restart_vectors(this,nc,nsites,sites)
rio_dbh_co(io_idx_co) = ccohort%dbh
rio_height_co(io_idx_co) = ccohort%hite
rio_laimemory_co(io_idx_co) = ccohort%laimemory
rio_g_sb_laweight_co(io_idx_co)= ccohort%g_sb_laweight

rio_nplant_co(io_idx_co) = ccohort%n
rio_gpp_acc_co(io_idx_co) = ccohort%gpp_acc
Expand Down Expand Up @@ -2179,6 +2186,7 @@ subroutine get_restart_vectors(this, nc, nsites, sites)
rio_canopy_trim_co => this%rvars(ir_canopy_trim_co)%r81d, &
rio_size_class_lasttimestep => this%rvars(ir_size_class_lasttimestep_co)%int1d, &
rio_dbh_co => this%rvars(ir_dbh_co)%r81d, &
rio_g_sb_laweight_co => this%rvars(ir_g_sb_laweight_co)%r81d, &
rio_height_co => this%rvars(ir_height_co)%r81d, &
rio_laimemory_co => this%rvars(ir_laimemory_co)%r81d, &
rio_nplant_co => this%rvars(ir_nplant_co)%r81d, &
Expand Down Expand Up @@ -2326,6 +2334,7 @@ subroutine get_restart_vectors(this, nc, nsites, sites)
ccohort%canopy_trim = rio_canopy_trim_co(io_idx_co)
ccohort%size_class_lasttimestep = rio_size_class_lasttimestep(io_idx_co)
ccohort%dbh = rio_dbh_co(io_idx_co)
ccohort%g_sb_laweight= rio_g_sb_laweight_co(io_idx_co)
ccohort%hite = rio_height_co(io_idx_co)
ccohort%laimemory = rio_laimemory_co(io_idx_co)
ccohort%n = rio_nplant_co(io_idx_co)
Expand Down
Loading

0 comments on commit 82498d5

Please sign in to comment.