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

fates-host parameter interface #188

Merged
merged 21 commits into from
Mar 15, 2017
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a651a4f
Update ed parameter file.
bandre-ucar Jan 12, 2017
1a3b8cb
Read fates parameters from their own file.
bandre-ucar Jan 18, 2017
5bdbd35
First pass at FatesParametersInterface
bandre-ucar Jan 19, 2017
7c0fa28
Move grperc parameter into EDPftvarcon
bandre-ucar Jan 20, 2017
08182c3
Start reading spit fire scalar parameters with new infrastructure.
bandre-ucar Jan 20, 2017
d4c80ef
New infrastructure to read fates array parameters.
bandre-ucar Jan 26, 2017
73df6dc
Move fates parameters read into clmfates_interface infrastructure.
bandre-ucar Jan 27, 2017
d8ddde4
Add hooks to read host parameters used by fates from the host file.
bandre-ucar Jan 27, 2017
2ef7e63
Move clm-fates parameter interface code into standalone module to
bandre-ucar Jan 28, 2017
189acf9
Convert ed pftvarcon to use new parameter interface.
bandre-ucar Jan 28, 2017
829fa24
Update some fates scalar parameter representations.
bandre-ucar Feb 8, 2017
435b3bc
Check fates parameter dimensions when reading from file.
bandre-ucar Feb 8, 2017
87cf419
Dynamic allocation of fates pft parameters.
bandre-ucar Feb 9, 2017
509fafa
Apply fates_ namespace to fates parameters.
bandre-ucar Feb 10, 2017
3f3f16f
Merge remote-tracking branch 'ngeet/master' into andre-ed-params
bandre-ucar Feb 14, 2017
db6b32d
Dead code removal of edpftconrd
bandre-ucar Feb 22, 2017
47af51b
Update default fates parameter file
bandre-ucar Mar 9, 2017
3e25ba9
Bugfix in FatesParameterDerivedMod
bandre-ucar Mar 9, 2017
ddc40e6
Merge bufix branch into parameter refactor branch.
bandre-ucar Mar 9, 2017
7afeecc
Rename EDSharedParams to FatesSynchronizedParam
bandre-ucar Mar 14, 2017
1992685
Merge master, commit '0ea3fed', into andre-ed-params
bandre-ucar Mar 15, 2017
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
3 changes: 2 additions & 1 deletion components/clm/bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1976,7 +1976,7 @@ sub setup_logic_params_file {

if ( $physv->as_long() >= $physv->as_long("clm4_5") ) {
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'paramfile',
'use_ed'=>$nl_flags->{'use_ed'}, 'phys'=>$nl_flags->{'phys'},
'phys'=>$nl_flags->{'phys'},
'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} );
} else {
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fpftcon');
Expand Down Expand Up @@ -3367,6 +3367,7 @@ sub setup_logic_ed {

if ($physv->as_long() >= $physv->as_long("clm4_5") && value_is_true( $nl_flags->{'use_ed'}) ) {
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_ed_spit_fire', 'use_ed'=>$nl_flags->{'use_ed'} );
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- The default filenames are given relative to the root directory
for the CLM2 data in the CESM distribution -->
<!-- Plant function types (relative to {csmdata}) -->
<paramfile phys="clm5_0" use_ed=".false.">lnd/clm2/paramdata/clm5_params.c160713.nc</paramfile>
<paramfile phys="clm4_5" use_ed=".false.">lnd/clm2/paramdata/clm_params.c160713.nc</paramfile>
<paramfile phys="clm4_5" use_ed=".true." >lnd/clm2/paramdata/clm_params_ed.c160808.nc</paramfile>
<paramfile phys="clm5_0">lnd/clm2/paramdata/clm5_params.c160713.nc</paramfile>
<paramfile phys="clm4_5">lnd/clm2/paramdata/clm_params.c160713.nc</paramfile>

<fates_paramfile phys="clm4_5">lnd/clm2/paramdata/fates_params.c170209.nc</fates_paramfile>

<!-- ======================================================================================== -->
<!-- clm 5.0 BGC nitrogen model -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@ Full pathname datafile with plant function type (PFT) constants combined with
constants for biogeochem modules
</entry>

<entry id="fates_paramfile" type="char*256" category="datasets"
input_pathname="abs" group="clm_inparm" valid_values="" >
Full pathname datafile with fates parameters
</entry>

<entry id="fsurdat" type="char*256" category="datasets"
input_pathname="abs" group="clm_inparm" valid_values="" >
Full pathname of surface data file.
Expand Down
16 changes: 8 additions & 8 deletions components/clm/src/ED/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
25 changes: 12 additions & 13 deletions components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module EDCohortDynamicsMod
use FatesConstantsMod , only : r8 => fates_r8
use FatesConstantsMod , only : fates_unset_int
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 @@ -116,11 +116,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 @@ -196,27 +196,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 @@ -226,7 +226,7 @@ subroutine allocate_live_biomass(cc_p,mode)

new_bl = currentcohort%balive*leaf_frac

new_br = pftcon%froot_leaf(ft) * (currentcohort%balive + currentcohort%laimemory) * leaf_frac
new_br = EDpftvarcon_inst%froot_leaf(ft) * (currentcohort%balive + currentcohort%laimemory) * leaf_frac

new_bsw = EDecophyscon%sapwood_ratio(ft) * currentcohort%hite *(currentcohort%balive + &
currentcohort%laimemory)*leaf_frac
Expand All @@ -251,7 +251,6 @@ subroutine allocate_live_biomass(cc_p,mode)
currentcohort%br = new_br
currentcohort%bsw = new_bsw


else ! Leaves are off (leaves_off_switch==1)

!the purpose of this section is to figure out the root and stem biomass when the leaves are off
Expand All @@ -261,11 +260,11 @@ subroutine allocate_live_biomass(cc_p,mode)
!not have enough live biomass to support the hypothesized root mass
!thus, we use 'ratio_balive' to adjust br and bsw. Apologies that this is so complicated! RF

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
ratio_balive = currentcohort%balive / ideal_balive

new_br = pftcon%froot_leaf(ft) * (ideal_balive + currentcohort%laimemory) * &
new_br = EDpftvarcon_inst%froot_leaf(ft) * (ideal_balive + currentcohort%laimemory) * &
leaf_frac * ratio_balive
new_bsw = EDecophyscon%sapwood_ratio(ft) * currentcohort%hite * &
(ideal_balive + currentcohort%laimemory) * leaf_frac * ratio_balive
Expand Down Expand Up @@ -294,7 +293,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 components/clm/src/ED/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 FatesGlobals , only : fates_log
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(fates_log(),*) '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(fates_log(),*) 'z_area 1',cohort_in%dbh,cohort_in%pft
write(fates_log(),*) 'z_area 2',EDecophyscon%max_dbh
write(fates_log(),*) 'z_area 3',pftcon%woody
write(fates_log(),*) 'z_area 3',EDPftvarcon_inst%woody
write(fates_log(),*) 'z_area 4',cohort_in%n
write(fates_log(),*) 'z_area 5',cohort_in%patchptr%spread
write(fates_log(),*) 'z_area 6',cohort_in%canopy_layer
write(fates_log(),*) '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 components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module EDPatchDynamicsMod
use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=)
use clm_varctl , only : iulog
use FatesGlobals , only : freq_day
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
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