Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the dust emission source function soil erodibility for the Zender scheme from CAM to CTSM #1967

Merged
merged 50 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8434fbb
An initial commit to enable CLM to read in Zender's soil erodibility …
dmleung Mar 13, 2023
2c9974c
first commit on adding a global tuning factor to tune global total du…
dmleung Mar 21, 2023
4f5dcb9
After discussing with CAM people, I took away the lines relevant to t…
dmleung Apr 5, 2023
7616b5c
Merge tag 'ctsm5.1.dev122' into zendersource_dev
ekluzek Apr 28, 2023
f4dde3d
Remove most of the comments that mention dmleung, changes will be sto…
ekluzek Jun 23, 2023
2a2caf1
Move files into inputdata, and nccopy mesh file from NetCDF4 to CDF5
ekluzek Jul 31, 2023
35b1f4a
Change ESMF Finalize to endrun, add more clarity on what's happening …
ekluzek Jul 31, 2023
a27f6f5
Some updates from the review, this compiles, but fails to run when it…
ekluzek Aug 18, 2023
cb81fdb
Remove dust_emis_fact as that will stay inside of CAM
ekluzek Aug 18, 2023
019282a
Add lnd_tuning modes for CAM4.0 and CAM5.0 for all CLM physics option…
ekluzek Aug 21, 2023
70289af
Get cam4,cam5 options working with coldstarts, add more tests, make s…
ekluzek Sep 9, 2023
a931e74
Add a comment about the ordering to the run_type subroutine
ekluzek Sep 9, 2023
a22b089
Merge tag 'ctsm5.1.dev166' into zendersource_dev
ekluzek Jan 26, 2024
08d3c86
Add two new namelist options to control the dust emission method and …
ekluzek Jan 29, 2024
3553bef
Add dust_emission namelist control items to build-namelist and add te…
ekluzek Jan 30, 2024
8a9f513
Fix bug in tests after running with the error check turned off
ekluzek Jan 30, 2024
dd61c14
Add zendersoilerodmapalgo into the build-namelist
ekluzek Jan 31, 2024
0d19e85
Add new test mods that include using Zender_2003 dust and lnd_tuning_…
ekluzek Jan 31, 2024
c3f2b30
Add in the new dust handling namelist parameters, and some control lo…
ekluzek Jan 31, 2024
15bf184
Get simple case with Zender soil eroditablity off working so SMS_D_Ld…
ekluzek Feb 2, 2024
0b9c979
Fix some issues, get a test using soileroditability file to work
ekluzek Feb 2, 2024
3921fbf
Add tests for Zender dust with soil eroditability file in CTSM for CA…
ekluzek Feb 3, 2024
2ad96ff
Add dust soil eroditability files for all CAM options, which requires…
ekluzek Feb 3, 2024
3011818
Need hgrid for some of the Zender soil eroditability files
ekluzek Feb 3, 2024
7e226ba
Correct year in dust_emis_method
ekluzek Feb 3, 2024
ef7a41a
Correct namelist name
ekluzek Feb 3, 2024
1941d2a
Merge remote-tracking branch 'escomp/master' into zendersource_dev
ekluzek Feb 6, 2024
68a35de
Merge remote-tracking branch 'escomp/b4b-dev' into zendersource_dev
ekluzek Feb 16, 2024
9f8e983
Merge branch 'zendersource_dev' of github.com:dmleung/CTSM into zende…
ekluzek Feb 16, 2024
2d9aacc
Use straight logic rather than a logical not of the straightforward c…
ekluzek Feb 27, 2024
8c42551
Change names with zendersoilerod in them, in some cases removing the …
ekluzek Feb 27, 2024
1421d6d
Fix some issues from comments in the PR, make sure all namelist items…
ekluzek Feb 27, 2024
b66c1f0
Fix issue so will compile
ekluzek Feb 27, 2024
23eb33b
Add comment about dust_emis_method
ekluzek Feb 27, 2024
4de177b
Merge remote-tracking branch 'escomp/master' into zendersource_dev
ekluzek Feb 27, 2024
cd005b3
Add some Zender soil eroditability tests for izumi, and a 1-degree CL…
ekluzek Feb 27, 2024
9dc57da
Change izumi_nag test to izumi_gnu because non-DEBUG tests don't buil…
ekluzek Feb 28, 2024
dd87593
Merge tag 'ctsm5.1.dev174' into zendersource_dev
ekluzek Mar 15, 2024
04d7790
Merge remote-tracking branch 'escomp/b4b-dev' into zendersource_dev
ekluzek Mar 20, 2024
d0537d1
Merge remote-tracking branch 'escomp/b4b-dev' into zendersource_dev
ekluzek Mar 21, 2024
f5168f9
Fix ordering so that array is allocated properly
ekluzek Mar 22, 2024
67bbf59
Add some error checking that would have caught the previous problem
ekluzek Mar 22, 2024
1d64435
Remove uneeded comment, and add a TODO from the code review
ekluzek Mar 25, 2024
d8ae9cd
Merge remote-tracking branch 'escomp/b4b-dev' into zendersource_dev
ekluzek Mar 25, 2024
36bfba6
Remove trailing whitespace
ekluzek Mar 25, 2024
7943f8d
Another trailing blank
ekluzek Mar 25, 2024
20e3fe9
More trailing whitspace
ekluzek Mar 25, 2024
b63459e
Correct number of tests
ekluzek Mar 25, 2024
296a00e
Remove a bunch of uneeded settings for initial conditions and use_ini…
ekluzek Mar 26, 2024
b01fbb5
Change compilers up for ZDustSoilErod tests a bit, and make sure ther…
ekluzek Mar 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);

