1537 class(UzfCellGroupType) :: this
1538 integer(I4B),
intent(in) :: icell
1539 real(DP),
intent(in) :: delt
1540 integer(I4B),
intent(in) :: ietflag
1541 integer(I4B),
intent(inout) :: ierr
1543 type(UzfCellGroupType) :: uzfktemp
1545 real(DP) :: thetaout
1548 real(DP) :: thtsrinv
1549 real(DP) :: epsfksthts
1564 integer(I4B) :: jhold
1568 integer(I4B) :: numadd
1571 integer(I4B) :: itest
1574 this%etact(icell) = dzero
1575 if (this%extdpuz(icell) < dem7)
return
1576 petsub = this%rootact(icell) * this%pet(icell) * &
1577 this%extdpuz(icell) / this%extdp(icell)
1578 thetaout = delt * petsub / this%extdp(icell)
1579 if (ietflag == 1) thetaout = delt * this%pet(icell) / this%extdp(icell)
1580 if (thetaout < dem10)
return
1581 depth = this%uzdpst(1, icell)
1582 st = this%unsat_stor(icell, depth)
1583 if (st < dem4)
return
1586 nwv = this%nwavst(icell)
1588 call uzfktemp%init(1, nwv)
1591 call uzfktemp%wave_shift(this, 1, icell, 0, 1, nwv, 1)
1593 this%etact(icell) = dzero
1594 if (this%thts(icell) - this%thtr(icell) < dem7)
then
1595 thtsrinv = 1.0 / dem7
1597 thtsrinv = done / (this%thts(icell) - this%thtr(icell))
1599 epsfksthts = this%eps(icell) * this%vks(icell) * thtsrinv
1600 this%etact(icell) = dzero
1602 extwc1 = this%extwc(icell) - this%thtr(icell)
1603 if (extwc1 < dem6) extwc1 = dem7
1609 do while (itest == 0)
1611 if (k > 1 .AND. abs(fmp - petsub) > dem5 * petsub)
then
1612 factor = factor / (fm / petsub)
1616 if (this%nwavst(icell) == 1 .AND. &
1617 this%uzdpst(1, icell) <= this%extdpuz(icell))
then
1618 if (ietflag == 2)
then
1619 tho = this%uzthst(1, icell)
1620 fktho = this%uzflst(1, icell)
1621 hcap = this%caph(icell, tho)
1622 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
1624 if ((this%uzthst(1, icell) - thetaout) > this%thtr(icell) + extwc1)
then
1625 this%uzthst(1, icell) = this%uzthst(1, icell) - thetaout
1626 this%uzflst(1, icell) = &
1627 this%vks(icell) * (((this%uzthst(1, icell) - &
1628 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1629 else if (this%uzthst(1, icell) > this%thtr(icell) + extwc1)
then
1630 this%uzthst(1, icell) = this%thtr(icell) + extwc1
1631 this%uzflst(1, icell) = &
1632 this%vks(icell) * (((this%uzthst(1, icell) - &
1633 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1637 else if (this%nwavst(icell) > 1 .AND. &
1638 this%uzdpst(this%nwavst(icell), icell) > this%extdpuz(icell))
then
1639 if (ietflag == 2)
then
1640 tho = this%uzthst(this%nwavst(icell), icell)
1641 fktho = this%uzflst(this%nwavst(icell), icell)
1642 hcap = this%caph(icell, tho)
1643 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
1645 if (this%uzthst(this%nwavst(icell), icell) - thetaout > &
1646 this%thtr(icell) + extwc1)
then
1647 this%uzthst(this%nwavst(icell) + 1, icell) = &
1648 this%uzthst(this%nwavst(icell), icell) - thetaout
1650 else if (this%uzthst(this%nwavst(icell), icell) > &
1651 this%thtr(icell) + extwc1)
then
1652 this%uzthst(this%nwavst(icell) + 1, icell) = this%thtr(icell) + extwc1
1655 if (numadd == 1)
then
1656 this%uzflst(this%nwavst(icell) + 1, icell) = &
1658 (((this%uzthst(this%nwavst(icell) + 1, icell) - &
1659 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1660 theta2 = this%uzthst(this%nwavst(icell) + 1, icell)
1661 flux2 = this%uzflst(this%nwavst(icell) + 1, icell)
1662 flux1 = this%uzflst(this%nwavst(icell), icell)
1663 theta1 = this%uzthst(this%nwavst(icell), icell)
1664 this%uzspst(this%nwavst(icell) + 1, icell) = &
1665 leadspeed(theta1, theta2, flux1, flux2, this%thts(icell), &
1666 this%thtr(icell), this%eps(icell), this%vks(icell))
1667 this%uzdpst(this%nwavst(icell) + 1, icell) = this%extdpuz(icell)
1668 this%nwavst(icell) = this%nwavst(icell) + 1
1669 if (this%nwavst(icell) > this%nwav(icell))
then
1680 else if (this%nwavst(icell) == 1)
then
1681 if (ietflag == 2)
then
1682 tho = this%uzthst(1, icell)
1683 fktho = this%uzflst(1, icell)
1684 hcap = this%caph(icell, tho)
1685 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
1687 if ((this%uzthst(1, icell) - thetaout) > this%thtr(icell) + extwc1)
then
1688 if (thetaout > dem30)
then
1689 this%uzthst(2, icell) = this%uzthst(1, icell) - thetaout
1690 this%uzflst(2, icell) = &
1691 this%vks(icell) * (((this%uzthst(2, icell) - this%thtr(icell)) * &
1692 thtsrinv)**this%eps(icell))
1693 this%uzdpst(2, icell) = this%extdpuz(icell)
1694 theta2 = this%uzthst(2, icell)
1695 flux2 = this%uzflst(2, icell)
1696 flux1 = this%uzflst(1, icell)
1697 theta1 = this%uzthst(1, icell)
1698 this%uzspst(2, icell) = &
1699 leadspeed(theta1, theta2, flux1, flux2, this%thts(icell), &
1700 this%thtr(icell), this%eps(icell), this%vks(icell))
1701 this%nwavst(icell) = this%nwavst(icell) + 1
1702 if (this%nwavst(icell) > this%nwav(icell))
then
1709 else if (this%uzthst(1, icell) > this%thtr(icell) + extwc1)
then
1710 if (thetaout > dem30)
then
1711 this%uzthst(2, icell) = this%thtr(icell) + extwc1
1712 this%uzflst(2, icell) = &
1713 this%vks(icell) * (((this%uzthst(2, icell) - &
1714 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1715 this%uzdpst(2, icell) = this%extdpuz(icell)
1716 theta2 = this%uzthst(2, icell)
1717 flux2 = this%uzflst(2, icell)
1718 flux1 = this%uzflst(1, icell)
1719 theta1 = this%uzthst(1, icell)
1720 this%uzspst(2, icell) = &
1721 leadspeed(theta1, theta2, flux1, flux2, this%thts(icell), &
1722 this%thtr(icell), this%eps(icell), this%vks(icell))
1723 this%nwavst(icell) = this%nwavst(icell) + 1
1724 if (this%nwavst(icell) > this%nwav(icell))
then
1735 if (this%uzdpst(1, icell) - this%extdpuz(icell) > dem7)
then
1741 diff = this%uzdpst(j, icell) - this%extdpuz(icell)
1742 if (diff > dzero)
then
1749 if (this%uzthst(j, icell) > this%thtr(icell) + extwc1)
then
1752 if (abs(diff) > dem5)
then
1753 call this%wave_shift(this, icell, icell, -1, &
1754 this%nwavst(icell) + 1, j, -1)
1755 this%uzdpst(j, icell) = this%extdpuz(icell)
1756 this%nwavst(icell) = this%nwavst(icell) + 1
1757 if (this%nwavst(icell) > this%nwav(icell))
then
1766 jhold = this%nwavst(icell)
1768 do while (i < this%nwavst(icell))
1769 if (this%uzthst(i, icell) > this%thtr(icell) + extwc1)
then
1771 i = this%nwavst(icell) + 1
1783 do while (kk <= this%nwavst(icell))
1784 if (ietflag == 2)
then
1785 tho = this%uzthst(kk, icell)
1786 fktho = this%uzflst(kk, icell)
1787 hcap = this%caph(icell, tho)
1788 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
1790 if (this%uzthst(kk, icell) > this%thtr(icell) + extwc1)
then
1791 if (this%uzthst(kk, icell) - thetaout > &
1792 this%thtr(icell) + extwc1)
then
1793 this%uzthst(kk, icell) = this%uzthst(kk, icell) - thetaout
1794 else if (this%uzthst(kk, icell) > this%thtr(icell) + extwc1)
then
1795 this%uzthst(kk, icell) = this%thtr(icell) + extwc1
1798 this%uzflst(kk, icell) = &
1800 (((this%uzthst(kk, icell) - &
1801 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1805 this%vks(icell) * ((this%uzthst(kk - 1, icell) - &
1806 this%thtr(icell)) * thtsrinv)**this%eps(icell)
1808 this%vks(icell) * ((this%uzthst(kk, icell) - &
1809 this%thtr(icell)) * thtsrinv)**this%eps(icell)
1810 this%uzflst(kk, icell) = flux2
1811 theta2 = this%uzthst(kk, icell)
1812 theta1 = this%uzthst(kk - 1, icell)
1813 this%uzspst(kk, icell) = leadspeed(theta1, theta2, flux1, flux2, &
1816 this%eps(icell), this%vks(icell))
1825 do while (kj <= this%nwavst(icell) - 1)
1826 if (abs(this%uzthst(kj, icell) - this%uzthst(kj + 1, icell)) < dem6)
then
1827 call this%wave_shift(this, icell, icell, 1, kj + 1, &
1828 this%nwavst(icell) - 1, 1)
1830 this%nwavst(icell) = this%nwavst(icell) - 1
1834 depth = this%uzdpst(1, icell)
1835 fm = this%unsat_stor(icell, depth)
1836 this%etact(icell) = st - fm
1837 fm = this%etact(icell) / delt
1838 if (this%etact(icell) < dzero)
then
1839 call this%wave_shift(uzfktemp, icell, 1, 0, 1, nwv, 1)
1840 this%nwavst(icell) = nwv
1841 this%etact(icell) = dzero
1842 elseif (petsub - fm < -dem15 .AND. ietflag == 2)
then
1845 call this%wave_shift(uzfktemp, icell, 1, 0, 1, nwv, 1)
1846 this%nwavst(icell) = nwv
1847 this%etact(icell) = dzero
1856 elseif (ietflag < 2)
then
1864 call uzfktemp%dealloc()