Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
e505dc8
Add two 1x1 FatesColdPRT2 tests, one with, one without MIMICS
slevis-lmwg Jul 30, 2025
01671b9
Uncomment if ( .not. use_fates_sp ) section of clmfates_interfaceMod
slevis-lmwg Aug 11, 2025
59f9d09
Replace plant_ndemand(c) * nuptake_prof(c,j) with plant_ndemand_vr(c,j)
slevis-lmwg Aug 12, 2025
b155e58
New use_fates section for plant_ndemand_vr and plant_ndemand from fates
slevis-lmwg Aug 13, 2025
c79230c
New use_fates section to set the FATES N uptake fluxes
slevis-lmwg Aug 13, 2025
98b4b7d
Change clm_fate from "in" to "inout" argument
slevis-lmwg Aug 13, 2025
a46a76c
Replace if (use_fates) with (is_fates(c)) to add flexibility
slevis-lmwg Aug 14, 2025
f2202fb
Remove two unhelpful 1x1 FatesColdPRT2 tests that I added earlier
slevis-lmwg Aug 15, 2025
e96b87e
New is_fates section for plant_ndemand, now when use_nitrif_denitrif
slevis-lmwg Aug 26, 2025
b24738b
Add (really, uncomment) FATES npp to enable fixation
slevis-lmwg Aug 26, 2025
00a332e
Uncomment hrv_deadstem_to_prod* lines in clmfates_interfaceMod
slevis-lmwg Sep 19, 2025
2bbdd64
Add error check about fates_parteh_mode = 2 and suplnitro = suplnAll
slevis-lmwg Sep 20, 2025
d8bc6ce
Upd. namelist_defaults for suplnitro when parteh_mode == 1 or /= 1
slevis-lmwg Sep 22, 2025
116b310
prt_carbon_allom_hyp -> fates_c_only & prt_cnp_flex_allom_hyp ->fates_cn
slevis-lmwg Sep 22, 2025
ba955b6
Correction to syntax error caught by gnu and nvhpc, not intel
slevis-lmwg Sep 23, 2025
391a023
Update fates paramfile var prescribed_puptake to 1 for PRT2 test
slevis-lmwg Sep 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
24 changes: 14 additions & 10 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1687,10 +1687,10 @@ sub process_namelist_inline_logic {
}
setup_logic_cnmatrix($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref);
setup_logic_spinup($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_supplemental_nitrogen($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_c_isotope($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_snowpack($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_fates($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_supplemental_nitrogen($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_z0param($opts, $nl_flags, $definition, $defaults, $nl);
setup_logic_misc($opts, $nl_flags, $definition, $defaults, $nl);

Expand Down Expand Up @@ -3303,7 +3303,7 @@ sub setup_logic_supplemental_nitrogen {
} elsif ( $nl_flags->{'bgc_mode'} eq "fates" && not &value_is_true( $nl_flags->{'use_fates_sp'}) ) {
# Or... if its fates but not fates-sp
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl,
'suplnitro', 'use_fates'=>$nl_flags->{'use_fates'});
'suplnitro', 'fates_parteh_mode'=>$nl->get_value('fates_parteh_mode'));
}
#
# Error checking for suplnitro
Expand All @@ -3322,6 +3322,18 @@ sub setup_logic_supplemental_nitrogen {
$log->warning("There is no need to use a bgc_spinup mode when supplemental Nitrogen is on for all PFT's, as these modes spinup Nitrogen" );
}
}

my $parteh_mode = $nl->get_value('fates_parteh_mode');
if ( ($parteh_mode == 1) && ($suplnitro !~ /ALL/) && not &value_is_true( $nl_flags->{'use_fates_sp'}) ) {
$log->fatal_error("supplemental Nitrogen (suplnitro) is NOT set to ALL, FATES is on, " .
"and FATES-SP is not active, but fates_parteh_mode is 1, so Nitrogen is not active. " .
"Change suplnitro back to ALL");
}
if ( ($parteh_mode == 2) && ($suplnitro !~ /NONE/) && not &value_is_true( $nl_flags->{'use_fates_sp'}) ) {
$log->fatal_error("supplemental Nitrogen (suplnitro) is NOT set to NONE, FATES is on, " .
"and FATES-SP is not active, but fates_parteh_mode is 2, so Nitrogen is active; " .
"change suplnitro back to NONE");
}
}
}

Expand Down Expand Up @@ -4787,14 +4799,6 @@ sub setup_logic_fates {
'use_fates_lupft'=>$nl->get_value('use_fates_lupft'),
'use_fates_sp'=>$nl_flags->{'use_fates_sp'} );

my $suplnitro = $nl->get_value('suplnitro');
my $parteh_mode = $nl->get_value('fates_parteh_mode');
if ( ($parteh_mode == 1) && ($suplnitro !~ /ALL/) && not &value_is_true( $nl_flags->{'use_fates_sp'}) ) {
$log->fatal_error("supplemental Nitrogen (suplnitro) is NOT set to ALL, FATES is on, " .
"but and FATES-SP is not active, but fates_parteh_mode is 1, so Nitrogen is not active" .
"Change suplnitro back to ALL");
}

# For FATES SP mode make sure no-competetiion, and fixed-biogeography are also set
# And also check for other settings that can't be trigged on as well
#
Expand Down
7 changes: 3 additions & 4 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<megan_use_gamma_sm>.true.</megan_use_gamma_sm>
<megan_min_gamma_sm>0.0d00</megan_min_gamma_sm>

<!-- Supplmental Nitrogen mode -->
<suplnitro use_cn=".true." >NONE</suplnitro>
<suplnitro use_fates=".true." >ALL</suplnitro>

<!-- Albedo for glaciers -->
<albice >0.50,0.30</albice>
<albice phys="clm4_5" >0.60,0.40</albice>
Expand Down Expand Up @@ -2467,6 +2463,9 @@ lnd/clm2/surfdata_esmf/NEON/ctsm5.3.0/surfdata_1x1_NEON_TOOL_hist_2000_78pfts_c2
<use_fates_fixed_biogeog use_fates=".true." >.false.</use_fates_fixed_biogeog>
<fates_history_dimlevel use_fates=".true.">2,2</fates_history_dimlevel>

<!-- Supplmental Nitrogen mode -->
<suplnitro >NONE</suplnitro>
<suplnitro fates_parteh_mode="1" >ALL</suplnitro>

<!-- ========================================= -->
<!-- Defaults for dynamic subgrid -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
SRCDIR=`./xmlquery SRCROOT --value`
CASEDIR=`./xmlquery CASEROOT --value`
FATESDIR=$SRCDIR/src/fates/
FATESPARAMFILE=$CASEDIR/fates_params_prt2_prescribed_np.nc
FATESPARAMFILE=$CASEDIR/fates_params_prt2_prescribed_p.nc

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

$FATESDIR/tools/modify_fates_paramfile.py --O --fin $FATESPARAMFILE --fout $FATESPARAMFILE --var fates_cnp_prescribed_nuptake --val 1.0 --allpfts

$FATESDIR/tools/modify_fates_paramfile.py --O --fin $FATESPARAMFILE --fout $FATESPARAMFILE --var fates_cnp_prescribed_puptake --val 1.0 --allpfts

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fates_paramfile = '$CASEROOT/fates_params_prt2_prescribed_np.nc'
fates_paramfile = '$CASEROOT/fates_params_prt2_prescribed_p.nc'
fates_parteh_mode = 2
hist_fincl1 = 'FATES_L2FR','FATES_L2FR_CANOPY_REC_PF','FATES_L2FR_USTORY_REC_PF',
'FATES_NH4UPTAKE_SZPF','FATES_NO3UPTAKE_SZPF','FATES_NEFFLUX_SZPF',
Expand Down
2 changes: 1 addition & 1 deletion src/biogeochem/CNDriverMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ subroutine CNDriverNoLeaching(bounds,
cnveg_carbonflux_inst,cnveg_nitrogenstate_inst,cnveg_nitrogenflux_inst, &
soilbiogeochem_carbonflux_inst,&
soilbiogeochem_state_inst,soilbiogeochem_nitrogenstate_inst, &
soilbiogeochem_nitrogenflux_inst,canopystate_inst)
soilbiogeochem_nitrogenflux_inst,canopystate_inst, clm_fates)
call t_stopf('soilbiogeochemcompetition')

