Skip to content

Commit

Permalink
Merge remote-tracking branch 'rgknox/lnd/fates-twostream' into next(PR
Browse files Browse the repository at this point in the history
…#6279)

This set of changes enables compatibility with FATES API 33, which brings in two-stream radiation for vegetation canopies.

[non-BFB] for FATES
  • Loading branch information
peterdschwartz committed Apr 24, 2024
2 parents 5ce7a3d + 03371d6 commit 84d5e8d
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 7 deletions.
1 change: 1 addition & 0 deletions cime_config/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@
"ERS_Ld60.f45_g37.IELMFATES.elm-fates_cold_nofire",
"ERS_Ld60.f45_g37.IELMFATES.elm-fates_cold_st3",
"ERS_Ld60.f45_g37.IELMFATES.elm-fates_cold_pphys",
"SMS_D_Ld15.f45_g37.IELMFATES.elm-fates_cold_twostream",
)
},

Expand Down
1 change: 1 addition & 0 deletions components/elm/bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ sub write_filepath_cesmbld
"external_models/fates/biogeochem",
"external_models/fates/fire",
"external_models/fates/parteh",
"external_models/fates/radiation",
"external_models/mpp/src/mpp/dtypes",
"external_models/mpp/src/mpp/thermal",
"external_models/mpp/src/mpp/util",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
./xmlchange TEST_MEMLEAK_TOLERANCE=0.75
./xmlchange NTHRDS=1

# Change PIO settings as temporary fix for #6316
if [ `./xmlquery --value LND_GRID` == 1.9x2.5 ]; then
./xmlchange PIO_NUMTASKS=4
./xmlchange PIO_STRIDE=-999
fi
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ hist_fincl1 = 'FATES_CROWNAREA_PF', 'FATES_CANOPYCROWNAREA_PF',
'FATES_LAISHA_TOP_CL', 'FATES_FABD_SUN_CLLLPF', 'FATES_FABD_SHA_CLLLPF',
'FATES_FABI_SUN_CLLLPF', 'FATES_FABI_SHA_CLLLPF', 'FATES_FABD_SUN_CLLL',
'FATES_FABD_SHA_CLLL', 'FATES_FABI_SUN_CLLL', 'FATES_FABI_SHA_CLLL',
'FATES_PARPROF_DIR_CLLLPF', 'FATES_PARPROF_DIF_CLLLPF',
'FATES_PARPROF_DIR_CLLL', 'FATES_PARPROF_DIF_CLLL', 'FATES_FABD_SUN_TOPLF_CL',
'FATES_PARPROF_DIR_CLLLPF', 'FATES_PARPROF_DIF_CLLLPF','FATES_FABD_SUN_TOPLF_CL',
'FATES_FABD_SHA_TOPLF_CL', 'FATES_FABI_SUN_TOPLF_CL', 'FATES_FABI_SHA_TOPLF_CL',
'FATES_NET_C_UPTAKE_CLLL', 'FATES_CROWNAREA_CLLL', 'FATES_NPLANT_CANOPY_SZAP',
'FATES_NPLANT_USTORY_SZAP', 'FATES_DDBH_CANOPY_SZAP', 'FATES_DDBH_USTORY_SZAP',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Testing FATES two-stream radiation scheme is activated by switching the fates_rad_model
parameter from 1 to 2. This is all that is needed, both radiation schemes
1) Norman and 2) two-stream use the same optical parameters.

fates_rad_model

Note that to avoid exceeding the filename string length maximum, the parameter
file generated on the fly is placed in the $SRCROOT/src/fates/parameter_files
directory. This may still run into problems is the $SRCROOT string is too long.

Like the test with seed dispersal activation, the main downside of this method is
that this file will require a custom update for every fates parameter file API update.
Allowing the HLM to generate the file at runtime via buildnamelist step
will provide the capability to build the fates parameter file on
the fly which with the appropriate values for this test.

Note that the test as currently designed is not machine agnostic as it requires
specific shell commands for enabling the workflow to have access to ncgen. Currently
this test is only usable on perlmutter.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../fates_cold
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module load e4s
spack env activate gcc
spack load nco

SRCDIR=`./xmlquery SRCROOT --value`
CASEDIR=`./xmlquery CASEROOT --value`
FATESDIR=$SRCDIR/components/elm/src/external_models/fates
FATESPARAMFILE=$CASEDIR/fates_params_twostream.nc

ncgen -o $FATESPARAMFILE $FATESDIR/parameter_files/fates_params_default.cdl

$FATESDIR/tools/modify_fates_paramfile.py --O --fin $FATESPARAMFILE --fout $FATESPARAMFILE --var fates_rad_model --val 2 --allpfts

