From 8434fbb5957e062f38981a0a6cc764d65dff380c Mon Sep 17 00:00:00 2001 From: "Danny M. Leung" Date: Mon, 13 Mar 2023 00:46:19 -0600 Subject: [PATCH 01/77] An initial commit to enable CLM to read in Zender's soil erodibility streams (dmleung 12 Mar 2023) --- bld/CLMBuildNamelist.pm | 11 + bld/namelist_files/namelist_defaults_ctsm.xml | 12 + .../namelist_definition_ctsm.xml | 15 + src/biogeochem/DUSTMod.F90 | 39 +- .../share_esmf/ZenderSoilErodStreamType.F90 | 346 ++++++++++++++++++ src/main/clm_instMod.F90 | 2 +- 6 files changed, 415 insertions(+), 10 deletions(-) create mode 100644 src/cpl/share_esmf/ZenderSoilErodStreamType.F90 diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 05631edc23..a5abc00671 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1560,6 +1560,7 @@ sub process_namelist_inline_logic { setup_logic_snowpack($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_fates($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_misc($opts, $nl_flags, $definition, $defaults, $nl); + setup_logic_zender_soilerod($opts, $nl_flags, $definition, $defaults, $nl); # dmleung added 11 Mar 2023 ######################################### # namelist group: atm2lnd_inparm @@ -4187,6 +4188,15 @@ sub setup_logic_misc { #------------------------------------------------------------------------------- +sub setup_logic_zender_soilerod { + # dmleung added on 31 Dec 2022 for reading Prigent's roughness stream file + my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_zendersoilerod' ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_meshfile_zendersoilerod' ); +} + +#------------------------------------------------------------------------------- + sub write_output_files { my ($opts, $nl_flags, $defaults, $nl) = @_; @@ -4235,6 +4245,7 @@ sub write_output_files { push @groups, "ch4finundated"; push @groups, "soilbgc_decomp"; push @groups, "clm_canopy_inparm"; + push @groups, "zendersoilerod"; # dmleung 11 Mar 2023 if (remove_leading_and_trailing_quotes($nl->get_value('snow_cover_fraction_method')) eq 'SwensonLawrence2012') { push @groups, "scf_swenson_lawrence_2012_inparm"; } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 41103b5259..4ee9d1f92e 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2537,6 +2537,18 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts lnd/clm2/paramdata/finundated_inversiondata_0.9x1_ESMFmesh_cdf5_130621.nc + + + + + + + +/gpfs/fs1/work/dleung/Zender_dust_source/dst_source2x2tunedcam6-2x2-forCLM_c230311.nc +/gpfs/fs1/work/dleung/Zender_dust_source/lnd_mesh.nc + diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index bc1dd034aa..bd5fd05a48 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1693,6 +1693,21 @@ Mapping method from Nitrogen deposition input file to the model resolution copy = copy using the same indices + + + + + + +Filename of input stream data for Zender's soil erodibility source function + + + +mesh filename of input stream data for Zender's soil erodibility source function + + diff --git a/src/biogeochem/DUSTMod.F90 b/src/biogeochem/DUSTMod.F90 index a86531ba62..bae61fd430 100644 --- a/src/biogeochem/DUSTMod.F90 +++ b/src/biogeochem/DUSTMod.F90 @@ -30,6 +30,7 @@ module DUSTMod use LandunitType , only : lun use ColumnType , only : col use PatchType , only : patch + use ZenderSoilErodStreamType, only : zendersoilerodstream_type ! dmleung added 11 Mar 2023 ! ! !PUBLIC TYPES implicit none @@ -59,7 +60,9 @@ module DUSTMod real(r8), pointer, private :: vlc_trb_2_patch (:) ! turbulent deposition velocity 2(m/s) real(r8), pointer, private :: vlc_trb_3_patch (:) ! turbulent deposition velocity 3(m/s) real(r8), pointer, private :: vlc_trb_4_patch (:) ! turbulent deposition velocity 4(m/s) - real(r8), pointer, private :: mbl_bsn_fct_col (:) ! basin factor + !########### added by dmleung 11 Mar 2023 ######################################################################## + type(zendersoilerodstream_type), private :: zendersoilerodstream ! Zender soil erodibility stream data + real(r8), pointer, private :: mbl_bsn_fct_col (:) ! [dimensionless] basin factor, or soil erodibility, time-constant contains @@ -78,13 +81,17 @@ module DUSTMod contains !------------------------------------------------------------------------ - subroutine Init(this, bounds) + !subroutine Init(this, bounds) + !##### dmleung edited for initializing stream files 11 Mar 2023 ######## + subroutine Init(this, bounds, NLFilename) class(dust_type) :: this type(bounds_type), intent(in) :: bounds + character(len=*), intent(in) :: NLFilename ! dmleung added 11 Mar 2023 call this%InitAllocate (bounds) call this%InitHistory (bounds) + call this%zendersoilerodstream%Init( bounds, NLFilename ) ! dmleung added 11 Mar 2023 call this%InitCold (bounds) call this%InitDustVars (bounds) @@ -129,9 +136,11 @@ subroutine InitHistory(this, bounds) ! ! !LOCAL VARIABLES: integer :: begp,endp + integer :: begc,endc ! dmleung added 11 Mar 2023 !------------------------------------------------------------------------ begp = bounds%begp; endp = bounds%endp + begc = bounds%begc; endc = bounds%endp this%flx_mss_vrt_dst_tot_patch(begp:endp) = spval call hist_addfld1d (fname='DSTFLXT', units='kg/m2/s', & @@ -158,6 +167,13 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='turbulent deposition velocity 4', & ptr_patch=this%vlc_trb_4_patch, default='inactive') + !#####added by dmleung 11 Mar 2023 ######################################## + this%mbl_bsn_fct_col(begc:endc) = spval + call hist_addfld1d (fname='LND_MBL', units='fraction', & + avgflag='A', long_name='Soil erodibility factor', & + ptr_col=this%mbl_bsn_fct_col) + !########################################################################## + end subroutine InitHistory !----------------------------------------------------------------------- @@ -173,13 +189,18 @@ subroutine InitCold(this, bounds) ! Set basin factor to 1 for now - do c = bounds%begc, bounds%endc - l = col%landunit(c) + !if (dust_emission_scheme == 'Leung2023') + ! do c = bounds%begc, bounds%endc + ! l = col%landunit(c) - if (.not.lun%lakpoi(l)) then - this%mbl_bsn_fct_col(c) = 1.0_r8 - end if - end do + ! if (.not.lun%lakpoi(l)) then + ! this%mbl_bsn_fct_col(c) = 1.0_r8 + ! end if + ! end do + !else if (dust_emission_scheme == 'Zender2003') + call this%zendersoilerodstream%CalcDustSource( bounds, & + this%mbl_bsn_fct_col(bounds%begc:bounds%endc) ) + !end if end subroutine InitCold @@ -262,7 +283,7 @@ subroutine DustEmission (bounds, & fv => frictionvel_inst%fv_patch , & ! Input: [real(r8) (:) ] friction velocity (m/s) (for dust model) u10 => frictionvel_inst%u10_patch , & ! Input: [real(r8) (:) ] 10-m wind (m/s) (created for dust model) - mbl_bsn_fct => dust_inst%mbl_bsn_fct_col , & ! Input: [real(r8) (:) ] basin factor + mbl_bsn_fct => dust_inst%mbl_bsn_fct_col , & ! Input: [real(r8) (:) ] basin factor ; dmleung changed the value in InitCold 11 Mar 2023 flx_mss_vrt_dst => dust_inst%flx_mss_vrt_dst_patch , & ! Output: [real(r8) (:,:) ] surface dust emission (kg/m**2/s) flx_mss_vrt_dst_tot => dust_inst%flx_mss_vrt_dst_tot_patch & ! Output: [real(r8) (:) ] total dust flux back to atmosphere (pft) ) diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 new file mode 100644 index 0000000000..ab7d71a24f --- /dev/null +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -0,0 +1,346 @@ +module ZenderSoilErodStreamType +!dmleung modified based on PrigetnRoughnessStreamType.F90 on 11 Mar 2023 +#include "shr_assert.h" ! What is this? In many modules but not dust module + + !----------------------------------------------------------------------- + ! !DESCRIPTION: + ! Contains methods for reading in the Zender et al. (2003b) Dust source function streams file that has been read in from CAM instead of CLM. dmleung 11 Mar 2023 + ! pathname in CAM: /glade/p/cesmdata/cseg/inputdata/atm/cam/dst/ + ! relevant filenames: (CAM6) dst_source2x2tunedcam6-2x2-04062017.nc (default) + ! (CAM5) dst_source2x2_cam5.4_c150327.nc + ! (CAM4) dst_source2x2tuned-cam4-06132012.nc + ! These files are largely similar and the differences are mainly only a little tuning. + ! This .F90 file for now only deals with the CAM6 source function, which can be used in CAM5 and CAM4 too. Not sure if we will expand the code to include a namelist control to deal + ! with the other files. + ! + ! !USES + use ESMF , only : ESMF_LogFoundError, ESMF_LOGERR_PASSTHRU, ESMF_Finalize, ESMF_END_ABORT + use dshr_strdata_mod , only : shr_strdata_type + use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_cl + use shr_log_mod , only : errMsg => shr_log_errMsg + use spmdMod , only : mpicom, masterproc + use clm_varctl , only : iulog + use abortutils , only : endrun + use decompMod , only : bounds_type + + ! !PUBLIC TYPES: + implicit none + private + + type, public :: zendersoilerodstream_type + real(r8), pointer, private :: soil_erodibility (:) ! Zender et al. (2003b) dust source function (or soil erodibility) + contains + + ! !PUBLIC MEMBER FUNCTIONS: + procedure, public :: Init ! Initialize and read data in + procedure, public :: CalcDustSource ! Calculate dust source spatial filter (basically truncating stream data value smaller than 0.1 following CAM's practice) based on input streams + procedure, public :: UseStreams ! If streams will be used + + ! !PRIVATE MEMBER FUNCTIONS: + procedure, private :: InitAllocate ! Allocate data + + end type zendersoilerodstream_type + + ! ! PRIVATE DATA: + type, private :: streamcontrol_type + character(len=CL) :: stream_fldFileName_zendersoilerod ! data Filename + character(len=CL) :: stream_meshfile_zendersoilerod ! mesh Filename + character(len=CL) :: zendersoilerodmapalgo ! map algo + contains + procedure, private :: ReadNML ! Read in namelist + end type streamcontrol_type + + type(streamcontrol_type), private :: control ! Stream control data + + character(len=*), parameter, private :: sourcefile = & + __FILE__ + +!============================================================================== +contains +!============================================================================== + + subroutine Init(this, bounds, NLFilename) + ! + ! Initialize the prigent roughness stream object + ! + ! Uses: + use spmdMod , only : iam + use lnd_comp_shr , only : mesh, model_clock + use dshr_strdata_mod , only : shr_strdata_init_from_inline, shr_strdata_print + use dshr_strdata_mod , only : shr_strdata_advance + use dshr_methods_mod , only : dshr_fldbun_getfldptr + ! + ! arguments + implicit none + class(zendersoilerodstream_type) :: this + type(bounds_type), intent(in) :: bounds + character(len=*), intent(in) :: NLFilename ! Namelist filename + ! + ! local variables + integer :: ig, g, n ! Indices + integer :: year ! year (0, ...) for nstep+1 + integer :: mon ! month (1, ..., 12) for nstep+1 + integer :: day ! day of month (1, ..., 31) for nstep+1 + integer :: sec ! seconds into current date for nstep+1 + integer :: mcdate ! Current model date (yyyymmdd) + type(shr_strdata_type) :: sdat_erod ! input data stream + character(len=16), allocatable :: stream_varnames(:) ! array of stream field names + integer :: rc ! error code + real(r8), pointer :: dataptr1d(:) ! temporary pointer + character(len=*), parameter :: stream_name = 'zendersoilerod' + !----------------------------------------------------------------------- + + !if ( finundation_mtd /= finundation_mtd_h2osfc )then ! how should I change this? comment out for now + call this%InitAllocate( bounds ) + call control%ReadNML( bounds, NLFileName ) + + if ( this%useStreams() )then ! is this a namelist input and is it set in namelist default + + allocate(stream_varnames(1)) + stream_varnames = (/"mbl_bsn_fct_geo"/) ! varname in the dust source file; the variable is dimensionless + + if (masterproc) then + write(iulog,*) ' stream_varnames = ',stream_varnames + end if + + ! Initialize the cdeps data type sdat_erod + call shr_strdata_init_from_inline(sdat_erod, & ! what is this function and where does it come from? + my_task = iam, & + logunit = iulog, & + compname = 'LND', & + model_clock = model_clock, & + model_mesh = mesh, & + stream_meshfile = control%stream_meshfile_zendersoilerod, & + stream_lev_dimname = 'null', & + stream_mapalgo = control%zendersoilerodmapalgo, & + stream_filenames = (/trim(control%stream_fldFileName_zendersoilerod)/), & + stream_fldlistFile = stream_varnames, & + stream_fldListModel = stream_varnames, & + stream_yearFirst = 1997, & + stream_yearLast = 1997, & + stream_yearAlign = 1, & + stream_offset = 0, & + stream_taxmode = 'extend', & + stream_dtlimit = 1.0e30_r8, & + stream_tintalgo = 'linear', & + stream_name = 'Zender soil erodibility', & + rc = rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call ESMF_Finalize(endflag=ESMF_END_ABORT) + end if + + ! Explicitly set current date to a hardcoded constant value. Otherwise + ! using the real date can cause roundoff differences that are + ! detrected as issues with exact restart. EBK M05/20/2017 + ! call get_curr_date(year, mon, day, sec) + year = 2003 + mon = 12 + day = 31 + sec = 0 + mcdate = year*10000 + mon*100 + day + + call shr_strdata_advance(sdat_erod, ymd=mcdate, tod=sec, logunit=iulog, istr='zendersoilerod', rc=rc) ! what is istr and do I need to change elsewhere because the change of istr here + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call ESMF_Finalize(endflag=ESMF_END_ABORT) + end if + + ! Get pointer for stream data that is time and spatially interpolate to model time and grid + do n = 1,size(stream_varnames) + call dshr_fldbun_getFldPtr(sdat_erod%pstrm(1)%fldbun_model, stream_varnames(n), fldptr1=dataptr1d, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then + call ESMF_Finalize(endflag=ESMF_END_ABORT) + end if + if (trim(stream_varnames(n)) == 'mbl_bsn_fct_geo') then + ig = 0 + do g = bounds%begg,bounds%endg + ig = ig+1 ! not sure why +1 is needed but it's okay + this%soil_erodibility(g) = dataptr1d(ig) + end do + + end if + + end do + end if + !end if !comment out for now + + end subroutine Init + + !============================================================================== + logical function UseStreams(this) + ! + ! !DESCRIPTION: + ! Return true if + ! + ! !USES: + ! + ! !ARGUMENTS: + implicit none + class(zendersoilerodstream_type) :: this + ! + ! !LOCAL VARIABLES: + !if ( trim(control%stream_fldFileName_zendersoilerod) == '' .or. dust_emission_scheme == 'Leung2023')then + if ( trim(control%stream_fldFileName_zendersoilerod) == '')then + UseStreams = .false. + else + UseStreams = .true. + end if + end function UseStreams + + !============================================================================== + subroutine InitAllocate(this, bounds) + ! + ! !DESCRIPTION: + ! Allocate module variables and data structures + ! + ! !USES: + use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) + ! + ! !ARGUMENTS: + implicit none + class(zendersoilerodstream_type) :: this + type(bounds_type), intent(in) :: bounds + ! + ! !LOCAL VARIABLES: + !integer :: begc, endc + integer :: begg, endg + !--------------------------------------------------------------------- + + !begc = bounds%begc; endc = bounds%endc + begg = bounds%begg; endg = bounds%endg + + allocate(this%soil_erodibility (begg:endg)) ; this%soil_erodibility (:) = nan + + end subroutine InitAllocate + + !============================================================================== + !subroutine CalcFinundated(this, bounds, num_soilc, filter_soilc, soilhydrology_inst, & + ! waterdiagnosticbulk_inst, qflx_surf_lag_col, finundated ) + !subroutine CalcDragPartition(this, bounds, num_nolakep, filter_nolakep, dpfct_rock) + subroutine CalcDustSource(this, bounds, soil_erod) + ! + ! !DESCRIPTION: + ! Commented below by dmleung 31 Dec 2022 + ! Calculate the drag partition effect of friction velocity due to surface roughness following + ! Leung et al. (2022). This module is used in the dust emission module DUSTMod.F90 for + ! calculating drag partitioning. The drag partition equation comes from Marticorena and + ! Bergametti (1995) with constants modified by Darmenova et al. (2009). Here it is assumed + ! that this equation is used only over arid/desertic regions, such that Catherine Prigent's + ! roughness measurements represents mostly rocks. For more vegetated areas, the vegetation + ! roughness and drag partitioning are calculated in the DustEmission subroutine. This + ! subroutine is used in the InitCold subroutine of DUSTMod.F90. + ! + ! !USES: + use ColumnType , only : col + !use PatchType , only : patch + !USES dmleung added 31 Dec 2022 + use landunit_varcon , only : istdlak + use LandunitType , only : lun + ! + ! !ARGUMENTS: + implicit none + class(zendersoilerodstream_type) :: this + type(bounds_type) , intent(in) :: bounds + real(r8) , intent(inout) :: soil_erod(bounds%begc:) ! [fraction] rock drag partition factor (roughness effect) + ! + ! !LOCAL VARIABLES: + !integer :: g, c, fc ! Indices + integer :: g, p, fp, l, c ! Indices + !real(r8) :: z0s ! smooth roughness length (m) + + ! constants + real(r8),parameter :: soil_erod_threshold = 0.1_r8 ! CAM soil erodibility threshold; below threshold -> soil_erod = 0_r8 11 Mar 2023 + !--------------------------------------------------------------------- + + SHR_ASSERT_ALL_FL((ubound(soil_erod) == (/bounds%endc/)), sourcefile, __LINE__) !what's the use of this + + !associate( & + !z => col%z & ! Input: [real(r8) (:,:) ] layer depth (m) (-nlevsno+1:nlevsoi) + !) + + + ! dmleung: this loop truncates soil erodibility values smaller than a threshold value (set as 0.1). We save the drag partition factor as a grid level quantity. + !do p = bounds%begp,bounds%endp + !g = patch%gridcell(p) + !l = patch%landunit(p) + do c = bounds%begc,bounds%endc + g = col%gridcell(c) + l = col%landunit(c) + if (lun%itype(l) /= istdlak) then ! not lake (can only be used during initialization) + + if (this%soil_erodibility(g) .lt. soil_erod_threshold ) then + soil_erod(c) = 0._r8 + else + soil_erod(c) = this%soil_erodibility(g) + end if + + end if + end do + + !end associate + + end subroutine CalcDustSource + + !============================================================================== + subroutine ReadNML(this, bounds, NLFilename) + ! + ! Read the namelist data stream information. + ! + ! Uses: + use shr_nl_mod , only : shr_nl_find_group_name + use shr_log_mod , only : errMsg => shr_log_errMsg + use shr_mpi_mod , only : shr_mpi_bcast + ! + ! arguments + implicit none + class(streamcontrol_type) :: this + type(bounds_type), intent(in) :: bounds + character(len=*), intent(in) :: NLFilename ! Namelist filename + ! + ! local variables + integer :: nu_nml ! unit for namelist file + integer :: nml_error ! namelist i/o error flag + character(len=CL) :: stream_fldFileName_zendersoilerod = ' ' + character(len=CL) :: stream_meshfile_zendersoilerod = ' ' + character(len=CL) :: zendersoilerodmapalgo = 'bilinear' + character(len=*), parameter :: namelist_name = 'zendersoilerod' ! MUST agree with group name in namelist definition to read. dmleung commented + character(len=*), parameter :: subName = "('zendersoilerod::ReadNML')" + !----------------------------------------------------------------------- + + namelist /zendersoilerod/ & ! MUST agree with namelist_name above + zendersoilerodmapalgo, stream_fldFileName_zendersoilerod, stream_meshfile_zendersoilerod + + ! Default values for namelist + + ! Read zenderdustsource namelist + if (masterproc) then + open( newunit=nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) + call shr_nl_find_group_name(nu_nml, namelist_name, status=nml_error) + if (nml_error == 0) then + read(nu_nml, nml=zendersoilerod, iostat=nml_error) ! MUST agree with namelist_name above + if (nml_error /= 0) then + call endrun(msg=' ERROR reading '//namelist_name//' namelist'//errMsg(sourcefile, __LINE__)) + end if + else + call endrun(msg=' ERROR finding '//namelist_name//' namelist'//errMsg(sourcefile, __LINE__)) + end if + close(nu_nml) + endif + + call shr_mpi_bcast(zendersoilerodmapalgo , mpicom) + call shr_mpi_bcast(stream_fldFileName_zendersoilerod , mpicom) + call shr_mpi_bcast(stream_meshfile_zendersoilerod , mpicom) + + if (masterproc) then + write(iulog,*) ' ' + write(iulog,*) namelist_name, ' stream settings:' + write(iulog,*) ' stream_fldFileName_zendersoilerod = ',stream_fldFileName_zendersoilerod + write(iulog,*) ' stream_meshfile_zendersoilerod = ',stream_meshfile_zendersoilerod + write(iulog,*) ' zendersoilerodmapalgo = ',zendersoilerodmapalgo + endif + this%stream_fldFileName_zendersoilerod = stream_fldFileName_zendersoilerod + this%stream_meshfile_zendersoilerod = stream_meshfile_zendersoilerod + this%zendersoilerodmapalgo = zendersoilerodmapalgo + + end subroutine ReadNML + +end module ZenderSoilErodStreamType diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 7924c2111e..795c780f40 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -340,7 +340,7 @@ subroutine clm_instInit(bounds) call surfrad_inst%Init(bounds) - call dust_inst%Init(bounds) + call dust_inst%Init(bounds, NLFilename) ! dmleung added NLFilename 11 Mar 2023 allocate(scf_method, source = CreateAndInitSnowCoverFraction( & snow_cover_fraction_method = snow_cover_fraction_method, & From 2c9974c6255080ab6a8930eb05c9461b8c039898 Mon Sep 17 00:00:00 2001 From: "Danny M. Leung" Date: Tue, 21 Mar 2023 15:44:10 -0600 Subject: [PATCH 02/77] first commit on adding a global tuning factor to tune global total dust emission (dmleung 20 Mar 2023) --- bld/CLMBuildNamelist.pm | 3 +- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- .../namelist_definition_ctsm.xml | 5 +++ src/biogeochem/DUSTMod.F90 | 41 ++++++++++++++++--- .../share_esmf/ZenderSoilErodStreamType.F90 | 4 +- 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index a5abc00671..3900265ac6 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -4245,7 +4245,8 @@ sub write_output_files { push @groups, "ch4finundated"; push @groups, "soilbgc_decomp"; push @groups, "clm_canopy_inparm"; - push @groups, "zendersoilerod"; # dmleung 11 Mar 2023 + push @groups, "zendersoilerod"; # dmleung added 11 Mar 2023 + push @groups, "dust_nl"; # dmleung added 11 Mar 2023 if (remove_leading_and_trailing_quotes($nl->get_value('snow_cover_fraction_method')) eq 'SwensonLawrence2012') { push @groups, "scf_swenson_lawrence_2012_inparm"; } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 4ee9d1f92e..9703ae99e7 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2545,7 +2545,7 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts /gpfs/fs1/work/dleung/Zender_dust_source/dst_source2x2tunedcam6-2x2-forCLM_c230311.nc +>/gpfs/fs1/work/dleung/Zender_dust_source/cdf5_dst_source2x2tunedcam6-2x2-forCLM_c230311.nc /gpfs/fs1/work/dleung/Zender_dust_source/lnd_mesh.nc diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index bd5fd05a48..dca70b1628 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1698,6 +1698,11 @@ Mapping method from Nitrogen deposition input file to the model resolution + +Tuning parameter for dust emissions. + + Filename of input stream data for Zender's soil erodibility source function diff --git a/src/biogeochem/DUSTMod.F90 b/src/biogeochem/DUSTMod.F90 index bae61fd430..c5fda3c23b 100644 --- a/src/biogeochem/DUSTMod.F90 +++ b/src/biogeochem/DUSTMod.F90 @@ -31,6 +31,7 @@ module DUSTMod use ColumnType , only : col use PatchType , only : patch use ZenderSoilErodStreamType, only : zendersoilerodstream_type ! dmleung added 11 Mar 2023 + use spmdMod , only : masterproc, mpicom, MPI_REAL8 ! dmleung added 11 Mar 2023 ! ! !PUBLIC TYPES implicit none @@ -48,6 +49,7 @@ module DUSTMod real(r8) , allocatable :: stk_crc(:) ![frc] Correction to Stokes settling velocity real(r8) tmp1 !Factor in saltation computation (named as in Charlie's code) real(r8) dns_aer ![kg m-3] Aerosol density + real(r8) dust_emis_fact ! dmleung added 11 Mar 2023 ! ! !PUBLIC DATA TYPES: ! @@ -119,7 +121,7 @@ subroutine InitAllocate(this, bounds) allocate(this%vlc_trb_2_patch (begp:endp)) ; this%vlc_trb_2_patch (:) = nan allocate(this%vlc_trb_3_patch (begp:endp)) ; this%vlc_trb_3_patch (:) = nan allocate(this%vlc_trb_4_patch (begp:endp)) ; this%vlc_trb_4_patch (:) = nan - allocate(this%mbl_bsn_fct_col (begc:endc)) ; this%mbl_bsn_fct_col (:) = nan + allocate(this%mbl_bsn_fct_col (begc:endc)) ; this%mbl_bsn_fct_col (:) = nan end subroutine InitAllocate @@ -168,10 +170,10 @@ subroutine InitHistory(this, bounds) ptr_patch=this%vlc_trb_4_patch, default='inactive') !#####added by dmleung 11 Mar 2023 ######################################## - this%mbl_bsn_fct_col(begc:endc) = spval - call hist_addfld1d (fname='LND_MBL', units='fraction', & - avgflag='A', long_name='Soil erodibility factor', & - ptr_col=this%mbl_bsn_fct_col) + !this%mbl_bsn_fct_col(begc:endc) = spval + !call hist_addfld1d (fname='LND_MBL', units='fraction', & + ! avgflag='A', long_name='Soil erodibility factor', & + ! ptr_col=this%mbl_bsn_fct_col) !########################################################################## end subroutine InitHistory @@ -185,8 +187,34 @@ subroutine InitCold(this, bounds) ! ! !LOCAL VARIABLES: integer :: c,l + integer ier ! error code, dmleung added 11 Mar 2023 !----------------------------------------------------------------------- + !#### dmleung added 11 Mar 2023 #################################### + ! read in global tuning factor from namelist + namelist /dust_nl/ dust_emis_fact + ! Default values for namelist + dust_emis_fact = 1 + ! Read soilm_streams namelist + !if (masterproc) then + ! open( newunit=nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) + ! call find_nlgroup_name(nu_nml, 'dust_nl', status=nml_error) + ! if (nml_error == 0) then + ! read(nu_nml, nml=dust_nl,iostat=nml_error) + ! if (nml_error /= 0) then + ! call endrun(subname // ':: ERROR reading dust_nl namelist') + ! end if + ! else + ! call endrun(subname // ':: ERROR finding dust_nl namelist') + ! end if + ! close(nu_nml) + !endif + !call shr_mpi_bcast(dust_emis_fact, mpicom) + call mpi_bcast (dust_emis_fact, 1, MPI_REAL8,0, mpicom, ier) + if (masterproc) then + write(iulog,*) ' dust_emis_fact = ',dust_emis_fact + end if + ! Set basin factor to 1 for now !if (dust_emission_scheme == 'Leung2023') @@ -456,7 +484,8 @@ subroutine DustEmission (bounds, & ! integrated streamwise mass flux dst_slt_flx_rat_ttl = 100.0_r8 * exp( log(10.0_r8) * (13.4_r8 * mss_frc_cly_vld(c) - 6.0_r8) ) - flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl + !flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl + flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl / dust_emis_fact ! dmleung added 11 Mar 2023 end if ! lnd_frc_mbl > 0.0 diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index ab7d71a24f..5b93a62f38 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -116,8 +116,8 @@ subroutine Init(this, bounds, NLFilename) stream_filenames = (/trim(control%stream_fldFileName_zendersoilerod)/), & stream_fldlistFile = stream_varnames, & stream_fldListModel = stream_varnames, & - stream_yearFirst = 1997, & - stream_yearLast = 1997, & + stream_yearFirst = 2003, & + stream_yearLast = 2003, & stream_yearAlign = 1, & stream_offset = 0, & stream_taxmode = 'extend', & From 4f5dcb95366950669f6ba265e28a095f5f5686af Mon Sep 17 00:00:00 2001 From: "Danny M. Leung" Date: Wed, 5 Apr 2023 13:02:29 -0600 Subject: [PATCH 03/77] After discussing with CAM people, I took away the lines relevant to the global tuning factor. We will keep the global tuning factor in CAM. dmleung 5 Apr 2023 --- bld/CLMBuildNamelist.pm | 2 +- .../namelist_definition_ctsm.xml | 8 +++---- src/biogeochem/DUSTMod.F90 | 22 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 3900265ac6..f8fff880fb 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -4246,7 +4246,7 @@ sub write_output_files { push @groups, "soilbgc_decomp"; push @groups, "clm_canopy_inparm"; push @groups, "zendersoilerod"; # dmleung added 11 Mar 2023 - push @groups, "dust_nl"; # dmleung added 11 Mar 2023 + #push @groups, "dust_nl"; # dmleung added 11 Mar 2023 if (remove_leading_and_trailing_quotes($nl->get_value('snow_cover_fraction_method')) eq 'SwensonLawrence2012') { push @groups, "scf_swenson_lawrence_2012_inparm"; } diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index dca70b1628..8a7b03fd19 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1698,10 +1698,10 @@ Mapping method from Nitrogen deposition input file to the model resolution - -Tuning parameter for dust emissions. - + + + + diff --git a/src/biogeochem/DUSTMod.F90 b/src/biogeochem/DUSTMod.F90 index c5fda3c23b..a730a0eba1 100644 --- a/src/biogeochem/DUSTMod.F90 +++ b/src/biogeochem/DUSTMod.F90 @@ -31,7 +31,7 @@ module DUSTMod use ColumnType , only : col use PatchType , only : patch use ZenderSoilErodStreamType, only : zendersoilerodstream_type ! dmleung added 11 Mar 2023 - use spmdMod , only : masterproc, mpicom, MPI_REAL8 ! dmleung added 11 Mar 2023 + !use spmdMod , only : masterproc, mpicom, MPI_REAL8 ! dmleung added 11 Mar 2023 ! ! !PUBLIC TYPES implicit none @@ -49,7 +49,7 @@ module DUSTMod real(r8) , allocatable :: stk_crc(:) ![frc] Correction to Stokes settling velocity real(r8) tmp1 !Factor in saltation computation (named as in Charlie's code) real(r8) dns_aer ![kg m-3] Aerosol density - real(r8) dust_emis_fact ! dmleung added 11 Mar 2023 + !real(r8) dust_emis_fact ! dmleung added 11 Mar 2023 ! ! !PUBLIC DATA TYPES: ! @@ -187,14 +187,14 @@ subroutine InitCold(this, bounds) ! ! !LOCAL VARIABLES: integer :: c,l - integer ier ! error code, dmleung added 11 Mar 2023 + !integer ier ! error code, dmleung added 11 Mar 2023 !----------------------------------------------------------------------- !#### dmleung added 11 Mar 2023 #################################### ! read in global tuning factor from namelist - namelist /dust_nl/ dust_emis_fact + !namelist /dust_nl/ dust_emis_fact ! Default values for namelist - dust_emis_fact = 1 + !dust_emis_fact = 1 ! Read soilm_streams namelist !if (masterproc) then ! open( newunit=nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) @@ -210,10 +210,10 @@ subroutine InitCold(this, bounds) ! close(nu_nml) !endif !call shr_mpi_bcast(dust_emis_fact, mpicom) - call mpi_bcast (dust_emis_fact, 1, MPI_REAL8,0, mpicom, ier) - if (masterproc) then - write(iulog,*) ' dust_emis_fact = ',dust_emis_fact - end if + !call mpi_bcast (dust_emis_fact, 1, MPI_REAL8,0, mpicom, ier) + !if (masterproc) then + ! write(iulog,*) ' dust_emis_fact = ',dust_emis_fact + !end if ! Set basin factor to 1 for now @@ -484,8 +484,8 @@ subroutine DustEmission (bounds, & ! integrated streamwise mass flux dst_slt_flx_rat_ttl = 100.0_r8 * exp( log(10.0_r8) * (13.4_r8 * mss_frc_cly_vld(c) - 6.0_r8) ) - !flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl - flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl / dust_emis_fact ! dmleung added 11 Mar 2023 + flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl + !flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl / dust_emis_fact ! dmleung added 11 Mar 2023 end if ! lnd_frc_mbl > 0.0 From f4dde3d623e517013ffcba549c3a65b3910614eb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 23 Jun 2023 13:18:55 -0600 Subject: [PATCH 04/77] Remove most of the comments that mention dmleung, changes will be stored in git --- bld/CLMBuildNamelist.pm | 9 ++++---- bld/namelist_files/namelist_defaults_ctsm.xml | 2 -- .../namelist_definition_ctsm.xml | 3 +-- src/biogeochem/DUSTMod.F90 | 22 +++++++------------ .../share_esmf/ZenderSoilErodStreamType.F90 | 8 ++----- src/main/clm_instMod.F90 | 2 +- 6 files changed, 17 insertions(+), 29 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index b99a86bbc2..b28dc54814 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1560,7 +1560,7 @@ sub process_namelist_inline_logic { setup_logic_snowpack($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_fates($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_misc($opts, $nl_flags, $definition, $defaults, $nl); - setup_logic_zender_soilerod($opts, $nl_flags, $definition, $defaults, $nl); # dmleung added 11 Mar 2023 + setup_logic_zender_soilerod($opts, $nl_flags, $definition, $defaults, $nl); ######################################### # namelist group: atm2lnd_inparm @@ -4247,7 +4247,9 @@ sub setup_logic_misc { #------------------------------------------------------------------------------- sub setup_logic_zender_soilerod { - # dmleung added on 31 Dec 2022 for reading Prigent's roughness stream file + # + # Handle the Zender soil eroditability file + # my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_zendersoilerod' ); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_meshfile_zendersoilerod' ); @@ -4303,8 +4305,7 @@ sub write_output_files { push @groups, "ch4finundated"; push @groups, "soilbgc_decomp"; push @groups, "clm_canopy_inparm"; - push @groups, "zendersoilerod"; # dmleung added 11 Mar 2023 - #push @groups, "dust_nl"; # dmleung added 11 Mar 2023 + push @groups, "zendersoilerod"; if (remove_leading_and_trailing_quotes($nl->get_value('snow_cover_fraction_method')) eq 'SwensonLawrence2012') { push @groups, "scf_swenson_lawrence_2012_inparm"; } diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 84cc77e53c..f4dc483d17 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2540,8 +2540,6 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts - - - - + diff --git a/src/biogeochem/DUSTMod.F90 b/src/biogeochem/DUSTMod.F90 index a730a0eba1..8ef0bbbd7c 100644 --- a/src/biogeochem/DUSTMod.F90 +++ b/src/biogeochem/DUSTMod.F90 @@ -30,8 +30,7 @@ module DUSTMod use LandunitType , only : lun use ColumnType , only : col use PatchType , only : patch - use ZenderSoilErodStreamType, only : zendersoilerodstream_type ! dmleung added 11 Mar 2023 - !use spmdMod , only : masterproc, mpicom, MPI_REAL8 ! dmleung added 11 Mar 2023 + use ZenderSoilErodStreamType, only : zendersoilerodstream_type ! ! !PUBLIC TYPES implicit none @@ -49,7 +48,6 @@ module DUSTMod real(r8) , allocatable :: stk_crc(:) ![frc] Correction to Stokes settling velocity real(r8) tmp1 !Factor in saltation computation (named as in Charlie's code) real(r8) dns_aer ![kg m-3] Aerosol density - !real(r8) dust_emis_fact ! dmleung added 11 Mar 2023 ! ! !PUBLIC DATA TYPES: ! @@ -62,8 +60,7 @@ module DUSTMod real(r8), pointer, private :: vlc_trb_2_patch (:) ! turbulent deposition velocity 2(m/s) real(r8), pointer, private :: vlc_trb_3_patch (:) ! turbulent deposition velocity 3(m/s) real(r8), pointer, private :: vlc_trb_4_patch (:) ! turbulent deposition velocity 4(m/s) - !########### added by dmleung 11 Mar 2023 ######################################################################## - type(zendersoilerodstream_type), private :: zendersoilerodstream ! Zender soil erodibility stream data + type(zendersoilerodstream_type), private :: zendersoilerodstream ! Zender soil erodibility stream data real(r8), pointer, private :: mbl_bsn_fct_col (:) ! [dimensionless] basin factor, or soil erodibility, time-constant contains @@ -84,16 +81,15 @@ module DUSTMod !------------------------------------------------------------------------ !subroutine Init(this, bounds) - !##### dmleung edited for initializing stream files 11 Mar 2023 ######## subroutine Init(this, bounds, NLFilename) class(dust_type) :: this type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename ! dmleung added 11 Mar 2023 + character(len=*), intent(in) :: NLFilename call this%InitAllocate (bounds) call this%InitHistory (bounds) - call this%zendersoilerodstream%Init( bounds, NLFilename ) ! dmleung added 11 Mar 2023 + call this%zendersoilerodstream%Init( bounds, NLFilename ) call this%InitCold (bounds) call this%InitDustVars (bounds) @@ -138,7 +134,7 @@ subroutine InitHistory(this, bounds) ! ! !LOCAL VARIABLES: integer :: begp,endp - integer :: begc,endc ! dmleung added 11 Mar 2023 + integer :: begc,endc !------------------------------------------------------------------------ begp = bounds%begp; endp = bounds%endp @@ -169,12 +165,10 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='turbulent deposition velocity 4', & ptr_patch=this%vlc_trb_4_patch, default='inactive') - !#####added by dmleung 11 Mar 2023 ######################################## !this%mbl_bsn_fct_col(begc:endc) = spval !call hist_addfld1d (fname='LND_MBL', units='fraction', & ! avgflag='A', long_name='Soil erodibility factor', & ! ptr_col=this%mbl_bsn_fct_col) - !########################################################################## end subroutine InitHistory @@ -187,7 +181,7 @@ subroutine InitCold(this, bounds) ! ! !LOCAL VARIABLES: integer :: c,l - !integer ier ! error code, dmleung added 11 Mar 2023 + !integer ier !----------------------------------------------------------------------- !#### dmleung added 11 Mar 2023 #################################### @@ -311,7 +305,7 @@ subroutine DustEmission (bounds, & fv => frictionvel_inst%fv_patch , & ! Input: [real(r8) (:) ] friction velocity (m/s) (for dust model) u10 => frictionvel_inst%u10_patch , & ! Input: [real(r8) (:) ] 10-m wind (m/s) (created for dust model) - mbl_bsn_fct => dust_inst%mbl_bsn_fct_col , & ! Input: [real(r8) (:) ] basin factor ; dmleung changed the value in InitCold 11 Mar 2023 + mbl_bsn_fct => dust_inst%mbl_bsn_fct_col , & ! Input: [real(r8) (:) ] basin factor flx_mss_vrt_dst => dust_inst%flx_mss_vrt_dst_patch , & ! Output: [real(r8) (:,:) ] surface dust emission (kg/m**2/s) flx_mss_vrt_dst_tot => dust_inst%flx_mss_vrt_dst_tot_patch & ! Output: [real(r8) (:) ] total dust flux back to atmosphere (pft) ) @@ -485,7 +479,7 @@ subroutine DustEmission (bounds, & dst_slt_flx_rat_ttl = 100.0_r8 * exp( log(10.0_r8) * (13.4_r8 * mss_frc_cly_vld(c) - 6.0_r8) ) flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl - !flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl / dust_emis_fact ! dmleung added 11 Mar 2023 + !flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl / dust_emis_fact end if ! lnd_frc_mbl > 0.0 diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index 5b93a62f38..dfa6705275 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -1,5 +1,4 @@ module ZenderSoilErodStreamType -!dmleung modified based on PrigetnRoughnessStreamType.F90 on 11 Mar 2023 #include "shr_assert.h" ! What is this? In many modules but not dust module !----------------------------------------------------------------------- @@ -232,7 +231,7 @@ subroutine CalcDustSource(this, bounds, soil_erod) ! !USES: use ColumnType , only : col !use PatchType , only : patch - !USES dmleung added 31 Dec 2022 + !USES use landunit_varcon , only : istdlak use LandunitType , only : lun ! @@ -259,9 +258,6 @@ subroutine CalcDustSource(this, bounds, soil_erod) ! dmleung: this loop truncates soil erodibility values smaller than a threshold value (set as 0.1). We save the drag partition factor as a grid level quantity. - !do p = bounds%begp,bounds%endp - !g = patch%gridcell(p) - !l = patch%landunit(p) do c = bounds%begc,bounds%endc g = col%gridcell(c) l = col%landunit(c) @@ -302,7 +298,7 @@ subroutine ReadNML(this, bounds, NLFilename) character(len=CL) :: stream_fldFileName_zendersoilerod = ' ' character(len=CL) :: stream_meshfile_zendersoilerod = ' ' character(len=CL) :: zendersoilerodmapalgo = 'bilinear' - character(len=*), parameter :: namelist_name = 'zendersoilerod' ! MUST agree with group name in namelist definition to read. dmleung commented + character(len=*), parameter :: namelist_name = 'zendersoilerod' ! MUST agree with group name in namelist definition to read. character(len=*), parameter :: subName = "('zendersoilerod::ReadNML')" !----------------------------------------------------------------------- diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 795c780f40..099959581f 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -340,7 +340,7 @@ subroutine clm_instInit(bounds) call surfrad_inst%Init(bounds) - call dust_inst%Init(bounds, NLFilename) ! dmleung added NLFilename 11 Mar 2023 + call dust_inst%Init(bounds, NLFilename) allocate(scf_method, source = CreateAndInitSnowCoverFraction( & snow_cover_fraction_method = snow_cover_fraction_method, & From 2a2caf14962f202009ec1e83bbe2255d78de1e97 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 30 Jul 2023 19:26:12 -0600 Subject: [PATCH 05/77] Move files into inputdata, and nccopy mesh file from NetCDF4 to CDF5 --- bld/namelist_files/namelist_defaults_ctsm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index f4dc483d17..848a5e510c 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2543,9 +2543,9 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts /gpfs/fs1/work/dleung/Zender_dust_source/cdf5_dst_source2x2tunedcam6-2x2-forCLM_c230311.nc +>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc /gpfs/fs1/work/dleung/Zender_dust_source/lnd_mesh.nc +>lnd/clm2/dustemisdata/dust_2x2_ESMFmesh_cdf5_c230730.nc From 35b1f4ad139aeefecd9bba9c69a31199a2181a6a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 30 Jul 2023 19:34:46 -0600 Subject: [PATCH 06/77] Change ESMF Finalize to endrun, add more clarity on what's happening on exit --- src/cpl/share_esmf/ZenderSoilErodStreamType.F90 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index dfa6705275..032469acfc 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -95,11 +95,12 @@ subroutine Init(this, bounds, NLFilename) if ( this%useStreams() )then ! is this a namelist input and is it set in namelist default - allocate(stream_varnames(1)) - stream_varnames = (/"mbl_bsn_fct_geo"/) ! varname in the dust source file; the variable is dimensionless + allocate(stream_varnames(1)) + stream_varnames = (/"mbl_bsn_fct_geo"/) ! varname in the dust source file; the variable is dimensionless if (masterproc) then write(iulog,*) ' stream_varnames = ',stream_varnames + flush(iulog) end if ! Initialize the cdeps data type sdat_erod @@ -125,7 +126,8 @@ subroutine Init(this, bounds, NLFilename) stream_name = 'Zender soil erodibility', & rc = rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call ESMF_Finalize(endflag=ESMF_END_ABORT) + write(iulog,*) 'Error on stream initialize -- see PET*.ESMF_LogFile(s)' + call endrun("ESMF log error") end if ! Explicitly set current date to a hardcoded constant value. Otherwise @@ -140,14 +142,16 @@ subroutine Init(this, bounds, NLFilename) call shr_strdata_advance(sdat_erod, ymd=mcdate, tod=sec, logunit=iulog, istr='zendersoilerod', rc=rc) ! what is istr and do I need to change elsewhere because the change of istr here if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call ESMF_Finalize(endflag=ESMF_END_ABORT) + write(iulog,*) 'Error on stream advance -- see PET*.ESMF_LogFile(s)' + call endrun("ESMF log error") end if ! Get pointer for stream data that is time and spatially interpolate to model time and grid do n = 1,size(stream_varnames) call dshr_fldbun_getFldPtr(sdat_erod%pstrm(1)%fldbun_model, stream_varnames(n), fldptr1=dataptr1d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then - call ESMF_Finalize(endflag=ESMF_END_ABORT) + write(iulog,*) 'Error on get field pointer -- see PET*.ESMF_LogFile(s)' + call endrun("ESMF log error") end if if (trim(stream_varnames(n)) == 'mbl_bsn_fct_geo') then ig = 0 From a27f6f519ebb8dc83e7aa25227f8ce0057a79634 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 18 Aug 2023 11:09:19 -0600 Subject: [PATCH 07/77] Some updates from the review, this compiles, but fails to run when it gets to the soil eroditability file --- .../share_esmf/ZenderSoilErodStreamType.F90 | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index 032469acfc..8993722115 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -1,5 +1,5 @@ module ZenderSoilErodStreamType -#include "shr_assert.h" ! What is this? In many modules but not dust module +#include "shr_assert.h" !----------------------------------------------------------------------- ! !DESCRIPTION: @@ -172,7 +172,8 @@ end subroutine Init logical function UseStreams(this) ! ! !DESCRIPTION: - ! Return true if + ! Return true if the Zender method is being used and the soil erodability + ! file is being used with it ! ! !USES: ! @@ -216,21 +217,10 @@ subroutine InitAllocate(this, bounds) end subroutine InitAllocate !============================================================================== - !subroutine CalcFinundated(this, bounds, num_soilc, filter_soilc, soilhydrology_inst, & - ! waterdiagnosticbulk_inst, qflx_surf_lag_col, finundated ) - !subroutine CalcDragPartition(this, bounds, num_nolakep, filter_nolakep, dpfct_rock) subroutine CalcDustSource(this, bounds, soil_erod) ! ! !DESCRIPTION: - ! Commented below by dmleung 31 Dec 2022 - ! Calculate the drag partition effect of friction velocity due to surface roughness following - ! Leung et al. (2022). This module is used in the dust emission module DUSTMod.F90 for - ! calculating drag partitioning. The drag partition equation comes from Marticorena and - ! Bergametti (1995) with constants modified by Darmenova et al. (2009). Here it is assumed - ! that this equation is used only over arid/desertic regions, such that Catherine Prigent's - ! roughness measurements represents mostly rocks. For more vegetated areas, the vegetation - ! roughness and drag partitioning are calculated in the DustEmission subroutine. This - ! subroutine is used in the InitCold subroutine of DUSTMod.F90. + ! Calculate the soil eroditability for the Zender dust method. ! ! !USES: use ColumnType , only : col @@ -254,7 +244,7 @@ subroutine CalcDustSource(this, bounds, soil_erod) real(r8),parameter :: soil_erod_threshold = 0.1_r8 ! CAM soil erodibility threshold; below threshold -> soil_erod = 0_r8 11 Mar 2023 !--------------------------------------------------------------------- - SHR_ASSERT_ALL_FL((ubound(soil_erod) == (/bounds%endc/)), sourcefile, __LINE__) !what's the use of this + SHR_ASSERT_ALL_FL((ubound(soil_erod) == (/bounds%endc/)), sourcefile, __LINE__) !associate( & !z => col%z & ! Input: [real(r8) (:,:) ] layer depth (m) (-nlevsno+1:nlevsoi) @@ -283,7 +273,8 @@ end subroutine CalcDustSource !============================================================================== subroutine ReadNML(this, bounds, NLFilename) ! - ! Read the namelist data stream information. + ! Read the namelist data stream information for the Zender method soil + ! eroditability file ! ! Uses: use shr_nl_mod , only : shr_nl_find_group_name From cb81fdb1ee40de0de9f538974d2a3042ca369940 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 18 Aug 2023 17:53:41 -0600 Subject: [PATCH 08/77] Remove dust_emis_fact as that will stay inside of CAM --- .../namelist_definition_ctsm.xml | 5 --- src/biogeochem/DUSTMod.F90 | 37 +++---------------- 2 files changed, 6 insertions(+), 36 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 7e2edd7f80..633d5b6437 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1697,11 +1697,6 @@ Mapping method from Nitrogen deposition input file to the model resolution - - - - - Filename of input stream data for Zender's soil erodibility source function diff --git a/src/biogeochem/DUSTMod.F90 b/src/biogeochem/DUSTMod.F90 index 8ef0bbbd7c..485086203b 100644 --- a/src/biogeochem/DUSTMod.F90 +++ b/src/biogeochem/DUSTMod.F90 @@ -165,10 +165,12 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='turbulent deposition velocity 4', & ptr_patch=this%vlc_trb_4_patch, default='inactive') - !this%mbl_bsn_fct_col(begc:endc) = spval - !call hist_addfld1d (fname='LND_MBL', units='fraction', & - ! avgflag='A', long_name='Soil erodibility factor', & - ! ptr_col=this%mbl_bsn_fct_col) + ! if Zender + this%mbl_bsn_fct_col(begc:endc) = spval + call hist_addfld1d (fname='LND_MBL', units='fraction', & + avgflag='A', long_name='Soil erodibility factor', & + ptr_col=this%mbl_bsn_fct_col, default='inactive') + ! end if end subroutine InitHistory @@ -181,34 +183,8 @@ subroutine InitCold(this, bounds) ! ! !LOCAL VARIABLES: integer :: c,l - !integer ier !----------------------------------------------------------------------- - !#### dmleung added 11 Mar 2023 #################################### - ! read in global tuning factor from namelist - !namelist /dust_nl/ dust_emis_fact - ! Default values for namelist - !dust_emis_fact = 1 - ! Read soilm_streams namelist - !if (masterproc) then - ! open( newunit=nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - ! call find_nlgroup_name(nu_nml, 'dust_nl', status=nml_error) - ! if (nml_error == 0) then - ! read(nu_nml, nml=dust_nl,iostat=nml_error) - ! if (nml_error /= 0) then - ! call endrun(subname // ':: ERROR reading dust_nl namelist') - ! end if - ! else - ! call endrun(subname // ':: ERROR finding dust_nl namelist') - ! end if - ! close(nu_nml) - !endif - !call shr_mpi_bcast(dust_emis_fact, mpicom) - !call mpi_bcast (dust_emis_fact, 1, MPI_REAL8,0, mpicom, ier) - !if (masterproc) then - ! write(iulog,*) ' dust_emis_fact = ',dust_emis_fact - !end if - ! Set basin factor to 1 for now !if (dust_emission_scheme == 'Leung2023') @@ -479,7 +455,6 @@ subroutine DustEmission (bounds, & dst_slt_flx_rat_ttl = 100.0_r8 * exp( log(10.0_r8) * (13.4_r8 * mss_frc_cly_vld(c) - 6.0_r8) ) flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl - !flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl / dust_emis_fact end if ! lnd_frc_mbl > 0.0 From 019282a63a41616ae1a43819ab89c1fb4e8e46c0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 21 Aug 2023 01:03:31 -0600 Subject: [PATCH 09/77] Add lnd_tuning modes for CAM4.0 and CAM5.0 for all CLM physics options and add tests for it that currently fail --- bld/namelist_files/namelist_definition_ctsm.xml | 2 +- bld/unit_testers/build-namelist_test.pl | 8 ++++---- cime_config/config_component.xml | 16 +++++++++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 633d5b6437..69d9a5c278 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -2057,7 +2057,7 @@ Land mask description + valid_values="clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,clm4_5_cam5.0,clm4_5_cam4.0,clm5_0_cam6.0,clm5_0_cam5.0,clm5.0_cam4.0,clm5_0_CRUv7,clm5_0_GSWP3v1,clm5_1_GSWP3v1,clm5_1_cam6.0,clm5_1_cam5.0,clm5_1_cam4.0"> General configuration of model version and atmospheric forcing to tune the model to run under. This sets the model to run with constants and initial conditions that were set to run well under the configuration of model version and atmospheric forcing. To run well constants would need to be changed diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 79add93d88..524a23a402 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -163,9 +163,9 @@ sub cat_and_create_namelistinfile { # # Figure out number of tests that will run # -my $ntests = 1850; +my $ntests = 1922; if ( defined($opts{'compare'}) ) { - $ntests += 1254; + $ntests += 1308; } plan( tests=>$ntests ); @@ -1631,9 +1631,9 @@ sub cat_and_create_namelistinfile { &make_config_cache($phys); my @forclist = (); if ( $phys == "clm5_1" ) { - @forclist = ( "GSWP3v1" ); + @forclist = ( "GSWP3v1", "cam6.0", "cam5.0", "cam4.0" ); } else { - @forclist = ( "CRUv7", "GSWP3v1", "cam6.0" ); + @forclist = ( "CRUv7", "GSWP3v1", "cam6.0", "cam5.0", "cam4.0" ); } foreach my $forc ( @forclist ) { foreach my $bgc ( "sp", "bgc" ) { diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 555a0ce9b5..66ccc400f9 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -63,18 +63,28 @@ Tuning parameters and initial conditions should be optimized for what CLM model version and what meteorlogical forcing combination? UNSET - clm5_0_cam6.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,clm5_1_GSWP3v1 + clm5_0_cam6.0,clm5.0_cam5.0,clm5.0_cam4.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,clm4_5_cam5.0,clm4_5_cam4.0,clm5_1_GSWP3v1,clm5_1_cam6.0,clm5_1_cam5.0,clm5_1_cam4.0 clm4_5_CRUv7 clm4_5_CRUv7 clm4_5_GSWP3v1 - clm4_5_cam6.0 + clm4_5_cam4.0 + clm4_5_cam5.0 + clm4_5_cam6.0 + clm4_5_cam6.0 clm4_5_cam6.0 clm5_0_CRUv7 clm5_0_CRUv7 clm5_0_GSWP3v1 - clm5_0_cam6.0 + clm5_0_cam4.0 + clm5_0_cam5.0 + clm5_0_cam6.0 + clm5_0_cam6.0 clm5_0_cam6.0 + clm5_1_cam4.0 + clm5_1_cam5.0 + clm5_1_cam6.0 + clm5_1_cam6.0 clm5_1_GSWP3v1 From 70289af6ee39edd203cefe7d21dcd03d8662374c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 9 Sep 2023 02:03:14 -0600 Subject: [PATCH 10/77] Get cam4,cam5 options working with coldstarts, add more tests, make sure lnd_tuning_mode has all of the clm physics options paired with all of the forcing types, build-namelist tests now pass --- bld/CLMBuildNamelist.pm | 21 +++-- bld/namelist_files/namelist_defaults_ctsm.xml | 76 ++++++++++++++++++- .../namelist_defaults_overall.xml | 6 ++ .../namelist_definition_ctsm.xml | 2 +- 4 files changed, 89 insertions(+), 16 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index b28dc54814..f39052d796 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -648,9 +648,9 @@ sub process_namelist_commandline_options { setup_cmdl_dynamic_vegetation($opts, $nl_flags, $definition, $defaults, $nl); setup_cmdl_fates_mode($opts, $nl_flags, $definition, $defaults, $nl); setup_cmdl_vichydro($opts, $nl_flags, $definition, $defaults, $nl); + setup_logic_lnd_tuning($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_cmdl_run_type($opts, $nl_flags, $definition, $defaults, $nl); setup_cmdl_output_reals($opts, $nl_flags, $definition, $defaults, $nl); - setup_logic_lnd_tuning($opts, $nl_flags, $definition, $defaults, $nl, $physv); } #------------------------------------------------------------------------------- @@ -1243,20 +1243,19 @@ sub setup_cmdl_run_type { my $group = $definition->get_group_name($date); $nl->set_variable_value($group, $date, $ic_date ); } + my $set = undef; if (defined $opts->{$var}) { - if ($opts->{$var} eq "default" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'}, - 'sim_year'=>$st_year, 'sim_year_range'=>$nl_flags->{'sim_year_range'}, - 'bgc_spinup'=>$nl_flags->{'bgc_spinup'} ); - } else { + if ($opts->{$var} ne "default" ) { + $set = 1; my $group = $definition->get_group_name($var); $nl->set_variable_value($group, $var, quote_string( $opts->{$var} ) ); } - } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'}, - 'sim_year'=>$st_year ); + } + if ( ! defined $set ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, + 'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'}, + 'sim_year'=>$st_year, 'sim_year_range'=>$nl_flags->{'sim_year_range'}, + 'bgc_spinup'=>$nl_flags->{'bgc_spinup'}, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'} ); } $nl_flags->{'clm_start_type'} = $nl->get_value($var); $nl_flags->{'st_year'} = $st_year; diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 848a5e510c..4be4a9a102 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -278,6 +278,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >30.0d00 20.0d00 +20.0d00 +20.0d00 80.0d00 0.85d00 0.98d00 @@ -289,6 +293,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >0.010d00 0.008d00 +0.008d00 +0.008d00 0.17d-3 1.6d-4 0.33d00 @@ -628,7 +636,15 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -.true. +.true. +.true. +.true. +.true. +.true. +.true. +.true. +.true. +.true. .true. -.true. -.true. +.true. +.true. +.true. +.true. +.true. +.true. .true. .true. .true. + +.false. +.false. +.false. +.false. +.false. +.false. .false. + hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.false. glc_nec=10 do_transient_pfts=.false. @@ -710,6 +737,14 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.false. glc_nec=10 do_transient_pfts=.false. +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.false. glc_nec=10 do_transient_pfts=.false. + + +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.false. glc_nec=10 do_transient_pfts=.false. + + hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false. @@ -726,10 +761,19 @@ attributes from the config_cache.xml file (with keys converted to upper-case). hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false. + hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false. +hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false. + + +hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false. + + hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false. @@ -913,6 +957,18 @@ p lnd_tuning_mode="clm5_1_GSWP3v1" >lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c200428.nc +lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c200428.nc + +lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c200428.nc + diff --git a/bld/namelist_files/namelist_defaults_overall.xml b/bld/namelist_files/namelist_defaults_overall.xml index c4ccac6467..fe5abee44b 100644 --- a/bld/namelist_files/namelist_defaults_overall.xml +++ b/bld/namelist_files/namelist_defaults_overall.xml @@ -22,6 +22,12 @@ determine default values for namelists. --> +cold +cold +cold +cold +cold +cold arb_ic arb_ic arb_ic diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 69d9a5c278..e2dc7c804c 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -2057,7 +2057,7 @@ Land mask description + valid_values="clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,clm4_5_cam5.0,clm4_5_cam4.0,clm5_0_cam6.0,clm5_0_cam5.0,clm5_0_cam4.0,clm5_0_CRUv7,clm5_0_GSWP3v1,clm5_1_GSWP3v1,clm5_1_CRUv7,clm5_1_cam6.0,clm5_1_cam5.0,clm5_1_cam4.0"> General configuration of model version and atmospheric forcing to tune the model to run under. This sets the model to run with constants and initial conditions that were set to run well under the configuration of model version and atmospheric forcing. To run well constants would need to be changed From a931e74d72b2a777440bbdb59edd53ed8b9c2e73 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 9 Sep 2023 11:39:17 -0600 Subject: [PATCH 11/77] Add a comment about the ordering to the run_type subroutine --- bld/CLMBuildNamelist.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index f39052d796..0420593b10 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1229,6 +1229,8 @@ sub setup_cmdl_simulation_year { sub setup_cmdl_run_type { my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; + # Set the clm_start_type and the st_year, start year + # This MUST be done after lnd_tuning_mode is set my $val; my $var = "clm_start_type"; From 08d3c86f33c3b15b0ba4b3a5bd4423240e61a774 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 29 Jan 2024 12:00:40 -0700 Subject: [PATCH 12/77] Add two new namelist options to control the dust emission method and for the Zender scheme how the soil eroditability file is handled --- bld/namelist_files/namelist_definition_ctsm.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index fef39bd8b1..2daf278ade 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1788,6 +1788,18 @@ Mapping method from Nitrogen deposition input file to the model resolution + +Which dust emission method is going to be used. Either the Zender 2003 scheme or the Leung 2023 +scheme. + + + +Option only applying for the Zender_2003 method for whether the soil erodibility file is handled +here in CTSM, or in the ATM model. When dust_emis_method is NOT Zender_2003 it HAS to be none. + + Filename of input stream data for Zender's soil erodibility source function From 3553befe18f782ec2377f517864e1518d06ad39a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 29 Jan 2024 18:22:53 -0700 Subject: [PATCH 13/77] Add dust_emission namelist control items to build-namelist and add tests for them --- bld/CLMBuildNamelist.pm | 66 +++++++++++++++---- bld/namelist_files/namelist_defaults_ctsm.xml | 6 +- .../namelist_definition_ctsm.xml | 12 ++-- bld/unit_testers/build-namelist_test.pl | 24 ++++++- 4 files changed, 87 insertions(+), 21 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index ac065e6594..0803428f09 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1599,7 +1599,6 @@ sub process_namelist_inline_logic { setup_logic_fates($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_z0param($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_misc($opts, $nl_flags, $definition, $defaults, $nl); - setup_logic_zender_soilerod($opts, $nl_flags, $definition, $defaults, $nl); ######################################### # namelist group: atm2lnd_inparm @@ -1697,6 +1696,11 @@ sub process_namelist_inline_logic { ################################# setup_logic_fire_emis($opts, $nl_flags, $definition, $defaults, $nl); + ###################################### + # namelist options for dust emissions + ###################################### + setup_logic_dust_emis($opts, $nl_flags, $definition, $defaults, $nl); + ################################# # namelist group: megan_emis_nl # ################################# @@ -3936,6 +3940,55 @@ sub setup_logic_fire_emis { #------------------------------------------------------------------------------- +sub setup_logic_dust_emis { + # Logic to handle the dust emissions + my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; + + # First get the dust emission method + my $var = "dust_emis_method"; + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var ); + + my $dust_emis_method = remove_leading_and_trailing_quotes( $nl->get_value($var) ); + + my @zender_files_in_lnd_opts = ( "stream_fldfilename_zendersoilerod", "stream_meshfile_zendersoilerod" ); + if ( $dust_emis_method eq "Zender_2003" ) { + # get the zender_soil_erod_source + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, + "zender_soil_erod_source", 'dust_emis_method'=>$dust_emis_method ); + + my $zender_source = remove_leading_and_trailing_quotes( $nl->get_value('zender_soil_erod_source') ); + if ( $zender_source eq "lnd" ) { + foreach my $option ( @zender_files_in_lnd_opts ) { + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $option, + 'dust_emis_method'=>$dust_emis_method, 'zender_soil_erod_source'=>$zender_source, + 'lnd_tuning_mod'=>$nl_flags->{'lnd_tuning_mode'} ); + } + } else { + foreach my $option ( @zender_files_in_lnd_opts ) { + if ( defined($nl->get_value($option)) ) { + $log->fatal_error("zender_soil_erod_source is NOT lnd, but the file option $option is being set" . + " and should NOT be unless you want it handled here in the LAND model, " . + "otherwise the equivalent option is set in CAM" ); + } + } + } + } else { + # Verify that NONE of the Zender options are being set if Zender is NOT being used + push @zender_files_in_lnd_opts, "zender_soil_erod_source"; + foreach my $option ( @zender_files_in_lnd_opts ) { + if ( defined($nl->get_value($option)) ) { + $log->fatal_error("dust_emis_method is NOT set to Zender_2003, but one of it's options " . + "$option is being set, need to change one or the other" ); + } + } + if ( $dust_emis_method eq "Leung_2023" ) { + $log->warning("dust_emis_method is Leung_2023 and that option has NOT been brought into CTSM yet"); + } + } +} + +#------------------------------------------------------------------------------- + sub setup_logic_megan { my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; @@ -4570,17 +4623,6 @@ sub setup_logic_misc { #------------------------------------------------------------------------------- -sub setup_logic_zender_soilerod { - # - # Handle the Zender soil eroditability file - # - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_zendersoilerod' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_meshfile_zendersoilerod' ); -} - -#------------------------------------------------------------------------------- - sub write_output_files { my ($opts, $nl_flags, $defaults, $nl) = @_; diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 7ffac74625..f3c108a68c 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2813,9 +2813,11 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1 -Zender_2003 +atm +lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc -lnd/clm2/dustemisdata/dust_2x2_ESMFmesh_cdf5_c230730.nc diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 2daf278ade..3f382fabe5 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1789,25 +1789,29 @@ Mapping method from Nitrogen deposition input file to the model resolution + group="clm_inparm" valid_values="Zender_2003,Leung_2023" > Which dust emission method is going to be used. Either the Zender 2003 scheme or the Leung 2023 scheme. +(NOTE: The Leung 2023 method is NOT currently available) - + Option only applying for the Zender_2003 method for whether the soil erodibility file is handled -here in CTSM, or in the ATM model. When dust_emis_method is NOT Zender_2003 it HAS to be none. +here in CTSM, or in the ATM model. +(only used when dust_emis_method is Zender_2003) Filename of input stream data for Zender's soil erodibility source function +(only used when dust_emis_method is Zender_2003, and zender_soil_erod_source is lnd) mesh filename of input stream data for Zender's soil erodibility source function +(only used when dust_emis_method is Zender_2003, and zender_soil_erod_source is lnd) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 7d813e37cb..3f05bac893 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -163,10 +163,10 @@ sub cat_and_create_namelistinfile { # # Figure out number of tests that will run # -my $ntests = 2071; +my $ntests = 2080; if ( defined($opts{'compare'}) ) { - $ntests += 1407; + $ntests += 1410; } plan( tests=>$ntests ); @@ -470,6 +470,7 @@ sub cat_and_create_namelistinfile { "-bgc fates -use_case 1850_control -no-megan -namelist \"&a use_fates_sp=T, soil_decomp_method='None'/\"", "-bgc sp -use_case 2000_control -res 0.9x1.25 -namelist '&a use_soil_moisture_streams = T/'", "-bgc bgc -use_case 1850-2100_SSP5-8.5_transient -namelist '&a start_ymd=19101023/'", + "-namelist \"&a dust_emis_method='Zender_2003', zender_soil_erod_source='lnd' /'\"", "-bgc bgc -use_case 2000_control -namelist \"&a fire_method='nofire'/\" -crop", "-res 0.9x1.25 -bgc sp -use_case 1850_noanthro_control -drydep -fire_emis", "-res 0.9x1.25 -bgc bgc -use_case 1850_noanthro_control -drydep -fire_emis -light_res 360x720", @@ -1222,7 +1223,7 @@ sub cat_and_create_namelistinfile { phys=>"clm5_0", }, "NOlunabutsetJmaxb1" =>{ options=>"-envxml_dir . -bgc sp", - namelst=>"use_luna=.false., jmaxb1=1.0", + namelst=>"use_luna=.fwlse., jmaxb1=1.0", GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, @@ -1256,6 +1257,18 @@ sub cat_and_create_namelistinfile { GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_0", }, + "soil_erod_wo_Zender" =>{ options=>"--envxml_dir . --ignore_warnings", + namelst=>"dust_emis_msethod='Leung_2023', " . + "stream_meshfile_zendersoilerod = '/dev/null'", + GLC_TWO_WAY_COUPLING=>"FALSE", + phys=>"clm5_1", + }, + "soil_erod_wo_lnd_source" =>{ options=>"--envxml_dir .", + namelst=>"dust_emis_msethod='Zender_2003', " . + "stream_fldfilename_zendersoilerod = '/dev/null', zender_soil_erod_source='atm'", + GLC_TWO_WAY_COUPLING=>"FALSE", + phys=>"clm5_1", + }, ); foreach my $key ( keys(%failtest) ) { print( "$key\n" ); @@ -1277,6 +1290,11 @@ sub cat_and_create_namelistinfile { my %warntest = ( # Warnings without the -ignore_warnings option given + "dustemisLeung" =>{ options=>"-envxml_dir .", + namelst=>"dust_emis_method = 'Leung_2023'", + GLC_TWO_WAY_COUPLING=>"FALSE", + phys=>"clm5_1", + }, "coldwfinidat" =>{ options=>"-envxml_dir . -clm_start_type cold", namelst=>"finidat = 'testfile.nc'", GLC_TWO_WAY_COUPLING=>"FALSE", From 8a9f51356ad2bfa295ec2b7f9b3de8f7d3f313f5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 29 Jan 2024 20:22:44 -0700 Subject: [PATCH 14/77] Fix bug in tests after running with the error check turned off --- bld/unit_testers/build-namelist_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 3f05bac893..cb2456ee32 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -1258,13 +1258,13 @@ sub cat_and_create_namelistinfile { phys=>"clm5_0", }, "soil_erod_wo_Zender" =>{ options=>"--envxml_dir . --ignore_warnings", - namelst=>"dust_emis_msethod='Leung_2023', " . + namelst=>"dust_emis_method='Leung_2023', " . "stream_meshfile_zendersoilerod = '/dev/null'", GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_1", }, "soil_erod_wo_lnd_source" =>{ options=>"--envxml_dir .", - namelst=>"dust_emis_msethod='Zender_2003', " . + namelst=>"dust_emis_method='Zender_2003', " . "stream_fldfilename_zendersoilerod = '/dev/null', zender_soil_erod_source='atm'", GLC_TWO_WAY_COUPLING=>"FALSE", phys=>"clm5_1", From dd61c141ee267b293b532724f7f9daa6f966816a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 30 Jan 2024 21:37:29 -0700 Subject: [PATCH 15/77] Add zendersoilerodmapalgo into the build-namelist --- bld/CLMBuildNamelist.pm | 3 ++- bld/namelist_files/namelist_defaults_ctsm.xml | 1 + bld/namelist_files/namelist_definition_ctsm.xml | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 0803428f09..ba2885e5de 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3950,7 +3950,8 @@ sub setup_logic_dust_emis { my $dust_emis_method = remove_leading_and_trailing_quotes( $nl->get_value($var) ); - my @zender_files_in_lnd_opts = ( "stream_fldfilename_zendersoilerod", "stream_meshfile_zendersoilerod" ); + my @zender_files_in_lnd_opts = ( "stream_fldfilename_zendersoilerod", "stream_meshfile_zendersoilerod", + "zendersoilerodmapalgo" ); if ( $dust_emis_method eq "Zender_2003" ) { # get the zender_soil_erod_source add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index f3c108a68c..d1e77db965 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2815,6 +2815,7 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1 Zender_2003 atm +bilinear lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc + +Option only applying for the Zender_2003 method for whether the soil erodibility file is handled +here in CTSM, or in the ATM model. +(only used when dust_emis_method is Zender_2003) + bilinear = bilinear interpolation + nn = nearest neighbor + nnoni = nearest neighbor on the "i" (longitude) axis + nnonj = nearest neighbor on the "j" (latitude) axis + spval = set to special value + copy = copy using the same indices + + Filename of input stream data for Zender's soil erodibility source function From 0d19e854d852ba7c50f20519db3842978c8cd35d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Jan 2024 16:56:03 -0700 Subject: [PATCH 16/77] Add new test mods that include using Zender_2003 dust and lnd_tuning_modes for CAM4 and CAM5 --- .../clm/clm45cam4LndTuningModZDustSoilErod/include_user_mods | 1 + .../clm/clm45cam4LndTuningModZDustSoilErod/shell_commands | 4 ++++ .../clm/clm45cam4LndTuningModZDustSoilErod/user_nl_clm | 3 +++ .../clm/clm45cam5LndTuningModZDustSoilErod/include_user_mods | 1 + .../clm/clm45cam5LndTuningModZDustSoilErod/shell_commands | 5 +++++ 5 files changed, 14 insertions(+) create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/user_nl_clm create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModZDustSoilErod/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModZDustSoilErod/shell_commands diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/include_user_mods new file mode 100644 index 0000000000..fe0e18cf88 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/include_user_mods @@ -0,0 +1 @@ +../default diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/shell_commands b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/shell_commands new file mode 100644 index 0000000000..b858269501 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/shell_commands @@ -0,0 +1,4 @@ +#!/bin/bash + +./xmlchange LND_TUNING_MODE="clm4_5_cam4.0" + diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/user_nl_clm new file mode 100644 index 0000000000..deab434d1c --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/user_nl_clm @@ -0,0 +1,3 @@ +! Turn on using the soil eroditability file in CTSM +dust_emis_method = 'Zender_2023' +clm45cam4LndTuningModZDustSoilErod = 'lnd' diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModZDustSoilErod/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModZDustSoilErod/include_user_mods new file mode 100644 index 0000000000..fe0e18cf88 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModZDustSoilErod/include_user_mods @@ -0,0 +1 @@ +../default diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModZDustSoilErod/shell_commands b/cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModZDustSoilErod/shell_commands new file mode 100644 index 0000000000..753bc2f045 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModZDustSoilErod/shell_commands @@ -0,0 +1,5 @@ +#!/bin/bash + +./xmlchange LND_TUNING_MODE="clm5_0_cam5.0" +./xmlchange ROF_NCPL='$ATM_NCPL' + From c3f2b30fedf87baf4b3fc469f4993704b68583ed Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Jan 2024 16:57:17 -0700 Subject: [PATCH 17/77] Add in the new dust handling namelist parameters, and some control logic for it, this compilers, but does NOT run --- src/biogeochem/DUSTMod.F90 | 32 ++++++++++------- .../share_esmf/ZenderSoilErodStreamType.F90 | 35 +++++++++++++------ src/main/clm_varctl.F90 | 5 +++ src/main/controlMod.F90 | 2 +- 4 files changed, 50 insertions(+), 24 deletions(-) diff --git a/src/biogeochem/DUSTMod.F90 b/src/biogeochem/DUSTMod.F90 index 485086203b..28823f573d 100644 --- a/src/biogeochem/DUSTMod.F90 +++ b/src/biogeochem/DUSTMod.F90 @@ -31,6 +31,7 @@ module DUSTMod use ColumnType , only : col use PatchType , only : patch use ZenderSoilErodStreamType, only : zendersoilerodstream_type + use clm_varctl , only : dust_emis_method ! ! !PUBLIC TYPES implicit none @@ -80,7 +81,6 @@ module DUSTMod contains !------------------------------------------------------------------------ - !subroutine Init(this, bounds) subroutine Init(this, bounds, NLFilename) class(dust_type) :: this @@ -187,18 +187,24 @@ subroutine InitCold(this, bounds) ! Set basin factor to 1 for now - !if (dust_emission_scheme == 'Leung2023') - ! do c = bounds%begc, bounds%endc - ! l = col%landunit(c) - - ! if (.not.lun%lakpoi(l)) then - ! this%mbl_bsn_fct_col(c) = 1.0_r8 - ! end if - ! end do - !else if (dust_emission_scheme == 'Zender2003') - call this%zendersoilerodstream%CalcDustSource( bounds, & - this%mbl_bsn_fct_col(bounds%begc:bounds%endc) ) - !end if + if (dust_emis_method == 'Leung_2023') then + !do c = bounds%begc, bounds%endc + ! l = col%landunit(c) + + ! if (.not.lun%lakpoi(l)) then + ! this%mbl_bsn_fct_col(c) = 1.0_r8 + ! end if + !end do + call endrun( msg="Leung_2023 dust_emis_method is currently not available"//errMsg(sourcefile, __LINE__)) + else if (dust_emis_method == 'Zender_2003') then + if ( this%zendersoilerodstream%UseStreams() )then + call this%zendersoilerodstream%CalcDustSource( bounds, & + this%mbl_bsn_fct_col(bounds%begc:bounds%endc) ) + end if + else + write(iulog,*) 'dust_emis_method not recognized = ', trim(dust_emis_method) + call endrun( msg="dust_emis_method namelist item is not valid "//errMsg(sourcefile, __LINE__)) + end if end subroutine InitCold diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index 8993722115..1422f2e84c 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -42,6 +42,7 @@ module ZenderSoilErodStreamType ! ! PRIVATE DATA: type, private :: streamcontrol_type + character(len=CL) :: zender_soil_erod_source ! if calculed in lnd or atm character(len=CL) :: stream_fldFileName_zendersoilerod ! data Filename character(len=CL) :: stream_meshfile_zendersoilerod ! mesh Filename character(len=CL) :: zendersoilerodmapalgo ! map algo @@ -60,7 +61,7 @@ module ZenderSoilErodStreamType subroutine Init(this, bounds, NLFilename) ! - ! Initialize the prigent roughness stream object + ! Initialize the Zender soil eroditability stream object ! ! Uses: use spmdMod , only : iam @@ -89,7 +90,6 @@ subroutine Init(this, bounds, NLFilename) character(len=*), parameter :: stream_name = 'zendersoilerod' !----------------------------------------------------------------------- - !if ( finundation_mtd /= finundation_mtd_h2osfc )then ! how should I change this? comment out for now call this%InitAllocate( bounds ) call control%ReadNML( bounds, NLFileName ) @@ -164,7 +164,6 @@ subroutine Init(this, bounds, NLFilename) end do end if - !end if !comment out for now end subroutine Init @@ -176,14 +175,14 @@ logical function UseStreams(this) ! file is being used with it ! ! !USES: + use clm_varctl, only : dust_emis_method ! ! !ARGUMENTS: implicit none class(zendersoilerodstream_type) :: this ! ! !LOCAL VARIABLES: - !if ( trim(control%stream_fldFileName_zendersoilerod) == '' .or. dust_emission_scheme == 'Leung2023')then - if ( trim(control%stream_fldFileName_zendersoilerod) == '')then + if ( (trim(dust_emis_method) /= 'Zender_2003') .or. (control%zender_soil_erod_source == "atm") )then UseStreams = .false. else UseStreams = .true. @@ -205,14 +204,17 @@ subroutine InitAllocate(this, bounds) type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: - !integer :: begc, endc integer :: begg, endg !--------------------------------------------------------------------- - !begc = bounds%begc; endc = bounds%endc begg = bounds%begg; endg = bounds%endg - allocate(this%soil_erodibility (begg:endg)) ; this%soil_erodibility (:) = nan + if ( this%useStreams() ) then + allocate(this%soil_erodibility (begg:endg)) + else + allocate(this%soil_erodibility (0)) + end if + this%soil_erodibility (:) = nan end subroutine InitAllocate @@ -293,12 +295,14 @@ subroutine ReadNML(this, bounds, NLFilename) character(len=CL) :: stream_fldFileName_zendersoilerod = ' ' character(len=CL) :: stream_meshfile_zendersoilerod = ' ' character(len=CL) :: zendersoilerodmapalgo = 'bilinear' + character(len=3) :: zender_soil_erod_source = 'atm' character(len=*), parameter :: namelist_name = 'zendersoilerod' ! MUST agree with group name in namelist definition to read. character(len=*), parameter :: subName = "('zendersoilerod::ReadNML')" !----------------------------------------------------------------------- namelist /zendersoilerod/ & ! MUST agree with namelist_name above - zendersoilerodmapalgo, stream_fldFileName_zendersoilerod, stream_meshfile_zendersoilerod + zendersoilerodmapalgo, zendersoilerodmapalgo, stream_fldFileName_zendersoilerod, & + stream_meshfile_zendersoilerod ! Default values for namelist @@ -321,16 +325,27 @@ subroutine ReadNML(this, bounds, NLFilename) call shr_mpi_bcast(stream_fldFileName_zendersoilerod , mpicom) call shr_mpi_bcast(stream_meshfile_zendersoilerod , mpicom) - if (masterproc) then + if (masterproc .and. (zender_soil_erod_source == "lnd") ) then write(iulog,*) ' ' write(iulog,*) namelist_name, ' stream settings:' write(iulog,*) ' stream_fldFileName_zendersoilerod = ',stream_fldFileName_zendersoilerod write(iulog,*) ' stream_meshfile_zendersoilerod = ',stream_meshfile_zendersoilerod write(iulog,*) ' zendersoilerodmapalgo = ',zendersoilerodmapalgo endif + + if ( (zender_soil_erod_source /= 'atm') .and. (zender_soil_erod_source /= 'lnd') )then + call endrun(msg=' ERROR zender_soil_erod_source must be either lnd or atm and is NOT'//errMsg(sourcefile, __LINE__)) + end if + if ( len_trim(stream_meshfile_zendersoilerod) == 0 )then + call endrun(msg=' ERROR stream_meshfile_zendersoilerod must be set when Zender_2003 is being used and zender_soil_erod_source is lnd'//errMsg(sourcefile, __LINE__)) + end if + if ( len_trim(stream_meshfile_zendersoilerod) == 0 )then + call endrun(msg=' ERROR stream_meshfile_zendersoilerod must be set when Zender_2003 is being used and zender_soil_erod_source is lnd'//errMsg(sourcefile, __LINE__)) + end if this%stream_fldFileName_zendersoilerod = stream_fldFileName_zendersoilerod this%stream_meshfile_zendersoilerod = stream_meshfile_zendersoilerod this%zendersoilerodmapalgo = zendersoilerodmapalgo + this%zender_soil_erod_source = zender_soil_erod_source end subroutine ReadNML diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 615f3b2606..e2ad7156ef 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -265,6 +265,11 @@ module clm_varctl ! option to activate OC in snow in SNICAR logical, public :: do_sno_oc = .false. ! control to include organic carbon (OC) in snow + !---------------------------------------------------------- + ! DUST emission method + !---------------------------------------------------------- + character(len=25), public :: dust_emis_method = 'Zender_2003' ! Dust emisison method to use: Zender_2003 or Leung_2023 + !---------------------------------------------------------- ! C isotopes !---------------------------------------------------------- diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index d95c0e28e0..b3120c353a 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -205,7 +205,7 @@ subroutine control_init(dtime) crop_fsat_equals_zero, for_testing_run_ncdiopio_tests, & for_testing_use_second_grain_pool, for_testing_use_repr_structure_pool, & for_testing_no_crop_seed_replenishment, & - z0param_method, use_z0m_snowmelt + z0param_method, use_z0m_snowmelt, dust_emis_method ! vertical soil mixing variables namelist /clm_inparm/ & From 15bf184e4d66927ce85e215db41b53c99f8a5326 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 1 Feb 2024 20:36:59 -0700 Subject: [PATCH 18/77] Get simple case with Zender soil eroditablity off working so SMS_D_Ld1_Mmpi-serial.1x1_brazil.I2000Clm51SpRs.derecho_gnu.clm-clm51cam6LndTuningMode PASSes --- src/biogeochem/DUSTMod.F90 | 16 +++++++++------- src/cpl/share_esmf/ZenderSoilErodStreamType.F90 | 16 +++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/biogeochem/DUSTMod.F90 b/src/biogeochem/DUSTMod.F90 index 28823f573d..d447f42f04 100644 --- a/src/biogeochem/DUSTMod.F90 +++ b/src/biogeochem/DUSTMod.F90 @@ -87,9 +87,9 @@ subroutine Init(this, bounds, NLFilename) type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename + call this%zendersoilerodstream%Init( bounds, NLFilename ) call this%InitAllocate (bounds) call this%InitHistory (bounds) - call this%zendersoilerodstream%Init( bounds, NLFilename ) call this%InitCold (bounds) call this%InitDustVars (bounds) @@ -165,12 +165,14 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='turbulent deposition velocity 4', & ptr_patch=this%vlc_trb_4_patch, default='inactive') - ! if Zender - this%mbl_bsn_fct_col(begc:endc) = spval - call hist_addfld1d (fname='LND_MBL', units='fraction', & - avgflag='A', long_name='Soil erodibility factor', & - ptr_col=this%mbl_bsn_fct_col, default='inactive') - ! end if + if (dust_emis_method == 'Zender_2003') then + if ( this%zendersoilerodstream%UseStreams() )then + this%mbl_bsn_fct_col(begc:endc) = spval + call hist_addfld1d (fname='LND_MBL', units='fraction', & + avgflag='A', long_name='Soil erodibility factor', & + ptr_col=this%mbl_bsn_fct_col, default='inactive') + end if + end if end subroutine InitHistory diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index 1422f2e84c..2749b9b28f 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -302,7 +302,7 @@ subroutine ReadNML(this, bounds, NLFilename) namelist /zendersoilerod/ & ! MUST agree with namelist_name above zendersoilerodmapalgo, zendersoilerodmapalgo, stream_fldFileName_zendersoilerod, & - stream_meshfile_zendersoilerod + stream_meshfile_zendersoilerod, zender_soil_erod_source ! Default values for namelist @@ -333,14 +333,16 @@ subroutine ReadNML(this, bounds, NLFilename) write(iulog,*) ' zendersoilerodmapalgo = ',zendersoilerodmapalgo endif - if ( (zender_soil_erod_source /= 'atm') .and. (zender_soil_erod_source /= 'lnd') )then + if ( (trim(zender_soil_erod_source) /= 'atm') .and. (trim(zender_soil_erod_source) /= 'lnd') )then call endrun(msg=' ERROR zender_soil_erod_source must be either lnd or atm and is NOT'//errMsg(sourcefile, __LINE__)) end if - if ( len_trim(stream_meshfile_zendersoilerod) == 0 )then - call endrun(msg=' ERROR stream_meshfile_zendersoilerod must be set when Zender_2003 is being used and zender_soil_erod_source is lnd'//errMsg(sourcefile, __LINE__)) - end if - if ( len_trim(stream_meshfile_zendersoilerod) == 0 )then - call endrun(msg=' ERROR stream_meshfile_zendersoilerod must be set when Zender_2003 is being used and zender_soil_erod_source is lnd'//errMsg(sourcefile, __LINE__)) + if ( trim(zender_soil_erod_source) == 'lnd' )then + if ( len_trim(stream_meshfile_zendersoilerod) == 0 )then + call endrun(msg=' ERROR stream_meshfile_zendersoilerod must be set when Zender_2003 is being used and zender_soil_erod_source is lnd'//errMsg(sourcefile, __LINE__)) + end if + if ( len_trim(stream_meshfile_zendersoilerod) == 0 )then + call endrun(msg=' ERROR stream_meshfile_zendersoilerod must be set when Zender_2003 is being used and zender_soil_erod_source is lnd'//errMsg(sourcefile, __LINE__)) + end if end if this%stream_fldFileName_zendersoilerod = stream_fldFileName_zendersoilerod this%stream_meshfile_zendersoilerod = stream_meshfile_zendersoilerod From 0b9c97976aad14ce10ce09d786c1cbc094444815 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 2 Feb 2024 16:15:35 -0700 Subject: [PATCH 19/77] Fix some issues, get a test using soileroditability file to work --- src/biogeochem/DUSTMod.F90 | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/biogeochem/DUSTMod.F90 b/src/biogeochem/DUSTMod.F90 index d447f42f04..3d1d4d80ee 100644 --- a/src/biogeochem/DUSTMod.F90 +++ b/src/biogeochem/DUSTMod.F90 @@ -138,7 +138,7 @@ subroutine InitHistory(this, bounds) !------------------------------------------------------------------------ begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endp + begc = bounds%begc; endc = bounds%endc this%flx_mss_vrt_dst_tot_patch(begp:endp) = spval call hist_addfld1d (fname='DSTFLXT', units='kg/m2/s', & @@ -202,6 +202,8 @@ subroutine InitCold(this, bounds) if ( this%zendersoilerodstream%UseStreams() )then call this%zendersoilerodstream%CalcDustSource( bounds, & this%mbl_bsn_fct_col(bounds%begc:bounds%endc) ) + else + this%mbl_bsn_fct_col(:) = 1.0_r8 end if else write(iulog,*) 'dust_emis_method not recognized = ', trim(dust_emis_method) @@ -708,10 +710,6 @@ subroutine InitDustVars(this, bounds) real(r8), parameter :: dns_slt = 2650.0_r8 ! [kg m-3] Density of optimal saltation particles !------------------------------------------------------------------------ - associate(& - mbl_bsn_fct => this%mbl_bsn_fct_col & ! Output: [real(r8) (:)] basin factor - ) - ! allocate module variable allocate (ovr_src_snk_mss(dst_src_nbr,ndst)) allocate (dmt_vwr(ndst)) @@ -947,8 +945,6 @@ subroutine InitDustVars(this, bounds) stk_crc(m) = vlc_grv(m) / vlc_stk(m) end do - end associate - end subroutine InitDustVars end module DUSTMod From 3921fbf67a8e8e2eb115ef9ddd7e8b3908786fd3 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 2 Feb 2024 17:12:42 -0700 Subject: [PATCH 20/77] Add tests for Zender dust with soil eroditability file in CTSM for CAM4, CAM5, CAM6 cases --- cime_config/testdefs/testlist_clm.xml | 22 +++++++++++++++++-- .../include_user_mods | 0 .../shell_commands | 1 + .../user_nl_clm | 0 .../include_user_mods | 0 .../shell_commands | 0 .../include_user_mods | 1 + .../user_nl_clm | 3 +++ 8 files changed, 25 insertions(+), 2 deletions(-) rename cime_config/testdefs/testmods_dirs/clm/{clm45cam4LndTuningModZDustSoilErod => clm45cam4LndTuningModeZDustSoilErod}/include_user_mods (100%) rename cime_config/testdefs/testmods_dirs/clm/{clm45cam4LndTuningModZDustSoilErod => clm45cam4LndTuningModeZDustSoilErod}/shell_commands (63%) rename cime_config/testdefs/testmods_dirs/clm/{clm45cam4LndTuningModZDustSoilErod => clm45cam4LndTuningModeZDustSoilErod}/user_nl_clm (100%) rename cime_config/testdefs/testmods_dirs/clm/{clm45cam5LndTuningModZDustSoilErod => clm45cam5LndTuningModeZDustSoilErod}/include_user_mods (100%) rename cime_config/testdefs/testmods_dirs/clm/{clm45cam5LndTuningModZDustSoilErod => clm45cam5LndTuningModeZDustSoilErod}/shell_commands (100%) create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/include_user_mods create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 4761a2111f..958a903eab 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -52,14 +52,32 @@ - + + + + + + + + + + + + + + + + + + + - + diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/include_user_mods similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/include_user_mods rename to cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/include_user_mods diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/shell_commands b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/shell_commands similarity index 63% rename from cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/shell_commands rename to cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/shell_commands index b858269501..010b5b5680 100644 --- a/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/shell_commands +++ b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/shell_commands @@ -1,4 +1,5 @@ #!/bin/bash ./xmlchange LND_TUNING_MODE="clm4_5_cam4.0" +./xmlchange ROF_NCPL='$ATM_NCPL' diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/user_nl_clm similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModZDustSoilErod/user_nl_clm rename to cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/user_nl_clm diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModZDustSoilErod/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModeZDustSoilErod/include_user_mods similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModZDustSoilErod/include_user_mods rename to cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModeZDustSoilErod/include_user_mods diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModZDustSoilErod/shell_commands b/cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModeZDustSoilErod/shell_commands similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModZDustSoilErod/shell_commands rename to cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModeZDustSoilErod/shell_commands diff --git a/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/include_user_mods new file mode 100644 index 0000000000..aa76c52034 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/include_user_mods @@ -0,0 +1 @@ +../clm51cam6LndTuningMode diff --git a/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm new file mode 100644 index 0000000000..deab434d1c --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm @@ -0,0 +1,3 @@ +! Turn on using the soil eroditability file in CTSM +dust_emis_method = 'Zender_2023' +clm45cam4LndTuningModZDustSoilErod = 'lnd' From 2ad96ff966695c90d26f4c88a8abfe1ddbfd4de9 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 2 Feb 2024 18:00:42 -0700 Subject: [PATCH 21/77] Add dust soil eroditability files for all CAM options, which requires a version for each lnd_tuning_mode, and for CAM4 cases for the f09 grid --- bld/namelist_files/namelist_defaults_ctsm.xml | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index d1e77db965..a6b9a7a6cc 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2816,8 +2816,49 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1 Zender_2003 atm bilinear -lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc +lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc +lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc +lnd/clm2/dustemisdata/dst_source2x2_cam5.4-forCLM_cdf5_c240202.nc +lnd/clm2/dustemisdata/dst_source2x2_cam5.4-forCLM_cdf5_c240202.nc +lnd/clm2/dustemisdata/dst_source2x2_cam5.4-forCLM_cdf5_c240202.nc +lnd/clm2/dustemisdata/dst_source2x2tuned-cam4-forCLM_cdf5_c240202.nc +lnd/clm2/dustemisdata/dst_source2x2tuned-cam4-forCLM_cdf5_c240202.nc +lnd/clm2/dustemisdata/dst_source2x2tuned-cam4-forCLM_cdf5_c240202.nc +lnd/clm2/dustemisdata/dst_source1x1tuned-cam4-forCLM_cdf5_c240202.nc +lnd/clm2/dustemisdata/dst_source1x1tuned-cam4-forCLM_cdf5_c240202.nc +lnd/clm2/dustemisdata/dst_source1x1tuned-cam4-forCLM_cdf5_c240202.nc +lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc +lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc +lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc +lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc +lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc +lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc +lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc +lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc +lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc + lnd/clm2/dustemisdata/dust_2x2_ESMFmesh_cdf5_c230730.nc From 301181856209bb3f4e2b30f100b7eec032d830b1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 2 Feb 2024 18:04:05 -0700 Subject: [PATCH 22/77] Need hgrid for some of the Zender soil eroditability files --- bld/CLMBuildNamelist.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index ba2885e5de..facfef91ce 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3962,7 +3962,7 @@ sub setup_logic_dust_emis { foreach my $option ( @zender_files_in_lnd_opts ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $option, 'dust_emis_method'=>$dust_emis_method, 'zender_soil_erod_source'=>$zender_source, - 'lnd_tuning_mod'=>$nl_flags->{'lnd_tuning_mode'} ); + 'hgrid'=>$nl_flags->{'res'}, 'lnd_tuning_mod'=>$nl_flags->{'lnd_tuning_mode'} ); } } else { foreach my $option ( @zender_files_in_lnd_opts ) { From 7e226ba46459e14cab820122e424877edc30862b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 3 Feb 2024 12:27:18 -0700 Subject: [PATCH 23/77] Correct year in dust_emis_method --- .../clm/clm45cam4LndTuningModeZDustSoilErod/user_nl_clm | 2 +- .../clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/user_nl_clm index deab434d1c..755d7e30c9 100644 --- a/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/user_nl_clm @@ -1,3 +1,3 @@ ! Turn on using the soil eroditability file in CTSM -dust_emis_method = 'Zender_2023' +dust_emis_method = 'Zender_2003' clm45cam4LndTuningModZDustSoilErod = 'lnd' diff --git a/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm index deab434d1c..755d7e30c9 100644 --- a/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm @@ -1,3 +1,3 @@ ! Turn on using the soil eroditability file in CTSM -dust_emis_method = 'Zender_2023' +dust_emis_method = 'Zender_2003' clm45cam4LndTuningModZDustSoilErod = 'lnd' From ef7a41a9ae379c3082d0660e6261487bd204bec1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 3 Feb 2024 13:39:04 -0700 Subject: [PATCH 24/77] Correct namelist name --- .../clm/clm45cam4LndTuningModeZDustSoilErod/user_nl_clm | 2 +- .../include_user_mods | 0 .../shell_commands | 0 .../clm/clm50cam5LndTuningModeZDustSoilErod/user_nl_clm | 3 +++ .../clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm | 2 +- 5 files changed, 5 insertions(+), 2 deletions(-) rename cime_config/testdefs/testmods_dirs/clm/{clm45cam5LndTuningModeZDustSoilErod => clm50cam5LndTuningModeZDustSoilErod}/include_user_mods (100%) rename cime_config/testdefs/testmods_dirs/clm/{clm45cam5LndTuningModeZDustSoilErod => clm50cam5LndTuningModeZDustSoilErod}/shell_commands (100%) create mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50cam5LndTuningModeZDustSoilErod/user_nl_clm diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/user_nl_clm index 755d7e30c9..93b7ee2e48 100644 --- a/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/clm45cam4LndTuningModeZDustSoilErod/user_nl_clm @@ -1,3 +1,3 @@ ! Turn on using the soil eroditability file in CTSM dust_emis_method = 'Zender_2003' -clm45cam4LndTuningModZDustSoilErod = 'lnd' +zender_soil_erod_source = 'lnd' diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModeZDustSoilErod/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm50cam5LndTuningModeZDustSoilErod/include_user_mods similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModeZDustSoilErod/include_user_mods rename to cime_config/testdefs/testmods_dirs/clm/clm50cam5LndTuningModeZDustSoilErod/include_user_mods diff --git a/cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModeZDustSoilErod/shell_commands b/cime_config/testdefs/testmods_dirs/clm/clm50cam5LndTuningModeZDustSoilErod/shell_commands similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/clm45cam5LndTuningModeZDustSoilErod/shell_commands rename to cime_config/testdefs/testmods_dirs/clm/clm50cam5LndTuningModeZDustSoilErod/shell_commands diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50cam5LndTuningModeZDustSoilErod/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm50cam5LndTuningModeZDustSoilErod/user_nl_clm new file mode 100644 index 0000000000..93b7ee2e48 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/clm50cam5LndTuningModeZDustSoilErod/user_nl_clm @@ -0,0 +1,3 @@ +! Turn on using the soil eroditability file in CTSM +dust_emis_method = 'Zender_2003' +zender_soil_erod_source = 'lnd' diff --git a/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm index 755d7e30c9..93b7ee2e48 100644 --- a/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/clm51cam6LndTuningModeZDustSoilErod/user_nl_clm @@ -1,3 +1,3 @@ ! Turn on using the soil eroditability file in CTSM dust_emis_method = 'Zender_2003' -clm45cam4LndTuningModZDustSoilErod = 'lnd' +zender_soil_erod_source = 'lnd' From 2d9aaccf240b0b4a4a8f9db7017cb15e2f4710e4 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 26 Feb 2024 17:01:43 -0700 Subject: [PATCH 25/77] Use straight logic rather than a logical not of the straightforward case for simplicity, suggested by @slevis-lmwg --- src/cpl/share_esmf/ZenderSoilErodStreamType.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index 2749b9b28f..fdb170d4d8 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -182,10 +182,10 @@ logical function UseStreams(this) class(zendersoilerodstream_type) :: this ! ! !LOCAL VARIABLES: - if ( (trim(dust_emis_method) /= 'Zender_2003') .or. (control%zender_soil_erod_source == "atm") )then - UseStreams = .false. - else + if ( (trim(dust_emis_method) == 'Zender_2003') .and. (control%zender_soil_erod_source == "lnd") )then UseStreams = .true. + else + UseStreams = .false. end if end function UseStreams From 8c42551d770c36bed4ed233deae5027389fea1ea Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 26 Feb 2024 17:15:56 -0700 Subject: [PATCH 26/77] Change names with zendersoilerod in them, in some cases removing the zender part of it, and for zendersoilerodmapalgo add a underscore for readability --- bld/CLMBuildNamelist.pm | 2 +- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- .../namelist_definition_ctsm.xml | 2 +- src/biogeochem/DUSTMod.F90 | 12 ++++----- .../share_esmf/ZenderSoilErodStreamType.F90 | 26 +++++++++---------- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index facfef91ce..18999dd5af 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -3951,7 +3951,7 @@ sub setup_logic_dust_emis { my $dust_emis_method = remove_leading_and_trailing_quotes( $nl->get_value($var) ); my @zender_files_in_lnd_opts = ( "stream_fldfilename_zendersoilerod", "stream_meshfile_zendersoilerod", - "zendersoilerodmapalgo" ); + "zendersoilerod_mapalgo" ); if ( $dust_emis_method eq "Zender_2003" ) { # get the zender_soil_erod_source add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index a6b9a7a6cc..e8328c29de 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2815,7 +2815,7 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1 Zender_2003 atm -bilinear +bilinear lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc - Option only applying for the Zender_2003 method for whether the soil erodibility file is handled here in CTSM, or in the ATM model. diff --git a/src/biogeochem/DUSTMod.F90 b/src/biogeochem/DUSTMod.F90 index 3d1d4d80ee..ffa2bfe6f0 100644 --- a/src/biogeochem/DUSTMod.F90 +++ b/src/biogeochem/DUSTMod.F90 @@ -30,7 +30,7 @@ module DUSTMod use LandunitType , only : lun use ColumnType , only : col use PatchType , only : patch - use ZenderSoilErodStreamType, only : zendersoilerodstream_type + use ZenderSoilErodStreamType, only : soil_erod_stream_type use clm_varctl , only : dust_emis_method ! ! !PUBLIC TYPES @@ -61,7 +61,7 @@ module DUSTMod real(r8), pointer, private :: vlc_trb_2_patch (:) ! turbulent deposition velocity 2(m/s) real(r8), pointer, private :: vlc_trb_3_patch (:) ! turbulent deposition velocity 3(m/s) real(r8), pointer, private :: vlc_trb_4_patch (:) ! turbulent deposition velocity 4(m/s) - type(zendersoilerodstream_type), private :: zendersoilerodstream ! Zender soil erodibility stream data + type(soil_erod_stream_type), private :: soil_erod_stream ! Zender soil erodibility stream data real(r8), pointer, private :: mbl_bsn_fct_col (:) ! [dimensionless] basin factor, or soil erodibility, time-constant contains @@ -87,7 +87,7 @@ subroutine Init(this, bounds, NLFilename) type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename - call this%zendersoilerodstream%Init( bounds, NLFilename ) + call this%soil_erod_stream%Init( bounds, NLFilename ) call this%InitAllocate (bounds) call this%InitHistory (bounds) call this%InitCold (bounds) @@ -166,7 +166,7 @@ subroutine InitHistory(this, bounds) ptr_patch=this%vlc_trb_4_patch, default='inactive') if (dust_emis_method == 'Zender_2003') then - if ( this%zendersoilerodstream%UseStreams() )then + if ( this%soil_erod_stream%UseStreams() )then this%mbl_bsn_fct_col(begc:endc) = spval call hist_addfld1d (fname='LND_MBL', units='fraction', & avgflag='A', long_name='Soil erodibility factor', & @@ -199,8 +199,8 @@ subroutine InitCold(this, bounds) !end do call endrun( msg="Leung_2023 dust_emis_method is currently not available"//errMsg(sourcefile, __LINE__)) else if (dust_emis_method == 'Zender_2003') then - if ( this%zendersoilerodstream%UseStreams() )then - call this%zendersoilerodstream%CalcDustSource( bounds, & + if ( this%soil_erod_stream%UseStreams() )then + call this%soil_erod_stream%CalcDustSource( bounds, & this%mbl_bsn_fct_col(bounds%begc:bounds%endc) ) else this%mbl_bsn_fct_col(:) = 1.0_r8 diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index fdb170d4d8..4eee1cbd56 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -26,7 +26,7 @@ module ZenderSoilErodStreamType implicit none private - type, public :: zendersoilerodstream_type + type, public :: soil_erod_stream_type real(r8), pointer, private :: soil_erodibility (:) ! Zender et al. (2003b) dust source function (or soil erodibility) contains @@ -38,14 +38,14 @@ module ZenderSoilErodStreamType ! !PRIVATE MEMBER FUNCTIONS: procedure, private :: InitAllocate ! Allocate data - end type zendersoilerodstream_type + end type soil_erod_stream_type ! ! PRIVATE DATA: type, private :: streamcontrol_type character(len=CL) :: zender_soil_erod_source ! if calculed in lnd or atm character(len=CL) :: stream_fldFileName_zendersoilerod ! data Filename character(len=CL) :: stream_meshfile_zendersoilerod ! mesh Filename - character(len=CL) :: zendersoilerodmapalgo ! map algo + character(len=CL) :: zendersoilerod_mapalgo ! map algo contains procedure, private :: ReadNML ! Read in namelist end type streamcontrol_type @@ -72,7 +72,7 @@ subroutine Init(this, bounds, NLFilename) ! ! arguments implicit none - class(zendersoilerodstream_type) :: this + class(soil_erod_stream_type) :: this type(bounds_type), intent(in) :: bounds character(len=*), intent(in) :: NLFilename ! Namelist filename ! @@ -112,7 +112,7 @@ subroutine Init(this, bounds, NLFilename) model_mesh = mesh, & stream_meshfile = control%stream_meshfile_zendersoilerod, & stream_lev_dimname = 'null', & - stream_mapalgo = control%zendersoilerodmapalgo, & + stream_mapalgo = control%zendersoilerod_mapalgo, & stream_filenames = (/trim(control%stream_fldFileName_zendersoilerod)/), & stream_fldlistFile = stream_varnames, & stream_fldListModel = stream_varnames, & @@ -179,7 +179,7 @@ logical function UseStreams(this) ! ! !ARGUMENTS: implicit none - class(zendersoilerodstream_type) :: this + class(soil_erod_stream_type) :: this ! ! !LOCAL VARIABLES: if ( (trim(dust_emis_method) == 'Zender_2003') .and. (control%zender_soil_erod_source == "lnd") )then @@ -200,7 +200,7 @@ subroutine InitAllocate(this, bounds) ! ! !ARGUMENTS: implicit none - class(zendersoilerodstream_type) :: this + class(soil_erod_stream_type) :: this type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: @@ -233,7 +233,7 @@ subroutine CalcDustSource(this, bounds, soil_erod) ! ! !ARGUMENTS: implicit none - class(zendersoilerodstream_type) :: this + class(soil_erod_stream_type) :: this type(bounds_type) , intent(in) :: bounds real(r8) , intent(inout) :: soil_erod(bounds%begc:) ! [fraction] rock drag partition factor (roughness effect) ! @@ -294,14 +294,14 @@ subroutine ReadNML(this, bounds, NLFilename) integer :: nml_error ! namelist i/o error flag character(len=CL) :: stream_fldFileName_zendersoilerod = ' ' character(len=CL) :: stream_meshfile_zendersoilerod = ' ' - character(len=CL) :: zendersoilerodmapalgo = 'bilinear' + character(len=CL) :: zendersoilerod_mapalgo = 'bilinear' character(len=3) :: zender_soil_erod_source = 'atm' character(len=*), parameter :: namelist_name = 'zendersoilerod' ! MUST agree with group name in namelist definition to read. character(len=*), parameter :: subName = "('zendersoilerod::ReadNML')" !----------------------------------------------------------------------- namelist /zendersoilerod/ & ! MUST agree with namelist_name above - zendersoilerodmapalgo, zendersoilerodmapalgo, stream_fldFileName_zendersoilerod, & + zendersoilerod_mapalgo, zendersoilerod_mapalgo, stream_fldFileName_zendersoilerod, & stream_meshfile_zendersoilerod, zender_soil_erod_source ! Default values for namelist @@ -321,7 +321,7 @@ subroutine ReadNML(this, bounds, NLFilename) close(nu_nml) endif - call shr_mpi_bcast(zendersoilerodmapalgo , mpicom) + call shr_mpi_bcast(zendersoilerod_mapalgo , mpicom) call shr_mpi_bcast(stream_fldFileName_zendersoilerod , mpicom) call shr_mpi_bcast(stream_meshfile_zendersoilerod , mpicom) @@ -330,7 +330,7 @@ subroutine ReadNML(this, bounds, NLFilename) write(iulog,*) namelist_name, ' stream settings:' write(iulog,*) ' stream_fldFileName_zendersoilerod = ',stream_fldFileName_zendersoilerod write(iulog,*) ' stream_meshfile_zendersoilerod = ',stream_meshfile_zendersoilerod - write(iulog,*) ' zendersoilerodmapalgo = ',zendersoilerodmapalgo + write(iulog,*) ' zendersoilerod_mapalgo = ',zendersoilerod_mapalgo endif if ( (trim(zender_soil_erod_source) /= 'atm') .and. (trim(zender_soil_erod_source) /= 'lnd') )then @@ -346,7 +346,7 @@ subroutine ReadNML(this, bounds, NLFilename) end if this%stream_fldFileName_zendersoilerod = stream_fldFileName_zendersoilerod this%stream_meshfile_zendersoilerod = stream_meshfile_zendersoilerod - this%zendersoilerodmapalgo = zendersoilerodmapalgo + this%zendersoilerod_mapalgo = zendersoilerod_mapalgo this%zender_soil_erod_source = zender_soil_erod_source end subroutine ReadNML From 1421d6d76cbff3a2ec274205f2d4933eabe840db Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 26 Feb 2024 18:25:41 -0700 Subject: [PATCH 27/77] Fix some issues from comments in the PR, make sure all namelist items are broadcast, remove an unneeded item, add checks that namelist items are set (or not set) appropriately --- .../share_esmf/ZenderSoilErodStreamType.F90 | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index 4eee1cbd56..11ae162d1e 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -290,18 +290,20 @@ subroutine ReadNML(this, bounds, NLFilename) character(len=*), intent(in) :: NLFilename ! Namelist filename ! ! local variables + integer :: i ! Indices integer :: nu_nml ! unit for namelist file integer :: nml_error ! namelist i/o error flag character(len=CL) :: stream_fldFileName_zendersoilerod = ' ' character(len=CL) :: stream_meshfile_zendersoilerod = ' ' - character(len=CL) :: zendersoilerod_mapalgo = 'bilinear' + character(len=CL) :: zendersoilerod_mapalgo = ' ' + character(len=CL) :: tmp_file_array(3) character(len=3) :: zender_soil_erod_source = 'atm' character(len=*), parameter :: namelist_name = 'zendersoilerod' ! MUST agree with group name in namelist definition to read. character(len=*), parameter :: subName = "('zendersoilerod::ReadNML')" !----------------------------------------------------------------------- namelist /zendersoilerod/ & ! MUST agree with namelist_name above - zendersoilerod_mapalgo, zendersoilerod_mapalgo, stream_fldFileName_zendersoilerod, & + zendersoilerod_mapalgo, stream_fldFileName_zendersoilerod, & stream_meshfile_zendersoilerod, zender_soil_erod_source ! Default values for namelist @@ -321,7 +323,8 @@ subroutine ReadNML(this, bounds, NLFilename) close(nu_nml) endif - call shr_mpi_bcast(zendersoilerod_mapalgo , mpicom) + call shr_mpi_bcast(zender_soil_erod_source , mpicom) + call shr_mpi_bcast(zendersoilerod_mapalgo , mpicom) call shr_mpi_bcast(stream_fldFileName_zendersoilerod , mpicom) call shr_mpi_bcast(stream_meshfile_zendersoilerod , mpicom) @@ -330,23 +333,31 @@ subroutine ReadNML(this, bounds, NLFilename) write(iulog,*) namelist_name, ' stream settings:' write(iulog,*) ' stream_fldFileName_zendersoilerod = ',stream_fldFileName_zendersoilerod write(iulog,*) ' stream_meshfile_zendersoilerod = ',stream_meshfile_zendersoilerod - write(iulog,*) ' zendersoilerod_mapalgo = ',zendersoilerod_mapalgo + write(iulog,*) ' zendersoilerod_mapalgo = ',zendersoilerod_mapalgo endif if ( (trim(zender_soil_erod_source) /= 'atm') .and. (trim(zender_soil_erod_source) /= 'lnd') )then call endrun(msg=' ERROR zender_soil_erod_source must be either lnd or atm and is NOT'//errMsg(sourcefile, __LINE__)) end if + tmp_file_array(1) = stream_fldFileName_zendersoilerod + tmp_file_array(2) = stream_meshfile_zendersoilerod + tmp_file_array(3) = zendersoilerod_mapalgo if ( trim(zender_soil_erod_source) == 'lnd' )then - if ( len_trim(stream_meshfile_zendersoilerod) == 0 )then - call endrun(msg=' ERROR stream_meshfile_zendersoilerod must be set when Zender_2003 is being used and zender_soil_erod_source is lnd'//errMsg(sourcefile, __LINE__)) - end if - if ( len_trim(stream_meshfile_zendersoilerod) == 0 )then - call endrun(msg=' ERROR stream_meshfile_zendersoilerod must be set when Zender_2003 is being used and zender_soil_erod_source is lnd'//errMsg(sourcefile, __LINE__)) - end if + do i = 1, size(tmp_file_array) + if ( len_trim(tmp_file_array(i)) == 0 )then + call endrun(msg=' ERROR '//trim(tmp_file_array(i)//' must be set when Zender_2003 is being used and zender_soil_erod_source is lnd'//errMsg(sourcefile, __LINE__)) + end if + end do + else + do i = 1, size(tmp_file_array) + if ( len_trim(tmp_file_array(i)) > 0 )then + call endrun(msg=' ERROR '//trim(tmp_file_array(i)//' is set and MUST iNOT be when Zender_2003 is NOT being used or zender_soil_erod_source is atm'//errMsg(sourcefile, __LINE__)) + end if + end do end if this%stream_fldFileName_zendersoilerod = stream_fldFileName_zendersoilerod this%stream_meshfile_zendersoilerod = stream_meshfile_zendersoilerod - this%zendersoilerod_mapalgo = zendersoilerod_mapalgo + this%zendersoilerod_mapalgo = zendersoilerod_mapalgo this%zender_soil_erod_source = zender_soil_erod_source end subroutine ReadNML From b66c1f06e6d10d7f6b7ff627684c827c2424e5af Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 26 Feb 2024 18:54:14 -0700 Subject: [PATCH 28/77] Fix issue so will compile --- src/cpl/share_esmf/ZenderSoilErodStreamType.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index 11ae162d1e..1755a32f76 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -345,13 +345,13 @@ subroutine ReadNML(this, bounds, NLFilename) if ( trim(zender_soil_erod_source) == 'lnd' )then do i = 1, size(tmp_file_array) if ( len_trim(tmp_file_array(i)) == 0 )then - call endrun(msg=' ERROR '//trim(tmp_file_array(i)//' must be set when Zender_2003 is being used and zender_soil_erod_source is lnd'//errMsg(sourcefile, __LINE__)) + call endrun(msg=' ERROR '//trim(tmp_file_array(i))//' must be set when Zender_2003 is being used and zender_soil_erod_source is lnd'//errMsg(sourcefile, __LINE__)) end if end do else do i = 1, size(tmp_file_array) if ( len_trim(tmp_file_array(i)) > 0 )then - call endrun(msg=' ERROR '//trim(tmp_file_array(i)//' is set and MUST iNOT be when Zender_2003 is NOT being used or zender_soil_erod_source is atm'//errMsg(sourcefile, __LINE__)) + call endrun(msg=' ERROR '//trim(tmp_file_array(i))//' is set and MUST iNOT be when Zender_2003 is NOT being used or zender_soil_erod_source is atm'//errMsg(sourcefile, __LINE__)) end if end do end if From 23eb33be6eb1a3f681d4492f4376ac816959446f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 26 Feb 2024 19:09:24 -0700 Subject: [PATCH 29/77] Add comment about dust_emis_method --- src/main/controlMod.F90 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index b3120c353a..d8a0eb6fea 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -205,7 +205,13 @@ subroutine control_init(dtime) crop_fsat_equals_zero, for_testing_run_ncdiopio_tests, & for_testing_use_second_grain_pool, for_testing_use_repr_structure_pool, & for_testing_no_crop_seed_replenishment, & - z0param_method, use_z0m_snowmelt, dust_emis_method + z0param_method, use_z0m_snowmelt + + ! NOTE: EBK 02/26/2024: dust_emis_method is here in CTSM temporarily until it's moved to CMEPS + ! See: https://github.com/ESCOMP/CMEPS/pull/429 + ! Normally this should also need error checking and a broadcast, but since + ! there is only one hardcoded option right now that is unneeded. + namelist /clm_inparm/ dust_emis_method ! vertical soil mixing variables namelist /clm_inparm/ & From cd005b3c548e69c019c3262322c0e6de107c5dfa Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 27 Feb 2024 14:51:23 -0700 Subject: [PATCH 30/77] Add some Zender soil eroditability tests for izumi, and a 1-degree CLM4 test for Derecho --- cime_config/testdefs/testlist_clm.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index d602e25413..8359217e65 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -55,15 +55,26 @@ + + + + + + + + + + + From 9dc57dad549ff537bf1e65f16aa9baac49d6179b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 28 Feb 2024 14:39:28 -0700 Subject: [PATCH 31/77] Change izumi_nag test to izumi_gnu because non-DEBUG tests don't build on izumi --- cime_config/testdefs/testlist_clm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 8359217e65..90f8b4a6a7 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -55,7 +55,7 @@ - + @@ -74,7 +74,7 @@ - + From f5168f9a995dbe37d57bf31e0284ea98e35d5754 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 22 Mar 2024 16:38:54 -0600 Subject: [PATCH 32/77] Fix ordering so that array is allocated properly --- src/cpl/share_esmf/ZenderSoilErodStreamType.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index 1755a32f76..0d5a7653dc 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -90,8 +90,8 @@ subroutine Init(this, bounds, NLFilename) character(len=*), parameter :: stream_name = 'zendersoilerod' !----------------------------------------------------------------------- - call this%InitAllocate( bounds ) call control%ReadNML( bounds, NLFileName ) + call this%InitAllocate( bounds ) if ( this%useStreams() )then ! is this a namelist input and is it set in namelist default From 67bbf59cd7bbf1b03ed979989723effaf027ab7d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 22 Mar 2024 17:46:42 -0600 Subject: [PATCH 33/77] Add some error checking that would have caught the previous problem --- src/cpl/share_esmf/ZenderSoilErodStreamType.F90 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index 0d5a7653dc..1dfe899700 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -45,7 +45,8 @@ module ZenderSoilErodStreamType character(len=CL) :: zender_soil_erod_source ! if calculed in lnd or atm character(len=CL) :: stream_fldFileName_zendersoilerod ! data Filename character(len=CL) :: stream_meshfile_zendersoilerod ! mesh Filename - character(len=CL) :: zendersoilerod_mapalgo ! map algo + character(len=CL) :: zendersoilerod_mapalgo ! map algo + logical :: namelist_set = .false. ! if namelist was set yet contains procedure, private :: ReadNML ! Read in namelist end type streamcontrol_type @@ -182,6 +183,9 @@ logical function UseStreams(this) class(soil_erod_stream_type) :: this ! ! !LOCAL VARIABLES: + if ( .not. control%namelist_set )then + call endrun(msg=' ERROR namelist NOT set before being used'//errMsg(sourcefile, __LINE__)) + end if if ( (trim(dust_emis_method) == 'Zender_2003') .and. (control%zender_soil_erod_source == "lnd") )then UseStreams = .true. else @@ -360,6 +364,8 @@ subroutine ReadNML(this, bounds, NLFilename) this%zendersoilerod_mapalgo = zendersoilerod_mapalgo this%zender_soil_erod_source = zender_soil_erod_source + this%namelist_set = .true. + end subroutine ReadNML end module ZenderSoilErodStreamType From 1d64435838e78e331df7ec6030ae6d09b81600fc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 25 Mar 2024 12:40:38 -0600 Subject: [PATCH 34/77] Remove uneeded comment, and add a TODO from the code review --- src/cpl/share_esmf/ZenderSoilErodStreamType.F90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index 1dfe899700..73c93a5b92 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -157,13 +157,16 @@ subroutine Init(this, bounds, NLFilename) if (trim(stream_varnames(n)) == 'mbl_bsn_fct_geo') then ig = 0 do g = bounds%begg,bounds%endg - ig = ig+1 ! not sure why +1 is needed but it's okay + ig = ig+1 this%soil_erodibility(g) = dataptr1d(ig) end do end if end do + ! TODO: EBK 03/25/2024: When shr_strdata adds a clean method we should invoke it here to save memory + ! This is talked about in https://github.com/ESCOMP/CDEPS/issues/261 + end if end subroutine Init From 36bfba6e821f48948b6486269a1621fab894b72a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 25 Mar 2024 13:02:36 -0600 Subject: [PATCH 35/77] Remove trailing whitespace --- src/cpl/share_esmf/ZenderSoilErodStreamType.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 index 73c93a5b92..194e022132 100644 --- a/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 +++ b/src/cpl/share_esmf/ZenderSoilErodStreamType.F90 @@ -13,7 +13,7 @@ module ZenderSoilErodStreamType ! with the other files. ! ! !USES - use ESMF , only : ESMF_LogFoundError, ESMF_LOGERR_PASSTHRU, ESMF_Finalize, ESMF_END_ABORT + use ESMF , only : ESMF_LogFoundError, ESMF_LOGERR_PASSTHRU, ESMF_Finalize, ESMF_END_ABORT use dshr_strdata_mod , only : shr_strdata_type use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_cl use shr_log_mod , only : errMsg => shr_log_errMsg @@ -53,7 +53,7 @@ module ZenderSoilErodStreamType type(streamcontrol_type), private :: control ! Stream control data - character(len=*), parameter, private :: sourcefile = & + character(len=*), parameter, private :: sourcefile = & __FILE__ !============================================================================== @@ -148,7 +148,7 @@ subroutine Init(this, bounds, NLFilename) end if ! Get pointer for stream data that is time and spatially interpolate to model time and grid - do n = 1,size(stream_varnames) + do n = 1,size(stream_varnames) call dshr_fldbun_getFldPtr(sdat_erod%pstrm(1)%fldbun_model, stream_varnames(n), fldptr1=dataptr1d, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) then write(iulog,*) 'Error on get field pointer -- see PET*.ESMF_LogFile(s)' @@ -248,7 +248,7 @@ subroutine CalcDustSource(this, bounds, soil_erod) !integer :: g, c, fc ! Indices integer :: g, p, fp, l, c ! Indices !real(r8) :: z0s ! smooth roughness length (m) - + ! constants real(r8),parameter :: soil_erod_threshold = 0.1_r8 ! CAM soil erodibility threshold; below threshold -> soil_erod = 0_r8 11 Mar 2023 !--------------------------------------------------------------------- @@ -268,10 +268,10 @@ subroutine CalcDustSource(this, bounds, soil_erod) if (this%soil_erodibility(g) .lt. soil_erod_threshold ) then soil_erod(c) = 0._r8 - else + else soil_erod(c) = this%soil_erodibility(g) end if - + end if end do From 7943f8d3b0d2cf56efe2f840756552f6c05d49d0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 25 Mar 2024 13:07:12 -0600 Subject: [PATCH 36/77] Another trailing blank --- src/main/controlMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index cc56cb8d59..dc9622ddac 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -205,7 +205,7 @@ subroutine control_init(dtime) crop_fsat_equals_zero, for_testing_run_ncdiopio_tests, & for_testing_use_second_grain_pool, for_testing_use_repr_structure_pool, & for_testing_no_crop_seed_replenishment, & - z0param_method, use_z0m_snowmelt + z0param_method, use_z0m_snowmelt ! NOTE: EBK 02/26/2024: dust_emis_method is here in CTSM temporarily until it's moved to CMEPS ! See: https://github.com/ESCOMP/CMEPS/pull/429 From 20e3fe9bac504a336107b165ab13f1d09fc7d595 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 25 Mar 2024 13:08:52 -0600 Subject: [PATCH 37/77] More trailing whitspace --- bld/CLMBuildNamelist.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index f62a16ffa1..fd8def8845 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -1266,7 +1266,7 @@ sub setup_cmdl_simulation_year { sub setup_cmdl_run_type { my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; # Set the clm_start_type and the st_year, start year - # This MUST be done after lnd_tuning_mode is set + # This MUST be done after lnd_tuning_mode is set my $val; my $var = "clm_start_type"; @@ -3975,7 +3975,7 @@ sub setup_logic_dust_emis { my $dust_emis_method = remove_leading_and_trailing_quotes( $nl->get_value($var) ); - my @zender_files_in_lnd_opts = ( "stream_fldfilename_zendersoilerod", "stream_meshfile_zendersoilerod", + my @zender_files_in_lnd_opts = ( "stream_fldfilename_zendersoilerod", "stream_meshfile_zendersoilerod", "zendersoilerod_mapalgo" ); if ( $dust_emis_method eq "Zender_2003" ) { # get the zender_soil_erod_source From b63459e6a50e00d67f56663b70781b09a6b18144 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 25 Mar 2024 14:21:41 -0600 Subject: [PATCH 38/77] Correct number of tests --- bld/unit_testers/build-namelist_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl index 76612736be..f207053924 100755 --- a/bld/unit_testers/build-namelist_test.pl +++ b/bld/unit_testers/build-namelist_test.pl @@ -166,7 +166,7 @@ sub cat_and_create_namelistinfile { my $ntests = 1611; if ( defined($opts{'compare'}) ) { - $ntests += 1145; + $ntests += 945; } plan( tests=>$ntests ); From 296a00eeae9840a61f06a9fa6eeabaa211d382cb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 26 Mar 2024 10:17:21 -0600 Subject: [PATCH 39/77] Remove a bunch of uneeded settings for initial conditions and use_init_interp, this gets the ERI_D.ne30pg3_t232.I1850Clm51BgcCrop.derecho_intel.clm-clm51cam6LndTuningMode test giving identical answers as baseline --- bld/namelist_files/namelist_defaults_ctsm.xml | 68 +++---------------- 1 file changed, 10 insertions(+), 58 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 682955b204..a01839836d 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -665,15 +665,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -.true. -.true. -.true. -.true. -.true. -.true. -.true. -.true. -.true. +.true. .true. -.true. -.true. -.true. -.true. -.true. -.true. +.true. +.true. .true. .true. .true. -.false. -.false. -.false. -.false. -.false. -.false. + +.false. +.false. +.false. +.false. +.false. +.false. .false. hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.false. glc_nec=10 do_transient_pfts=.false. @@ -797,14 +781,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false. -hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false. - - -hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false. - - hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_crop=.true. irrigate=.true. glc_nec=10 do_transient_pfts=.false. @@ -1038,18 +1014,6 @@ attributes from the config_cache.xml file (with keys converted to upper-case). lnd_tuning_mode="clm5_1_GSWP3v1" >lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c200428.nc -lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c200428.nc - -lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c200428.nc - lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c190312.nc -lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c190312.nc - -lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c190312.nc - From b01fbb5312f6e6c9dc1332d542b9180573e56955 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 26 Mar 2024 12:02:22 -0600 Subject: [PATCH 40/77] Change compilers up for ZDustSoilErod tests a bit, and make sure there is a izumi_nag test --- cime_config/testdefs/testlist_clm.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 3209068d46..8354a40c60 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -73,8 +73,8 @@ - - + + @@ -85,6 +85,7 @@ + From ef7de616b8c6028fc8f3e19ef1389d1c4ea060bf Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Wed, 27 Mar 2024 04:35:17 -0600 Subject: [PATCH 41/77] changes needed for adding a dglc --- cime_config/buildnml | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 84e1581406..9420741ee5 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -60,6 +60,7 @@ def buildnml(case, caseroot, compname): run_reftod = case.get_value("RUN_REFTOD") glc_nec = case.get_value("GLC_NEC") cism_use_antarctica = case.get_value("CISM_USE_ANTARCTICA") + dglc_use_antarctica = case.get_value("DGLC_USE_ANTARCTICA") mask = case.get_value("MASK_GRID") driver = case.get_value("COMP_INTERFACE").lower() @@ -153,20 +154,30 @@ def buildnml(case, caseroot, compname): else: nomeg = "" - if cism_use_antarctica is None: - # This is the case for compsets without CISM, where the CISM_USE_ANTARCTICA xml - # variable isn't defined + + glc_use_antarctica = cism_use_antarctica + if glc_use_antarctica is None: + glc_use_antarctica = dglc_use_antarctica + if glc_use_antarctica is None: + # This is the case for compsets without CISM or DGLC, where the + # CISM_USE_ANTARCTICA and DGLC_USE_ANTARCTICA xml variables are not defined glc_use_antarctica_flag = "" - elif isinstance(cism_use_antarctica, bool): - if cism_use_antarctica: + elif isinstance(glc_use_antarctica, bool): + if glc_use_antarctica: glc_use_antarctica_flag = "-glc_use_antarctica" else: glc_use_antarctica_flag = "" else: - expect( - False, - "Unexpected value for CISM_USE_ANTARCTICA: {}".format(cism_use_antarctica), - ) + if cism_use_antarctia: + expect( + False, + "Unexpected value for CISM_USE_ANTARCTICA: {}".format(cism_use_antarctica), + ) + else: + expect( + False, + "Unexpected value for DGLC_USE_ANTARCTICA: {}".format(dglc_use_antarctica), + ) if clm_nml_use_case != "UNSET": usecase = "-use_case %s" % clm_nml_use_case From 29f5bbb8bd7f5941c86340e7eaab394d1cf97b4c Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 1 Apr 2024 11:07:30 -0600 Subject: [PATCH 42/77] reformat using black --- cime_config/buildnml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index d2e7ddc886..fd40a6e05a 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -27,6 +27,7 @@ _config_cache_template = """ """ + ############################################################################### def buildnml(case, caseroot, compname): ############################################################################### @@ -97,7 +98,9 @@ def buildnml(case, caseroot, compname): clm_phys = case.get_value("CLM_PHYSICS_VERSION") config_cache_text = _config_cache_template.format(clm_phys=clm_phys) - config_cache_path = os.path.join(caseroot, "Buildconf", compname + "conf", "config_cache.xml") + config_cache_path = os.path.join( + caseroot, "Buildconf", compname + "conf", "config_cache.xml" + ) with open(config_cache_path, "w") as config_cache_file: config_cache_file.write(config_cache_text) @@ -154,7 +157,6 @@ def buildnml(case, caseroot, compname): else: nomeg = "" - glc_use_antarctica = cism_use_antarctica if glc_use_antarctica is None: glc_use_antarctica = dglc_use_antarctica @@ -171,12 +173,16 @@ def buildnml(case, caseroot, compname): if cism_use_antarctia: expect( False, - "Unexpected value for CISM_USE_ANTARCTICA: {}".format(cism_use_antarctica), + "Unexpected value for CISM_USE_ANTARCTICA: {}".format( + cism_use_antarctica + ), ) else: expect( False, - "Unexpected value for DGLC_USE_ANTARCTICA: {}".format(dglc_use_antarctica), + "Unexpected value for DGLC_USE_ANTARCTICA: {}".format( + dglc_use_antarctica + ), ) if clm_nml_use_case != "UNSET": @@ -212,7 +218,9 @@ def buildnml(case, caseroot, compname): lndfrac_file = os.path.join(lnd_domain_path, lnd_domain_file) lndfrac_setting = "-lnd_frac " + lndfrac_file - config_cache_file = os.path.join(caseroot, "Buildconf", compname + "conf", "config_cache.xml") + config_cache_file = os.path.join( + caseroot, "Buildconf", compname + "conf", "config_cache.xml" + ) # ----------------------------------------------------- # Clear out old data @@ -227,7 +235,6 @@ def buildnml(case, caseroot, compname): ninst = int(ninst_lnd) for inst_counter in range(1, ninst + 1): - # determine instance string inst_string = "" if ninst > 1: @@ -275,7 +282,9 @@ def buildnml(case, caseroot, compname): break if not os.path.exists(os.path.join(rundir, clm_startfile)): - logger.warning("WARNING: Could NOT find a start file to use using" + clm_startfile) + logger.warning( + "WARNING: Could NOT find a start file to use using" + clm_startfile + ) clm_icfile = "%s = '%s'" % (startfile_type, clm_startfile) else: clm_icfile = "" @@ -286,7 +295,9 @@ def buildnml(case, caseroot, compname): user_nl_file = os.path.join(caseroot, "user_nl_clm" + inst_string) namelist_infile = os.path.join(ctsmconf, "namelist") - create_namelist_infile(case, user_nl_file, namelist_infile, "\n".join(infile_lines)) + create_namelist_infile( + case, user_nl_file, namelist_infile, "\n".join(infile_lines) + ) cmd = os.path.join(lnd_root, "bld", "build-namelist") @@ -349,7 +360,6 @@ def buildnml(case, caseroot, compname): ############################################################################### def _main_func(): - caseroot = parse_input(sys.argv) with Case(caseroot) as case: compname = case.get_value("COMP_LND") From bedafa385478b0bfc0c55b06932f52cc074dd8e2 Mon Sep 17 00:00:00 2001 From: Mariana Vertenstein Date: Mon, 1 Apr 2024 11:15:36 -0600 Subject: [PATCH 43/77] refactored the use of GLC_USE_ANTARCTICA --- cime_config/buildnml | 47 ++++++++++++-------------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index fd40a6e05a..d4106e970c 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -27,7 +27,6 @@ _config_cache_template = """ """ - ############################################################################### def buildnml(case, caseroot, compname): ############################################################################### @@ -60,8 +59,7 @@ def buildnml(case, caseroot, compname): run_refdate = case.get_value("RUN_REFDATE") run_reftod = case.get_value("RUN_REFTOD") glc_nec = case.get_value("GLC_NEC") - cism_use_antarctica = case.get_value("CISM_USE_ANTARCTICA") - dglc_use_antarctica = case.get_value("DGLC_USE_ANTARCTICA") + glc_use_antarctica = case.get_value("GLC_USE_ANTARCTICA") mask = case.get_value("MASK_GRID") driver = case.get_value("COMP_INTERFACE").lower() @@ -98,9 +96,7 @@ def buildnml(case, caseroot, compname): clm_phys = case.get_value("CLM_PHYSICS_VERSION") config_cache_text = _config_cache_template.format(clm_phys=clm_phys) - config_cache_path = os.path.join( - caseroot, "Buildconf", compname + "conf", "config_cache.xml" - ) + config_cache_path = os.path.join(caseroot, "Buildconf", compname + "conf", "config_cache.xml") with open(config_cache_path, "w") as config_cache_file: config_cache_file.write(config_cache_text) @@ -157,12 +153,9 @@ def buildnml(case, caseroot, compname): else: nomeg = "" - glc_use_antarctica = cism_use_antarctica - if glc_use_antarctica is None: - glc_use_antarctica = dglc_use_antarctica if glc_use_antarctica is None: - # This is the case for compsets without CISM or DGLC, where the - # CISM_USE_ANTARCTICA and DGLC_USE_ANTARCTICA xml variables are not defined + # This is the case for compsets with SGLC where the GLC_USE_ANTARCTICA xml + # variable isn't defined glc_use_antarctica_flag = "" elif isinstance(glc_use_antarctica, bool): if glc_use_antarctica: @@ -170,20 +163,10 @@ def buildnml(case, caseroot, compname): else: glc_use_antarctica_flag = "" else: - if cism_use_antarctia: - expect( - False, - "Unexpected value for CISM_USE_ANTARCTICA: {}".format( - cism_use_antarctica - ), - ) - else: - expect( - False, - "Unexpected value for DGLC_USE_ANTARCTICA: {}".format( - dglc_use_antarctica - ), - ) + expect( + False, + "Unexpected value for GLC_USE_ANTARCTICA: {}".format(glc_use_antarctica), + ) if clm_nml_use_case != "UNSET": usecase = "-use_case %s" % clm_nml_use_case @@ -218,9 +201,7 @@ def buildnml(case, caseroot, compname): lndfrac_file = os.path.join(lnd_domain_path, lnd_domain_file) lndfrac_setting = "-lnd_frac " + lndfrac_file - config_cache_file = os.path.join( - caseroot, "Buildconf", compname + "conf", "config_cache.xml" - ) + config_cache_file = os.path.join(caseroot, "Buildconf", compname + "conf", "config_cache.xml") # ----------------------------------------------------- # Clear out old data @@ -235,6 +216,7 @@ def buildnml(case, caseroot, compname): ninst = int(ninst_lnd) for inst_counter in range(1, ninst + 1): + # determine instance string inst_string = "" if ninst > 1: @@ -282,9 +264,7 @@ def buildnml(case, caseroot, compname): break if not os.path.exists(os.path.join(rundir, clm_startfile)): - logger.warning( - "WARNING: Could NOT find a start file to use using" + clm_startfile - ) + logger.warning("WARNING: Could NOT find a start file to use using" + clm_startfile) clm_icfile = "%s = '%s'" % (startfile_type, clm_startfile) else: clm_icfile = "" @@ -295,9 +275,7 @@ def buildnml(case, caseroot, compname): user_nl_file = os.path.join(caseroot, "user_nl_clm" + inst_string) namelist_infile = os.path.join(ctsmconf, "namelist") - create_namelist_infile( - case, user_nl_file, namelist_infile, "\n".join(infile_lines) - ) + create_namelist_infile(case, user_nl_file, namelist_infile, "\n".join(infile_lines)) cmd = os.path.join(lnd_root, "bld", "build-namelist") @@ -360,6 +338,7 @@ def buildnml(case, caseroot, compname): ############################################################################### def _main_func(): + caseroot = parse_input(sys.argv) with Case(caseroot) as case: compname = case.get_value("COMP_LND") From 4d7b4881b25979a85f37a58e2602dbcdb1fe8d73 Mon Sep 17 00:00:00 2001 From: mvdebolskiy Date: Tue, 2 Apr 2024 12:58:57 +0200 Subject: [PATCH 44/77] make black happy --- cime_config/buildnml | 1 + 1 file changed, 1 insertion(+) diff --git a/cime_config/buildnml b/cime_config/buildnml index d4106e970c..f09c45e703 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -27,6 +27,7 @@ _config_cache_template = """ """ + ############################################################################### def buildnml(case, caseroot, compname): ############################################################################### From a69456eb1254e28b19df1c7ed6d531c50d1206b5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 3 Apr 2024 16:43:25 -0600 Subject: [PATCH 45/77] Update cism tag --- Externals.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals.cfg b/Externals.cfg index c09bd4041e..185f412cab 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -8,7 +8,7 @@ required = True local_path = components/cism protocol = git repo_url = https://github.com/ESCOMP/CISM-wrapper -tag = cismwrap_2_1_97 +tag = cismwrap_2_1_99 externals = Externals_CISM.cfg required = True From 5d06a722ade2c951b1d936cd265946a8bd6d1df8 Mon Sep 17 00:00:00 2001 From: Adrianna Foster Date: Thu, 4 Apr 2024 16:36:08 -0600 Subject: [PATCH 46/77] add new expected fails --- cime_config/testdefs/ExpectedTestFails.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 8a18fc2901..a510f38545 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -113,6 +113,21 @@ #2373 + + + + FAIL + #2453 + + + + + + FAIL + #2454 + + + From 8704598bf3b3cb59430fe5781acfabee7f79696e Mon Sep 17 00:00:00 2001 From: Adrianna Foster Date: Thu, 4 Apr 2024 18:25:49 -0600 Subject: [PATCH 47/77] change izumi test to f10 --- cime_config/testdefs/testlist_clm.xml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 8354a40c60..2b8048a64d 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -85,12 +85,20 @@ - + + + + + + + + + From e54f08adf41301d7090416fe014a244d2c6f4564 Mon Sep 17 00:00:00 2001 From: Adrianna Foster Date: Thu, 4 Apr 2024 18:52:23 -0600 Subject: [PATCH 48/77] update changelog --- doc/ChangeLog | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 67 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index f822c5a72e..d58d7150dd 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,70 @@ =============================================================== +Tag name: ctsm5.1.dev176 +Originator(s): afoster (Adrianna Foster,UCAR/TSS,303-497-1728) +Date: Thu 04 Apr 2024 06:29:36 PM MDT +One-line Summary: Merge b4b-dev + +Purpose and description of changes +---------------------------------- + +change needed for the addition of a dglc component in cdeps #2449 +Move the dust emission source function soil erodibility for the Zender scheme from CAM to CTSM #1967 + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed +---------- +[Remove any lines that don't apply. Remove entire section if nothing applies.] + +CTSM issues fixed (include CTSM Issue #): +Closes #2222 - Fixing Negative Ice Fluxes from Ocean to Glacier +Closes #2117 - Add LND_TUNING_MODE for CAM4, CAM5, CAM7 +Addresses #2149 - Change handling of LND_TUNING_MODE so user is warned of which option is used, add more supported options +Addresses part of #1836 - Move the soil erodibility dataset dust emission source function from CAM to CTSM +Helps with ESCOMP/CAM#651 - Move the dust emission source function and global tuning factor from CAM to CTSM + +Known bugs introduced in this tag (include issue #): + +Notes of particular relevance for users +--------------------------------------- + +Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): new namelist options for dust + + +Testing summary: +---------------- + + build-namelist tests (if CLMBuildNamelist.pm has changed): + + derecho - PASS + + regular tests + + derecho ----- OK + izumi ------- OK + +Pull Requests that document the changes (include PR ids): +(https://github.com/ESCOMP/ctsm/pull): + +https://github.com/ESCOMP/CTSM/pull/2455 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev175 Originator(s): slevis (Samuel Levis,UCAR/TSS,303-665-1310) Date: Thu 21 Mar 2024 05:49:04 PM MDT diff --git a/doc/ChangeSum b/doc/ChangeSum index e8c32d90a8..2464a4980f 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev176 afoster 04/04/2024 Merge b4b-dev ctsm5.1.dev175 slevis 03/21/2024 merge-b4bdev-20240321 ctsm5.1.dev174 olyson 03/14/2024 Improve vegetation health at high latitudes ctsm5.1.dev173 rgknox 03/13/2024 New FATES namelist variable: fates_history_dimlevel From b32df77723fe9d7e5f86aa886804799a6cf827a2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Apr 2024 13:44:29 -0600 Subject: [PATCH 49/77] Put new ctsm5.2 finidat files in initdata_esmf/ctsm5.2 directory --- bld/namelist_files/namelist_defaults_ctsm.xml | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 47273636f4..db36e222b5 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -439,7 +439,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). -lnd/clm2/paramdata/ctsm51_params.c240208.nc +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 @@ -959,7 +959,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="18500101" sim_year="1850" do_transient_pfts=".false." ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".false." lnd_tuning_mode="clm5_0_GSWP3v1" ->lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c240223.nc +>lnd/clm2/initdata_esmf/ctsm5.2/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c240223.nc @@ -967,7 +967,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="18500101" sim_year="1850" do_transient_pfts=".false." ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".false." lnd_tuning_mode="clm5_0_CRUv7" ->lnd/clm2/initdata_map/clmi.I1850Clm50BgcCropCru-ciso.1526-01-01.0.9x1.25_gx1v7_simyr1850_c240223.nc +>lnd/clm2/initdata_esmf/ctsm5.2/clmi.I1850Clm50BgcCropCru-ciso.1526-01-01.0.9x1.25_gx1v7_simyr1850_c240223.nc @@ -996,7 +996,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="18500101" sim_year="1850" do_transient_pfts=".false." ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".false." lnd_tuning_mode="clm5_1_GSWP3v1" ->lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c240223.nc +>lnd/clm2/initdata_esmf/ctsm5.2/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c240223.nc @@ -1018,7 +1018,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="18500101" sim_year="1850" do_transient_pfts=".false." ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".false." lnd_tuning_mode="clm6_0_GSWP3v1" ->lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c240223.nc +>lnd/clm2/initdata_esmf/ctsm5.2/clmi.I1850Clm50BgcCrop-ciso.1366-01-01.0.9x1.25_gx1v7_simyr1850_c240223.nc @@ -1039,7 +1039,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="20110101" sim_year="2000" do_transient_pfts=".false." ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".true." lnd_tuning_mode="clm4_5_GSWP3v1" ->lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c240223.nc +>lnd/clm2/initdata_esmf/ctsm5.2/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c240223.nc @@ -1047,7 +1047,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="20110101" sim_year="2000" do_transient_pfts=".false." ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".true." lnd_tuning_mode="clm4_5_CRUv7" ->lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c240223.nc +>lnd/clm2/initdata_esmf/ctsm5.2/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c240223.nc @@ -1055,19 +1055,19 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="20110101" sim_year="2000" do_transient_pfts=".false." ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".true." lnd_tuning_mode="clm5_0_GSWP3v1" ->lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c240223.nc +>lnd/clm2/initdata_esmf/ctsm5.2/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c240223.nc lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c240223.nc +>lnd/clm2/initdata_esmf/ctsm5.2/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c240223.nc lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c240223.nc +>lnd/clm2/initdata_esmf/ctsm5.2/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c240223.nc @@ -1076,7 +1076,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). ic_ymd="20110101" sim_year="2000" do_transient_pfts=".false." ic_tod="0" glc_nec="10" use_crop=".true." irrigate=".true." lnd_tuning_mode="clm5_0_CRUv7" ->lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c240223.nc +>lnd/clm2/initdata_esmf/ctsm5.2/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c240223.nc From ec9af2d713fb680f255236ae31163be5dee9f61c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Apr 2024 13:54:52 -0600 Subject: [PATCH 50/77] Just update mksurfdata_map to mksurfdata_esmf using VS code --- doc/source/lilac/specific-atm-models/wrf-tools.rst | 4 ++-- .../CLM50_Tech_Note_Transient_Landcover.rst | 8 ++++---- doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst | 2 +- .../running-PTCLM/adding-ptclm-site-data.rst | 2 +- .../running-single-point-configurations.rst | 6 +++--- .../running-special-cases/Running-with-irrigation.rst | 2 +- .../using-clm-tools/building-the-clm-tools.rst | 8 ++++---- .../creating-input-for-surface-dataset-generation.rst | 6 +++--- .../using-clm-tools/creating-surface-datasets.rst | 10 +++++----- .../using-clm-tools/observational-sites-datasets.rst | 2 +- .../using-clm-tools/what-are-the-clm-tools.rst | 8 ++++---- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/doc/source/lilac/specific-atm-models/wrf-tools.rst b/doc/source/lilac/specific-atm-models/wrf-tools.rst index 0366bc1582..f67a05ea0a 100644 --- a/doc/source/lilac/specific-atm-models/wrf-tools.rst +++ b/doc/source/lilac/specific-atm-models/wrf-tools.rst @@ -52,9 +52,9 @@ is described in here. ./gen_domain -m /glade/work/$USER/ctsm/nldas_grid/scrip/wrf2clm_mapping_noneg.nc -o wrf2clm_ocn_noneg -l wrf2clm_lnd_noneg -6. Create surface datasets in ``tools/mksurfdata_map``:: +6. Create surface datasets in ``tools/mksurfdata_esmf``:: - ./mksurfdata.pl -res usrspec -usr_gname "nldas" -usr_gdate "190124" -usr_mapdir "/glade/work/$USER/ctsm/nldas_grid/map" -y 2000 -exedir "/glade/u/home/$USER/src/ctsm/ctsm_surfdata/tools/mksurfdata_map" -no-crop + ./mksurfdata.pl -res usrspec -usr_gname "nldas" -usr_gdate "190124" -usr_mapdir "/glade/work/$USER/ctsm/nldas_grid/map" -y 2000 -exedir "/glade/u/home/$USER/src/ctsm/ctsm_surfdata/tools/mksurfdata_esmf" -no-crop Merge WRF initial conditions into an existing CTSM initial condition file -------------------------------------------------------------------------- diff --git a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst index c221a14d28..99ee5ab676 100644 --- a/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst +++ b/doc/source/tech_note/Transient_Landcover/CLM50_Tech_Note_Transient_Landcover.rst @@ -107,9 +107,9 @@ To represent the LUH2 transient LULCC dataset in CLM5, the annual fractional com To support this translation task the CLM5 Land Use Data tool has been built that extends the methods described in Lawrence et al (2012) to include all the new functionality of CMIP6 and CLM5 LULCC. The tool translates each of the LUH2 land units for a given year into fractional PFT and CFT values based on the current day CLM5 data for the land unit in that grid cell. The current day land unit descriptions are generated from from 1km resolution MODIS, MIRCA2000, ICESAT, AVHRR, SRTM, and CRU climate data products combined with reference year LUH2 land unit data, usually set to 2005. Where the land unit does not exist in a grid cell for the current day, the land unit description is generated from nearest neighbors with an inverse distance weighted search algorithm. -The Land Use Data tool produces raw vegetation, crop, and management data files which are combined with other raw land surface data to produce the CLM5 initial surface dataset and the dynamic *landuse.timeseries* dataset with the CLM5 mksurfdata_map tool. The schematic of this entire process from LUH2 time series and high resolution current day data to the output of CLM5 surface datasets from the mksurfdata_map tool is shown in Figure 21.2. +The Land Use Data tool produces raw vegetation, crop, and management data files which are combined with other raw land surface data to produce the CLM5 initial surface dataset and the dynamic *landuse.timeseries* dataset with the CLM5 mksurfdata_esmf tool. The schematic of this entire process from LUH2 time series and high resolution current day data to the output of CLM5 surface datasets from the mksurfdata_esmf tool is shown in Figure 21.2. -The methodology for creating the CLM5 transient PFT and CFT dataset is based on four steps which are applied across all of the historical and future time series. The first step involves generating the current day descriptions of natural and managed vegetation PFTs at 1km resolution from the global source datasets, and the current day description of crop CFTs at the 10km resolution from the MIRCA 2000 datasets. The second step combines the current day (2005) LUH2 land units with the current day CLM5 PFT and CFT distributions to get CLM5 land unit descriptions in either PFTs or CFTs at the LUH2 resolution of 0.25 degrees. The third step involves combining the LUH2 land unit time series with the CLM5 PFT and CFT descriptions for that land unit to generate the CLM5 raw PFT and CFT time series in the *landuse.timeseries* file. At this point in the process management information in terms of fertilizer, irrigation and wood harvest are added to the CLM5 PFT and CFT data to complete the CLM5 raw PFT and CFT files. The final step is to combine these files with the other raw CLM5 surface data files in the mksurfdata_map tool. +The methodology for creating the CLM5 transient PFT and CFT dataset is based on four steps which are applied across all of the historical and future time series. The first step involves generating the current day descriptions of natural and managed vegetation PFTs at 1km resolution from the global source datasets, and the current day description of crop CFTs at the 10km resolution from the MIRCA 2000 datasets. The second step combines the current day (2005) LUH2 land units with the current day CLM5 PFT and CFT distributions to get CLM5 land unit descriptions in either PFTs or CFTs at the LUH2 resolution of 0.25 degrees. The third step involves combining the LUH2 land unit time series with the CLM5 PFT and CFT descriptions for that land unit to generate the CLM5 raw PFT and CFT time series in the *landuse.timeseries* file. At this point in the process management information in terms of fertilizer, irrigation and wood harvest are added to the CLM5 PFT and CFT data to complete the CLM5 raw PFT and CFT files. The final step is to combine these files with the other raw CLM5 surface data files in the mksurfdata_esmf tool. .. _Figure Schematic of land cover change: @@ -123,8 +123,8 @@ The methodology for creating the CLM5 transient PFT and CFT dataset is based on Schematic of translation of annual LUH2 land units to CLM5 plant and crop functional types. -.. _Figure Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool: +.. _Figure Workflow of CLM5 Land Use Data Tool and mksurfdata_esmf Tool: .. figure:: image3.png - Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool + Workflow of CLM5 Land Use Data Tool and mksurfdata_esmf Tool diff --git a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst index e9bfb5eb57..8777c7be74 100644 --- a/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst +++ b/doc/source/tech_note/Urban/CLM50_Tech_Note_Urban.rst @@ -19,7 +19,7 @@ Present day global urban extent and urban properties were developed by :ref:`Jac For each of 33 distinct regions across the globe, thermal (e.g., heat capacity and thermal conductivity), radiative (e.g., albedo and emissivity) and morphological (e.g., height to width ratio, roof fraction, average building height, and pervious fraction of the canyon floor) properties are provided for each of the density classes. Building interior minimum and maximum temperatures are prescribed based on climate and socioeconomic considerations. The surface dataset creation routines (see CLM5.0 User's Guide) aggregate the data to the desired resolution. -An optional urban properties dataset, including a tool that allows for generating future urban development scenarios is also available (:ref:`Oleson and Feddema (2018) `). This will become the default dataset in future model versions. As described in :ref:`Oleson and Feddema (2018) ` the urban properties dataset in :ref:`Jackson et al. (2010) ` was modified with respect to wall and roof thermal properties to correct for biases in heat transfer due to layer and building type averaging. Further changes to the dataset reflect the need for scenario development, thus allowing for the creation of hypothetical wall types, and the easier interchange of wall facets. The new urban properties tool is available as part of the Toolbox for Human-Earth System Integration & Scaling (THESIS) tool set (http://www.cgd.ucar.edu/iam/projects/thesis/thesis-urbanproperties-tool.html; :ref:`Feddema and Kauffman (2016) `). The driver script (urban_prop.csh) specifies three input csv files (by default, mat_prop.csv, lam_spec.csv, and city_spec.csv; (:numref:`Figure schematic of THESIS urban properties tool`)) that describe the morphological, radiative, and thermal properties of urban areas, and generates a global dataset at 0.05° latitude by longitude in NetCDF format (urban_properties_data.05deg.nc). A standalone NCL routine (gen_data_clm.ncl) can be run separately after the mksurfdata_map tool creates the CLM surface dataset. This creates a supplementary streams file of setpoints for the maximum interior building temperature at yearly time resolution. +An optional urban properties dataset, including a tool that allows for generating future urban development scenarios is also available (:ref:`Oleson and Feddema (2018) `). This will become the default dataset in future model versions. As described in :ref:`Oleson and Feddema (2018) ` the urban properties dataset in :ref:`Jackson et al. (2010) ` was modified with respect to wall and roof thermal properties to correct for biases in heat transfer due to layer and building type averaging. Further changes to the dataset reflect the need for scenario development, thus allowing for the creation of hypothetical wall types, and the easier interchange of wall facets. The new urban properties tool is available as part of the Toolbox for Human-Earth System Integration & Scaling (THESIS) tool set (http://www.cgd.ucar.edu/iam/projects/thesis/thesis-urbanproperties-tool.html; :ref:`Feddema and Kauffman (2016) `). The driver script (urban_prop.csh) specifies three input csv files (by default, mat_prop.csv, lam_spec.csv, and city_spec.csv; (:numref:`Figure schematic of THESIS urban properties tool`)) that describe the morphological, radiative, and thermal properties of urban areas, and generates a global dataset at 0.05° latitude by longitude in NetCDF format (urban_properties_data.05deg.nc). A standalone NCL routine (gen_data_clm.ncl) can be run separately after the mksurfdata_esmf tool creates the CLM surface dataset. This creates a supplementary streams file of setpoints for the maximum interior building temperature at yearly time resolution. .. Figure 12.1. Schematic representation of the urban land unit diff --git a/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst b/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst index d085c2f689..b95831427f 100644 --- a/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst +++ b/doc/source/users_guide/running-PTCLM/adding-ptclm-site-data.rst @@ -38,7 +38,7 @@ There is a mechanism for giving site-specific land-use change in PTCLMmkdata. Ad trans_year,pft_f1,pft_c1,pft_f2,pft_c2,pft_f3,pft_c3,pft_f4,pft_c4,pft_f5,pft_c5,har_vh1,har_vh2,har_sh1,har_sh2,har_sh3,graze,hold_harv,hold_graze -This file only requires a line for each year where a transition or harvest happens. As in the "pftdata" file above "pft_f" refers to the fraction and "pft_c" refers to the PFT index, and only up to five vegetation types are allowed to co-exist. The last eight columns have to do with harvesting and grazing. The last two columns are whether to hold harvesting and/or grazing constant until the next transition year and will just be either 1 or 0. This file will be converted by the **PTCLM_sitedata/cnvrt_trnsyrs2_pftdyntxtfile.pl** script in the PTCLMmkdata directory to a format that **mksurfdata_map** can read that has an entry for each year for the range of years valid for the compset in question. +This file only requires a line for each year where a transition or harvest happens. As in the "pftdata" file above "pft_f" refers to the fraction and "pft_c" refers to the PFT index, and only up to five vegetation types are allowed to co-exist. The last eight columns have to do with harvesting and grazing. The last two columns are whether to hold harvesting and/or grazing constant until the next transition year and will just be either 1 or 0. This file will be converted by the **PTCLM_sitedata/cnvrt_trnsyrs2_pftdyntxtfile.pl** script in the PTCLMmkdata directory to a format that **mksurfdata_esmf** can read that has an entry for each year for the range of years valid for the compset in question. .. _converting-ameriflux-for-ptclmmkdata: diff --git a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst index 8588da8b99..9d2b68456b 100644 --- a/doc/source/users_guide/running-single-points/running-single-point-configurations.rst +++ b/doc/source/users_guide/running-single-points/running-single-point-configurations.rst @@ -152,7 +152,7 @@ Example: Creating a surface dataset for a single point > ./mknoocnmap.pl -p 40,255 -n $GRIDNAME # Set pointer to MAPFILE just created that will be used later > setenv MAPFILE `pwd`/map_${GRIDNAME}_noocean_to_${GRIDNAME}_nomask_aave_da_${CDATE}.nc - # create the mapping files needed by mksurfdata_map. + # create the mapping files needed by mksurfdata_esmf. > cd ../.././mkmapdata > setenv GRIDFILE ../mkmapgrids/SCRIPgrid_${GRIDNAME}_nomask_${CDATE}.nc > ./mkmapdata.sh -r $GRIDNAME -f $GRIDFILE -t regional @@ -167,7 +167,7 @@ Example: Creating a surface dataset for a single point # Save the location where the domain file was created > setenv GENDOM_PATH `pwd` # Finally create the surface dataset - > cd ../../../../lnd/clm/tools/|version|/mksurfdata_map/src + > cd ../../../../lnd/clm/tools/|version|/mksurfdata_esmf/src > gmake > cd .. > ./mksurfdata.pl -r usrspec -usr_gname $GRIDNAME -usr_gdate $CDATE @@ -186,7 +186,7 @@ Example: Setting up a case from the single-point surface dataset just created > ./link_dirtree $CSMDATA $MYCSMDATA # Copy the file you created above to your new $MYCSMDATA location following the CLMUSRDAT # naming convention (leave off the creation date) - > cp $CESMROOT/$CTSMROOT/tools/mksurfdata_map/surfdata_${GRIDNAME}_simyr1850_$CDATE.nc \ + > cp $CESMROOT/$CTSMROOT/tools/mksurfdata_esmf/surfdata_${GRIDNAME}_simyr1850_$CDATE.nc \ $MYCSMDATA/lnd/clm2/surfdata_map/surfdata_${GRIDNAME}_simyr1850.nc > cd $CESMROOT/scripts > ./create_newcase -case my_usernldatasets_test -res CLM_USRDAT -compset I1850Clm50BgcCropCru \ diff --git a/doc/source/users_guide/running-special-cases/Running-with-irrigation.rst b/doc/source/users_guide/running-special-cases/Running-with-irrigation.rst index 12fa76af5b..f19b489731 100644 --- a/doc/source/users_guide/running-special-cases/Running-with-irrigation.rst +++ b/doc/source/users_guide/running-special-cases/Running-with-irrigation.rst @@ -6,7 +6,7 @@ Running with irrigation =================================== -In CLM4.0 irrigation isn't an allowed option. In CLM4.5 irrigation can ONLY be used WITH crop. With CLM5.0 irrigation can be used whether crop is on or not -- **BUT** if crop is off, your surface datasets **HAVE** to have irrigation defined appropriately. Right now *ALL* surface datasets without crop enabled have irrigation hard-wired on. In order to create datasets with irrigation off, you'd need to make changes to ``mksurfdata_map`` in order to have all generic crops to be non-irrigated. To turn on irrigation in |version| we simply add "-irrig on" to ``CLM_BLDNML_OPTS``. +In CLM4.0 irrigation isn't an allowed option. In CLM4.5 irrigation can ONLY be used WITH crop. With CLM5.0 irrigation can be used whether crop is on or not -- **BUT** if crop is off, your surface datasets **HAVE** to have irrigation defined appropriately. Right now *ALL* surface datasets without crop enabled have irrigation hard-wired on. In order to create datasets with irrigation off, you'd need to make changes to ``mksurfdata_esmf`` in order to have all generic crops to be non-irrigated. To turn on irrigation in |version| we simply add "-irrig on" to ``CLM_BLDNML_OPTS``. Example: Irrigation Simulation ------------------------------------------ diff --git a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst index 09725c8afc..95e0333d6d 100644 --- a/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst +++ b/doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst @@ -6,15 +6,15 @@ The CLM FORTRAN tools all have similar makefiles, and similar options for building. The tools **cprnc** and **gen_domain** use the CIME configure/build system which is described in the next section. -The Makefiles (for **mksurfdata_map** and **mkprocdata_map**) use GNU Make extensions and thus require that you use GNU make to use them. They also auto detect the type of platform you are on, using "uname -s" and set the compiler, compiler flags and such accordingly. There are also environment variables that can be set to set things that must be customized. All the tools use NetCDF and hence require the path to the NetCDF libraries and include files. On some platforms (such as Linux) multiple compilers can be used, and hence there are env variables that can be set to change the FORTRAN and/or "C" compilers used. The tools also allow finer control, by also allowing the user to add compiler flags they choose, for both FORTRAN and "C", as well as picking the compiler, linker and and add linker options. Finally the tools allow you to turn optimization on (which is off by default but on for **mksurfdata_map**) with the OPT flag so that the tool will run faster. +The Makefiles (for **mksurfdata_esmf** and **mkprocdata_map**) use GNU Make extensions and thus require that you use GNU make to use them. They also auto detect the type of platform you are on, using "uname -s" and set the compiler, compiler flags and such accordingly. There are also environment variables that can be set to set things that must be customized. All the tools use NetCDF and hence require the path to the NetCDF libraries and include files. On some platforms (such as Linux) multiple compilers can be used, and hence there are env variables that can be set to change the FORTRAN and/or "C" compilers used. The tools also allow finer control, by also allowing the user to add compiler flags they choose, for both FORTRAN and "C", as well as picking the compiler, linker and and add linker options. Finally the tools allow you to turn optimization on (which is off by default but on for **mksurfdata_esmf**) with the OPT flag so that the tool will run faster. -Options used by all: **mksurfdata_map** +Options used by all: **mksurfdata_esmf** - ``LIB_NETCDF`` -- sets the location of the NetCDF library. - ``INC_NETCDF`` -- sets the location of the NetCDF include files. - ``USER_FC`` -- sets the name of the FORTRAN compiler. -Options used by: **mkprocdata_map**, and **mksurfdata_map** +Options used by: **mkprocdata_map**, and **mksurfdata_esmf** - ``MOD_NETCDF`` -- sets the location of the NetCDF FORTRAN module. - ``USER_LINKER`` -- sets the name of the linker to use. @@ -69,7 +69,7 @@ More details on each environment variable. .. warning:: Note, that depending on the compiler answers may be different when SMP is activated. ``OPT`` - This variable flags if compiler optimization should be used when compiling the tool. It can be set to either ``TRUE`` or ``FALSE``, by default it is set to for both **mksurfdata_map** and **mkprocdata_map**. Turning this on should make the tool run much faster. + This variable flags if compiler optimization should be used when compiling the tool. It can be set to either ``TRUE`` or ``FALSE``, by default it is set to for both **mksurfdata_esmf** and **mkprocdata_map**. Turning this on should make the tool run much faster. .. warning:: Note, you should expect that answers will be different when ``OPT`` is activated. diff --git a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst index 276394e2b9..a727631a6c 100644 --- a/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst +++ b/doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst @@ -40,12 +40,12 @@ If you want to create a regular latitude/longitude single-point or regional grid See :numref:`Figure mknoocnmap.pl` for a visual representation of this process. -Creating mapping files for mksurfdata_map +Creating mapping files for mksurfdata_esmf ============================================== ``mkmapdata.sh`` uses the above SCRIP grid input files to create SCRIP mapping data files (uses ESMF). -The bash shell script ``$CTSMROOT/tools/mkmapgrids/mkmapdata.sh`` uses ``ESMF_RegridWeightGen`` to create a list of maps from the raw datasets that are input to ``mksurfdata_map``. Each dataset that has a different grid, or land-mask needs a different mapping file for it, but many different raw datasets share the same grid/land-mask as other files. Hence, there doesn't need to be a different mapping file for EACH raw dataset---just for each raw dataset that has a DIFFERENT grid or land-mask. See :numref:`Figure mkmapdata.sh` for a visual representation of how this works. The bash script figures out which mapping files it needs to create and then runs ``ESMF_RegridWeightGen`` for each one. You can then either enter the datasets into the XML database (see Chapter :numref:`adding-new-resolutions-section`), or leave the files in place and use the ``-res usrspec -usr_gname -usr_gdate`` options to ``mksurfdata_map``. ``mkmapdata.sh`` has a help option with the following +The bash shell script ``$CTSMROOT/tools/mkmapgrids/mkmapdata.sh`` uses ``ESMF_RegridWeightGen`` to create a list of maps from the raw datasets that are input to ``mksurfdata_esmf``. Each dataset that has a different grid, or land-mask needs a different mapping file for it, but many different raw datasets share the same grid/land-mask as other files. Hence, there doesn't need to be a different mapping file for EACH raw dataset---just for each raw dataset that has a DIFFERENT grid or land-mask. See :numref:`Figure mkmapdata.sh` for a visual representation of how this works. The bash script figures out which mapping files it needs to create and then runs ``ESMF_RegridWeightGen`` for each one. You can then either enter the datasets into the XML database (see Chapter :numref:`adding-new-resolutions-section`), or leave the files in place and use the ``-res usrspec -usr_gname -usr_gdate`` options to ``mksurfdata_esmf``. ``mkmapdata.sh`` has a help option with the following :: ../../tools/mkmapdata/mkmapdata.sh @@ -104,4 +104,4 @@ The bash shell script ``$CTSMROOT/tools/mkmapgrids/mkmapdata.sh`` uses ``ESMF_Re Details of running mkmapdata.sh -Each of the raw datasets for ``mksurfdata_map`` needs a mapping file to map from the output grid you are running on to the grid and land-mask for that dataset. This is what ``mkmapdata.sh`` does. To create the mapping files you need a SCRIP grid file to correspond with each resolution and land mask that you have a raw data file in ``mksurfdata_map``. Some raw datasets share the same grid and land mask -- hence they can share the same SCRIP grid file. The output maps created here go into ``mksurfdata_map`` see :numref:`Figure Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool`. +Each of the raw datasets for ``mksurfdata_esmf`` needs a mapping file to map from the output grid you are running on to the grid and land-mask for that dataset. This is what ``mkmapdata.sh`` does. To create the mapping files you need a SCRIP grid file to correspond with each resolution and land mask that you have a raw data file in ``mksurfdata_esmf``. Some raw datasets share the same grid and land mask -- hence they can share the same SCRIP grid file. The output maps created here go into ``mksurfdata_esmf`` see :numref:`Figure Workflow of CLM5 Land Use Data Tool and mksurfdata_esmf Tool`. diff --git a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst index cfaa8527cd..d2e2ef7c89 100644 --- a/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/creating-surface-datasets.rst @@ -14,7 +14,7 @@ When just creating a replacement file for an existing one, the relevant tool sho Data Flow for Creation of Surface Datasets from Raw SCRIP Grid Files -Starting from a SCRIP grid file that describes the grid you will run the model on, you first run ```mkmapdata.sh`` to create a list of mapping files. See :numref:`Figure mkmapdata.sh` for a more detailed view of how ``mkmapdata.sh`` works. The mapping files tell ``mksurfdata_map`` how to map between the output grid and the raw datasets that it uses as input. The output of ``mksurfdata_map`` is a surface dataset that you then use for running the model. See :numref:`Figure Workflow of CLM5 Land Use Data Tool and Mksurfdata_map Tool` for a more detailed view of how ``mksurfdata_map`` works. +Starting from a SCRIP grid file that describes the grid you will run the model on, you first run ```mkmapdata.sh`` to create a list of mapping files. See :numref:`Figure mkmapdata.sh` for a more detailed view of how ``mkmapdata.sh`` works. The mapping files tell ``mksurfdata_esmf`` how to map between the output grid and the raw datasets that it uses as input. The output of ``mksurfdata_esmf`` is a surface dataset that you then use for running the model. See :numref:`Figure Workflow of CLM5 Land Use Data Tool and mksurfdata_esmf Tool` for a more detailed view of how ``mksurfdata_esmf`` works. :numref:`Figure Data_Flow_Legend` is the legend for this figure (:numref:`Figure Data_Flow`) and other figures in this chapter (:numref:`Figure Global-Domain` and :numref:`Figure mknoocnmap.pl`). @@ -26,7 +26,7 @@ Starting from a SCRIP grid file that describes the grid you will run the model o Green arrows define the input to a program, while red arrows define the output. Cylinders define files that are either created by a program or used as input for a program. Boxes are programs. -You start with a description of a SCRIP grid file for your output grid file and then create mapping files from the raw datasets to it. Once, the mapping files are created **mksurfdata_map** is run to create the surface dataset to run the model. +You start with a description of a SCRIP grid file for your output grid file and then create mapping files from the raw datasets to it. Once, the mapping files are created **mksurfdata_esmf** is run to create the surface dataset to run the model. Creating a Complete Set of Files for Input to CLM ------------------------------------------------- @@ -39,13 +39,13 @@ Creating a Complete Set of Files for Input to CLM Next use gen_domain to create a domain file for use by DATM and CLM. This is required, unless a domain file was already created. See the Section called Creating a domain file for CLM and DATM for more information on this. -3. Create mapping files for mksurfdata_map (if NOT already done) +3. Create mapping files for mksurfdata_esmf (if NOT already done) - Create mapping files for mksurfdata_map with mkmapdata.sh in $CTSMROOT/tools/mkmapdata. See the Section called Creating mapping files that mksurfdata_map will use for more information on this. + Create mapping files for mksurfdata_esmf with mkmapdata.sh in $CTSMROOT/tools/mkmapdata. See the Section called Creating mapping files that mksurfdata_esmf will use for more information on this. 4. Create surface datasets - Next use mksurfdata_map to create a surface dataset, using the mapping datasets created on the previous step as input. There is a version for either clm4_0 or |version| for this program. See the Section called Using mksurfdata_map to create surface datasets from grid datasets for more information on this. + Next use mksurfdata_esmf to create a surface dataset, using the mapping datasets created on the previous step as input. There is a version for either clm4_0 or |version| for this program. See the Section called Using mksurfdata_esmf to create surface datasets from grid datasets for more information on this. 5. Enter the new datasets into the build-namelist XML database The last optional thing to do is to enter the new datasets into the build-namelist XML database. See Chapter 3 for more information on doing this. This is optional because the user may enter these files into their namelists manually. The advantage of entering them into the database is so that they automatically come up when you create new cases. diff --git a/doc/source/users_guide/using-clm-tools/observational-sites-datasets.rst b/doc/source/users_guide/using-clm-tools/observational-sites-datasets.rst index 385ec159aa..50a7969281 100644 --- a/doc/source/users_guide/using-clm-tools/observational-sites-datasets.rst +++ b/doc/source/users_guide/using-clm-tools/observational-sites-datasets.rst @@ -6,6 +6,6 @@ Observational Sites Datasets ******************************* -There are two ways to customize datasets for a particular observational site. The first is to customize the input to the tools that create the dataset, and the second is to overwrite the default data after you've created a given dataset. Depending on the tool it might be easier to do it one way or the other. In Table :numref:`reqd-files-table` we list the files that are most likely to be customized and the way they might be customized. Of those files, the ones you are most likely to customize are: ``fatmlndfrc``, ``fsurdat``, ``faerdep`` (for DATM), and ``stream_fldfilename_ndep``. Note ``mksurfdata_map`` as documented previously has options to overwrite the vegetation and soil types. For more information on this also see :ref:`creating-your-own-singlepoint-dataset`. ``PTCLM`` uses these methods to customize datasets; see Chapter :numref:`running-PTCLM`. +There are two ways to customize datasets for a particular observational site. The first is to customize the input to the tools that create the dataset, and the second is to overwrite the default data after you've created a given dataset. Depending on the tool it might be easier to do it one way or the other. In Table :numref:`reqd-files-table` we list the files that are most likely to be customized and the way they might be customized. Of those files, the ones you are most likely to customize are: ``fatmlndfrc``, ``fsurdat``, ``faerdep`` (for DATM), and ``stream_fldfilename_ndep``. Note ``mksurfdata_esmf`` as documented previously has options to overwrite the vegetation and soil types. For more information on this also see :ref:`creating-your-own-singlepoint-dataset`. ``PTCLM`` uses these methods to customize datasets; see Chapter :numref:`running-PTCLM`. Another aspect of customizing your input datasets is customizing the input atmospheric forcing datasets; see :ref:`creating-your-own-singlepoint-dataset` for more information on this. :ref:`converting-ameriflux-for-ptclmmkdata` has information on using the AmeriFlux tower site data as atmospheric forcing. diff --git a/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst b/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst index 6921e4dafd..664e23a220 100644 --- a/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst +++ b/doc/source/users_guide/using-clm-tools/what-are-the-clm-tools.rst @@ -16,7 +16,7 @@ The list of generally important scripts and programs are as follows. #. *./mkmapdata* to create SCRIP mapping data file from SCRIP grid files (uses ESMF). -#. *mksurfdata_map* to create surface datasets from grid datasets (clm4_0 and |version| versions). +#. *mksurfdata_esmf* to create surface datasets from grid datasets (clm4_0 and |version| versions). #. *./mkprocdata_map* to interpolate output unstructured grids (such as the CAM HOMME dy-core "ne" grids like ne30np4) into a 2D regular lat/long grid format that can be plotted easily. Can be used by either clm4_0 or |version|. @@ -26,7 +26,7 @@ The list of generally important scripts and programs are as follows. In the sections to come we will go into detailed description of how to use each of these tools in turn. First, however we will discuss the common environment variables and options that are used by all of the FORTRAN tools. Second, we go over the outline of the entire file creation process for all input files needed by CLM for a new resolution, then we turn to each tool. In the last section we will discuss how to customize files for particular observational sites. -The FORTRAN tools (mksurfdata_map and mkprocdata_map) run, with a namelist (mksurfdata_map) to provide options, or with command line arguments (mkprocdata_map). +The FORTRAN tools (mksurfdata_esmf and mkprocdata_map) run, with a namelist (mksurfdata_esmf) to provide options, or with command line arguments (mkprocdata_map). In the following sections, we will outline how to make these files available for build-namelist so that you can easily create simulations that include them. In the chapter on single-point and regional datasets we also give an alternative way to enter new datasets without having to edit files. @@ -34,12 +34,12 @@ In the following sections, we will outline how to make these files available for Running FORTRAN tools with namelists ------------------------------------ -**mksurfdata_map** runs with a namelist that is read from standard input. Hence, you create a namelist and then run them by redirecting the namelist file into standard input as follows: +**mksurfdata_esmf** runs with a namelist that is read from standard input. Hence, you create a namelist and then run them by redirecting the namelist file into standard input as follows: :: ./program < namelist -There is a sample namelist called ``$CTSMROOT/tools/mksurfdata_map/mksurfdata_map.namleist`` that shows you what the namelist should look like. **mksurfdata_map** also has a script that creates the namelist and runs the program for you. Namelists that you create should be similar to the example namelist. The namelist values are also documented along with the other namelists in the: +There is a sample namelist called ``$CTSMROOT/tools/mksurfdata_esmf/mksurfdata_esmf.namleist`` that shows you what the namelist should look like. **mksurfdata_esmf** also has a script that creates the namelist and runs the program for you. Namelists that you create should be similar to the example namelist. The namelist values are also documented along with the other namelists in the: :: $CTSMROOT/bld/namelist_files/namelist_definition.xml`` file From 91a4906605ab18649655843aa1c12dccae13bb2c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Apr 2024 14:00:40 -0600 Subject: [PATCH 51/77] remove some no longer needed mksurfdata_map settings --- .gitignore | 1 - .../namelist_definition_ctsm.xml | 203 ------------------ 2 files changed, 204 deletions(-) diff --git a/.gitignore b/.gitignore index 5885db2237..9cd97ae20e 100644 --- a/.gitignore +++ b/.gitignore @@ -95,7 +95,6 @@ ctsm.input_data_list.previous /tools/mksurfdata_esmf/mksurfdata_jobscript_single /tools/mksurfdata_esmf/pio_iotype.txt /tools/mksurfdata_esmf/*.sh -/tools/mksurfdata_esmf/mksrf_*.o* /tools/mksurfdata_esmf/tool_bld /tools/mksurfdata_esmf/pio_iotype.txt diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index cfa06dd6f3..73f933d3f6 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -1374,209 +1374,6 @@ Toggle to turn on the dynamic root model Toggle to turn on on diagnostic Snow Radiative Effect - - - - -Output of "git describe" to give the tag/commit the version being used corresponds to - - - -Filename for mksurfdata_map to remap raw data into the output surface dataset - - - -Plant Function Type dataset for mksurfdata - - - -Harvest dataset for mksurfdata - - - -Dataset for percent glacier land-unit for mksurfdata - - - -Dataset for glacier region ID for mksurfdata - - - -Dataset for topography used to define urban threshold - - - -Leaf Area Index dataset for mksurfdata - - - -Soil texture dataset for mksurfdata - - - -Soil color dataset for mksurfdata - - - -Soil max fraction dataset for mksurfdata - - - -High resolution land mask/fraction dataset for mksurfdata -(used for glacier_mec land-units) - - - -Type of grid to create for mksurfdata - - - -Grid file at the output resolution for mksurfdata - - - -Text file with filepaths (or list of XML elements) for vegetation fractions -and harvesting for each year to run over for mksurfdata to be able to model -transient land-use change - - - -High resolution topography dataset for mksurfdata -(used for glacier_mec land-units) - - - -Irrigation dataset for mksurfdata - - - -Organic soil dataset for mksurfdata - - - -Lake water dataset for mksurfdata - - - -Wetland dataset for mksurfdata - - - -Urban dataset for mksurfdata - - - -Biogenic Volatile Organic Compounds (VOC) emissions dataset for mksurfdata - - - -GDP dataset for mksurfdata - - - -Peat dataset for mksurfdata - - - -Soil depth dataset for mksurfdata - - - -Agricultural burning dominant month dataset for mksurfdata - - - -Topography statistics dataset for mksurfdata - - - -VIC parameters dataset for mksurfdata - - - -If TRUE, output variables in double precision for mksurfdata - - - -If TRUE, ignore other files, and set the output percentage to 100% urban and -zero for other land-use types. - - - -If TRUE, set wetland to 0% over land (renormalizing other landcover types as needed); -wetland will only be used for ocean points. - - - -Number of Plant Functional Types (excluding bare-soil) - - - -Plant Function Type index to override global file with for mksurfdata - - - -Plant Function Type fraction to override global file with for mksurfdata - - - -Soil color index to override global file with for mksurfdata - - - -Soil maximum fraction to override global file with for mksurfdata - - - -Soil percent sand to override global file with for mksurfdata - - - -Soil percent clay to override global file with for mksurfdata - - - From c9f13bd4e56efb92d6e10d1050882c4c7d28a587 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Apr 2024 14:24:04 -0600 Subject: [PATCH 52/77] Remove comments about mksurfdata_map --- tools/README | 8 +++++--- tools/README.filecopies | 15 ++++----------- tools/mkprocdata_map/src/Makefile | 4 ++-- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/tools/README b/tools/README index 78a2cccb09..7fc72f04fb 100644 --- a/tools/README +++ b/tools/README @@ -59,7 +59,7 @@ II. Notes on building/running for each of the above tools: so that you can use the debugger, and with bounds-checking, and float trapping on. To speed up do the following... - gmake OPT=TRUE (by default already on for mksurfdata_map) + gmake OPT=TRUE Also some of the tools allow for OpenMP shared memory parallelism (such as mksurfdata) with @@ -78,8 +78,10 @@ II. Notes on building/running for each of the above tools: mksurfdata_esmf has a cime configure and CMake based build using the following files: - CMakeLists.txt -- Tells CMake how to build the source code - Makefile -------- GNU makefile to link the program together + gen_mksurfdata_build.sh - Build mksurfdata_esmf + src/CMakeLists.txt ------ Tells CMake how to build the source code + Makefile ---------------- GNU makefile to link the program together + cmake ------------------- CMake macros for finding libraries mkmapgrids, and site_and_regional only contain scripts so don't have the above build files. diff --git a/tools/README.filecopies b/tools/README.filecopies index 5ab2bc96d1..a96dff1ab7 100644 --- a/tools/README.filecopies +++ b/tools/README.filecopies @@ -1,27 +1,20 @@ tools/README.filecopies May/26/2011 There are several files that are copies of the original files from -either CTSM src/main, cime/src/share/utils, -cime/src/share/unit_test_stubs, or copies from other tool -directories. By having copies the tools can all be made stand-alone, +either CTSM src/utils or src/main, or share/src. +By having copies the tools can all be made stand-alone, but any changes to the originals will have to be put into the tool directories as well. I. Files that are IDENTICAL: - 1. csm_share files copied that should be identical to cime/share/utils: + 1. csm_share files copied that should be identical to share/src: shr_kind_mod.F90 shr_const_mod.F90 - shr_log_mod.F90 - shr_timer_mod.F90 shr_string_mod.F90 shr_file_mod.F90 - 2. csm_share files copied that should be identical to cime/share/csm_share/unit_testers: - - test_mod.F90 - II. Files with differences 1. csm_share files copied with differences: @@ -32,7 +25,7 @@ II. Files with differences fileutils.F90 --- Remove use of masterproc and spmdMod and endrun in abortutils. - 3. Files in mksurfdata_map + 3. Files in mksurfdata_esmf mkvarpar.F90 nanMod.F90 diff --git a/tools/mkprocdata_map/src/Makefile b/tools/mkprocdata_map/src/Makefile index 6f07deb741..42f797b3c2 100644 --- a/tools/mkprocdata_map/src/Makefile +++ b/tools/mkprocdata_map/src/Makefile @@ -1,4 +1,4 @@ -# Makefile for mksurfdata_map +# Makefile for mkprocdata_map EXENAME = ../mkprocdata_map @@ -7,4 +7,4 @@ ifeq ($(OPT),$(null)) OPT := TRUE endif -include Makefile.common \ No newline at end of file +include Makefile.common From 146d44adfe1e2f89438409c63eaead66509bf86b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Apr 2024 17:36:12 -0600 Subject: [PATCH 53/77] Updates to ChangeLog from @slevis-lmwg review, and a few additions from going through issues --- doc/ChangeLog | 28 +++++++++++++++++++++------- doc/ChangeSum | 2 +- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 58e46cbb4a..337445490e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.2.0 -Originator(s): erik (Erik Kluzek) -Date: Wed Apr 3 01:17:18 MDT 2024 +Originator(s): many (see below) +Date: Wed Apr 10 17:35:36 MDT 2024 One-line Summary: New surface datasets and new mksurfdata_esmf tool to create them Purpose and description of changes @@ -26,9 +26,9 @@ on coastal areas was also done. The following fields were added and removed to the list of fields on the datasets. Fields added: - ORGC, BULK, CFRAG, PHAQ (soil data) + ORGC, BULK, CFRAG, PHAQ (soil data) (currently NOT used by CTSM) mapunits (map units for the soil dataset) - LANDFRAC_MKSURFDATA + LANDFRAC_MKSURFDATA (for reference NOT used by CTSM) PCT_OCEAN (previously PCT_WETLAND was used) Fields removed: @@ -70,7 +70,8 @@ New lake datasets: HydroLake: Messager et. al. (2016) Contributors ------------ -@mvertens @ekluzek @jedwards4b @billsacks @wwieder @lawrencepj1 @negin513 @dlawrenncar @olyson +@mvertens @ekluzek @slevis-lmwg @jedwards4b @billsacks @wwieder @lawrencepj1 @negin513 @dlawrenncar @olyson +@keerzhang1 @fang-bowen @Face2sea @adamrher @samsrabin Significant changes to scientifically-supported configurations -------------------------------------------------------------- @@ -103,8 +104,11 @@ CTSM issues fixed (include CTSM Issue #): the landuse.timeseries file is made Fixes #2218 CTSM5.2 branch dies weirdly when clm5.0/ctsm5.1 datasets are used -- die with an error - Fixes #2278 Allow CTSM to output history files interpolated to a regular - grid (for example from SE unstructured grids to a FV grid) + Fixes #1483 hcru surface datasets + Fixes #2228 sys test requirements for mksurfdata_esmf + Fixes #90 Remove need for fatmgrid + Fixes #80 Improve modularity of mksurfdata_map + Fixes #1878 Convert wetlands to bare-ground Notes of particular relevance for users --------------------------------------- @@ -113,6 +117,16 @@ Caveats for users (e.g., need to interpolate initial conditions): These surface datasets can NOT be used in previous versions of the model Older surface datasets can NOT be used with this model version + IMPORTANT NOTE FOR USERS FOR REGIONAL CASES: + Because of this issue: + + https://github.com/ESCOMP/CTSM/issues/2430 + + We recommend that users use subset_data to subset your region from a global + grid. This could mean creating a global grid at the resolution you need (if + not standard) and then use subset_data on it to get the region of + interest. + Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): New CLM_PHYSICS_VERSION option of clm6_0 added (use it rather than clm5_1) New compsets for Clm60 added diff --git a/doc/ChangeSum b/doc/ChangeSum index c027721724..a62eeeac91 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,6 +1,6 @@ Tag Who Date Summary ============================================================================================================================ - ctsm5.2.0 multiple 04/03/2024 New mksurfdata_esmf tool to create new surface datasets that are in place + ctsm5.2.0 many 04/10/2024 New mksurfdata_esmf tool to create new surface datasets that are in place ctsm5.1.dev175 slevis 03/21/2024 merge-b4bdev-20240321 ctsm5.1.dev174 olyson 03/14/2024 Improve vegetation health at high latitudes ctsm5.1.dev173 rgknox 03/13/2024 New FATES namelist variable: fates_history_dimlevel From 5b1ee03f5c8b1af4cd5ab19f3674ba33f7e2c0b2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Apr 2024 18:13:12 -0600 Subject: [PATCH 54/77] Add cam7.0 LND_TUNING options --- cime_config/config_component.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index c9f9e2d0ec..41fc8f737d 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -66,7 +66,10 @@ Atm forcing options: CRUv7 GSWP3 + CAM4.0 + CAM5.0 CAM6.0 + CAM7.0 QIAN (not tuned) 1PT (not tuned) NLDAS2 (not tuned) @@ -74,8 +77,8 @@ Other atm forcing options are invalid to run CLM and will result in an error. UNSET - - clm5_0_cam6.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm5_0_QIAN,clm5_0_1PT,clm5_0_NLDAS2,clm5_0_ERA5,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_QIAN,clm4_5_cam6.0,clm4_5_1PT,clm4_5_NLDAS2,clm4_5_ERA5,clm5_1_CRUv7,clm5_1_GSWP3v1,clm5_1_cam6.0,clm5_1_QIAN,clm5_1_1PT,clm5_1_NLDAS2,clm5_1_ERA5,clm6_0_CRUv7,clm6_0_GSWP3v1,clm6_0_cam6.0,clm6_0_QIAN,clm6_0_1PT,clm6_0_NLDAS2,clm6_0_ERA5 + + clm5_0_cam6.0,clm5_0_cam7.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm5_0_QIAN,clm5_0_1PT,clm5_0_NLDAS2,clm5_0_ERA5,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_QIAN,clm4_5_cam6.0,clm4_5_cam7.0,clm4_5_1PT,clm4_5_NLDAS2,clm4_5_ERA5,clm5_1_CRUv7,clm5_1_GSWP3v1,clm5_1_cam6.0,clm5_1_QIAN,clm5_1_1PT,clm5_1_NLDAS2,clm5_1_ERA5,clm6_0_CRUv7,clm6_0_GSWP3v1,clm6_0_cam6.0,clm6_0_cam7.0,clm6_0_QIAN,clm6_0_1PT,clm6_0_NLDAS2,clm6_0_ERA5 @@ -84,6 +87,7 @@ clm4_5_CRUv7 clm4_5_GSWP3v1 clm4_5_cam6.0 + clm4_5_cam7.0 clm4_5_cam6.0 clm4_5_QIAN clm4_5_QIAN @@ -96,6 +100,7 @@ clm5_0_GSWP3v1 clm5_0_GSWP3v1 clm5_0_cam6.0 + clm5_0_cam7.0 clm5_0_cam6.0 clm5_0_QIAN clm5_0_QIAN @@ -113,6 +118,7 @@ clm6_0_GSWP3v1 clm6_0_GSWP3v1 clm6_0_cam6.0 + clm6_0_cam7.0 clm6_0_cam6.0 clm6_0_QIAN clm6_0_QIAN From 705d0c76adce8268ef1fdfaf9020dff92ed3f2e5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Apr 2024 18:26:15 -0600 Subject: [PATCH 55/77] make default gen_mksurfdata generated scripts have a .sh extension --- .gitignore | 4 ++-- cime_config/SystemTests/mksurfdataesmf.py | 4 ++-- python/ctsm/toolchain/gen_mksurfdata_jobscript_multi.py | 2 +- python/ctsm/toolchain/gen_mksurfdata_jobscript_single.py | 2 +- tools/README | 4 ++-- tools/mksurfdata_esmf/README.md | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 9cd97ae20e..1da8072fed 100644 --- a/.gitignore +++ b/.gitignore @@ -91,8 +91,8 @@ ctsm.input_data_list.previous /tools/mksurfdata_esmf/mksurfdata_in /tools/mksurfdata_esmf/surfdata_*.nc /tools/mksurfdata_esmf/landuse.timeseries_*.nc -/tools/mksurfdata_esmf/mksurfdata_jobscript_multi -/tools/mksurfdata_esmf/mksurfdata_jobscript_single +/tools/mksurfdata_esmf/mksurfdata_jobscript_multi.sh +/tools/mksurfdata_esmf/mksurfdata_jobscript_single.sh /tools/mksurfdata_esmf/pio_iotype.txt /tools/mksurfdata_esmf/*.sh /tools/mksurfdata_esmf/tool_bld diff --git a/cime_config/SystemTests/mksurfdataesmf.py b/cime_config/SystemTests/mksurfdataesmf.py index 301141f02a..f5de3c4592 100644 --- a/cime_config/SystemTests/mksurfdataesmf.py +++ b/cime_config/SystemTests/mksurfdataesmf.py @@ -35,7 +35,7 @@ def __init__(self, case): time_stamp = datetime.today().strftime("%y%m%d") self._res = "10x15" # see important comment in script's docstring self._model_yr = "1850" - self._jobscript = os.path.join(self._get_caseroot(), "mksurfdata_jobscript_single") + self._jobscript = os.path.join(self._get_caseroot(), "mksurfdata_jobscript_single.sh") self._fsurdat_namelist = os.path.join( self._get_caseroot(), f"surfdata_{self._res}_hist_{self._model_yr}_78pfts_c{time_stamp}.namelist", @@ -62,7 +62,7 @@ def build_phase(self, sharedlib_only=False, model_only=False): # Paths and strings build_script_path = os.path.join(self._tool_path, "gen_mksurfdata_build.sh") nml_script_path = os.path.join(self._tool_path, "gen_mksurfdata_namelist") - gen_jobscript_path = os.path.join(self._tool_path, "gen_mksurfdata_jobscript_single") + gen_jobscript_path = os.path.join(self._tool_path, "gen_mksurfdata_jobscript_single.sh") gen_mksurfdata_namelist = f"{nml_script_path} --res {self._res} --start-year {self._model_yr} --end-year {self._model_yr}" gen_mksurfdata_jobscript = f"{gen_jobscript_path} --number-of-nodes 1 --tasks-per-node 64 --namelist-file {self._fsurdat_namelist} --bld-path {self._tool_bld}" diff --git a/python/ctsm/toolchain/gen_mksurfdata_jobscript_multi.py b/python/ctsm/toolchain/gen_mksurfdata_jobscript_multi.py index d0ad313867..6deb50ebfb 100755 --- a/python/ctsm/toolchain/gen_mksurfdata_jobscript_multi.py +++ b/python/ctsm/toolchain/gen_mksurfdata_jobscript_multi.py @@ -66,7 +66,7 @@ def get_parser(): """ Get parser object for this script. """ - parser = base_get_parser(default_js_name="mksurfdata_jobscript_multi") + parser = base_get_parser(default_js_name="mksurfdata_jobscript_multi.sh") parser.add_argument( "--scenario", diff --git a/python/ctsm/toolchain/gen_mksurfdata_jobscript_single.py b/python/ctsm/toolchain/gen_mksurfdata_jobscript_single.py index a04265ba84..ff793165d9 100755 --- a/python/ctsm/toolchain/gen_mksurfdata_jobscript_single.py +++ b/python/ctsm/toolchain/gen_mksurfdata_jobscript_single.py @@ -20,7 +20,7 @@ logger = logging.getLogger(__name__) -def base_get_parser(default_js_name="mksurfdata_jobscript_single"): +def base_get_parser(default_js_name="mksurfdata_jobscript_single.sh"): """ Get parser object for the gen_mksurfdata_jobscript scripts """ diff --git a/tools/README b/tools/README index 7fc72f04fb..70a2807214 100644 --- a/tools/README +++ b/tools/README @@ -198,7 +198,7 @@ III. Process sequence to create input datasets needed to run CTSM gridnames. 5.) Create surface datasets with mksurfdata_esmf on Derecho - (See mksurfdata_esmf/README for more help on doing this) + (See mksurfdata_esmf/README.md for more help on doing this) - gen_mksurfdata_build.sh to build - gen_mksurfdata_namelist to build the namelist @@ -216,7 +216,7 @@ III. Process sequence to create input datasets needed to run CTSM ./gen_mksurfdata_build.sh ./gen_mksurfdata_namelist --res 0.9x1.25 --start-year 1850 --end-year 1850 ./gen_mksurfdata_jobscript_single --number-of-nodes 24 --tasks-per-node 12 --namelist-file target.namelist - qsub mksurfdata_jobscript_single + qsub mksurfdata_jobscript_single.sh NOTE that surface dataset will be used by default for fatmgrid - and it will contain the lat,lon,edges and area values for the atm grid - ASSUMING that diff --git a/tools/mksurfdata_esmf/README.md b/tools/mksurfdata_esmf/README.md index 3c551d0388..a748c3d721 100644 --- a/tools/mksurfdata_esmf/README.md +++ b/tools/mksurfdata_esmf/README.md @@ -153,7 +153,7 @@ for example try --res 1.9x2.5 --start-year 1850 --end-year 1850: ``` shell # Assuming pwd is the tools/mksurfdata_esmf directory ./gen_mksurfdata_jobscript_single --number-of-nodes 2 --tasks-per-node 128 --namelist-file target.namelist - qsub mksurfdata_jobscript_single + qsub mksurfdata_jobscript_single.sh ``` Read note about regional grids at the end. @@ -167,7 +167,7 @@ for example try --res 1.9x2.5 --start-year 1850 --end-year 1850: ``` shell # Assuming pwd is the tools/mksurfdata_esmf directory ./gen_mksurfdata_jobscript_multi --number-of-nodes 2 --scenario global-present - qsub mksurfdata_jobscript_multi + qsub mksurfdata_jobscript_multi.sh ``` If you are looking to generate all (or a large number of) the datasets or the From 9b5ef2221876e9e5e4a7781d0da1be6672588d5c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Apr 2024 18:31:51 -0600 Subject: [PATCH 56/77] Remove the .sh exention from gen_mksurfdata_build.sh as one of the parts of #2446 --- cime_config/SystemTests/mksurfdataesmf.py | 2 +- .../test/test_unit_gen_mksurfdata_jobscript_single.py | 2 +- tools/README | 6 +++--- tools/mksurfdata_esmf/README.md | 2 +- tools/mksurfdata_esmf/gen_mksurfdata_build.sh | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cime_config/SystemTests/mksurfdataesmf.py b/cime_config/SystemTests/mksurfdataesmf.py index f5de3c4592..03295201ac 100644 --- a/cime_config/SystemTests/mksurfdataesmf.py +++ b/cime_config/SystemTests/mksurfdataesmf.py @@ -60,7 +60,7 @@ def build_phase(self, sharedlib_only=False, model_only=False): # if the test stops and gets restarted. if sharedlib_only: # Paths and strings - build_script_path = os.path.join(self._tool_path, "gen_mksurfdata_build.sh") + build_script_path = os.path.join(self._tool_path, "gen_mksurfdata_build") nml_script_path = os.path.join(self._tool_path, "gen_mksurfdata_namelist") gen_jobscript_path = os.path.join(self._tool_path, "gen_mksurfdata_jobscript_single.sh") gen_mksurfdata_namelist = f"{nml_script_path} --res {self._res} --start-year {self._model_yr} --end-year {self._model_yr}" diff --git a/python/ctsm/test/test_unit_gen_mksurfdata_jobscript_single.py b/python/ctsm/test/test_unit_gen_mksurfdata_jobscript_single.py index f09d91ccce..5038c6b3e1 100755 --- a/python/ctsm/test/test_unit_gen_mksurfdata_jobscript_single.py +++ b/python/ctsm/test/test_unit_gen_mksurfdata_jobscript_single.py @@ -151,7 +151,7 @@ def test_derecho_mpirun(self): self.assertEqual(self._account, args.account) # Create the env_mach_specific.xml file needed for get_mpirun # This will catch problems with our usage of CIME objects - # Doing this here will also catch potential issues in the gen_mksurfdata_build.sh script + # Doing this here will also catch potential issues in the gen_mksurfdata_build script configure_path = os.path.join(path_to_cime(), "CIME", "scripts", "configure") self.assertTrue(os.path.exists(configure_path)) options = " --macros-format CMake --silent --compiler intel --machine " + machine diff --git a/tools/README b/tools/README index 70a2807214..568dc1239b 100644 --- a/tools/README +++ b/tools/README @@ -78,7 +78,7 @@ II. Notes on building/running for each of the above tools: mksurfdata_esmf has a cime configure and CMake based build using the following files: - gen_mksurfdata_build.sh - Build mksurfdata_esmf + gen_mksurfdata_build ---- Build mksurfdata_esmf src/CMakeLists.txt ------ Tells CMake how to build the source code Makefile ---------------- GNU makefile to link the program together cmake ------------------- CMake macros for finding libraries @@ -200,7 +200,7 @@ III. Process sequence to create input datasets needed to run CTSM 5.) Create surface datasets with mksurfdata_esmf on Derecho (See mksurfdata_esmf/README.md for more help on doing this) - - gen_mksurfdata_build.sh to build + - gen_mksurfdata_build to build - gen_mksurfdata_namelist to build the namelist - gen_mksurfdata_jobscript_single to build a batch script to run on Derecho - Submit the batch script just created above @@ -213,7 +213,7 @@ III. Process sequence to create input datasets needed to run CTSM Example: for 0.9x1.25 resolution fro 1850 cd mksurfdata_esmf - ./gen_mksurfdata_build.sh + ./gen_mksurfdata_build ./gen_mksurfdata_namelist --res 0.9x1.25 --start-year 1850 --end-year 1850 ./gen_mksurfdata_jobscript_single --number-of-nodes 24 --tasks-per-node 12 --namelist-file target.namelist qsub mksurfdata_jobscript_single.sh diff --git a/tools/mksurfdata_esmf/README.md b/tools/mksurfdata_esmf/README.md index a748c3d721..11cb69c681 100644 --- a/tools/mksurfdata_esmf/README.md +++ b/tools/mksurfdata_esmf/README.md @@ -100,7 +100,7 @@ This will bring in CIME and ccs_config which are required for building. ``` shell # Assuming pwd is the tools/mksurfdata_esmf directory - ./gen_mksurfdata_build.sh # For machines with a cime build + ./gen_mksurfdata_build # For machines with a cime build ``` Note: The pio_iotype value gets set and written to a simple .txt file diff --git a/tools/mksurfdata_esmf/gen_mksurfdata_build.sh b/tools/mksurfdata_esmf/gen_mksurfdata_build.sh index c8b891c1c4..974c1929a5 100755 --- a/tools/mksurfdata_esmf/gen_mksurfdata_build.sh +++ b/tools/mksurfdata_esmf/gen_mksurfdata_build.sh @@ -6,7 +6,7 @@ usage() { echo "" echo "***********************************************************************" echo "usage:" - echo "./gen_mksurfdata_build.sh" + echo "./gen_mksurfdata_build" echo "" echo "valid arguments: " echo "[-h|--help] " @@ -14,14 +14,14 @@ usage() { echo "[-v|--verbose] " echo " Run in verbose mode" echo "[-b|--blddir ] " - echo " Overrides default, which is /tool_bld in the same directory as ./gen_mksurfdata_build.sh" + echo " Overrides default, which is /tool_bld in the same directory as ./gen_mksurfdata_build" echo "[-m|--machine ] " echo " Overrides default MACH" echo "***********************************************************************" } -# Current working directory: the location of ./gen_mksurfdata_build.sh +# Current working directory: the location of ./gen_mksurfdata_build cwd=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Default settings @@ -102,7 +102,7 @@ cd $blddir # Write pio_iotype to file with name pio_iotype.txt pio_iotype_filepath=../pio_iotype.txt # one up from /tool_bld if [ ! -f "$pio_iotype_filepath" ]; then - echo 'VALUE OF pio_iotype WRITTEN BY gen_mksurfdata_build.sh AND USED BY mksurfdata (i.e. THE FORTRAN EXECUTABLE):' > $pio_iotype_filepath + echo 'VALUE OF pio_iotype WRITTEN BY gen_mksurfdata_build AND USED BY mksurfdata (i.e. THE FORTRAN EXECUTABLE):' > $pio_iotype_filepath echo $pio_iotype >> $pio_iotype_filepath else echo "Use existing $pio_iotype_filepath file" From 6bfb9af0f65f6079d0d186de1fcef58da6803451 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 10 Apr 2024 22:12:37 -0600 Subject: [PATCH 57/77] Remove mkmapdata and mksurfdata from the template file --- bld/namelist_files/namelist_definition.xsl | 23 ---------------------- 1 file changed, 23 deletions(-) diff --git a/bld/namelist_files/namelist_definition.xsl b/bld/namelist_files/namelist_definition.xsl index 545d810e52..7917cc262f 100644 --- a/bld/namelist_files/namelist_definition.xsl +++ b/bld/namelist_files/namelist_definition.xsl @@ -252,18 +252,6 @@

