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

Migrate parameter file switches that are moving to HLM namelist #1300

Merged
merged 21 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
723c6d8
remove parameter file switches that are moving to HLM namelist
glemieux Dec 11, 2024
e8ae746
move daylength factor switch from EDParams to FatesInterfaceMod
glemieux Dec 11, 2024
2a49f4c
move hydro solver switch from EDParamsMod to FatesInterfaceTypesMod
glemieux Dec 11, 2024
5a6e475
move photosythentic tempsens model switch from EDParamsMod to FatesIn…
glemieux Dec 11, 2024
377b155
move stomatal assimiliation switch from EDParamsMod to FatesInterface…
glemieux Dec 11, 2024
e63b20d
move stomatal model switch from EDParamsMod to FatesInterfaceTypesMod
glemieux Dec 11, 2024
e6db48f
move leaf maintenance respiration switch from EDParamsMod to FatesInt…
glemieux Dec 11, 2024
1056092
move carbon starvation mortality switch from EDParamsMod to FatesInte…
glemieux Dec 11, 2024
c8e0d2b
move radiation model switch from EDParamsMod to FatesInterfaceTypesMod
glemieux Dec 11, 2024
ef51623
move seed regen model switch from EDParamsMod to FatesInterfaceTypesMod
glemieux Dec 11, 2024
a265f96
change photosynthetic acclimation pass name
glemieux Jan 15, 2025
e02533b
added new pft-level switches that control how btran reduces conductan…
rgknox Jan 17, 2025
01e418c
added grazing parameters
rgknox Jan 17, 2025
9cb1611
Merge pull request #31 from rgknox/parameter-switch-migration
glemieux Jan 17, 2025
2a6b33e
Merge tag 'sci.1.81.1_api.37.1.0' into parameter-switch-migration
glemieux Feb 20, 2025
928dcd5
update patch parameter file
glemieux Feb 20, 2025
d87123d
rename patch parameter file and archive default parameter file
glemieux Feb 20, 2025
601d18b
update comments in the api38 patch parameter file
glemieux Feb 20, 2025
8fe2fe7
update archived parameter file to use api37.1 as the base file
glemieux Feb 20, 2025
d88cf4a
correct archived parameter file to be api37.1
glemieux Feb 23, 2025
3b4d20c
correct bad tag merge
glemieux Feb 23, 2025
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
Prev Previous commit
Next Next commit
move hydro solver switch from EDParamsMod to FatesInterfaceTypesMod
  • Loading branch information
glemieux committed Dec 11, 2024
commit 2a49f4cb0821fa306dae7bbd1f11be906b4a9680
18 changes: 9 additions & 9 deletions biogeophys/FatesPlantHydraulicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ module FatesPlantHydraulicsMod
use EDParamsMod , only : hydr_psi0
use EDParamsMod , only : hydr_psicap
use EDParamsMod , only : hydr_htftype_node
use EDParamsMod , only : hydr_solver

use EDTypesMod , only : ed_site_type
use FatesPatchMod , only : fates_patch_type
Expand All @@ -64,6 +63,7 @@ module FatesPlantHydraulicsMod
use FatesInterfaceTypesMod , only : hlm_ipedof
use FatesInterfaceTypesMod , only : numpft
use FatesInterfaceTypesMod , only : nlevsclass
use FatesInterfaceTypesMod , only : hlm_hydr_solver

use FatesAllometryMod, only : bleaf
use FatesAllometryMod, only : bsap_allom
Expand Down Expand Up @@ -1419,7 +1419,7 @@ subroutine InitHydrSites(sites,bc_in)
case(rhizlayer_aggmeth_none)

csite_hydr%nlevrhiz = bc_in(s)%nlevsoil
call sites(s)%si_hydr%InitHydrSite(numpft,nlevsclass,hydr_solver,bc_in(s)%nlevsoil)
call sites(s)%si_hydr%InitHydrSite(numpft,nlevsclass,hlm_hydr_solver,bc_in(s)%nlevsoil)

do j=1,csite_hydr%nlevrhiz
csite_hydr%map_r2s(j,1) = j
Expand All @@ -1431,7 +1431,7 @@ subroutine InitHydrSites(sites,bc_in)
case(rhizlayer_aggmeth_combine12)