spack unload nco
module unload e4s
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fates_paramfile = '$CASEROOT/fates_params_twostream.nc'
2 changes: 1 addition & 1 deletion components/elm/src/external_models/fates
Submodule fates updated 37 files
+171 −123 biogeochem/EDCanopyStructureMod.F90
+27 −9 biogeochem/EDCohortDynamicsMod.F90
+66 −20 biogeochem/EDMortalityFunctionsMod.F90
+5 −4 biogeochem/EDPatchDynamicsMod.F90
+125 −12 biogeochem/FatesAllometryMod.F90
+2 −0 biogeochem/FatesCohortMod.F90
+35 −31 biogeochem/FatesPatchMod.F90
+1,715 −1,524 biogeophys/FatesPlantRespPhotosynthMod.F90
+1,133 −0 functional_unit_testing/radiation/RadiationUTestDriver.py
+1 −0 functional_unit_testing/radiation/bld/README
+26 −0 functional_unit_testing/radiation/build_radiation_f90_objects.sh
+276 −0 functional_unit_testing/radiation/f90_src/RadiationWrapMod.F90
+31 −0 functional_unit_testing/radiation/f90_src/WrapShrMod.F90
+3 −0 functional_unit_testing/shared/py_src/PyF90Utils.py
+14 −13 main/EDInitMod.F90
+19 −28 main/EDParamsMod.F90
+9 −7 main/EDPftvarcon.F90
+31 −14 main/EDTypesMod.F90
+10 −3 main/FatesConstantsMod.F90
+3 −0 main/FatesGlobals.F90
+108 −61 main/FatesHistoryInterfaceMod.F90
+0 −1 main/FatesIOVariableKindMod.F90
+23 −25 main/FatesInterfaceMod.F90
+1 −2 main/FatesInterfaceTypesMod.F90
+3 −4 main/FatesInventoryInitMod.F90
+102 −43 main/FatesRestartInterfaceMod.F90
+1 −1 parameter_files/fates_params_default.cdl
+1 −1 parameter_files/patch_default_bciopt224.xml
+59 −400 radiation/FatesNormanRadMod.F90
+504 −0 radiation/FatesRadiationDriveMod.F90
+61 −0 radiation/FatesRadiationMemMod.F90
+534 −0 radiation/FatesTwoStreamUtilsMod.F90
+1,729 −0 radiation/TwoStreamMLPEMod.F90
+14 −5 tools/BatchPatchParams.py
+9 −4 tools/FatesPFTIndexSwapper.py
+14 −7 tools/UpdateParamAPI.py
+10 −1 tools/modify_fates_paramfile.py
9 changes: 5 additions & 4 deletions components/elm/src/main/elmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ module ELMFatesInterfaceMod
use EDInitMod , only : init_patches
use EDInitMod , only : set_site_properties
use EDPftVarcon , only : EDpftvarcon_inst
use EDSurfaceRadiationMod , only : ED_SunShadeFracs, ED_Norman_Radiation
use FatesRadiationDriveMod, only : FatesSunShadeFracs
use FatesRadiationDriveMod, only : FatesNormalizedCanopyRadiation
use EDBtranMod , only : btran_ed, &
get_active_suction_layers
use EDCanopyStructureMod , only : canopy_summarization, update_hlm_dynamics
Expand Down Expand Up @@ -519,7 +520,7 @@ subroutine ELMFatesGlobals2()
call set_fates_ctrlparms('num_lu_harvest_cats',ival=pass_num_lu_harvest_types)
call set_fates_ctrlparms('use_logging',ival=pass_logging)

if(use_fates_luh) then
if (use_fates_luh) then
pass_use_luh = 1
pass_num_luh_states = num_landuse_state_vars
pass_num_luh_transitions = num_landuse_transition_vars
Expand Down Expand Up @@ -2055,7 +2056,7 @@ subroutine wrap_sunfrac(this,bounds_clump,top_af_inst,canopystate_inst)
! as well as total patch sun/shade fraction output boundary condition
! -------------------------------------------------------------------------------

call ED_SunShadeFracs(this%fates(nc)%nsites, &
call FatesSunShadeFracs(this%fates(nc)%nsites, &
this%fates(nc)%sites, &
this%fates(nc)%bc_in, &
this%fates(nc)%bc_out)
Expand Down Expand Up @@ -2563,7 +2564,7 @@ subroutine wrap_canopy_radiation(this, bounds_clump, &
end do
end do

call ED_Norman_Radiation(this%fates(nc)%nsites, &
call FatesNormalizedCanopyRadiation(this%fates(nc)%nsites, &
this%fates(nc)%sites, &
this%fates(nc)%bc_in, &
this%fates(nc)%bc_out)
Expand Down

0 comments on commit 84d5e8d

Please sign in to comment.