| 189 | }}} |
| 190 | Further changes needed regarding residual to ensure mass conservation: |
| 191 | 1. The residual has to be initialized with zero: |
| 192 | {{{ |
| 193 | ! If npp is not initialized, bare soil value is never set. |
| 194 | npp(:,:) = zero |
| 195 | |
| 196 | !DSGdebug_05a ! Not having this results in an unitilized error |
| 197 | !DSGdebug_05a ! with valgrid, but I can't figure out why. It always |
| 198 | !DSGdebug_05a ! seems to be set before being used. |
| 199 | ! DSG: Of course you get errors, when a variable was never set but is used |
| 200 | ! (for example in case first_call=true) |
| 201 | ! I set it to zero, as it should be zero in the aformentioned case |
| 202 | !DSGdebug_05a residual(:,:) = val_exp |
| 203 | !DSGdebug_05a |
| 204 | residual(:,:) = zero |
| 205 | !DSGdebug_05a |
| 206 | }}} |
| 207 | 2. In case of nutrient down regulating bm_alloc the labile pool has to be corrected for not allocated residual |
| 208 | {{{ |
| 209 | !DSGdebug_01 |
| 210 | biomass(:,:,ilabile,:) = biomass(:,:,ilabile,:) - alloc_tot(:,:,:) |
| 211 | !DSGdebug_01 |
| 212 | |
| 213 | !DSGdebug_05a |
| 214 | WHERE ((residual(:,:).GT. zero).AND.(residual(:,:) .GT. bm_alloc_tot(:,:))) |
| 215 | biomass(:,:,ilabile,icarbon) = biomass(:,:,ilabile,icarbon) - (residual(:,:) - bm_alloc_tot(:,:)) |
| 216 | END WHERE |
| 217 | !DSGdebug_05a |
| 218 | |