csite_hydr%nlevrhiz = max(1,bc_in(s)%nlevsoil-1)
call sites(s)%si_hydr%InitHydrSite(numpft,nlevsclass,hydr_solver,bc_in(s)%nlevsoil)
call sites(s)%si_hydr%InitHydrSite(numpft,nlevsclass,hlm_hydr_solver,bc_in(s)%nlevsoil)

csite_hydr%map_r2s(1,1) = 1
j_bc = min(2,bc_in(s)%nlevsoil) ! this protects 1 soil layer
Expand All @@ -1449,7 +1449,7 @@ subroutine InitHydrSites(sites,bc_in)
case(rhizlayer_aggmeth_balN)

csite_hydr%nlevrhiz = min(aggN,bc_in(s)%nlevsoil)
call sites(s)%si_hydr%InitHydrSite(numpft,nlevsclass,hydr_solver,bc_in(s)%nlevsoil)
call sites(s)%si_hydr%InitHydrSite(numpft,nlevsclass,hlm_hydr_solver,bc_in(s)%nlevsoil)

ntoagg = int(ceiling(real(bc_in(s)%nlevsoil)/real(csite_hydr%nlevrhiz)-nearzero))

Expand Down Expand Up @@ -2583,21 +2583,21 @@ subroutine hydraulics_bc ( nsites, sites, bc_in, bc_out, dtime)
! from leaf to the current soil layer. This does NOT
! update cohort%th_*

if(hydr_solver == hydr_solver_2DNewton) then
if(hlm_hydr_solver == hydr_solver_2DNewton) then

call MatSolve2D(csite_hydr,ccohort,ccohort_hydr, &
dtime,qflx_tran_veg_indiv, &
sapflow,rootuptake(1:nlevrhiz),wb_err_plant,dwat_plant, &
dth_layershell_col)

elseif(hydr_solver == hydr_solver_2DPicard) then
elseif(hlm_hydr_solver == hydr_solver_2DPicard) then

call PicardSolve2D(csite_hydr,ccohort,ccohort_hydr, &
dtime,qflx_tran_veg_indiv, &
sapflow,rootuptake(1:nlevrhiz),wb_err_plant,dwat_plant, &
dth_layershell_col,csite_hydr%num_nodes)

elseif(hydr_solver == hydr_solver_1DTaylor ) then
elseif(hlm_hydr_solver == hydr_solver_1DTaylor ) then

