Skip to content

Commit

Permalink
Read fates parameters from their own file.
Browse files Browse the repository at this point in the history
The fates parameter file is now specified via a separate namelist
fates_paramfile. This variable may or may not point to the same netcdf
file as the host parameter file. All fates parameters are read from
this file, including the pft level variables, which are now stored in
EDpftvarcon instead of pftcon. Note that some parameters are shared
between the host and fates. These are 'host' parameters, not fates
parameters and are read from the host file.

Work for NGT-ED Github issue #155

User interface changes?: Yes. Users who have custom parameter files
will need to set namelist varible 'fates_paramfile' to point to their
file instead. Host parameters are still read from the file specified
by namelist variable 'paramfile'. If users have modified host
parameters in addition to fates parameters, they will need to update
both namelist variables.

Code review: andre

Test suite: clm_short
Test baseline: clm4_5_12_r195
Test namelist changes: none
Test answer changes: bit for bit
Test summary: all tests pass

Test suite: ed - yellowstone gnu, intel, pgi
Test baseline: a651a4f
Test namelist changes: yes, new namilest var fates_paramfile
Test answer changes: bit for bit
Test summary: all tests pass
  • Loading branch information
bandre-ucar committed Feb 1, 2017
1 parent 465603f commit 6042241
Show file tree
Hide file tree
Showing 14 changed files with 254 additions and 123 deletions.
16 changes: 8 additions & 8 deletions biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module EDCanopyStructureMod

use shr_kind_mod , only : r8 => shr_kind_r8;
use FatesGlobals , only : fates_log
use pftconMod , only : pftcon
use EDPftvarcon , only : EDPftvarcon_inst
use EDGrowthFunctionsMod , only : c_area
use EDCohortDynamicsMod , only : copy_cohort, terminate_cohorts, fuse_cohorts
use EDtypesMod , only : ed_site_type, ed_patch_type, ed_cohort_type, ncwd
Expand Down Expand Up @@ -617,7 +617,7 @@ subroutine canopy_spread( currentSite )
currentCohort => currentPatch%tallest
do while (associated(currentCohort))
currentCohort%c_area = c_area(currentCohort)
if(pftcon%woody(currentCohort%pft) == 1)then
if(EDPftvarcon_inst%woody(currentCohort%pft) == 1)then
arealayer(currentCohort%canopy_layer) = arealayer(currentCohort%canopy_layer) + currentCohort%c_area
endif
currentCohort => currentCohort%shorter
Expand Down Expand Up @@ -663,7 +663,7 @@ subroutine canopy_summarization( nsites, sites, bc_in )
use EDGrowthFunctionsMod , only : tree_lai, c_area
use EDEcophysConType , only : EDecophyscon
use EDtypesMod , only : area
use pftconMod , only : pftcon
use EDPftvarcon , only : EDPftvarcon_inst

! !ARGUMENTS
integer , intent(in) :: nsites
Expand Down Expand Up @@ -727,7 +727,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(pftcon%woody(ft)==1)then
if(EDPftvarcon_inst%woody(ft)==1)then
currentPatch%total_tree_area = currentPatch%total_tree_area + currentCohort%c_area
endif
endif
Expand Down Expand Up @@ -989,11 +989,11 @@ subroutine leaf_area_profile( currentSite , snow_depth_si, frac_sno_eff_si)
do iv = 1,currentCohort%NV-1

! what is the height of this layer? (for snow burial purposes...)
! pftcon%vertical_canopy_frac(ft))! fudge - this should be pft specific but i cant get it to compile.
! EDPftvarcon_inst%vertical_canopy_frac(ft))! fudge - this should be pft specific but i cant get it to compile.
layer_top_hite = currentCohort%hite-((iv/currentCohort%NV) * currentCohort%hite * &
EDecophyscon%crown(currentCohort%pft) )
layer_bottom_hite = currentCohort%hite-(((iv+1)/currentCohort%NV) * currentCohort%hite * &
EDecophyscon%crown(currentCohort%pft)) ! pftcon%vertical_canopy_frac(ft))
EDecophyscon%crown(currentCohort%pft)) ! EDPftvarcon_inst%vertical_canopy_frac(ft))

fraction_exposed =1.0_r8

Expand Down Expand Up @@ -1022,10 +1022,10 @@ subroutine leaf_area_profile( currentSite , snow_depth_si, frac_sno_eff_si)

