Subroutine vom_subhourly

1667 : 
1668 : !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1669 : !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1670 : !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1671 : !*----water balance and conditions at next time step--------------------
1672 : 
1673 :       subroutine vom_subhourly ()
1674 :       use vom_vegwat_mod
1675 :       implicit none
1676 : 
1677 :       REAL*8  :: dtss
1678 :       REAL*8  :: dtmq         ! Maximum timestep allowed by tree water content change
1679 : 
1680 :       dtmq = 99999.d0
1681 : 
1682 :       if (q_md .gt. 0.d0) then
1683 : !       * avoids mq from becoming larger than mqx or smaller than 0.9mqx
1684 :         if (dmqt .gt. 0.d0) then
1685 :           dtmq = (q_mqx - mqt_) / dmqt
1686 :         elseif (dmqt .lt. 0.d0) then
1687 :           dtmq = (0.9d0 * q_mqx - mqt_) / dmqt
1688 :         endif
1689 : 
1690 :         if (ABS(mqt_ - mqsst_) .gt. q_mqx / 1.d6) then
1691 :           dtss = (mqt_ - mqsst_) / (1.d6 * (etmt__ - SUM(ruptkt__(:))))
1692 :           if (dtss .le. 0.d0) dtss = 99999.d0
1693 :         else
1694 :           dtss = 99999.d0
1695 :         endif
1696 :       else
1697 :         dtss = 99999.d0
1698 :       endif
1699 : 
1700 :       dtmax = MIN(dtss, dtmq, 3600.d0 - time)
1701 : 
1702 : !     * waterbalance uses dtmax for the determination of dt
1703 :       call waterbalance()
1704 : 
1705 :       return
1706 :       end subroutine vom_subhourly