Potential bug in mo_multi_param_reg.f90
When the fractions of the different land cover types are calculated in mo_multi_param_reg.f90
:
fSealed1(:, 1, iiLC) = fracSealed_CityArea * fSealed1(:, 1, iiLC)
fPerm1(:) = fPerm1(:) + (1.0_dp - fracSealed_CityArea) * fSealed1(:, 1, iiLC)
! to make sure everything happens smoothly
fForest1(:) = fForest1(:) / (fForest1(:) + fSealed1(:, 1, iiLC) + fPerm1(:))
fSealed1(:, 1, iiLC) = fSealed1(:, 1, iiLC) / (fForest1(:) + fSealed1(:, 1, iiLC) + fPerm1(:))
fPerm1(:) = fPerm1(:) / (fForest1(:) + fSealed1(:, 1, iiLC) + fPerm1(:))
the 2nd line contains IMHO a bug. fPerm1 must be based on the original fSealed, not the corrected one. One possible alternative could be, for example:
fSealed1(:, 1, iiLC) = fracSealed_CityArea * fSealed1(:, 1, iiLC)
fPerm1(:) = 1.0_dp - fSealed1(:, 1, iiLC) - fForest1(:)
There are multiple ways to implement that, but this one is the neatest, I think and makes the last checks obsolete. fForest1(:) + fSealed1(:, 1, iiLC) + fPerm1(:) should always sum to 1, as they come directly from the L0 land cover fields. @rakovec Please give some feedback and decide, what is to be done. It influences all the snow parameters and fSealed is also used in many parts of the program. The code has also been there in version 5.8.