#########################################
# namelist group: atm2lnd_inparm
Expand Down Expand Up @@ -4245,6 +4246,17 @@ 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' );
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_meshfile_zendersoilerod' );
}

#-------------------------------------------------------------------------------

sub write_output_files {
my ($opts, $nl_flags, $defaults, $nl) = @_;

Expand Down Expand Up @@ -4293,6 +4305,7 @@ sub write_output_files {
push @groups, "ch4finundated";
push @groups, "soilbgc_decomp";
push @groups, "clm_canopy_inparm";
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";
}
Expand Down
10 changes: 10 additions & 0 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2537,6 +2537,16 @@ lnd/clm2/surfdata_map/release-clm5.0.30/surfdata_ne0np4.CONUS.ne30x8_hist_78pfts
<stream_meshfile_ch4finundated finundation_method="ZWT_inversion"
>lnd/clm2/paramdata/finundated_inversiondata_0.9x1_ESMFmesh_cdf5_130621.nc</stream_meshfile_ch4finundated>

<!-- =========================================== -->
<!-- Defaults for dust namelist items -->
<!-- Defaults for Zender's soil erodibility data -->
<!-- =========================================== -->

<stream_fldfilename_zendersoilerod
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
>lnd/clm2/dustemisdata/dst_source2x2tunedcam6-2x2-forCLM_cdf5_c230312.nc</stream_fldfilename_zendersoilerod>
<stream_meshfile_zendersoilerod
>lnd/clm2/dustemisdata/dust_2x2_ESMFmesh_cdf5_c230730.nc</stream_meshfile_zendersoilerod>

<!-- ========================================= -->
<!-- Defaults for different BGC/decomp modes -->
<!-- ========================================= -->
Expand Down
19 changes: 19 additions & 0 deletions bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1693,6 +1693,25 @@ Mapping method from Nitrogen deposition input file to the model resolution
copy = copy using the same indices
</entry>

<!-- ======================================================================================== -->
<!-- Dust namelist and Zender soil erodibility stream -->
<!-- ======================================================================================== -->

<!-- <entry id="dust_emis_fact" type="real" category="dataset" -->
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
<!-- group="dust_nl" valid_values="" > -->
<!-- Tuning parameter for dust emissions. -->
<!-- </entry> -->

<entry id="stream_fldfilename_zendersoilerod" type="char*256" category="datasets"
input_pathname="abs" group="zendersoilerod" valid_values="" >
Filename of input stream data for Zender's soil erodibility source function
</entry>

<entry id="stream_meshfile_zendersoilerod" type="char*256" category="datasets"
input_pathname="abs" group="zendersoilerod" valid_values="" >
mesh filename of input stream data for Zender's soil erodibility source function
</entry>

<!-- ======================================================================================== -->
<!-- finundated stream -->
<!-- ======================================================================================== -->
Expand Down
64 changes: 54 additions & 10 deletions src/biogeochem/DUSTMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module DUSTMod
use LandunitType , only : lun
use ColumnType , only : col
use PatchType , only : patch
use ZenderSoilErodStreamType, only : zendersoilerodstream_type
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
!
! !PUBLIC TYPES
implicit none
Expand Down Expand Up @@ -59,7 +60,8 @@ 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
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

Expand All @@ -78,13 +80,16 @@ module DUSTMod
contains

!------------------------------------------------------------------------
subroutine Init(this, bounds)
!subroutine Init(this, bounds)
subroutine Init(this, bounds, NLFilename)

class(dust_type) :: this
type(bounds_type), intent(in) :: bounds
character(len=*), intent(in) :: NLFilename

call this%InitAllocate (bounds)
call this%InitHistory (bounds)
call this%zendersoilerodstream%Init( bounds, NLFilename )
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
call this%InitCold (bounds)
call this%InitDustVars (bounds)

Expand Down Expand Up @@ -112,7 +117,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

Expand All @@ -129,9 +134,11 @@ subroutine InitHistory(this, bounds)
!
! !LOCAL VARIABLES:
integer :: begp,endp
integer :: begc,endc
!------------------------------------------------------------------------

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', &
Expand All @@ -158,6 +165,11 @@ 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
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
!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

!-----------------------------------------------------------------------
Expand All @@ -169,17 +181,48 @@ subroutine InitCold(this, bounds)
!
! !LOCAL VARIABLES:
integer :: c,l
!integer ier
!-----------------------------------------------------------------------

!#### dmleung added 11 Mar 2023 ####################################
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
! 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

do c = bounds%begc, bounds%endc
l = col%landunit(c)
!if (dust_emission_scheme == 'Leung2023')
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
! 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')
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
call this%zendersoilerodstream%CalcDustSource( bounds, &
this%mbl_bsn_fct_col(bounds%begc:bounds%endc) )
!end if

end subroutine InitCold

Expand Down Expand Up @@ -262,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
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)
)
Expand Down Expand Up @@ -436,6 +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
ekluzek marked this conversation as resolved.
Show resolved Hide resolved

end if ! lnd_frc_mbl > 0.0

Expand Down
Loading
Loading