These are namelist items that appear in the CLM Tools under components/clm/tools.

- - - - - - - - - - -
CLM mksurfdata
NameTypeDescription
Valid values
- @@ -276,17 +264,6 @@
CLM mkgriddata
Name
- - - - - - - - - - -
CLM mkmapdata
NameTypeDescription
Valid values
From 7cd7f8081c9fdfe53c6da3a0208e1773d6fc1dae Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 12 Apr 2024 15:47:52 -0600 Subject: [PATCH 58/77] Update doc/ChangeLog From @slevis-lmwg suggestion. Co-authored-by: Samuel Levis --- doc/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index af1a74b43a..56f1ef9d19 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -27,7 +27,7 @@ The following fields were added and removed to the list of fields on the dataset Fields added: ORGC, BULK, CFRAG, PHAQ (soil data) (currently NOT used by CTSM) - mapunits (map units for the soil dataset) + mapunits (map units from the soil dataset) LANDFRAC_MKSURFDATA (for reference NOT used by CTSM) PCT_OCEAN (previously PCT_WETLAND was used) From babd28124af7fc7ff3c27a946bde1be42a535b84 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 12 Apr 2024 17:13:42 -0600 Subject: [PATCH 59/77] Get namelist working Update namelist with needed cam4.0, cam5.0, and clm6_0 changes so that the namelist tester works and compares as expected to the previous version. --- bld/namelist_files/namelist_defaults_ctsm.xml | 30 +++++++++++++++++-- .../namelist_defaults_overall.xml | 2 ++ bld/unit_testers/build-namelist_test.pl | 4 +-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index ab6b5772aa..ae38b758cf 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -245,10 +245,22 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >30.0d00 20.0d00 +20.0d00 +20.0d00 20.0d00 +20.0d00 +20.0d00 20.0d00 +20.0d00 +20.0d00 80.0d00 0.85d00 0.98d00 @@ -260,10 +272,22 @@ attributes from the config_cache.xml file (with keys converted to upper-case). >0.010d00 0.008d00 +0.008d00 +0.008d00 0.008d00 +0.008d00 +0.008d00 0.008d00 +0.008d00 +0.008d00 0.17d-3 1.6d-4 0.33d00 @@ -642,7 +666,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case). - + .true. .false. .false. .false. +.false. +.false. -.false. +.false. + + + + FAIL + MOSART#91 + + + From 6926f4b84e8179a1adea9987d702678ac6e50217 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 19 Apr 2024 11:02:46 -0600 Subject: [PATCH 76/77] Add more notes about the testlists --- cime_config/testdefs/testlist_clm.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index cdbe058890..05526b3529 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -1,14 +1,15 @@ From 78b22676464a843f35f9049fffddb87b4e3af182 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 19 Apr 2024 12:52:11 -0600 Subject: [PATCH 77/77] More expected fails because of long filenames --- cime_config/testdefs/ExpectedTestFails.xml | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 108ed50065..9c5339f2d5 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -154,8 +154,29 @@ #2454 - - + + + + FAIL + #2310 + + + FAIL + #2310 + + + + + + FAIL + #2310 + + + FAIL + #2310 + + +
CLM mkgriddata