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

Hillslope hydrology #1715

Merged
merged 189 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
52d5058
hillslope_hydrology_n01_clm4_5_14_r223
swensosc Feb 9, 2017
1af8d11
hillslope_hydrology_n02_clm4_5_14_r223
swensosc Feb 10, 2017
ee1fc0e
hillslope_hydrology_n03_clm4_5_14_r223
swensosc Feb 13, 2017
2d07001
hillslope_hydrology_n04_clm4_5_14_r226
swensosc Mar 7, 2017
fa7b4ec
hillslope_hydrology_n05_clm4_5_14_r226
swensosc Mar 14, 2017
73b2833
hillslope_hydrology_n06_clm4_5_14_r226
swensosc Mar 17, 2017
69d35dd
hillslope_hydrology_n07_clm4_5_14_r226
swensosc Apr 4, 2017
de6ce31
hillslope_hydrology_n08_clm4_5_14_r226
swensosc Apr 5, 2017
48f09fc
hillslope_hydrology_n09_clm4_5_14_r226
swensosc Dec 19, 2017
78096d5
hillslope_hydrology_n09_clm4_5_18_r270
billsacks Jan 2, 2018
0faafb1
hillslope_hydrology_n10_clm4_5_18_r270
billsacks Jan 2, 2018
031da7a
Merge tag 'clm4_5_18_r270' into hillslope_hydrology
billsacks Jan 12, 2018
c1b7412
Merge branch 'andre-standalone-dev' into hillslope_hydrology
billsacks Jan 17, 2018
9c3d3ce
Merge branch 'andre-standalone-dev' into hillslope_hydrology
billsacks Jan 17, 2018
dbbe17a
Add capability to read in hillslope geomorphology from surface data
swensosc Mar 12, 2018
7a84847
initial implementation of slope/aspect effects on incident direct sol…
swensosc Mar 14, 2018
be27720
correct col_ndx assignment
swensosc Aug 27, 2018
6487698
read hillslope geomorphological parametes from file
swensosc Aug 30, 2018
c747ee1
merged w/ escomp/master
swensosc Aug 30, 2018
9ee73ba
merge w/ initial isotope refactoring
swensosc Aug 30, 2018
7310baa
add stream depth from routing model; note, requires cime/mosart changes
swensosc Sep 11, 2018
49010fa
add tdepth to lnd
swensosc Sep 11, 2018
4b9ff7b
fix calculattion of col%colu
swensosc Sep 11, 2018
6019ade
add river depth to coupler
swensosc Oct 5, 2018
0c967fb
refactor SoilHydrologyMod for case of subsurface backflow
swensosc Oct 18, 2018
2d352c2
add stream depth
swensosc Oct 19, 2018
6b32610
add ncol minimum in subgridMod
swensosc Oct 23, 2018
3bd204b
merge with hillslope_hydrology
swensosc Oct 23, 2018
51247fa
fix tdepth
swensosc Oct 24, 2018
bac3e39
fix tdepth
swensosc Oct 24, 2018
c6be77e
merge to master
swensosc Mar 21, 2019
77e1cd3
update externals to point to hillslope_hydrology cime and mosart bran…
swensosc Apr 3, 2019
b2e4b74
update CLMBuildNamelist.pm for hillslope_hydrology_inparm
swensosc Apr 3, 2019
8387050
initialize column level direct solar forcing
swensosc Apr 4, 2019
5f54a18
remove analytical hillslope methods
swensosc Apr 21, 2020
6a00ef0
merge to master
swensosc Apr 21, 2020
151a474
minor cleanup
swensosc Apr 22, 2020
22a433b
fix bug in hillslope_area calculation
swensosc Apr 23, 2020
f69d6e0
add downscaling in TopoMod
swensosc Apr 23, 2020
e452966
remove urban from endrun message
swensosc Apr 24, 2020
4ee9ace
fix wtlunit recalculation
swensosc Sep 4, 2020
11a2911
convert arrayl to integer in surfrdMod
swensosc Sep 9, 2020
7fbfe38
fix elevation used in TopoMod
swensosc Oct 9, 2020
3a50c6a
add hillslope bedrock field
swensosc Nov 18, 2020
556dacc
merge to master
swensosc Mar 8, 2021
b5e62e1
merge to master
swensosc Mar 9, 2021
fbbe876
add precipitation downscaling
swensosc Mar 9, 2021
d86736e
add conditional to histFileMod
swensosc Mar 10, 2021
ae6085e
enable fates multi-column restarts
swensosc Mar 18, 2021
9dd871b
add units in ColumnType
swensosc Mar 18, 2021
069c910
add stream channel to ctsm
swensosc Mar 23, 2021
cbd6341
add to gridcell balance check
swensosc Mar 24, 2021
2bf70fd
fix wtlunit
swensosc Mar 31, 2021
03967e0
scale qdischarge
swensosc Mar 31, 2021
5940bd2
minor formatting
swensosc Mar 31, 2021
3dea895
add use_hillslope_routing namelist variable
swensosc Jul 14, 2021
98d1c45
re-add tdepth
swensosc Jul 14, 2021
31585df
initialize stream_water_lun
swensosc Jul 19, 2021
cf9f512
fix solar normalization
swensosc Jul 21, 2021
3e52233
add tdepth to nuopc
swensosc Sep 3, 2021
7df3dde
add downscaling flag
swensosc Sep 7, 2021
ffc3838
add downscaling flag
swensosc Sep 7, 2021
90bfa0c
add stream channel variable
swensosc Sep 7, 2021
3354cfe
add files
swensosc Sep 7, 2021
2ccca4e
update Externals.cfg
swensosc Sep 8, 2021
641b013
add fill value in histFileMod
swensosc Sep 8, 2021
81d4fb2
add downscale_hillslope_meteorology flag to TopoMod
swensosc Sep 20, 2021
6a9f979
correct hillslope routing water balance
swensosc Sep 23, 2021
e8814ec
move streamflow variable
swensosc Sep 23, 2021
e8d9c81
add drain_perched term in lnd2atmMod
swensosc Sep 23, 2021
230b15c
merge lateral subsurface flow subroutines
swensosc Nov 16, 2021
f64b69e
fix typo
swensosc Nov 16, 2021
0f57012
move InitHillslope before SoilStateInitTimeConst
swensosc Dec 3, 2021
7309558
add downscaling flag to SurfaceAlbedoMod
swensosc Dec 8, 2021
7bd8c92
add coszen_grc restart field
swensosc Jan 6, 2022
d655c0c
fix hillslope routing water balance
swensosc Apr 15, 2022
0655e12
merge to main
swensosc Apr 15, 2022
f640751
update hllslope_hydrology to master
swensosc May 5, 2022
edcf043
correct frost table value
swensosc May 5, 2022
7c20b41
fix inequality in perchedlateralflow
swensosc May 6, 2022
e1dc2ef
Minor cleanup
billsacks May 13, 2022
48e3a51
add namelist variables and remove omp directives
swensosc May 24, 2022
54545c0
merge with hillslope_hydrology
swensosc May 24, 2022
84f14ff
remove origflag and fracice
swensosc May 24, 2022
602eda0
clean up SoilHydrologyMod
swensosc May 24, 2022
4095d6c
remove hill_pftndx from column type
swensosc May 24, 2022
286edbe
add endrun for streamflow_method
swensosc May 24, 2022
fc6e667
Merge branch 'hillslope_hydrology' into hillslope_hydrology
swensosc May 24, 2022
c7caac7
Merge pull request #5 from billsacks/hillslope_hydrology
swensosc May 24, 2022
4060495
Merge tag 'ctsm5.1.dev097' into hillslope_hydrology
billsacks May 24, 2022
4593dff
Merge commit 'c3108e8c7' into hillslope_hydrology
billsacks May 24, 2022
6800cc8
Merge branch 'master' into hillslope_hydrology
billsacks May 24, 2022
71083f4
add downscaling identifiers to variables
swensosc May 25, 2022
14ffa23
reorder topo_col calculation
swensosc May 25, 2022
84b7093
change downscaling normalization weights
swensosc May 25, 2022
90bbebd
add set_c2l_scale call to subgridAveMod routines
swensosc May 26, 2022
0017cc5
add check to CLMBuildNamelist.pm
swensosc May 26, 2022
66e6fbc
add namelist variables for pft distribution
swensosc May 26, 2022
cb50d27
create setSoilLayerClass subroutine
swensosc May 26, 2022
c23fee1
modify solar radiation energy balance check
swensosc May 27, 2022
e46c80a
fix circular dependency due to namelist
swensosc Jun 1, 2022
93d2e17
modify subgrid weights
swensosc Jun 3, 2022
8fa6767
change gridcell average runoff calculation
swensosc Jun 3, 2022
36627d8
remove qdischarge from HillslopeUpdateStreamWater
swensosc Jun 7, 2022
014868e
minor cleanup
swensosc Jul 15, 2022
1b029d0
Remove build-namelist tests of origflag
billsacks Jul 16, 2022
9ff7241
Remove origflag=1 setting from oldhyd test
billsacks Jul 16, 2022
c6f4441
Fix build-namelist test count
billsacks Jul 16, 2022
1b5a4b2
Get unit tests passing
billsacks Jul 17, 2022
99cfb53
Temporary workaround for bare land smb flux issue
billsacks Jul 18, 2022
78cbfed
more minor fixes
swensosc Jul 18, 2022
64ba19d
Merge pull request #6 from billsacks/hillslope_hydrology
swensosc Jul 18, 2022
607ee4d
move initHillslope call earlier
swensosc Jul 21, 2022
c4d2037
update patch%mxy
swensosc Jul 22, 2022
e4c79e6
fix circular dependency (use_fun)
swensosc Aug 4, 2022
569cbbd
remove comments
swensosc Aug 4, 2022
5a5ab1d
move allocate statement in HillslopeHydrologyMod
swensosc Aug 9, 2022
96ded97
fix linear soil profile slope
swensosc Aug 26, 2022
d658d57
merge with main
swensosc Sep 14, 2022
61eb82f
minor cleanup
swensosc Sep 15, 2022
3ef6829
add illumination threshold for solar downscaling
swensosc Nov 11, 2022
98636e8
no hillslope columns when lun%wtgcell is zero
swensosc Nov 18, 2022
00e71e1
write global indices
swensosc Feb 3, 2023
806c6f6
add h_slope
swensosc May 15, 2023
dde5250
merge to main
swensosc Jul 20, 2023
2d9cb4d
back out surface water drainage change
swensosc Aug 21, 2023
3f4b9a8
small fixes
swensosc Aug 22, 2023
3034da1
back out two answer changers
swensosc Sep 11, 2023
5924c68
reintroduce if-block
swensosc Sep 11, 2023
595d95d
Merge tag 'ctsm5.1.dev142' into hillslope_hydrology-ssr
samsrabin Oct 4, 2023
4708a4a
use find_k_max_indices in surfrdMod
swensosc Oct 5, 2023
e1ce650
Merge branch 'hillslope_hydrology' into hillslope_hydrology-ssr
samsrabin Oct 6, 2023
d303ccb
Whitespace alignment in CLMBuildNamelist.pm.
samsrabin Oct 6, 2023
bd4a04e
Remove redundant check in CLMBuildNamelist.pm.
samsrabin Oct 6, 2023
5491aae
remove HillslopeDominantPft
swensosc Oct 6, 2023
79141f8
Do not allow use_hillslope with transient land cover change.
samsrabin Oct 6, 2023
fa5161f
Compile fixes from merge of ctsm5.1.dev142.
samsrabin Oct 6, 2023
53b8719
Add Hillslope test.
samsrabin Nov 3, 2023
0e7a9a9
Removed NTASKS=-2 from shell_commands.
samsrabin Nov 3, 2023
dbf6845
set c_dst
swensosc Nov 28, 2023
226f038
move g assignment out of if-block
swensosc Nov 28, 2023
e8af14d
revert last change; instead move forc_solar_col inside if-block
swensosc Nov 28, 2023
d06c3a5
move g
swensosc Nov 28, 2023
89a5671
Merge branch 'hillslope_hydrology' into hillslope_hydrology-ssr
samsrabin Dec 1, 2023
6efd50c
Update externals to work on Derecho.
samsrabin Dec 1, 2023
c477363
Misc. whitespace fixes and reversions.
samsrabin Dec 1, 2023
c7c8130
Remove a commented-out bit.
samsrabin Dec 1, 2023
7b77ae0
Merge tag 'ctsm5.1.dev156' into hillslope_hydrology-ssr
samsrabin Dec 4, 2023
55124be
Use DIN_LOC_ROOT in Hillslope test.
samsrabin Dec 4, 2023
ce9ed80
More whitespace fixes/reversions.
samsrabin Dec 4, 2023
50c0e7a
merge to main
swensosc Dec 29, 2023
989bcd3
Merge remote-tracking branch 'escomp' into merge_hillslope_hydrology
swensosc Dec 29, 2023
c7c6602
merge to main
swensosc Dec 29, 2023
a61b080
Merge branch 'hillslope_hydrology' into hillslope_hydrology-ssr
samsrabin Jan 8, 2024
44d37e7
add check for stream channel
swensosc Jan 19, 2024
efbeef4
Merge remote-tracking branch 'swensosc/hillslope_hydrology' into hill…
samsrabin Jan 19, 2024
54f765a
Hillslope test: Use fixed fsurdat.
samsrabin Jan 19, 2024
55e14eb
Remove EOL whitespace from HillslopeHydrologyMod.
samsrabin Jan 19, 2024
07969f0
Merge tag 'ctsm5.1.dev164' into hillslope_hydrology-ssr
samsrabin Jan 19, 2024
c5be402
Alignment changes in HillslopeHydrologyMod.
samsrabin Jan 22, 2024
51c95e5
Check for unrecognized pft_distribution_method in surfrd_hillslope().
samsrabin Jan 22, 2024
41a7e0d
Error on unhandled soil_profile_method in SetHillslopeSoilThickness().
samsrabin Jan 22, 2024
b1433a0
Fix logic for missing h_bedrock error check.
samsrabin Jan 22, 2024
8abcb55
Remove check_npatches, which was hard-coded true.
samsrabin Jan 22, 2024
00d2b1e
Un-nest "if (masterproc)" in HillslopeHydrologyMod.
samsrabin Jan 22, 2024
8f3d6ab
HillslopeHydrologyMod: Consistent whitespace in if statements.
samsrabin Jan 22, 2024
04bceb0
Check for unrecognized pft_distribution_method in InitHillslope().
samsrabin Jan 22, 2024
12721d4
Point Hillslope test at testdata/ instead of surfdata/.
samsrabin Jan 24, 2024
4d0da3d
Add Hillslope_DominantPftUniform and Hillslope_SoilProfileLinear test…
samsrabin Jan 24, 2024
03cc0f2
Add optional do_not_collapse arg to collapse_to_dominant().
samsrabin Jan 23, 2024
02d2cf7
Use collapse_to_dominant() in surfrd_hillslope().
samsrabin Jan 24, 2024
fd5ed37
Functionize & unit-test HillslopeSoilThicknessProfile_linear().
samsrabin Jan 26, 2024
6513894
Remove a leftover troubleshooting write().
samsrabin Jan 26, 2024
b84720c
Exit early from loop in HillslopeSoilThicknessProfile_linear().
samsrabin Jan 26, 2024
b426ce1
Better unit testing of HillslopeSoilThicknessProfile_linear().
samsrabin Jan 26, 2024
65ac615
Cleanup in HillslopeHydrologyUtils test.
samsrabin Jan 26, 2024
689a550
Rename to test_collapse_to_dom_do_not_collapse.
samsrabin Jan 26, 2024
1c8b468
Add test_collapse_to_dom_do_not_collapse_present_false.
samsrabin Jan 26, 2024
0ce76f0
Fix expected vs. actual in assertEqual() in test_surfrdUtils.
samsrabin Jan 26, 2024
c36280c
Delete 'found on surface data set' msgs from HillslopeHydrologyMod.
samsrabin Jan 27, 2024
0df44c9
Reduce nesting in HillslopeHydrologyMod.
samsrabin Jan 27, 2024
9c0123c
Remove if (masterproc) conditions on error checks outside initializat…
samsrabin Jan 27, 2024
a2b5788
Delete development testmods
samsrabin Jan 29, 2024
83e0bec
Fully specify namelist settings for Hillslope test.
samsrabin Jan 29, 2024
b026e2e
Add 3 new hillslope testmods:
samsrabin Jan 29, 2024
ed5e0ae
Add 4 hillslope tests to testlist_clm.xml:
samsrabin Jan 29, 2024
dbae8b6
Change an intent(out) to inout, satisfying nag test.
samsrabin Jan 29, 2024
220f314
Merge pull request #9 from samsrabin/hillslope_hydrology-ssr4
swensosc Feb 7, 2024
14f86af
make variable names consistent
swensosc Feb 7, 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
Prev Previous commit
Next Next commit
Add optional do_not_collapse arg to collapse_to_dominant().
This logical array, where .true. will prevent individual gridcells from being collapsed. Includes unit testing.
  • Loading branch information
