From 223b6e1d5557d27f4e76538a9f9d867d2bb1374a Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 26 Dec 2025 16:25:03 -0500 Subject: [PATCH 1/8] changing namelist type for fates_parteh_mode, part 1 --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- bld/namelist_files/namelist_definition_ctsm.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 1a2ac0df50..ccf21aa235 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2675,7 +2675,7 @@ lnd/clm2/surfdata_esmf/NEON/ctsm5.4.0/surfdata_1x1_NEON_TOOL_hist_2000_78pfts_c2 .true. .true. .false. -1 +carbon_only 0 .true. .true. diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 93666366df..1e708b5474 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -713,8 +713,8 @@ Toggle to turn on the FATES model Functionally Assembled Terrestrial Ecosystem Simulator (FATES) - + Switch deciding which nutrient model to use in FATES. (Only relevant if FATES is on) From f09d9ac123f9d017c4da28c385d2c34e6b20b540 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 16 Jan 2026 17:38:44 -0500 Subject: [PATCH 2/8] more name changes for fates CNP and c-only --- bld/CLMBuildNamelist.pm | 4 +-- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- .../clm/FatesColdPRT2/user_nl_clm | 2 +- .../clm/FatesColdPRT2_synthN/user_nl_clm | 2 +- src/main/clm_varctl.F90 | 13 ++++++--- src/main/clm_varpar.F90 | 10 ++++++- src/main/controlMod.F90 | 20 ++++++++------ .../SoilBiogeochemCompetitionMod.F90 | 9 ++++--- src/utils/clmfates_interfaceMod.F90 | 27 ++++++++++++++++--- 9 files changed, 64 insertions(+), 25 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 6c78a45e97..e1e055d276 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3351,12 +3351,12 @@ sub setup_logic_supplemental_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'}) ) { + if ( ($parteh_mode == 'carbon_only') && ($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'}) ) { + if ( ($parteh_mode == 'carbon_nitrogen') && ($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"); diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index ccf21aa235..23e85bdf33 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2687,7 +2687,7 @@ lnd/clm2/surfdata_esmf/NEON/ctsm5.4.0/surfdata_1x1_NEON_TOOL_hist_2000_78pfts_c2 NONE -ALL +ALL diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdPRT2/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdPRT2/user_nl_clm index 679f025b60..cf614522ec 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdPRT2/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdPRT2/user_nl_clm @@ -1,4 +1,4 @@ -fates_parteh_mode = 2 +fates_parteh_mode = 'carbon_nitrogen' hist_fincl1 = 'FATES_L2FR','FATES_L2FR_CANOPY_REC_PF','FATES_L2FR_USTORY_REC_PF', 'FATES_NH4UPTAKE_SZPF','FATES_NO3UPTAKE_SZPF','FATES_NEFFLUX_SZPF', 'FATES_NDEMAND_SZPF','FATES_NFIX_SYM_SZPF','FATES_NH4UPTAKE','FATES_NO3UPTAKE', diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdPRT2_synthN/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdPRT2_synthN/user_nl_clm index 679f025b60..cf614522ec 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdPRT2_synthN/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdPRT2_synthN/user_nl_clm @@ -1,4 +1,4 @@ -fates_parteh_mode = 2 +fates_parteh_mode = 'carbon_nitrogen' hist_fincl1 = 'FATES_L2FR','FATES_L2FR_CANOPY_REC_PF','FATES_L2FR_USTORY_REC_PF', 'FATES_NH4UPTAKE_SZPF','FATES_NO3UPTAKE_SZPF','FATES_NEFFLUX_SZPF', 'FATES_NDEMAND_SZPF','FATES_NFIX_SYM_SZPF','FATES_NH4UPTAKE','FATES_NO3UPTAKE', diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index efeee0d7e7..accbf2a0e8 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -324,9 +324,16 @@ 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 indicated by fates_c_only is carbon only - ! = 2 indicated by fates_cnp is C+N+P, though clm cannot enable phosphorus yet, so clm needs fates_cnp_prescribed_puptake > 1 (recommended value 10) in the fates paramfile - ! no others enabled + character(len=256), public :: fates_parteh_mode = '' ! FATES Plant Allocation Reactions and Transport Hypotheses + ! = carbon_only : Cycle carbon in FATES only + ! = carbon_nitrogen: Cycle both carbon and nitrogen + ! in FATES. FATES will cycle phosphorus as well, + ! to do this, FATES will generate synthetic uptake + ! conditions to make sure that phosphorus is saturated + ! in the plant stores + ! so clm needs fates_cnp_prescribed_puptake > 1 + ! (recommended value 10) in the fates paramfile + integer, public :: fates_spitfire_mode = 0 ! 0 for no fire; 1 for constant ignitions; ! > 1 for external data (lightning and/or anthropogenic ignitions) diff --git a/src/main/clm_varpar.F90 b/src/main/clm_varpar.F90 index 9ac4b197a0..676cdeefcc 100644 --- a/src/main/clm_varpar.F90 +++ b/src/main/clm_varpar.F90 @@ -53,8 +53,16 @@ module clm_varpar integer, public, parameter :: mxpft = 78 ! maximum number of PFT's for any mode; integer, public, parameter :: mxsowings = 1 ! maximum number of crop growing seasons to begin in any year; integer, public :: mxharvests ! maximum number of crop harvests in any year - ! (allows for multiple harvests in a calendar year in case harvest occurs near + ! (allows for multiple harvests in a calendar + ! year in case harvest occurs near ! beginning/end of year); + + ! These strings define the clm-fates coupling, i.e. which chemical species + ! are cycled between the two, see corresponding values for fates_parteh_mode: + ! bld/namelist_files/namelist_definition_ctsm.xml + character(len=256), public, parameter :: clmfates_carbon_only = 'carbon_only' + character(len=256), public, parameter :: clmfates_carbon_nitrogen = 'carbon_nitrogen' + ! FIX(RF,032414) might we set some of these automatically from reading pft-physiology? integer, public, parameter :: nlayer = 3 ! number of VIC soil layer --Added by AWang integer, public :: nlayert ! number of VIC soil layer + 3 lower thermal layers diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index dd753df338..fccdd2877f 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -20,6 +20,8 @@ module controlMod use decompInitMod , only: clump_pproc use clm_varcon , only: h2osno_max use clm_varpar , only: maxpatch_glc, numrad, nlevsno + use clm_varpar , only: clmfates_carbon_only + use clm_varpar , only: clmfates_carbon_nitrogen use fileutils , only: getavu, relavu, get_filename use histFileMod , only: max_tapes, max_namlen use histFileMod , only: hist_empty_htapes, hist_dov2xy, hist_avgflag_pertape, hist_type1d_pertape @@ -51,7 +53,7 @@ module controlMod use CanopyFluxesMod , only: CanopyFluxesReadNML use shr_drydep_mod , only: n_drydep use clm_varctl - use PRTGenericMod, only : fates_cnp, fates_c_only + ! ! !PUBLIC TYPES: implicit none @@ -492,18 +494,20 @@ subroutine control_init(dtime) use_fates_bgc = .true. end if - if (fates_parteh_mode == fates_c_only .and. suplnitro == suplnNon .and. use_fates_bgc )then - write(iulog,*) ' When fates_parteh_mode == fates_c_only,' + if (trim(fates_parteh_mode) == trim(clmfates_carbon_only) .and. & + suplnitro == suplnNon .and. use_fates_bgc )then + write(iulog,*) ' When fates_parteh_mode == carbon_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=fates_c_only must have suplnitro set to suplnAll.'//& + call endrun(msg=' ERROR: fates_parteh_mode=carbon_only must have suplnitro set to suplnAll.'//& errMsg(sourcefile, __LINE__)) end if - if (fates_parteh_mode == fates_cnp .and. suplnitro == suplnAll .and. use_fates_bgc )then - write(iulog,*) ' When fates_parteh_mode == fates_cnp,' + if (trim(fates_parteh_mode) == trim(clmfates_carbon_nitrogen) .and. & + suplnitro == suplnAll .and. use_fates_bgc )then + write(iulog,*) ' When fates_parteh_mode == carbon_nitrogen,' write(iulog,*) ' you must have supplemental nitrogen turned off.' - call endrun(msg=' ERROR: fates_parteh_mode=fates_cnp must have suplnitro set to suplnNon.'//& + call endrun(msg=' ERROR: fates_parteh_mode=carbon_nitrogen must have suplnitro set to suplnNon.'//& errMsg(sourcefile, __LINE__)) end if @@ -855,7 +859,7 @@ subroutine control_spmd() call mpi_bcast (flandusepftdat, len(flandusepftdat) , MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (use_fates_managed_fire, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (fates_parteh_mode, 1, MPI_INTEGER, 0, mpicom, ier) + call mpi_bcast (fates_parteh_mode, len(fates_parteh_mode), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fates_seeddisp_cadence, 1, MPI_INTEGER, 0, mpicom, ier) call mpi_bcast (fates_history_dimlevel, 2, MPI_INTEGER, 0, mpicom, ier) diff --git a/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 b/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 index 607cdc93b4..a8a7c5366e 100644 --- a/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 +++ b/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 @@ -176,8 +176,8 @@ subroutine SoilBiogeochemCompetition (bounds, num_bgc_soilc, filter_bgc_soilc,nu soilbiogeochem_nitrogenflux_inst,canopystate_inst, clm_fates) ! ! !USES: - use PRTGenericMod, only : fates_cnp use clm_varctl , only: fates_parteh_mode, allocate_carbon_only, iulog + use clm_varpar , only: clmfates_carbon_only,clmfates_carbon_nitrogen use clm_varpar , only: nlevdecomp, ndecomp_cascade_transitions use clm_varpar , only: i_cop_mic, i_oli_mic use clm_varcon , only: nitrif_n2o_loss_frac @@ -345,7 +345,7 @@ subroutine SoilBiogeochemCompetition (bounds, num_bgc_soilc, filter_bgc_soilc,nu do j = 1, nlevdecomp plant_ndemand_vr(c,j) = 0._r8 - if (fates_parteh_mode == fates_cnp) then + if (trim(fates_parteh_mode) == trim(clmfates_carbon_nitrogen)) then do f = 1, n_pcomp ft = clm_fates%fates(ci)%bc_out(s)%ft_index(f) @@ -612,7 +612,7 @@ subroutine SoilBiogeochemCompetition (bounds, num_bgc_soilc, filter_bgc_soilc,nu do j = 1, nlevdecomp plant_ndemand_vr(c,j) = 0._r8 - if (fates_parteh_mode == fates_cnp) then + if (trim(fates_parteh_mode) == trim(clmfates_carbon_nitrogen))then do f = 1, n_pcomp ft = clm_fates%fates(ci)%bc_out(s)%ft_index(f) @@ -1094,7 +1094,8 @@ subroutine SoilBiogeochemCompetition (bounds, num_bgc_soilc, filter_bgc_soilc,nu s = clm_fates%f2hmap(ci)%hsites(c) n_pcomp = clm_fates%fates(ci)%bc_out(s)%num_plant_comps - ! if fates_parteh_mode /= fates_cnp then plant_ndemand = 0 and this if-statement gets skipped + ! if fates_parteh_mode /= clmfates_carbon_nitrogen then + ! plant_ndemand = 0 and this if-statement gets skipped if ( plant_ndemand(c) > tiny(plant_ndemand(c)) ) then do f = 1, n_pcomp ft = clm_fates%fates(ci)%bc_out(s)%ft_index(f) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index f086b24cb6..0a3b1bddd9 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -46,7 +46,7 @@ module CLMFatesInterfaceMod use CNProductsMod , only : cn_products_type use clm_varctl , only : iulog use clm_varctl , only : fates_parteh_mode - use PRTGenericMod , only : fates_cnp + use PRTGenericMod , only : carbon_only,carbon_nitrogen_phosphorus use clm_varctl , only : use_fates use clm_varctl , only : fates_spitfire_mode use clm_varctl , only : use_fates_managed_fire @@ -93,6 +93,8 @@ module CLMFatesInterfaceMod use clm_varpar , only : nlevdecomp use clm_varpar , only : nlevdecomp_full use clm_varpar , only : nlevsoi + use clm_varpar , only : clmfates_carbon_only + use clm_varpar , only : clmfates_carbon_nitrogen use PhotosynthesisMod , only : photosyns_type use atm2lndType , only : atm2lnd_type use SurfaceAlbedoType , only : surfalb_type @@ -314,6 +316,7 @@ subroutine CLMFatesGlobals1(surf_numpft,surf_numcft,maxsoil_patches) integer :: pass_use_sp integer :: pass_masterproc integer :: pass_use_luh2 + integer :: pass_parteh_mode logical :: verbose_output call t_startf('fates_globals1') @@ -364,8 +367,24 @@ subroutine CLMFatesGlobals1(surf_numpft,surf_numcft,maxsoil_patches) end if call set_fates_ctrlparms('use_luh2',ival=pass_use_luh2) - - call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) + if(trim(fates_parteh_mode)==trim(clmfates_carbon_only))then + pass_parteh_mode = carbon_only + elseif(trim(fates_parteh_mode)==trim(clmfates_carbon_nitrogen))then + ! FATES has NO carbon_nitrogen mode. It cycles + ! either carbon alone, or carbon with both nutrients + ! If we want to couple nitrogen, we tell FATES + ! to use synthetic uptake conditions for phosphorus, which + ! most likely will be ample so that P stores in plants + ! are saturated and non-limiting + pass_parteh_mode = carbon_nitrogen_phosphorus + else + write(iulog,*) 'FATES coupling mode must be either' + write(iulog,*) trim(clmfates_carbon_only),' or ' + write(iulog,*) trim(clmfates_carbon_nitrogen) + write(iulog,*) 'you specified: ',trim(fates_parteh_mode) + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + call set_fates_ctrlparms('parteh_mode',ival=pass_parteh_mode) end if @@ -2809,7 +2828,7 @@ subroutine wrap_WoodProducts(this, bounds_clump, num_soilc, filter_soilc, & this%fates(ci)%bc_out(s)%hrv_deadstemc_to_prod100c ! If N cycling is on - if (fates_parteh_mode == fates_cnp) then + if ( trim(fates_parteh_mode)==trim(clmfates_carbon_nitrogen) ) then n_products_inst%hrv_deadstem_to_prod10_grc(g) = & n_products_inst%hrv_deadstem_to_prod10_grc(g) + & From b3afab968e8d52365a6d3dc805bad452536c7e68 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Sun, 18 Jan 2026 09:26:15 -0700 Subject: [PATCH 3/8] working on passing nl defaults --- bld/CLMBuildNamelist.pm | 20 ++++++++++--------- bld/namelist_files/namelist_defaults_ctsm.xml | 9 +++++++-- src/main/controlMod.F90 | 7 ------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index e1e055d276..345f52b8d6 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3330,7 +3330,12 @@ 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', 'fates_parteh_mode'=>$nl->get_value('fates_parteh_mode')); + 'suplnitro', 'fates_parteh_mode'=>$nl_flags->{'fates_parteh_mode'}, + 'use_fates'=>$nl_flags->{'use_fates'}); + $log->warning("suplnitro: $nl->get_value('suplnitro')") ; + $log->warning("suplnitro2: $nl_flags->{'splnitro'}") ; + $log->warning("parteh_mode: $nl->get_value('fates_parteh_mode')") ; + $log->warning("parteh_mode2: $nl_flags->{'fates_parteh_mode'}") ; } # # Error checking for suplnitro @@ -3352,14 +3357,11 @@ sub setup_logic_supplemental_nitrogen { my $parteh_mode = $nl->get_value('fates_parteh_mode'); if ( ($parteh_mode == 'carbon_only') && ($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 == 'carbon_nitrogen') && ($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"); + $log->fatal_error("supplemental Nitrogen (suplnitro) is NOT set to ALL, " . + "it is set to = $suplnitro. Yet, FATES is on, " . + "fates_parteh_mode = $parteh_mode" . + "and FATES-SP is not active. So Nitrogen should NOT be limiting. " . + "Change suplnitro back to ALL"); } } } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 23e85bdf33..033f7f111b 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -220,6 +220,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. 0.0d00 +NONE +ALL +NONE + 0.50,0.30 0.60,0.40 @@ -2686,8 +2690,9 @@ lnd/clm2/surfdata_esmf/NEON/ctsm5.4.0/surfdata_1x1_NEON_TOOL_hist_2000_78pfts_c2 2,2 -NONE -ALL + + + diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index fccdd2877f..5cae7350b3 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -503,13 +503,6 @@ subroutine control_init(dtime) call endrun(msg=' ERROR: fates_parteh_mode=carbon_only must have suplnitro set to suplnAll.'//& errMsg(sourcefile, __LINE__)) end if - if (trim(fates_parteh_mode) == trim(clmfates_carbon_nitrogen) .and. & - suplnitro == suplnAll .and. use_fates_bgc )then - write(iulog,*) ' When fates_parteh_mode == carbon_nitrogen,' - write(iulog,*) ' you must have supplemental nitrogen turned off.' - call endrun(msg=' ERROR: fates_parteh_mode=carbon_nitrogen must have suplnitro set to suplnNon.'//& - errMsg(sourcefile, __LINE__)) - end if if ( use_cn) then call endrun(msg=' ERROR: use_cn and use_fates cannot both be set to true.'//& From d26011037e58d93744e00a45ef042a7e8b23fd6a Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 26 Jan 2026 13:39:07 -0500 Subject: [PATCH 4/8] fixes to namelist processing of suplnitro --- bld/CLMBuildNamelist.pm | 6 +----- bld/namelist_files/namelist_defaults_ctsm.xml | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index ca12105427..5968ce262b 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3331,11 +3331,7 @@ sub setup_logic_supplemental_nitrogen { # Or... if its fates but not fates-sp add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'suplnitro', 'fates_parteh_mode'=>$nl_flags->{'fates_parteh_mode'}, - 'use_fates'=>$nl_flags->{'use_fates'}); - $log->warning("suplnitro: $nl->get_value('suplnitro')") ; - $log->warning("suplnitro2: $nl_flags->{'splnitro'}") ; - $log->warning("parteh_mode: $nl->get_value('fates_parteh_mode')") ; - $log->warning("parteh_mode2: $nl_flags->{'fates_parteh_mode'}") ; + 'use_fates'=>$nl_flags->{'use_fates'}, 'use_cn'=>$nl_flags->{'use_cn'}); } # # Error checking for suplnitro diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 033f7f111b..879c258ef3 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -221,8 +221,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 0.0d00 NONE -ALL -NONE +ALL +NONE 0.50,0.30 From e4b33ae91d0f51aab58bc5ae5cf7b14a5624bf29 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 26 Jan 2026 13:41:45 -0500 Subject: [PATCH 5/8] more explicit logic on suplnitro with fates --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 879c258ef3..63e9e82314 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -221,7 +221,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). 0.0d00 NONE -ALL +ALL NONE From 88a6770b3c47507cee6bc6fb7f632508b087ac57 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 26 Jan 2026 13:43:00 -0500 Subject: [PATCH 6/8] more explicit namelist defaults --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 63e9e82314..88c05d0673 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -220,7 +220,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. 0.0d00 -NONE +NONE ALL NONE From 8f2c0bb7bd6e98d28f063a6b4f0ab92f0b73af58 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 27 Jan 2026 16:05:19 -0700 Subject: [PATCH 7/8] Remove trailing whitespace --- src/utils/clmfates_interfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 0a3b1bddd9..dab361a894 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -375,7 +375,7 @@ subroutine CLMFatesGlobals1(surf_numpft,surf_numcft,maxsoil_patches) ! If we want to couple nitrogen, we tell FATES ! to use synthetic uptake conditions for phosphorus, which ! most likely will be ample so that P stores in plants - ! are saturated and non-limiting + ! are saturated and non-limiting pass_parteh_mode = carbon_nitrogen_phosphorus else write(iulog,*) 'FATES coupling mode must be either' From dde794231eb0b37ad45ba114dccba3f9886b0f78 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 27 Jan 2026 17:38:19 -0700 Subject: [PATCH 8/8] Changes for namelist updates to work --- bld/CLMBuildNamelist.pm | 9 ++++----- bld/namelist_files/namelist_defaults_ctsm.xml | 9 ++------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 5968ce262b..45895c4a58 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3325,13 +3325,12 @@ sub setup_logic_supplemental_nitrogen { if ( $nl_flags->{'bgc_mode'} ne "sp" && $nl_flags->{'bgc_mode'} ne "fates" && &value_is_true($nl_flags->{'use_crop'}) ) { # If this is non-fates, non-sp and crop is active add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - 'suplnitro', 'use_cn'=>$nl_flags->{'use_cn'}, 'use_crop'=>$nl_flags->{'use_crop'}); + 'suplnitro', 'use_cn'=>$nl_flags->{'use_cn'}, 'use_crop'=>$nl_flags->{'use_crop'}); } 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', 'fates_parteh_mode'=>$nl_flags->{'fates_parteh_mode'}, - 'use_fates'=>$nl_flags->{'use_fates'}, 'use_cn'=>$nl_flags->{'use_cn'}); + 'suplnitro', 'fates_parteh_mode'=>remove_leading_and_trailing_quotes($nl->get_value('fates_parteh_mode'))); } # # Error checking for suplnitro @@ -3352,12 +3351,12 @@ sub setup_logic_supplemental_nitrogen { } my $parteh_mode = $nl->get_value('fates_parteh_mode'); - if ( ($parteh_mode == 'carbon_only') && ($suplnitro !~ /ALL/) ) { + if ( ($parteh_mode =~ /carbon_only/i) && ($suplnitro !~ /ALL/i) ) { $log->fatal_error("supplemental Nitrogen (suplnitro) is NOT set to ALL, FATES is on, " . "and fates_parteh_mode = $parteh_mode, so Nitrogen is not active; " . "change suplnitro back to ALL"); } - if ( ($parteh_mode == 'carbon_nitrogen') && &value_is_true( $nl_flags->{'use_fates_sp'}) ) { + if ( ($parteh_mode =~ /carbon_nitrogen/i) && &value_is_true( $nl_flags->{'use_fates_sp'}) ) { $log->fatal_error("FATES is on, " . "FATES-SP is active, but fates_parteh_mode = $parteh_mode, so Nitrogen is active; " . "change fates_parteh_mode to carbon_only or do not use FATES-SP"); diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 88c05d0673..23e85bdf33 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -220,10 +220,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case). .false. 0.0d00 -NONE -ALL -NONE - 0.50,0.30 0.60,0.40 @@ -2690,9 +2686,8 @@ lnd/clm2/surfdata_esmf/NEON/ctsm5.4.0/surfdata_1x1_NEON_TOOL_hist_2000_78pfts_c2 2,2 - - - +NONE +ALL