Skip to content

Commit

Permalink
move stomatal model switch from EDParamsMod to FatesInterfaceTypesMod
Browse files Browse the repository at this point in the history
  • Loading branch information
glemieux committed Dec 11, 2024
1 parent f074358 commit 5c4c87e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
12 changes: 6 additions & 6 deletions biogeophys/FatesPlantRespPhotosynthMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ module FATESPlantRespPhotosynthMod
use PRTGenericMod, only : repro_organ
use PRTGenericMod, only : struct_organ
use EDParamsMod, only : maintresp_nonleaf_baserate
use EDParamsMod, only : stomatal_model
use PRTParametersMod, only : prt_params
use EDPftvarcon , only : EDPftvarcon_inst
use TemperatureType, only : temperature_type
Expand Down Expand Up @@ -1191,6 +1190,7 @@ subroutine LeafLayerPhotosynthesis(f_sun_lsl, & ! in

use EDParamsMod , only : theta_cj_c3, theta_cj_c4
use FatesInterfaceTypesMod, only : hlm_stomatal_assim_model
use FatesInterfaceTypesMod, only : hlm_stomatal_model

! Arguments
! ------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1458,7 +1458,7 @@ subroutine LeafLayerPhotosynthesis(f_sun_lsl, & ! in
anet = agross - lmr

if ( hlm_stomatal_assim_model == gross_assim_model ) then
if ( stomatal_model == medlyn_model ) then
if ( hlm_stomatal_model == medlyn_model ) then
write (fates_log(),*) 'Gross Assimilation conductance is incompatible with the Medlyn model'
call endrun(msg=errMsg(sourcefile, __LINE__))
end if
Expand Down Expand Up @@ -1499,7 +1499,7 @@ subroutine LeafLayerPhotosynthesis(f_sun_lsl, & ! in
! ------------------------------------------------------------------------------------


if ( stomatal_model == medlyn_model ) then
if ( hlm_stomatal_model == medlyn_model ) then
!stomatal conductance calculated from Medlyn et al. (2011), the numerical &
!implementation was adapted from the equations in CLM5.0
vpd = max((veg_esat - ceair), 50._r8) * 0.001_r8 !addapted from CLM5. Put some constraint on VPD
Expand All @@ -1515,7 +1515,7 @@ subroutine LeafLayerPhotosynthesis(f_sun_lsl, & ! in
call QuadraticRoots(aquad, bquad, cquad, r1, r2)
gs_mol = max(r1,r2)

else if ( stomatal_model == ballberry_model ) then !stomatal conductance calculated from Ball et al. (1987)
else if ( hlm_stomatal_model == ballberry_model ) then !stomatal conductance calculated from Ball et al. (1987)
aquad = leaf_co2_ppress
bquad = leaf_co2_ppress*(gb_mol - stomatal_intercept_btran) - bb_slope(ft) * a_gs * can_press
cquad = -gb_mol*(leaf_co2_ppress*stomatal_intercept_btran + &
Expand Down Expand Up @@ -1588,10 +1588,10 @@ subroutine LeafLayerPhotosynthesis(f_sun_lsl, & ! in
end if

! Compare with Medlyn model: gs_mol = 1.6*(1+m/sqrt(vpd)) * an/leaf_co2_ppress*p + b
if ( stomatal_model == 2 ) then
if ( hlm_stomatal_model == 2 ) then
gs_mol_err = h2o_co2_stoma_diffuse_ratio*(1 + medlyn_slope(ft)/sqrt(vpd))*max(anet,0._r8)/leaf_co2_ppress*can_press + stomatal_intercept_btran
! Compare with Ball-Berry model: gs_mol = m * an * hs/leaf_co2_ppress*p + b
else if ( stomatal_model == 1 ) then
else if ( hlm_stomatal_model == 1 ) then
hs = (gb_mol*ceair + gs_mol* veg_esat ) / ((gb_mol+gs_mol)*veg_esat )
gs_mol_err = bb_slope(ft)*max(anet, 0._r8)*hs/leaf_co2_ppress*can_press + stomatal_intercept_btran
end if
Expand Down
11 changes: 0 additions & 11 deletions main/EDParamsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ module EDParamsMod
real(r8),protected, public :: ED_val_cohort_age_fusion_tol ! minimum fraction in differece in cohort age between cohorts
real(r8),protected, public :: ED_val_patch_fusion_tol ! minimum fraction in difference in profiles between patches
real(r8),protected, public :: ED_val_canopy_closure_thresh ! site-level canopy closure point where trees take on forest (narrow) versus savannah (wide) crown allometry
integer,protected, public :: stomatal_model ! switch for choosing between stomatal conductance models, 1 for Ball-Berry, 2 for Medlyn
integer,protected, public :: regeneration_model ! Switch for choosing between regeneration models:
! (1) for Fates default
! (2) for the Tree Recruitment Scheme (Hanbury-Brown et al., 2022)
Expand Down Expand Up @@ -163,7 +162,6 @@ module EDParamsMod
character(len=param_string_length),parameter,public :: ED_name_cohort_age_fusion_tol = "fates_cohort_age_fusion_tol"
character(len=param_string_length),parameter,public :: ED_name_patch_fusion_tol= "fates_patch_fusion_tol"
character(len=param_string_length),parameter,public :: ED_name_canopy_closure_thresh= "fates_canopy_closure_thresh"
character(len=param_string_length),parameter,public :: ED_name_stomatal_model= "fates_leaf_stomatal_model"
character(len=param_string_length),parameter,public :: ED_name_regeneration_model= "fates_regeneration_model"

character(len=param_string_length),parameter,public :: name_theta_cj_c3 = "fates_leaf_theta_cj_c3"
Expand Down Expand Up @@ -320,7 +318,6 @@ subroutine FatesParamsInit()
ED_val_cohort_age_fusion_tol = nan
ED_val_patch_fusion_tol = nan
ED_val_canopy_closure_thresh = nan
stomatal_model = -9
regeneration_model = -9
max_cohort_per_patch = -9
hydr_kmax_rsurf1 = nan
Expand Down Expand Up @@ -467,9 +464,6 @@ subroutine FatesRegisterParams(fates_params)
call fates_params%RegisterParameter(name=ED_name_canopy_closure_thresh, dimension_shape=dimension_shape_scalar, &
dimension_names=dim_names_scalar)

call fates_params%RegisterParameter(name=ED_name_stomatal_model, dimension_shape=dimension_shape_scalar, &
dimension_names=dim_names_scalar)

call fates_params%RegisterParameter(name=ED_name_regeneration_model, dimension_shape=dimension_shape_scalar, &
dimension_names=dim_names_scalar)

Expand Down Expand Up @@ -680,10 +674,6 @@ subroutine FatesReceiveParams(fates_params)
call fates_params%RetrieveParameter(name=ED_name_canopy_closure_thresh, &
data=ED_val_canopy_closure_thresh)

call fates_params%RetrieveParameter(name=ED_name_stomatal_model, &
data=tmpreal)
stomatal_model = nint(tmpreal)

call fates_params%RetrieveParameter(name=ED_name_regeneration_model, &
data=tmpreal)
regeneration_model = nint(tmpreal)
Expand Down Expand Up @@ -854,7 +844,6 @@ subroutine FatesReportParams(is_master)
write(fates_log(),fmt0) 'ED_val_patch_fusion_tol = ',ED_val_patch_fusion_tol
write(fates_log(),fmt0) 'ED_val_canopy_closure_thresh = ',ED_val_canopy_closure_thresh
write(fates_log(),fmt0) 'regeneration_model = ',regeneration_model
write(fates_log(),fmt0) 'stomatal_model = ',stomatal_model
write(fates_log(),fmt0) 'hydro_kmax_rsurf1 = ',hydr_kmax_rsurf1
write(fates_log(),fmt0) 'hydro_kmax_rsurf2 = ',hydr_kmax_rsurf2
write(fates_log(),fmt0) 'hydro_psi0 = ',hydr_psi0
Expand Down
12 changes: 12 additions & 0 deletions main/FatesInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,7 @@ subroutine set_fates_ctrlparms(tag,ival,rval,cval)
hlm_daylength_factor_switch = unset_int
hlm_photo_tempsens_model = unset_int
hlm_stomatal_assim_model = unset_int
hlm_stomatal_model = unset_int
hlm_hydr_solver = unset_int
hlm_use_logging = unset_int
hlm_use_ed_st3 = unset_int
Expand Down Expand Up @@ -1777,6 +1778,11 @@ subroutine set_fates_ctrlparms(tag,ival,rval,cval)
call endrun(msg=errMsg(sourcefile, __LINE__))
end if

if(hlm_stomatal_model .eq. unset_int) then
write(fates_log(), *) 'stomatal model conductance is unset: hlm_stomatal_model exiting'
call endrun(msg=errMsg(sourcefile, __LINE__))
end if

if(hlm_hydr_solver .eq. unset_int) then
write(fates_log(), *) 'FATES hydro solver is unset: hlm_hydr_solver, exiting'
call endrun(msg=errMsg(sourcefile, __LINE__))
Expand Down Expand Up @@ -2003,6 +2009,12 @@ subroutine set_fates_ctrlparms(tag,ival,rval,cval)
write(fates_log(),*) 'Transfering hlm_stomatal_assim_model ',ival,' to FATES'
end if

case('stomatal_model')
hlm_stomatal_model = ival
if (fates_global_verbose()) then
write(fates_log(),*) 'Transfering hlm_stomatal_model ',ival,' to FATES'
end if

case('hydr_solver')
hlm_hydr_solver = ival
if (fates_global_verbose()) then
Expand Down
3 changes: 3 additions & 0 deletions main/FatesInterfaceTypesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ module FatesInterfaceTypesMod
integer, public :: hlm_stomatal_assim_model ! Switch designating whether to use net or gross assimilation in the stomata model
! 1 for net, 2 for gross

integer, public :: hlm_stomatal_model ! switch for choosing between stomatal conductance models
! 1 for Ball-Berry, 2 for Medlyn

integer, public :: hlm_use_ed_st3 ! This flag signals whether or not to use
! (ST)atic (ST)and (ST)ructure mode (ST3)
! Essentially, this gives us the ability
Expand Down

0 comments on commit 5c4c87e

Please sign in to comment.