Cleanup negative water handling in SoilWaterMovementMod
- Dominant language
- Fortran
- Stars
- 352
- Forks
- 361
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
SoilWaterMovementMod (subroutine SoilWater) has some code to prevent negative water for the sake of flexible-CN:
https://github.com/ESCOMP/ctsm/blob/527f3262e550c96b28ce78ee307457bf6adb2e46/src/biogeophys/SoilWaterMovementMod.F90#L306-L343
@swensosc and I see a few problems with this:
1. This code shouldn't be in a use_flexibleCN conditional: I really don't like that the operation of hydrology is affected by whether we're using a certain biogeochem option. Even if this is only needed when using flexible-CN, it would keep the code cleaner, easier to understand and less prone to future errors if this handling were always done.
2. The magic number for watmin disagrees with the watmin value used elsewhere. We're not sure if that's intentional or not.
3. This code is similar to code in SoilHydrologyMod, but with some differences that may or may not be intentional:
https://github.com/ESCOMP/ctsm/blob/527f3262e550c96b28ce78ee307457bf6adb2e46/src/biogeophys/SoilHydrologyMod.F90#L1510-L1560
We should probably create a shared routine that corrects for negative water and use that shared code wherever it's needed. However (if I'm remembering correctly) @swensosc feels that this general SoilWaterMovementMod negative water handling may not be necessary at all, if we change some code elsewhere to deal with negative water in the top layer.
More generally, we'll need to rework all of this negative water handling to use explicit fluxes, for the sake of water isotopes, etc.
Contributor guide
Assessment
This issue has not been assessed yet.