! distribute the available N between the competing patches on the basis of
Expand Down
9 changes: 2 additions & 7 deletions src/biogeochem/CNNDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,7 @@ subroutine CNNFixation(num_soilc, filter_soilc, &
if(col%is_fates(c))then
s = clm_fates%f2hmap(clump_index)%hsites(c)
! %ema_npp is Smoothed [gc/m2/yr]
!npp = clm_fates%fates(clump_index)%bc_out(s)%ema_npp/(dayspyr*secspday)
! FATES N cycling is not yet active, so runs are supplemented anyway
! this will be added when FATES N cycling is completed.
npp = 0._r8
npp = clm_fates%fates(clump_index)%bc_out(s)%ema_npp / (dayspyr * secspday)
else
npp = col_lag_npp(c)
end if
Expand All @@ -262,9 +259,7 @@ subroutine CNNFixation(num_soilc, filter_soilc, &

if(col%is_fates(c))then
s = clm_fates%f2hmap(clump_index)%hsites(c)
!npp = clm_fates%fates(clump_index)%bc_out(s)%ema_npp
! See above regarding FATES and N fixation
npp = 0._r8
npp = clm_fates%fates(clump_index)%bc_out(s)%ema_npp
else
npp = cannsum_npp(c)
end if
Expand Down
4 changes: 2 additions & 2 deletions src/main/clm_varctl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ module clm_varctl

integer, public :: fates_seeddisp_cadence = iundef ! 0 => no seed dispersal
! 1, 2, 3 => daily, monthly, or yearly dispersal
integer, public :: fates_parteh_mode = -9 ! 1 => carbon only
! 2 => C+N+P (not enabled yet)
integer, public :: fates_parteh_mode = -9 ! = 1 indicated by fates_c_only is carbon only
! = 2 indicated by fates_cn is C+N (P not enabled)
! no others enabled
integer, public :: fates_spitfire_mode = 0
! 0 for no fire; 1 for constant ignitions;
Expand Down
15 changes: 11 additions & 4 deletions src/main/controlMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module controlMod
use CNSharedParamsMod , only: use_fun, use_matrixcn
use CIsoAtmTimeseriesMod , only: use_c14_bombspike, atm_c14_filename, use_c13_timeseries, atm_c13_filename
use SoilBiogeochemDecompCascadeConType, only : use_soil_matrixcn
use SoilBiogeochemCompetitionMod , only: suplnitro, suplnNon
use SoilBiogeochemCompetitionMod , only: suplnitro, suplnNon, suplnAll
use SoilBiogeochemLittVertTranspMod , only: som_adv_flux, max_depth_cryoturb
use SoilBiogeochemVerticalProfileMod , only: surfprof_exp
use SoilBiogeochemNitrifDenitrifMod , only: no_frozen_nitrif_denitrif
Expand All @@ -51,6 +51,7 @@ module controlMod
use CanopyFluxesMod , only: CanopyFluxesReadNML
use shr_drydep_mod , only: n_drydep
use clm_varctl
use PRTGenericMod, only : fates_cn, fates_c_only
!
! !PUBLIC TYPES:
implicit none
Expand Down Expand Up @@ -490,12 +491,18 @@ subroutine control_init(dtime)
use_fates_bgc = .true.
end if

if (fates_parteh_mode == 1 .and. suplnitro == suplnNon .and. use_fates_bgc )then
write(iulog,*) ' When FATES with fates_parteh_mode == 1 (ie carbon only mode),'
if (fates_parteh_mode == fates_c_only .and. suplnitro == suplnNon .and. use_fates_bgc )then
write(iulog,*) ' When fates_parteh_mode == fates_c_only,'
write(iulog,*) ' you must have supplemental nitrogen turned on, there will be'
write(iulog,*) ' no nitrogen dynamics with the plants, and therefore no'
write(iulog,*) ' meaningful limitations to nitrogen.'
call endrun(msg=' ERROR: fates_parteh_mode=1 must have suplnitro set to suplnAll.'//&
call endrun(msg=' ERROR: fates_parteh_mode=fates_c_only must have suplnitro set to suplnAll.'//&
errMsg(sourcefile, __LINE__))
end if
if (fates_parteh_mode == fates_cn .and. suplnitro == suplnAll .and. use_fates_bgc )then
write(iulog,*) ' When fates_parteh_mode == fates_cn,'
write(iulog,*) ' you must have supplemental nitrogen turned off.'
call endrun(msg=' ERROR: fates_parteh_mode=fates_cn must have suplnitro set to suplnNon.'//&
errMsg(sourcefile, __LINE__))
end if

Expand Down
Loading