!Bottom layer
iv = currentCohort%NV
! pftcon%vertical_canopy_frac(ft))! fudge - this should be pft specific but i cant get it to compile.
! EDPftvarcon_inst%vertical_canopy_frac(ft))! fudge - this should be pft specific but i cant get it to compile.
layer_top_hite = currentCohort%hite-((iv/currentCohort%NV) * currentCohort%hite * &
EDecophyscon%crown(currentCohort%pft) )
! pftcon%vertical_canopy_frac(ft))
! EDPftvarcon_inst%vertical_canopy_frac(ft))
layer_bottom_hite = currentCohort%hite-(((iv+1)/currentCohort%NV) * currentCohort%hite * &
EDecophyscon%crown(currentCohort%pft))

Expand Down
30 changes: 15 additions & 15 deletions biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module EDCohortDynamicsMod
use FatesGlobals , only : fates_log
use FatesConstantsMod , only : r8 => fates_r8
use shr_log_mod , only : errMsg => shr_log_errMsg
use pftconMod , only : pftcon
use EDPftvarcon , only : EDPftvarcon_inst
use EDEcophysContype , only : EDecophyscon
use EDGrowthFunctionsMod , only : c_area, tree_lai
use EDTypesMod , only : ed_site_type, ed_patch_type, ed_cohort_type
Expand Down Expand Up @@ -114,11 +114,11 @@ subroutine create_cohort(patchptr, pft, nn, hite, dbh, &
call endrun(msg=errMsg(sourcefile, __LINE__))
endif

if (new_cohort%siteptr%status==2 .and. pftcon%season_decid(pft) == 1) then
if (new_cohort%siteptr%status==2 .and. EDPftvarcon_inst%season_decid(pft) == 1) then
new_cohort%laimemory = 0.0_r8
endif

if (new_cohort%siteptr%dstatus==2 .and. pftcon%stress_decid(pft) == 1) then
if (new_cohort%siteptr%dstatus==2 .and. EDPftvarcon_inst%stress_decid(pft) == 1) then
new_cohort%laimemory = 0.0_r8
endif

Expand Down Expand Up @@ -191,27 +191,27 @@ subroutine allocate_live_biomass(cc_p,mode)

currentCohort => cc_p
ft = currentcohort%pft
leaf_frac = 1.0_r8/(1.0_r8 + EDecophyscon%sapwood_ratio(ft) * currentcohort%hite + pftcon%froot_leaf(ft))
leaf_frac = 1.0_r8/(1.0_r8 + EDecophyscon%sapwood_ratio(ft) * currentcohort%hite + EDPftvarcon_inst%froot_leaf(ft))

!currentcohort%bl = currentcohort%balive*leaf_frac
!for deciduous trees, there are no leaves

if (pftcon%evergreen(ft) == 1) then
if (EDPftvarcon_inst%evergreen(ft) == 1) then
currentcohort%laimemory = 0._r8
currentcohort%status_coh = 2
endif

! iagnore the root and stem biomass from the functional balance hypothesis. This is used when the leaves are
!fully on.
!currentcohort%br = pftcon%froot_leaf(ft) * (currentcohort%balive + currentcohort%laimemory) * leaf_frac
!currentcohort%br = EDPftvarcon_inst%froot_leaf(ft) * (currentcohort%balive + currentcohort%laimemory) * leaf_frac
!currentcohort%bsw = EDecophyscon%sapwood_ratio(ft) * currentcohort%hite *(currentcohort%balive + &
! currentcohort%laimemory)*leaf_frac

leaves_off_switch = 0
if (currentcohort%status_coh == 1.and.pftcon%stress_decid(ft) == 1.and.currentcohort%siteptr%dstatus==1) then !no leaves
if (currentcohort%status_coh == 1.and.EDPftvarcon_inst%stress_decid(ft) == 1.and.currentcohort%siteptr%dstatus==1) then !no leaves
leaves_off_switch = 1 !drought decid
endif
if (currentcohort%status_coh == 1.and.pftcon%season_decid(ft) == 1.and.currentcohort%siteptr%status==1) then !no leaves
if (currentcohort%status_coh == 1.and.EDPftvarcon_inst%season_decid(ft) == 1.and.currentcohort%siteptr%status==1) then !no leaves
leaves_off_switch = 1 !cold decid
endif

Expand All @@ -232,8 +232,8 @@ subroutine allocate_live_biomass(cc_p,mode)
if(mode==1)then

currentcohort%npp_froot = currentcohort%npp_froot + &
max(0._r8,pftcon%froot_leaf(ft)*(currentcohort%balive+currentcohort%laimemory)*leaf_frac - currentcohort%br) / &
udata%deltat
max(0._r8, EDPftvarcon_inst%froot_leaf(ft)*(currentcohort%balive+currentcohort%laimemory)*leaf_frac - &
currentcohort%br) / udata%deltat

currentcohort%npp_bsw = max(0._r8,EDecophyscon%sapwood_ratio(ft) * currentcohort%hite *(currentcohort%balive + &
currentcohort%laimemory)*leaf_frac - currentcohort%bsw)/udata%deltat
Expand All @@ -242,7 +242,7 @@ subroutine allocate_live_biomass(cc_p,mode)

end if

currentcohort%br = pftcon%froot_leaf(ft) * (currentcohort%balive + currentcohort%laimemory) * leaf_frac
currentcohort%br = EDPftvarcon_inst%froot_leaf(ft) * (currentcohort%balive + currentcohort%laimemory) * leaf_frac
currentcohort%bsw = EDecophyscon%sapwood_ratio(ft) * currentcohort%hite *(currentcohort%balive + &
currentcohort%laimemory)*leaf_frac

Expand All @@ -257,9 +257,9 @@ subroutine allocate_live_biomass(cc_p,mode)


currentcohort%bl = 0.0_r8
ideal_balive = currentcohort%laimemory * pftcon%froot_leaf(ft) + &
ideal_balive = currentcohort%laimemory * EDPftvarcon_inst%froot_leaf(ft) + &
currentcohort%laimemory* EDecophyscon%sapwood_ratio(ft) * currentcohort%hite
currentcohort%br = pftcon%froot_leaf(ft) * (ideal_balive + currentcohort%laimemory) * leaf_frac
currentcohort%br = EDPftvarcon_inst%froot_leaf(ft) * (ideal_balive + currentcohort%laimemory) * leaf_frac
currentcohort%bsw = EDecophyscon%sapwood_ratio(ft) * currentcohort%hite *(ideal_balive + &
currentcohort%laimemory)*leaf_frac

Expand All @@ -271,7 +271,7 @@ subroutine allocate_live_biomass(cc_p,mode)
if(mode==1)then

currentcohort%npp_froot = currentcohort%npp_froot + &
max(0.0_r8,pftcon%froot_leaf(ft)*(ideal_balive + &
max(0.0_r8,EDPftvarcon_inst%froot_leaf(ft)*(ideal_balive + &
currentcohort%laimemory)*leaf_frac*ratio_balive-currentcohort%br)/udata%deltat

currentcohort%npp_bsw = max(0.0_r8,EDecophyscon%sapwood_ratio(ft) * currentcohort%hite *(ideal_balive + &
Expand All @@ -289,7 +289,7 @@ subroutine allocate_live_biomass(cc_p,mode)
currentcohort%status_coh,currentcohort%balive
write(fates_log(),*) 'actual vs predicted balive',ideal_balive,currentcohort%balive ,ratio_balive,leaf_frac
write(fates_log(),*) 'leaf,root,stem',currentcohort%bl,currentcohort%br,currentcohort%bsw
write(fates_log(),*) 'pft',ft,pftcon%evergreen(ft),pftcon%season_decid(ft),leaves_off_switch
write(fates_log(),*) 'pft',ft,EDPftvarcon_inst%evergreen(ft),EDPftvarcon_inst%season_decid(ft),leaves_off_switch
endif
currentCohort%b = currentCohort%bdead + currentCohort%balive

Expand Down
10 changes: 5 additions & 5 deletions biogeochem/EDGrowthFunctionsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module EDGrowthFunctionsMod

use shr_kind_mod , only : r8 => shr_kind_r8
use clm_varctl , only : iulog
use pftconMod , only : pftcon
use EDPftvarcon , only : EDPftvarcon_inst
use EDEcophysContype , only : EDecophyscon
use EDTypesMod , only : ed_cohort_type, cp_nlevcan, dinc_ed

Expand Down Expand Up @@ -114,7 +114,7 @@ real(r8) function Bleaf( cohort_in )
else
bleaf = 0.0419_r8 * (EDecophyscon%max_dbh(cohort_in%pft)**1.56) * EDecophyscon%wood_density(cohort_in%pft)**0.55_r8
endif
slascaler = 0.03_r8/pftcon%slatop(cohort_in%pft)
slascaler = 0.03_r8/EDPftvarcon_inst%slatop(cohort_in%pft)
bleaf = bleaf * slascaler

!write(iulog,*) 'bleaf',bleaf, slascaler,cohort_in%pft
Expand Down Expand Up @@ -145,7 +145,7 @@ real(r8) function tree_lai( cohort_in )
endif

if( cohort_in%status_coh == 2 ) then ! are the leaves on?
slat = 1000.0_r8 * pftcon%slatop(cohort_in%pft) ! m2/g to m2/kg
slat = 1000.0_r8 * EDPftvarcon_inst%slatop(cohort_in%pft) ! m2/g to m2/kg
cohort_in%c_area = c_area(cohort_in) ! call the tree area
leafc_per_unitarea = cohort_in%bl/(cohort_in%c_area/cohort_in%n) !KgC/m2
if(leafc_per_unitarea > 0.0_r8)then
Expand Down Expand Up @@ -225,15 +225,15 @@ real(r8) function c_area( cohort_in )
if (DEBUG_growth) then
write(iulog,*) 'z_area 1',cohort_in%dbh,cohort_in%pft
write(iulog,*) 'z_area 2',EDecophyscon%max_dbh
write(iulog,*) 'z_area 3',pftcon%woody
write(iulog,*) 'z_area 3',EDPftvarcon_inst%woody
write(iulog,*) 'z_area 4',cohort_in%n
write(iulog,*) 'z_area 5',cohort_in%patchptr%spread
write(iulog,*) 'z_area 6',cohort_in%canopy_layer
write(iulog,*) 'z_area 7',ED_val_grass_spread
end if

dbh = min(cohort_in%dbh,EDecophyscon%max_dbh(cohort_in%pft))
if(pftcon%woody(cohort_in%pft) == 1)then
if(EDPftvarcon_inst%woody(cohort_in%pft) == 1)then
c_area = 3.142_r8 * cohort_in%n * &
(cohort_in%patchptr%spread(cohort_in%canopy_layer)*dbh)**1.56_r8
else
Expand Down
10 changes: 5 additions & 5 deletions biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module EDPatchDynamicsMod
use shr_kind_mod , only : r8 => shr_kind_r8;
use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=)
use clm_varctl , only : iulog
use pftconMod , only : pftcon
use EDPftvarcon , only : EDPftvarcon_inst
use EDCohortDynamicsMod , only : fuse_cohorts, sort_cohorts, insert_cohort
use EDtypesMod , only : ncwd, n_dbh_bins, ntol, numpft_ed, area, dbhmax, maxPatchesPerCol
use EDTypesMod , only : ed_site_type, ed_patch_type, ed_cohort_type, udata
Expand Down Expand Up @@ -281,7 +281,7 @@ subroutine spawn_patches( currentSite )
nc%imort = nan
else
! small trees
if(pftcon%woody(currentCohort%pft) == 1)then
if(EDPftvarcon_inst%woody(currentCohort%pft) == 1)then

! Number of trees in the understory of new patch, before we impose impact mortality and survivorship
nc%n = currentCohort%n * patch_site_areadis/currentPatch%area
Expand Down Expand Up @@ -566,7 +566,7 @@ subroutine fire_litter_fluxes(cp_target, new_patch_target, patch_site_areadis)
currentCohort => currentPatch%shortest
do while(associated(currentCohort))
p = currentCohort%pft
if(pftcon%woody(p) == 1)then !DEAD (FROM FIRE) TREES
if(EDPftvarcon_inst%woody(p) == 1)then !DEAD (FROM FIRE) TREES
!************************************/
! Number of trees that died because of the fire, per m2 of ground.
! Divide their litter into the four litter streams, and spread evenly across ground surface.
Expand Down Expand Up @@ -649,7 +649,7 @@ subroutine fire_litter_fluxes(cp_target, new_patch_target, patch_site_areadis)
do while(associated(currentCohort))

currentCohort%c_area = c_area(currentCohort)
if(pftcon%woody(currentCohort%pft) == 1)then
if(EDPftvarcon_inst%woody(currentCohort%pft) == 1)then
burned_leaves = (currentCohort%bl+currentCohort%bsw) * currentCohort%cfa
else
burned_leaves = (currentCohort%bl+currentCohort%bsw) * currentPatch%burnt_frac_litter(6)
Expand Down Expand Up @@ -726,7 +726,7 @@ subroutine mortality_litter_fluxes(cp_target, new_patch_target, patch_site_aread
canopy_dead*(currentCohort%br+currentCohort%bstore)

else
if(pftcon%woody(currentCohort%pft) == 1)then
if(EDPftvarcon_inst%woody(currentCohort%pft) == 1)then

understorey_dead = ED_val_understorey_death * currentCohort%n * (patch_site_areadis/currentPatch%area) !kgC/site/day
currentPatch%canopy_mortality_woody_litter = currentPatch%canopy_mortality_woody_litter + &
Expand Down
Loading

0 comments on commit 6042241

Please sign in to comment.