CABLE-LSM / CABLE

Home to the CABLE land surface model and its documentation
https://cable.readthedocs.io/en/latest/
Other
8 stars 3 forks source link

Potential bug in subroutine avgsoil in casa_cnp.F90 #279

Open rml599gh opened 4 months ago

rml599gh commented 4 months ago

avgsoil calculates btran which is used in casa_xrateplant in the calculation of drought stress on leaf litter fall. The drought stress calculation comes from Arora and Boer (2005). btran appears to be 'W' from their eqn 16 and is described as a water availability index with W between 0 and 1 when root zone soil moisture is between wilting (W=0) and capacity (W=1). avgsoil has two calculations of btran at line 1501 and 1507

          casamet%btran(nland)     = casamet%btran(nland)+ veg%froot(nland,ns)  &
               * (MIN(soil%sfc(nland),casamet%moist(nland,ns))-soil%swilt(nland)) &
               /(soil%sfc(nland)-soil%swilt(nland))

          ! Ticket#121

          casamet%btran(nland)     = casamet%btran(nland)+ veg%froot(nland,ns)  &
               * (MAX(MIN(soil%sfc(nland),casamet%moist(nland,ns))-soil%swilt(nland),0.0)) &
               /(soil%sfc(nland)-soil%swilt(nland))

I think the second one is correct as it restricts W to be between 0 and 1 but, in this case, I think the first one needs to be removed. Otherwise, it looks like the terms are being summed up twice. The repeated statement appears to have come into the code between CABLE2.4 and CABLE2.5.

If one layer is drier than wilting is it likely that all of them are? Is there a difference in doing the restriction to positive for each layer individually rather than just doing it once the weighted average has been calculated?

Also the comment at the start of the subroutine doesn't seem to be correct. It is doing an average over the soil column (weighted by root fraction) not an average across the grid-cell.

rml599gh commented 1 month ago

Initial testing for a set of single grid-cells of different dominant vegetation types shows no impact if #275 is not implemented, as expected. When combined with #275, impact appears generally small - effectively correcting the large changes seen if #275 is implemented independently.