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 pre-merge changes #9

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
287 commits
Select commit Hold shift + click to select a range
8197954
Add NYRS_CROP_ACTIVE history variable.
samsrabin Jul 14, 2023
b693456
Merge branch 'master-NYRS_CROP_ACTIVE' into refactor-crop-gdd-runmeans
samsrabin Jul 14, 2023
4308802
Run fixes.
samsrabin Jul 17, 2023
6c0049a
Only call tillage_init_century() if doing tillage.
samsrabin Jul 17, 2023
e85505e
Allow tillage with FATES.
samsrabin Jul 17, 2023
d144df9
Added note about GDP dependence in old code.
samsrabin Jul 17, 2023
44eeaf7
Reorder tillage_mults_allphases fill for consistency.
samsrabin Jul 17, 2023
35b7f23
Removed an old comment in TillageMod.
samsrabin Jul 17, 2023
9090a6e
TillageMod now has its own copies of indices for soil pools.
samsrabin Jul 17, 2023
8c43072
Initialize tillage for MIMICS; not yet applying.
samsrabin Jul 17, 2023
a5e770e
Added note.
samsrabin Jul 7, 2023
07a259f
Only pass one patch's idop to get_tillage_multipliers().
samsrabin Jul 7, 2023
48b697e
Generalize tillage to work with multiple active crop patches.
samsrabin Jul 7, 2023
70e65c3
Merge branch 'tillage-multi-patch' into tillage-dev
samsrabin Jul 18, 2023
13f898c
Merge branch 'tillage-dev' into tillage-mimics
samsrabin Jul 18, 2023
eb3171d
Moved TillageMod.F90 to soilbiogeochem/
samsrabin Jul 18, 2023
955ec7f
Tillage now applied to MIMICS.
samsrabin Jul 18, 2023
6c4e019
Compile fixes.
samsrabin Jul 18, 2023
f9a03e6
Merge branch 'tillage-mimics' into tillage-dev
samsrabin Jul 19, 2023
d629ddd
Added script to add tillage parameters to params file.
samsrabin Jul 24, 2023
c148410
Tillage multipliers now read from params file.
samsrabin Jul 24, 2023
de88db0
Add git status info to params file.
samsrabin Jul 25, 2023
49b15ad
Save paramfile as NETCDF3_CLASSIC.
samsrabin Jul 26, 2023
0441df0
Replaced logical do_tillage_* with integer tillage_intensity.
samsrabin Jul 26, 2023
163147e
Removed unused 'use' in readParams_netcdf().
samsrabin Jul 26, 2023
23a89d6
Renamed nphases to ntill_intensities_max for consistency with netCDF …
samsrabin Jul 26, 2023
f61f983
Move present(idop) checks to beginning of decomp_rates_* subroutines.
samsrabin Jul 26, 2023
c1757d1
Rework get_apply_tillage_multipliers() to j;c loop instead of c;j.
samsrabin Jul 26, 2023
8cfeafe
Slice decomp_k by column and soil layer before passing to get_apply_t…
samsrabin Jul 26, 2023
750f5b9
Merge branch 'tillage-dev' into tillage
samsrabin Jul 26, 2023
255649b
Merge tag 'ctsm5.1.dev132' into refactor-crop-gdd-runmeans
samsrabin Aug 7, 2023
7eaf5e2
Merge tag 'ctsm5.1.dev132' into tillage
samsrabin Aug 9, 2023
4a8adff
Bugfix to check that tillage is off when use_crop false.
samsrabin Aug 9, 2023
9ce4ed9
Merge tag 'ctsm5.1.dev133' into fates-luh2
glemieux Aug 14, 2023
d856f1b
Improved description of get_tillage_multipliers().
samsrabin Aug 14, 2023
b71fa23
Improved description of use_original_tillage parameter.
samsrabin Aug 14, 2023
c5ee474
Improved error message when tillage on but use_crop off.
samsrabin Aug 14, 2023
fe568e1
Use get_do_tillage() in first readParams_netcdf() return check.
samsrabin Aug 14, 2023
3495f4b
Added a space.
samsrabin Aug 14, 2023
1865649
get_apply_tillage_multipliers(): multiple crop patches are OK.
samsrabin Aug 14, 2023
9063873
get_apply_tillage_multipliers: Check for sumwt < 1.
samsrabin Aug 14, 2023
56cb0b0
Initialize history variables to spval instead of nan.
samsrabin Aug 15, 2023
f01adc6
Share idpp calculation code.
samsrabin Aug 14, 2023
cb5a889
Prepend bgc_ to till_decompk_multipliers.
samsrabin Aug 21, 2023
86b81fb
Till to 32 cm depth rather than top 5 soil layers.
samsrabin Aug 21, 2023
69451e2
Allow partially-tilled soil layers.
samsrabin Aug 21, 2023
8e67f28
max_tillage_depth is now a namelist parameter.
samsrabin Aug 21, 2023
b18572d
Added a comment and TODO.
samsrabin Aug 22, 2023
7af6bf6
Max till depth now 26cm (match text of Graham et al., 2021).
samsrabin Aug 22, 2023
ebda444
Renamed var & added text re: original tillage settings.
samsrabin Aug 22, 2023
cc5c4ae
Merge tag 'ctsm5.1.dev135' into fates-luh2
glemieux Aug 22, 2023
28df94e
Revert "Merge branch 'master-NYRS_CROP_ACTIVE' into refactor-crop-gdd…
samsrabin Aug 23, 2023
5249af6
Merge branch 'refactor-crop-gdd-runmeans-dev2' into refactor-crop-gdd…
samsrabin Aug 23, 2023
2d76faa
Moved fraction_tilled calculation to new function get_fraction_tilled().
samsrabin Aug 31, 2023
e628c71
Added unit test for get_fraction_tilled().
samsrabin Aug 31, 2023
b12c780
Corrected a unit in a comment.
samsrabin Sep 1, 2023
c5171fe
get_apply_tillage_multipliers(): Skip non-crop columns more simply.
samsrabin Sep 1, 2023
195d0f3
resolve merge, add fates radiation
rgknox Sep 11, 2023
2183e0a
Placeholders in CN[CN]StateUpdate1Mod, CNPhenologyMod, CNCIsoFluxMod.
samsrabin Jul 19, 2023
8aaa7f3
Add new CNVeg*FluxType members for removed residues. Unused.
samsrabin Jul 19, 2023
d32a49e
Filled to_removedresidue placeholders in CIsoFlux1().
samsrabin Jul 19, 2023
26775c3
Added CIsoFluxCalc() calls for to_removedresiduec pools in CIsoFlux1().
samsrabin Jul 19, 2023
3cb6549
Filled to_removedresidue placeholders in CNCStateUpdate1Mod.
samsrabin Jul 19, 2023
0ba8bed
Filled to_removedresidue placeholders in CNNStateUpdate1Mod.
samsrabin Jul 19, 2023
cc32593
Filled _to_removedresidue placeholders in CNCropHarvestToProductPools()
samsrabin Jul 19, 2023
9621190
Added associate statements for to_removedresidue pools to CNOffsetLit…
samsrabin Jul 19, 2023
74b11d8
Add residue removal code, but removedresidue_fraction 0.
samsrabin Sep 11, 2023
1ec3f62
Add namelist parameter crop_residue_removal_frac.
samsrabin Sep 11, 2023
4e0144d
arguments and hist call updates
rgknox Sep 12, 2023
579ca9a
Bug fix in get_fraction_tilled().
samsrabin Sep 15, 2023
7f7dfc8
test_get_fraction_tilled(): Use nlayers instead of 5.
samsrabin Sep 18, 2023
46da730
test_get_fraction_tilled(): Now works with new function call.
samsrabin Sep 18, 2023
9c1618b
get_fraction_tilled() no longer takes argument j.
samsrabin Sep 18, 2023
b87fbd9
get_fraction_tilled() can now handle zero-thickness layers.
samsrabin Sep 18, 2023
c0d8784
Simplify and split up test_get_fraction_tilled().
samsrabin Sep 18, 2023
77d0c7d
get_fraction_tilled() receives layer_bottom, not layer_top.
samsrabin Sep 18, 2023
7b6f5fa
Merge branch 'clmfates-gru-init-fix' into ctsm5.1.dev139-two-stream
rgknox Sep 20, 2023
3d253a0
Updated temporary two-stream fates branch
rgknox Sep 21, 2023
3c24b25
Prevent tillage from being enabled.
samsrabin Oct 2, 2023
d43c617
Merge tag 'ctsm5.1.dev142' into tillage
samsrabin Oct 2, 2023
595d95d
Merge tag 'ctsm5.1.dev142' into hillslope_hydrology-ssr
samsrabin Oct 4, 2023
c8d6754
Removed a TODO.
samsrabin Oct 5, 2023
7510431
Removed an incorrect comment.
samsrabin Oct 5, 2023
d565176
Do not till generic crops.
samsrabin Oct 5, 2023
b86402e
Warn instead of fail when trying to enable tillage.
samsrabin Oct 5, 2023
1a3a8b7
Delete add_tillage_to_paramsfile.py.
samsrabin Oct 5, 2023
ae56384
Use ntill_intensities_max; set to private.
samsrabin 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
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
93a18c8
Merge tag 'ctsm5.1.dev138' into fates-luh2
glemieux Oct 9, 2023
53b8719
Add Hillslope test.
samsrabin Nov 3, 2023
0e7a9a9
Removed NTASKS=-2 from shell_commands.
samsrabin Nov 3, 2023
0a4b2cb
Merge tag 'ctsm5.1.dev152' into fates-luh2
glemieux Nov 15, 2023
3bbbc53
update fates setup loging to use remove_leading_and_trailing_quotes f…
glemieux Nov 15, 2023
96b827c
add test to check for namelist build error conditions
glemieux Nov 15, 2023
f795147
define LUH acronym
glemieux Nov 15, 2023
042b7ef
remove erroneous comment in use_fates_luh namelist option
glemieux Nov 15, 2023
87b149f
add clarifying comments for the fates landuse timeseries module
glemieux Nov 15, 2023
b061816
trim filename strings in control mod diagnostic output
glemieux Nov 15, 2023
faee6e5
setting fates external to two-stream feature branch
rgknox Nov 28, 2023
f1f1a91
Updating spacing for fates radiation path join
rgknox Nov 28, 2023
90a297e
Merge tag 'ctsm5.1.dev155' into fates-luh2
glemieux Nov 29, 2023
f2ad048
fates external pointer
rgknox Nov 30, 2023
cd93627
merge up to dev155
rgknox Nov 30, 2023
1f44adf
update fates parameter file name in defaults
glemieux Nov 30, 2023
fd7373d
remove obsolete disturbance variables from base fates testmod
glemieux Nov 30, 2023
97a93b7
add landuse site level variables to default fates testmod
glemieux Nov 30, 2023
c245592
remove obsolete disturbance variables from excluded output of fates_s…
glemieux Nov 30, 2023
8c0b078
add luh2 testmod
glemieux Nov 30, 2023
a0f8ff9
change location of luh2 fates data and make sure default is available
glemieux Dec 1, 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
bb23a70
replace use statements from the fluh_timeseries default setting
glemieux Dec 1, 2023
e2716ca
add build subdirectory for fates landuse timeseries default file
glemieux Dec 1, 2023
ffac03f
add fates to the build tag subdirectory name
glemieux Dec 1, 2023
be78a0b
add resolution to the add_default call for the fates landuse timeseries
glemieux Dec 1, 2023
3def7e3
correct descriptions and diagnostic write
glemieux Dec 1, 2023
e8b0508
correct hlm group name in namelist definition
glemieux Dec 2, 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
7dba402
Fates pointer
rgknox Dec 11, 2023
e6c0cbf
Update fates two-stream b4b pointer
rgknox Dec 11, 2023
1a1ec94
remove wood product flux from fates carbon balance check
glemieux Dec 12, 2023
7c2ec40
Merge tag 'ctsm5.1.dev159' into fates-luh2
glemieux Dec 13, 2023
67426be
update externals with fates landuse tag
glemieux Dec 14, 2023
131308f
update external
rgknox Dec 14, 2023
3425f4d
Revert "Revert "Merge remote-tracking branch 'samsrabin/regrid-shdate…
samsrabin Dec 14, 2023
197e53a
Improve comments/docstrings.
samsrabin Dec 14, 2023
0224c2a
Another comment/docstring improvement.
samsrabin Dec 14, 2023
4bf2384
Rename TestRegridGgcmiShdates to TestUtilsImportCoord.
samsrabin Dec 14, 2023
164357e
regrid_ggcmi_shdates now loads cdo module.
samsrabin Dec 14, 2023
225f092
Update the default fates paramfile
glemieux Dec 15, 2023
809ef08
Pass surfpft bounds as input argumment
glemieux Dec 15, 2023
27b2607
Delete a print(lat).
samsrabin Dec 17, 2023
f39f7b4
Use logging infra for *_ggcmi_shdates.py scripts.
samsrabin Dec 17, 2023
747eda6
chdir out of tempdir in tests and regrid_ggcmi_shdates.
samsrabin Dec 17, 2023
3f3f40c
Call regrid_ggcmi_shdates from tools/crop_calendars.
samsrabin Dec 17, 2023
c6bd829
Update process_ggcmi_shdates to work with reworked regrid_ggcmi_shdates.
samsrabin Dec 17, 2023
9fd3237
Warn instead of failing if process_ggcmi_shdates is missing an input …
samsrabin Dec 17, 2023
9c59d40
process_ggcmi_sdates now respects --crop-list.
samsrabin Dec 18, 2023
e4b4def
Call process_ggcmi_shdates from tools/crop_calendars.
samsrabin Dec 18, 2023
35a2f98
Remove an extraneous #.
samsrabin Dec 18, 2023
a9d9621
Reformatting with black.
samsrabin Dec 18, 2023
d19abd1
Added previous commit to .git-blame-ignore-revs.
samsrabin Dec 18, 2023
6b324ec
Merge tag 'ctsm5.1.dev159' into cropresidues3-dev
samsrabin Dec 18, 2023
aa463cf
add fates luh2 test to derecho
glemieux Dec 18, 2023
8bd8bfe
update changelog
glemieux Dec 19, 2023
35bcc4a
externals
rgknox Dec 19, 2023
cdf1bf9
updated fates externals to two-stream b4b test branch
rgknox Dec 20, 2023
877493f
Updated call to fates history
rgknox Dec 20, 2023
39e5496
merging luh2 and two-stream for fates
rgknox Dec 21, 2023
8607b25
update argument to fates hifrq hist
rgknox Dec 21, 2023
554a6ec
Crop tech note: Biofuel stems are also routed to biofuel pools.
samsrabin Dec 23, 2023
3d23110
Crop tech note: Add info about residue removal.
samsrabin Dec 23, 2023
a4c3741
Crop tech note: Don't show separate eqs for livestem and leaf removal.
samsrabin Dec 23, 2023
c05f728
Crop tech note: Refer to residue removal equations.
samsrabin Dec 23, 2023
6d78b7f
Crop tech note: Remove "leaf" from residue removal eq labels.
samsrabin Dec 23, 2023
1740a97
Crop tech note: Remove "wholly or partially."
samsrabin Dec 23, 2023
701c00f
Merge branch 'cropresidues3-dev' into cropresidues3
samsrabin Dec 23, 2023
84182bd
Updated test nl with updated fates history
rgknox Dec 27, 2023
d1f08a7
Add script used to add tillage to paramfile.
samsrabin Dec 29, 2023
d566b6d
Specify posNOTonfile=.true. in call of ncd_io() for till_decompk_mult…
samsrabin Dec 27, 2023
693750c
Replace a ntill_stages_max with ntill_intensities_max.
samsrabin Dec 29, 2023
9af1a04
Merge tag 'ctsm5.1.dev159' into tillage
samsrabin Dec 29, 2023
fffa851
Typo fix in crop Tech Note.
samsrabin Dec 29, 2023
ff610b4
Add tillage documentation to Tech Note.
samsrabin Dec 29, 2023
c86e1b6
Add "Running with tillage" section to User's Guide.
samsrabin Dec 29, 2023
f344ff1
Add 'till' testdef.
samsrabin Dec 29, 2023
225a510
Change LUH2 test to f09 so there won't be a LUH2 timeseries file for it
ekluzek Dec 31, 2023
6747e8c
Only get a default luh timeseries file if you need one, and ask for o…
ekluzek Dec 31, 2023
4e059c7
LUH file should be for 1850-2000, and add a case for constant until i…
ekluzek Dec 31, 2023
ebc5cd8
Update change files
ekluzek Dec 31, 2023
adbc727
Merge pull request #2076 from glemieux/fates-luh2
ekluzek Dec 31, 2023
c003f82
Merge tag 'ctsm5.1.dev160' into refactor-crop-gdd-runmeans
samsrabin Jan 3, 2024
0d8dc98
Update ChangeLog/ChangeSum.
samsrabin Jan 4, 2024
5753e32
Merge pull request #2060 from samsrabin/refactor-crop-gdd-runmeans
samsrabin Jan 4, 2024
0665754
Use parameter files with tillage multipliers (*.c240105.nc).
samsrabin Jan 5, 2024
2f69473
Remove warning about tillage not being scientifically tested.
samsrabin Jan 5, 2024
1e1f2e4
Point to raw GGCMI calendar files in *ggcmi_shdates scripts.
samsrabin Jan 5, 2024
534847d
Merge tag 'ctsm5.1.dev161' into regrid-shdate-dev2
samsrabin Jan 5, 2024
675205f
Update ChangeLog/ChangeSum.
samsrabin Jan 5, 2024
abd743b
Merge pull request #2292 from samsrabin/regrid-shdate-dev2
samsrabin Jan 5, 2024
3ff0b72
Merge tag 'ctsm5.1.dev162' into cropresidues3
samsrabin Jan 5, 2024
336f848
*_TO_REMOVEDRESIDUEC outputs now off by default.
samsrabin Jan 5, 2024
142c2c1
Enable tillage in two aux_clm tests.
samsrabin Jan 5, 2024
cd6a021
Merge branch 'cropresidues3' into tillage-and-residues4
samsrabin Jan 8, 2024
88519c0
Move numpy-dependent Python functions out of utils.py.
samsrabin Jan 8, 2024
b991db3
Import abort() in ctsm_pylib_dependent_utils.py.
samsrabin Jan 8, 2024
d866510
Formatting with black.
samsrabin Jan 8, 2024
be08199
Add previous commit to .git-blame-ignore-revs.
samsrabin Jan 8, 2024
a61b080
Merge branch 'hillslope_hydrology' into hillslope_hydrology-ssr
samsrabin Jan 8, 2024
1e2fa22
Added fates two-stream test
rgknox Jan 10, 2024
6a9af15
fix len error for fates landuse timeseries
glemieux Jan 10, 2024
db2aa54
Add NEON tests to expected fail list.
samsrabin Jan 10, 2024
77610f1
NEON tests can also fail during RUN.
samsrabin Jan 10, 2024
c7d7cfc
Enable tillage in two aux_clm tests.
samsrabin Jan 5, 2024
3cb6a6a
Remove tillage from CLM4.5 Intel test.
samsrabin Jan 10, 2024
537a422
Add residue removal test.
samsrabin Jan 10, 2024
4fe3a2d
Merge branch 'fix-izumi-runsystests' into tillage-and-residues4
samsrabin Jan 10, 2024
6820720
update seed dispersal test mod to place temp parameter file in case dir
glemieux Jan 10, 2024
3b52933
Merge branch 'tillage' into tillage-and-residues4
samsrabin Jan 10, 2024
65d5f8e
update seed dispersal clm user namelist to look in case dir for temp …
glemieux Jan 10, 2024
0f321ff
Update ChangeLog and ChangeSum
samsrabin Jan 10, 2024
438bcc6
Merge pull request #2311 from samsrabin/tillage-and-residues4
samsrabin Jan 10, 2024
cc2f408
Merge tag 'ctsm5.1.dev163' into fates-two-stream-dev163
rgknox Jan 10, 2024
9413b62
Added two-stream nocomp test
rgknox Jan 10, 2024
674715e
Changed test configuration to be gnu and debug to trigger errors
rgknox Jan 16, 2024
a32174e
reverting PEM seed dispersal test (fates) to use srcdir
rgknox Jan 16, 2024
38d505b
Updated fates external to new tag
rgknox Jan 16, 2024
f81961a
update change logs
rgknox Jan 16, 2024
f0d8017
Update change files
ekluzek Jan 17, 2024
5b72315
Merge pull request #2265 from rgknox/fates-two-stream
ekluzek Jan 17, 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
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
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
samsrabin marked this conversation as resolved.
Show resolved Hide resolved
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()
samsrabin marked this conversation as resolved.
Show resolved Hide resolved
! 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)
samsrabin marked this conversation as resolved.
Show resolved Hide resolved

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