NCAR / wrf_hydro_nwm_public

WRF-Hydro model code
https://ral.ucar.edu/projects/wrf_hydro
Other
181 stars 139 forks source link

Add negative soil moisture check and adjustment to SSTEP #644

Closed aubreyd closed 2 years ago

aubreyd commented 2 years ago

TYPE: enhancement?

KEYWORDS: NoahMP, soil moisture

SOURCE: Aubrey D, NCAR

DESCRIPTION OF CHANGES: The new Xinanjiang infiltration scheme triggers NaNs when the top 2 soil layers show a negative net soil moisture. There is a catch for this negative soil moisture condition at the end of the SOILWATER routine, but this happens after the Xinanjiang module is called within the infiltration iterative loop. To avoid NaNs, we added a duplicate check and adjustment (move water from lower layer to fill deficit in upper layer) into the SSTEP solver right after the oversaturation check. For consistency with current solution, we maintain the 0.01mm minimum soil water threshold implemented in the SOILWATER adjustment, however for future development we may want to consider SMCDRY or another fractional soil moisture based threshold.

There will be answer changes.

ISSUE: Fixes #645

TESTS CONDUCTED: 1) Tested on two sample NWM cutout basins that were generating NaNs with the Xinanjiang infiltration scheme. On 1-year tests, the new code does not produce NaNs and is very close to original solution. 2) Tested CONUS NWM domain over 3 months when original code was generating at least 1 NaN cell. The new code does not generate NaNs and is very close to original solution. 3) Code passed ncores and perfect restart tests with CONUS domain.

Checklist

Merging the PR depends on following checklist being completed. Add X between each of the square brackets if they are completed in the PR itself. If a bullet is not relevant to you, please comment on why below the bullet.

scrasmussen commented 2 years ago

LGTM! Still putting together unit test to try to simulate negative soil moisture to test this use case but I trust the testing Aubrey did 👍

3: . PRE-SH2O  =  -9.99999978E-03  -9.99999978E-03  -9.99999978E-03  0.340354979
3:  WARNING: Negative smc adjustment
3:  POST-SH2O =   9.99999975E-05   3.33333301E-05   1.66666650E-05  0.330289006
3:  WMINUS =    0.00000000

3: . PRE-SH2O  =  -9.99999978E-03  -9.99999978E-03  -9.99999978E-03  -9.99999978E-03
3:  WARNING: Negative smc adjustment
3:  WARNING: SMC deficit - this water will be removed from subsurface runoff (meters).   2.00759638E-02
3:  POST-SH2O =   9.99999975E-05   3.33333301E-05   1.66666650E-05   9.99999975E-06
3:  WMINUS =    2.00759638E-02

PR passes new unit tests and functions as expected 😄

aubreyd commented 2 years ago

Just adding that while I have not specifically tested this, it does look like there is an existing check for negative subsurface runoff in Land_models/NoahMP/phys/module_sf_noahmpdrv.F: soldrain(i,j) = max(RUNSB*dt, 0.) !mm , underground runoff So if we hit a case where the new soil moisture deficit correction needs to take water from subsurface runoff and subsurface runoff is 0, it will not crash the model with negative subsurface runoff (though it also will not conserve mass...).

aubreyd commented 2 years ago

See remaining outstanding issues logged here: https://github.com/NCAR/wrf_hydro_nwm_public/issues/646 https://github.com/NCAR/wrf_hydro_nwm_public/issues/647