From 4333a66ca69d32a2f24aa81cbb9214ead5e8b763 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 14 Aug 2024 15:57:27 -0600 Subject: [PATCH 1/4] PPE mods from /glade/work/linnia/PPEn14trans brought to ctsm5.2.015 Bringing the diffs between branch_tags/PPE16... and branch_tags/PPE15... to b4b-dev manually --- src/biogeochem/CNFUNMod.F90 | 8 -------- src/biogeochem/CNPhenologyMod.F90 | 23 +++++++++++++---------- src/main/initVerticalMod.F90 | 11 +++++++++++ src/main/pftconMod.F90 | 11 +++++++++++ 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/biogeochem/CNFUNMod.F90 b/src/biogeochem/CNFUNMod.F90 index dde666c1f7..a6614fe4b9 100644 --- a/src/biogeochem/CNFUNMod.F90 +++ b/src/biogeochem/CNFUNMod.F90 @@ -53,7 +53,6 @@ module CNFUNMod public:: CNFUN ! Run FUN type, private :: params_type - real(r8) :: ndays_on ! number of days to complete leaf onset real(r8) :: ndays_off ! number of days to complete leaf offset end type params_type @@ -64,7 +63,6 @@ module CNFUNMod ! ! !PRIVATE DATA MEMBERS: real(r8) :: dt ! decomp timestep (seconds) - real(r8) :: ndays_on ! number of days to complete onset real(r8) :: ndays_off ! number of days to complete offset integer, private, parameter :: COST_METHOD = 2 !new way of doing the N uptake @@ -104,11 +102,6 @@ subroutine readParams ( ncid ) ! read in parameters - tString='ndays_on' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ndays_on=tempr - tString='ndays_off' call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) @@ -172,7 +165,6 @@ subroutine CNFUNInit (bounds,cnveg_state_inst,cnveg_carbonstate_inst,cnveg_nitro timestep_fun = real(secspday * fun_period) nstep_fun = int(secspday * dayspyr / dt) - ndays_on = params_inst%ndays_on ndays_off = params_inst%ndays_off !-------------------------------------------------------------------- diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index 9c7e5a331a..d8789eb30f 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -94,7 +94,6 @@ module CNPhenologyMod real(r8) :: crit_dayl_lat_slope ! Slope of time for critical day length with latitude (sec/deg) ! (Birch et. all 2021 it was 720 see line below) ! 15hr-11hr/(65N-45N)=linear slope = 720 min/latitude (Birch et. al 2021) - real(r8) :: ndays_on ! number of days to complete leaf onset real(r8) :: ndays_off ! number of days to complete leaf offset real(r8) :: fstor2tran ! fraction of storage to move to transfer for each onset real(r8) :: crit_onset_fdd ! critical number of freezing days to set gdd counter @@ -113,7 +112,6 @@ module CNPhenologyMod real(r8) :: dt ! time step delta t (seconds) real(r8) :: fracday ! dtime as a fraction of day real(r8) :: crit_dayl ! critical daylength for offset (seconds) - real(r8) :: ndays_on ! number of days to complete onset real(r8) :: ndays_off ! number of days to complete offset real(r8) :: fstor2tran ! fraction of storage to move to transfer on each onset real(r8) :: crit_onset_fdd ! critical number of freezing days @@ -310,7 +308,6 @@ subroutine readParams ( ncid ) call readNcdioScalar(ncid, 'crit_dayl', subname, params_inst%crit_dayl) call readNcdioScalar(ncid, 'crit_dayl_at_high_lat', subname, params_inst%crit_dayl_at_high_lat) call readNcdioScalar(ncid, 'crit_dayl_lat_slope', subname, params_inst%crit_dayl_lat_slope) - call readNcdioScalar(ncid, 'ndays_on', subname, params_inst%ndays_on) call readNcdioScalar(ncid, 'ndays_off', subname, params_inst%ndays_off) call readNcdioScalar(ncid, 'fstor2tran', subname, params_inst%fstor2tran) call readNcdioScalar(ncid, 'crit_onset_fdd', subname, params_inst%crit_onset_fdd) @@ -471,7 +468,6 @@ subroutine CNPhenologyInit(bounds) crit_dayl=params_inst%crit_dayl ! Set constants for CNSeasonDecidPhenology and CNStressDecidPhenology - ndays_on=params_inst%ndays_on ndays_off=params_inst%ndays_off ! set transfer parameters @@ -882,6 +878,8 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) season_decid => pftcon%season_decid , & ! Input: binary flag for seasonal-deciduous leaf habit (0 or 1) season_decid_temperate => pftcon%season_decid_temperate , & ! Input: binary flag for seasonal-deciduous temperate leaf habit (0 or 1) + crit_onset_gdd_sf => pftcon%crit_onset_gdd_sf , & ! Input: scale factor for crit_onset_gdd (unitless) + ndays_on => pftcon%ndays_on , & ! Input: number of days to complete leaf onset (days t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) soila10 => temperature_inst%soila10_col , & ! Input: [real(r8) (:) ] @@ -1016,7 +1014,8 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & lgsf(p) = 0._r8 ! onset gdd sum from Biome-BGC, v4.1.2 - crit_onset_gdd = exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) - SHR_CONST_TKFRZ)) + crit_onset_gdd = crit_onset_gdd_sf(ivt(p)) * exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) & + - SHR_CONST_TKFRZ)) ! set flag for solstice period (winter->summer = 1, summer->winter = 0) if (dayl(g) >= prev_dayl(g)) then @@ -1109,7 +1108,8 @@ subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & onset_gddflag(p) = 0.0_r8 onset_gdd(p) = 0.0_r8 do_onset = .false. - onset_counter(p) = ndays_on * secspday + onset_counter(p) = ndays_on(ivt(p)) * secspday + ! move all the storage pools into transfer pools, ! where they will be transfered to displayed growth over the onset period. @@ -1399,7 +1399,10 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & stress_decid => pftcon%stress_decid , & ! Input: binary flag for stress-deciduous leaf habit (0 or 1) leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) - + + crit_onset_gdd_sf => pftcon%crit_onset_gdd_sf , & ! Input: scale factor for crit_onset_gdd (unitless) + ndays_on => pftcon%ndays_on , & ! Input: number of days to complete leaf onset (days) + soilpsi => soilstate_inst%soilpsi_col , & ! Input: [real(r8) (:,:) ] soil water potential in each soil layer (MPa) t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) @@ -1532,8 +1535,8 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & psi = soilpsi(c, phenology_soil_layer) ! onset gdd sum from Biome-BGC, v4.1.2 - crit_onset_gdd = exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) - SHR_CONST_TKFRZ)) - + crit_onset_gdd = crit_onset_gdd_sf(ivt(p)) * exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) & + - SHR_CONST_TKFRZ)) ! update offset_counter and test for the end of the offset period if (offset_flag(p) == 1._r8) then @@ -1673,7 +1676,7 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & onset_fdd(p) = 0._r8 onset_gdd(p) = 0._r8 onset_swi(p) = 0._r8 - onset_counter(p) = ndays_on * secspday + onset_counter(p) = ndays_on(ivt(p)) * secspday ! call subroutine to move all the storage pools into transfer pools, ! where they will be transfered to displayed growth over the onset period. diff --git a/src/main/initVerticalMod.F90 b/src/main/initVerticalMod.F90 index b91c3439aa..64383e7a7c 100644 --- a/src/main/initVerticalMod.F90 +++ b/src/main/initVerticalMod.F90 @@ -47,6 +47,8 @@ module initVerticalMod type, private :: params_type real(r8) :: slopebeta ! exponent for microtopography pdf sigma (unitless) real(r8) :: slopemax ! max topographic slope for microtopography pdf sigma (unitless) + real(r8) :: zbedrock ! parameter to substitute for zbedrock (m) + real(r8) :: zbedrock_sf ! parameter to scale zbedrock (m) end type params_type type(params_type), private :: params_inst ! @@ -79,6 +81,9 @@ subroutine readParams( ncid ) ! Max topographic slope for microtopography pdf sigma (unitless) call readNcdioScalar(ncid, 'slopemax', subname, params_inst%slopemax) + call readNcdioScalar(ncid, 'zbedrock', subname, params_inst%zbedrock) + call readNcdioScalar(ncid, 'zbedrock_sf', subname, params_inst%zbedrock_sf) + end subroutine readParams !------------------------------------------------------------------------ @@ -447,6 +452,12 @@ subroutine initVertical(bounds, glc_behavior, thick_wall, thick_roof) call endrun( 'ERROR:: zbedrock not found on surface data set, and use_bedrock is true.'//errmsg(sourcefile, __LINE__) ) end if end if + if (params_inst%zbedrock>=0._r8) then + zbedrock_in(:) = params_inst%zbedrock + end if + if (params_inst%zbedrock_sf/=1._r8) then + zbedrock_in(:) = params_inst%zbedrock_sf*zbedrock_in(:) + end if ! if use_bedrock = false, set zbedrock to lowest layer bottom interface else diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 index 7988b57e75..b987879c03 100644 --- a/src/main/pftconMod.F90 +++ b/src/main/pftconMod.F90 @@ -162,6 +162,8 @@ module pftconMod real(r8), allocatable :: taper (:) ! tapering ratio of height:radius_breast_height real(r8), allocatable :: rstem_per_dbh (:) ! stem resistance per dbh (s/m/m) real(r8), allocatable :: wood_density (:) ! wood density (kg/m3) + real(r8), allocatable :: crit_onset_gdd_sf(:)! scale factor for crit_onset_gdd + real(r8), allocatable :: ndays_on(:) ! number of days to complete leaf onset ! crop @@ -502,6 +504,8 @@ subroutine InitAllocate (this) allocate( this%taper (0:mxpft) ) allocate( this%rstem_per_dbh (0:mxpft) ) allocate( this%wood_density (0:mxpft) ) + allocate( this%crit_onset_gdd_sf (0:mxpft) ) + allocate( this%ndays_on (0:mxpft) ) end subroutine InitAllocate @@ -843,6 +847,11 @@ subroutine InitRead(this) call ncd_io('season_decid_temperate', this%season_decid_temperate, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + call ncd_io('crit_onset_gdd_sf', this%crit_onset_gdd_sf, 'read', ncid, readvar=readv, posNOTonfile=.true.) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) + + call ncd_io('ndays_on', this%ndays_on, 'read', ncid, readvar=readv, posNOTonfile=.true.) + if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) call ncd_io('pftpar20', this%pftpar20, 'read', ncid, readvar=readv, posNOTonfile=.true.) if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) @@ -1585,6 +1594,8 @@ subroutine Clean(this) deallocate( this%rstem_per_dbh) deallocate( this%wood_density) deallocate( this%taper) + deallocate( this%crit_onset_gdd_sf) + deallocate( this%ndays_on) end subroutine Clean end module pftconMod From 648d0c4d2b607e7e470a7083a51662325045dc2b Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 15 Aug 2024 10:09:36 -0600 Subject: [PATCH 2/4] One-line fix for build to complete --- src/biogeochem/CNPhenologyMod.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 index d8789eb30f..8108876586 100644 --- a/src/biogeochem/CNPhenologyMod.F90 +++ b/src/biogeochem/CNPhenologyMod.F90 @@ -274,7 +274,6 @@ subroutine CNPhenologySetParams( ) params_inst%crit_dayl = 39200._r8 ! Seconds params_inst%crit_dayl_at_high_lat = 54000._r8 ! Seconds params_inst%crit_dayl_lat_slope = 720._r8 ! Seconds / degree - params_inst%ndays_on = 15._r8 ! Days params_inst%ndays_off = 30._r8 ! Days params_inst%fstor2tran = 0.5 ! Fraction params_inst%crit_onset_fdd = 15._r8 ! Days From 2ee88b8f8cc618c1f75d7fc3a1cc05be3e2bfbd0 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 15 Aug 2024 10:12:14 -0600 Subject: [PATCH 3/4] Update default param file names in namelists --- bld/namelist_files/namelist_defaults_ctsm.xml | 8 ++++---- .../clm/clm60_monthly_matrixcn_soilCN30/user_nl_clm | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 97620c770d..7f6305087c 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -504,10 +504,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/ctsm60_params.c240208.nc -lnd/clm2/paramdata/ctsm51_params.c240208.nc -lnd/clm2/paramdata/clm50_params.c240208.nc -lnd/clm2/paramdata/clm45_params.c240208.nc +lnd/clm2/paramdata/ctsm60_params.c240814.nc +lnd/clm2/paramdata/ctsm51_params.c240814.nc +lnd/clm2/paramdata/clm50_params.c240814.nc +lnd/clm2/paramdata/clm45_params.c240814.nc diff --git a/cime_config/testdefs/testmods_dirs/clm/clm60_monthly_matrixcn_soilCN30/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm60_monthly_matrixcn_soilCN30/user_nl_clm index df20ced9e8..4bfc0520f8 100644 --- a/cime_config/testdefs/testmods_dirs/clm/clm60_monthly_matrixcn_soilCN30/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/clm60_monthly_matrixcn_soilCN30/user_nl_clm @@ -1,2 +1,2 @@ use_soil_matrixcn = .true. -paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/ctsm60_params_cn30.c240625.nc' +paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/ctsm60_params_cn30.c240814.nc' From 34839868c3b96149f619bd750e387da37d23e152 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 16 Aug 2024 15:20:53 -0600 Subject: [PATCH 4/4] Update another param file for aux_clm test to pass --- cime_config/testdefs/testmods_dirs/clm/ciso_cwd_hr/user_nl_clm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_cwd_hr/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/ciso_cwd_hr/user_nl_clm index 3c686f08b9..3462b802c7 100644 --- a/cime_config/testdefs/testmods_dirs/clm/ciso_cwd_hr/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/ciso_cwd_hr/user_nl_clm @@ -1,2 +1,2 @@ -paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/ctsm51_ciso_cwd_hr_params.c240208.nc' +paramfile = '$DIN_LOC_ROOT/lnd/clm2/paramdata/ctsm51_ciso_cwd_hr_params.c240814.nc' hist_fincl1 = 'CWDC_HR','C13_CWDC_HR','C14_CWDC_HR','CWD_HR_L2','CWD_HR_L2_vr','CWD_HR_L3','CWD_HR_L3_vr'