Subroutine waterbalance_update_state
299 :
300 : !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
301 : !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
302 : !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
303 : !*-----Calculating state variables at next time step--------------------
304 :
305 : subroutine waterbalance_update_state ()
306 : use vom_vegwat_mod
307 : implicit none
308 :
309 : INTEGER :: jj
310 :
311 : sunew(:) = su__(:) + dt_ * dsu(:)
312 : jj = s_maxlayer
313 : wlayernew = s_maxlayer
314 :
315 : ! * Find the lowest unsaturated layer and set the one below it as wlayernew
316 :
317 : do while (sunew(jj) .gt. 0.999999d0 .and. jj .gt. 1)
318 : jj = jj - 1
319 : wlayernew = jj
320 : enddo
321 :
322 : ! * If there is not enough moisture in the layer above the saturated
323 : ! layers, the water table is in the top saturated layer.
324 :
325 : if (sunew(wlayernew) .lt. sueq(wlayernew)) then
326 : wlayernew = wlayernew + 1
327 : endif
328 :
329 : sunew(wlayernew+1:s_maxlayer) = 1.d0
330 :
331 : pcapnew(:) = 1.d0 / s_avg(:) * (sunew(:) ** (-1.d0 / c_mvg(:)) &
332 : & - 1.d0) ** (1.d0 / s_nvg(:))
333 :
334 : kunsatnew(:) = s_ksat(:) * ((-sunew(:) ** (1.d0 &
335 : & / c_mvg(:)) + 1.d0) ** c_mvg(:) &
336 : & - 1.d0) ** 2.d0 * SQRT(sunew(:))
337 :
338 : ! * Position of the water table after eq_wt1 in watbal3:
339 :
340 : if (wlayernew .lt. s_maxlayer) then
341 : zwnew = SUM(s_delz(wlayernew:s_maxlayer)) - 2.d0 &
342 : & * s_delz(wlayernew) * pcapnew(wlayernew) &
343 : & / (s_delz(wlayernew+1) + s_delz(wlayernew))
344 : else
345 : zwnew = s_delz(wlayernew) - 2.d0 * s_delz(wlayernew) &
346 : & * pcapnew(wlayernew) / s_delz(wlayernew)
347 : endif
348 :
349 : return
350 : end subroutine waterbalance_update_state