Should be checking soil texture sums after perturbation
- Dominant language
- Fortran
- Stars
- 352
- Forks
- 361
- Avg merge
- 6d 6h
- Merged PRs (30d)
- 8
Description
### Brief summary of bug
We have the ability to perturb clay and sand percent (with `clay_pf` and `sand_pf` on the parameter file). However, after these values are updated, the sum of soil textures (clay + sand ?) is not checked, and this could lead to out-of-bounds (i.e. > 100 or <0?) values for `clay + sand`
### General bug information
See code [here](https://github.com/ESCOMP/CTSM/blob/942de5c248d891cbde945a2c8c27a01af697bc86/src/biogeophys/SoilStateInitTimeConstMod.F90#L502):
```
if (params_inst%sand_pf == 0._r8 .and. params_inst%clay_pf == 0._r8) then
soilstate_inst%cellsand_col(c,lev) = sand
soilstate_inst%cellclay_col(c,lev) = clay
else
! by default, will read sand and clay from the surface dataset
! - sand_pf can be used to perturb the absolute percent sand
! - clay_pf can be used to perturb what percent of (clay+silt) is clay
if (sand<100._r8) then
residual_clay_frac = clay/(100._r8-sand)
else
residual_clay_frac = 0.5_r8
end if
perturbed_sand = min(100._r8,max(0._r8,sand+params_inst%sand_pf))
perturbed_residual_clay_frac = min(1._r8,max(0._r8,residual_clay_frac + &
params_inst%clay_pf/100._r8))
soilstate_inst%cellsand_col(c,lev) = perturbed_sand
soilstate_inst%cellclay_col(c,lev) = (100._r8-perturbed_sand)*perturbed_residual_clay_frac
end if
```
Thanks to @ekluzek for checking on this, we do ensure the surface data is accurate in [`mksurfadata`](https://github.com/ESCOMP/CTSM/blob/942de5c248d891cbde945a2c8c27a01af697bc86/tools/mksurfdata_map/src/mksoilMod.F90#L122):
```
if ( sumtex < 0.0_r8 .or. sumtex > 100.0_r8 )then
write (6,*) subname//':error: soil_sand and soil_clay out of bounds: sand, clay = ', &
soil_sand, soil_clay
call abort()
end if
```
We should do the same thing after these values are perturbed (or perhaps on read-in regardless).
Related, I have been trying to run the PPE parameter files with the latest master and I get a model crash when `clay_pf` is negative. I'm not sure why this is occurring but thought it *might* be solved with some kind of soil texture sum check. @djk2120 or @olyson do you have any thoughts on this?
**CTSM version you are using:** `ctsm5.1.dev130`
**Does this bug cause significantly incorrect results in the model's science?** Probably not
**Configurations affected:** If `clay_pf` or `sand_pf` are perturbed outside of correct bounds
Contributor guide
Assessment
This issue has not been assessed yet.