! ---------------------------------------------------------------------------------
! Approach: do nlevsoi_hyd sequential solutions to Richards' equation,
Expand Down Expand Up @@ -4938,7 +4938,7 @@ subroutine MatSolve2D(csite_hydr,cohort,cohort_hydr, &


! This NaN's the scratch arrays
call csite_hydr%FlushSiteScratch(hydr_solver)
call csite_hydr%FlushSiteScratch(hlm_hydr_solver)

! This is the maximum number of iterations needed for this cohort
! (each soil layer has a different number, this saves the max)
Expand Down Expand Up @@ -5714,7 +5714,7 @@ subroutine PicardSolve2D(csite_hydr,cohort,cohort_hydr, &
ft => cohort%pft)

! This NaN's the scratch arrays
call csite_hydr%FlushSiteScratch(hydr_solver)
call csite_hydr%FlushSiteScratch(hlm_hydr_solver)

! This is the maximum number of iterations needed for this cohort
! (each soil layer has a different number, this saves the max)
Expand Down
21 changes: 0 additions & 21 deletions main/EDParamsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,6 @@ module EDParamsMod
real(r8),protected,public :: hydr_psicap ! sapwood water potential at which capillary reserves exhausted (MPa)
character(len=param_string_length),parameter,public :: hydr_name_psicap = "fates_hydro_psicap"


! Switch that defines which hydraulic solver to use
! 1 = Taylor solution that solves plant fluxes with 1 layer
! sequentially placing solution on top of previous layer solves
! 2 = Picard solution that solves all fluxes in a plant and
! the soil simultaneously, 2D: soil x (root + shell)
! 3 = Newton-Raphson (Deprecated) solution that solves all fluxes in a plant and
! the soil simultaneously, 2D: soil x (root + shell)

integer,protected,public :: hydr_solver ! switch designating hydraulics numerical solver
character(len=param_string_length),parameter,public :: hydr_name_solver = "fates_hydro_solver"

!Soil BGC parameters, mostly used for testing FATES when not coupled to the dynamics bgc hlm
! ----------------------------------------------------------------------------------------------
real(r8),protected,public :: bgc_soil_salinity ! site-level soil salinity for FATES when not coupled to dynamic soil BGC of salinity
Expand Down Expand Up @@ -350,7 +338,6 @@ subroutine FatesParamsInit()
hydr_kmax_rsurf2 = nan
hydr_psi0 = nan
hydr_psicap = nan
hydr_solver = -9
bgc_soil_salinity = nan
logging_dbhmin = nan
logging_dbhmax = nan
Expand Down Expand Up @@ -506,9 +493,6 @@ subroutine FatesRegisterParams(fates_params)
call fates_params%RegisterParameter(name=maxcohort_name, dimension_shape=dimension_shape_scalar, &
dimension_names=dim_names_scalar)

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

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

Expand Down Expand Up @@ -745,10 +729,6 @@ subroutine FatesReceiveParams(fates_params)
call fates_params%RetrieveParameter(name=hydr_name_psicap, &
data=hydr_psicap)

call fates_params%RetrieveParameter(name=hydr_name_solver, &
data=tmpreal)
hydr_solver = nint(tmpreal)

call fates_params%RetrieveParameter(name=bgc_name_soil_salinity, &
data=bgc_soil_salinity)

Expand Down Expand Up @@ -905,7 +885,6 @@ subroutine FatesReportParams(is_master)
write(fates_log(),fmt0) 'hydro_kmax_rsurf2 = ',hydr_kmax_rsurf2
write(fates_log(),fmt0) 'hydro_psi0 = ',hydr_psi0
write(fates_log(),fmt0) 'hydro_psicap = ',hydr_psicap
write(fates_log(),fmt0) 'hydro_solver = ',hydr_solver
write(fates_log(),fmt0) 'bgc_soil_salinity = ', bgc_soil_salinity
write(fates_log(),fmt0) 'logging_dbhmin = ',logging_dbhmin
write(fates_log(),fmt0) 'logging_dbhmax = ',logging_dbhmax
Expand Down
12 changes: 12 additions & 0 deletions main/FatesInterfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,7 @@ subroutine set_fates_ctrlparms(tag,ival,rval,cval)
hlm_num_luh2_transitions = unset_int
hlm_use_cohort_age_tracking = unset_int
hlm_daylength_factor_switch = unset_int
hlm_hydr_solver = unset_int
hlm_use_logging = unset_int
hlm_use_ed_st3 = unset_int
hlm_use_ed_prescribed_phys = unset_int
Expand Down Expand Up @@ -1764,6 +1765,11 @@ subroutine set_fates_ctrlparms(tag,ival,rval,cval)
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__))
end if

if(hlm_use_sp.eq.itrue.and.hlm_use_nocomp.eq.ifalse)then
write(fates_log(), *) 'SP cannot be on if nocomp mode is off. Exiting. '
call endrun(msg=errMsg(sourcefile, __LINE__))
Expand Down Expand Up @@ -1973,6 +1979,12 @@ subroutine set_fates_ctrlparms(tag,ival,rval,cval)
write(fates_log(),*) 'Transfering hlm_daylength_factor_switch= ',ival,' to FATES'
end if

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

case('use_logging')
hlm_use_logging = ival
if (fates_global_verbose()) then
Expand Down
8 changes: 8 additions & 0 deletions main/FatesInterfaceTypesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ module FatesInterfaceTypesMod
integer, public :: hlm_daylength_factor_switch ! This switch enables the use of the daylength factor from the HLM
! 1 = TRUE, 0 = FALSE

integer, public :: hlm_hydr_solver ! Switch that defines which hydraulic solver to use
! 1 = Taylor solution that solves plant fluxes with 1 layer
! sequentially placing solution on top of previous layer solves
! 2 = Picard solution that solves all fluxes in a plant and
! the soil simultaneously, 2D: soil x (root + shell)
! 3 = Newton-Raphson (Deprecated) solution that solves all fluxes in a plant and
! the soil simultaneously, 2D: soil x (root + shell)

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