samsrabin committed Jan 24, 2024
commit 03cc0f215d06d29cc5dd96962f1fa11e6722db40
12 changes: 10 additions & 2 deletions src/main/surfrdUtilsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ subroutine collapse_individual_lunits(wt_lunit, begg, endg, toosmall_soil, &
end subroutine collapse_individual_lunits

!-----------------------------------------------------------------------
subroutine collapse_to_dominant(weight, lower_bound, upper_bound, begg, endg, n_dominant)
subroutine collapse_to_dominant(weight, lower_bound, upper_bound, begg, endg, n_dominant, do_not_collapse)
!
! DESCRIPTION
! Collapse to the top N dominant pfts or landunits (n_dominant)
Expand All @@ -251,6 +251,7 @@ subroutine collapse_to_dominant(weight, lower_bound, upper_bound, begg, endg, n_
integer, intent(in) :: lower_bound ! lower bound of pft or landunit indices
integer, intent(in) :: upper_bound ! upper bound of pft or landunit indices
integer, intent(in) :: n_dominant ! # dominant pfts or landunits
logical, intent(in), optional :: do_not_collapse(begg:endg)
! This array modified in-place
! Weights of pfts or landunits per grid cell
! Dimensioned [g, lower_bound:upper_bound]
Expand All @@ -277,6 +278,14 @@ subroutine collapse_to_dominant(weight, lower_bound, upper_bound, begg, endg, n_
if (n_dominant > 0 .and. n_dominant < upper_bound) then
allocate(max_indices(n_dominant))
do g = begg, endg

! original sum of all the weights
wt_sum(g) = sum(weight(g,:))

if (present(do_not_collapse) .and. do_not_collapse(g)) then
cycle
end if

max_indices = 0 ! initialize
call find_k_max_indices(weight(g,:), lower_bound, n_dominant, &
max_indices)
Expand All @@ -286,7 +295,6 @@ subroutine collapse_to_dominant(weight, lower_bound, upper_bound, begg, endg, n_
! Typically the original sum of weights = 1, but if
! collapse_urban = .true., it equals the sum of the urban landunits.
! Also set the remaining weights to 0.
wt_sum(g) = sum(weight(g,:)) ! original sum of all the weights
wt_dom_sum = 0._r8 ! initialize the dominant pft or landunit sum
do n = 1, n_dominant
m = max_indices(n)
Expand Down
66 changes: 66 additions & 0 deletions src/main/test/surfrdUtils_test/test_surfrdUtils.pf
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,72 @@ contains

end subroutine test_collapse_to_dom_pfts


@Test
subroutine test_collapse_with_dont()
! Tests subroutine collapse_to_dominant when used with an optional logical array indicating which gridcells should actually be collapsed
!
use pftconMod, only: pftcon
use clm_instur, only: wt_nat_patch
use clm_varpar, only: natpft_lb, natpft_ub

implicit none
integer, parameter :: begg = 2, endg = 4, natpft_size = 15
real(r8), allocatable :: wt_nat_patch_expected(:,:)
real(r8), allocatable :: wt_nat_patch_in_out(:,:) ! used in subr. call
real(r8) :: expctd(9)
logical, allocatable :: do_not_collapse(:)

! Set relevant pftcon values to defaults; override where necessary
call pftcon%InitForTesting()
natpft_ub = natpft_size - 1
allocate( wt_nat_patch(begg:endg,natpft_lb:natpft_ub) )
allocate( wt_nat_patch_expected(begg:endg,natpft_lb:natpft_ub) )
allocate( wt_nat_patch_in_out(begg:endg,natpft_lb:natpft_ub) )
allocate( do_not_collapse(begg:endg) )

! INPUT VALUES
wt_nat_patch(begg:,:) = 0._r8 ! initialize
wt_nat_patch(begg:,0) = (/ 30._r8, 40._r8, 0._r8/) ! pft0
wt_nat_patch(begg:,1) = (/ 15._r8, 11._r8, 15._r8/) ! pft1
wt_nat_patch(begg:,2) = (/ 5._r8, 5._r8, 5._r8/) ! pft2
wt_nat_patch(begg:,3) = (/ 0._r8, 4._r8, 35._r8/) ! pft3
wt_nat_patch(begg:,4) = (/ 10._r8, 10._r8, 35._r8/) ! pft4
wt_nat_patch(begg:,5) = (/ 40._r8, 30._r8, 10._r8/) ! pft5
wt_nat_patch(:,:) = wt_nat_patch(:,:) / 100._r8
call check_sums_equal_1( wt_nat_patch, begg, "test_check_sums_add_to_1", &
"should not trigger an error")
do_not_collapse(begg:) = .true.

! OUTPUT VALUES EXPECTED
wt_nat_patch_expected = wt_nat_patch

call check_sums_equal_1( wt_nat_patch_expected, begg, "test_check_sums_add_to_1", &
"should not trigger an error")

! Collapse pfts
wt_nat_patch_in_out = wt_nat_patch ! reset argument for next call
call collapse_to_dominant(wt_nat_patch_in_out(begg:endg,:), &
natpft_lb, natpft_ub, begg, endg, &
1, &
do_not_collapse(begg:endg))

! Now check that are correct
call check_sums_equal_1( wt_nat_patch_in_out, begg, "test_check_sums_add_to_1", &
"should not trigger an error")

@assertEqual(wt_nat_patch_in_out(begg:,:), wt_nat_patch_expected(begg:,:), tolerance=0._r8)

deallocate( wt_nat_patch_expected )
deallocate( wt_nat_patch_in_out )
deallocate( wt_nat_patch )
deallocate( do_not_collapse )

call pftcon%clean()

end subroutine test_collapse_with_dont


@Test
subroutine test_collapse_crop_types_none()
! This test sets cftsize = 0, ie crops are lumped together with unmanaged
Expand Down