1542 class(UzfCellGroupType) :: this
1543 integer(I4B),
intent(in) :: icell
1544 real(DP),
intent(in) :: delt
1545 integer(I4B),
intent(in) :: ietflag
1546 integer(I4B),
intent(inout) :: ierr
1548 type(UzfCellGroupType) :: uzfktemp
1550 real(DP) :: thetaout
1553 real(DP) :: thtsrinv
1554 real(DP) :: epsfksthts
1569 integer(I4B) :: jhold
1573 integer(I4B) :: numadd
1576 integer(I4B) :: itest
1579 this%etact(icell) = dzero
1580 if (this%extdpuz(icell) < dem7)
return
1581 petsub = this%rootact(icell) * this%pet(icell) * &
1582 this%extdpuz(icell) / this%extdp(icell)
1583 thetaout = delt * petsub / this%extdp(icell)
1584 if (ietflag == 1) thetaout = delt * this%pet(icell) / this%extdp(icell)
1585 if (thetaout < dem10)
return
1586 depth = this%uzdpst(1, icell)
1587 st = this%unsat_stor(icell, depth)
1588 if (st < dem4)
return
1591 nwv = this%nwavst(icell)
1593 call uzfktemp%init(1, nwv)
1596 call uzfktemp%wave_shift(this, 1, icell, 0, 1, nwv, 1)
1598 this%etact(icell) = dzero
1599 if (this%thts(icell) - this%thtr(icell) < dem7)
then
1600 thtsrinv = 1.0 / dem7
1602 thtsrinv = done / (this%thts(icell) - this%thtr(icell))
1604 epsfksthts = this%eps(icell) * this%vks(icell) * thtsrinv
1605 this%etact(icell) = dzero
1607 extwc1 = this%extwc(icell) - this%thtr(icell)
1608 if (extwc1 < dem6) extwc1 = dem7
1614 do while (itest == 0)
1616 if (k > 1 .AND. abs(fmp - petsub) > dem5 * petsub)
then
1617 factor = factor / (fm / petsub)
1621 if (this%nwavst(icell) == 1 .AND. &
1622 this%uzdpst(1, icell) <= this%extdpuz(icell))
then
1623 if (ietflag == 2)
then
1624 tho = this%uzthst(1, icell)
1625 fktho = this%uzflst(1, icell)
1626 hcap = this%caph(icell, tho)
1627 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
1629 if ((this%uzthst(1, icell) - thetaout) > this%thtr(icell) + extwc1)
then
1630 this%uzthst(1, icell) = this%uzthst(1, icell) - thetaout
1631 this%uzflst(1, icell) = &
1632 this%vks(icell) * (((this%uzthst(1, icell) - &
1633 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1634 else if (this%uzthst(1, icell) > this%thtr(icell) + extwc1)
then
1635 this%uzthst(1, icell) = this%thtr(icell) + extwc1
1636 this%uzflst(1, icell) = &
1637 this%vks(icell) * (((this%uzthst(1, icell) - &
1638 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1642 else if (this%nwavst(icell) > 1 .AND. &
1643 this%uzdpst(this%nwavst(icell), icell) > this%extdpuz(icell))
then
1644 if (ietflag == 2)
then
1645 tho = this%uzthst(this%nwavst(icell), icell)
1646 fktho = this%uzflst(this%nwavst(icell), icell)
1647 hcap = this%caph(icell, tho)
1648 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
1650 if (this%nwavst(icell) + 1 > this%nwav(icell))
then
1656 if (this%uzthst(this%nwavst(icell), icell) - thetaout > &
1657 this%thtr(icell) + extwc1)
then
1658 this%uzthst(this%nwavst(icell) + 1, icell) = &
1659 this%uzthst(this%nwavst(icell), icell) - thetaout
1661 else if (this%uzthst(this%nwavst(icell), icell) > &
1662 this%thtr(icell) + extwc1)
then
1663 this%uzthst(this%nwavst(icell) + 1, icell) = this%thtr(icell) + extwc1
1666 if (numadd == 1)
then
1667 this%uzflst(this%nwavst(icell) + 1, icell) = &
1669 (((this%uzthst(this%nwavst(icell) + 1, icell) - &
1670 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1671 theta2 = this%uzthst(this%nwavst(icell) + 1, icell)
1672 flux2 = this%uzflst(this%nwavst(icell) + 1, icell)
1673 flux1 = this%uzflst(this%nwavst(icell), icell)
1674 theta1 = this%uzthst(this%nwavst(icell), icell)
1675 this%uzspst(this%nwavst(icell) + 1, icell) = &
1676 leadspeed(theta1, theta2, flux1, flux2, this%thts(icell), &
1677 this%thtr(icell), this%eps(icell), this%vks(icell))
1678 this%uzdpst(this%nwavst(icell) + 1, icell) = this%extdpuz(icell)
1679 this%nwavst(icell) = this%nwavst(icell) + 1
1680 if (this%nwavst(icell) > this%nwav(icell))
then
1691 else if (this%nwavst(icell) == 1)
then
1692 if (this%nwavst(icell) + 1 > this%nwav(icell))
then
1698 if (ietflag == 2)
then
1699 tho = this%uzthst(1, icell)
1700 fktho = this%uzflst(1, icell)
1701 hcap = this%caph(icell, tho)
1702 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
1704 if ((this%uzthst(1, icell) - thetaout) > this%thtr(icell) + extwc1)
then
1705 if (thetaout > dem30)
then
1706 this%uzthst(2, icell) = this%uzthst(1, icell) - thetaout
1707 this%uzflst(2, icell) = &
1708 this%vks(icell) * (((this%uzthst(2, icell) - this%thtr(icell)) * &
1709 thtsrinv)**this%eps(icell))
1710 this%uzdpst(2, icell) = this%extdpuz(icell)
1711 theta2 = this%uzthst(2, icell)
1712 flux2 = this%uzflst(2, icell)
1713 flux1 = this%uzflst(1, icell)
1714 theta1 = this%uzthst(1, icell)
1715 this%uzspst(2, icell) = &
1716 leadspeed(theta1, theta2, flux1, flux2, this%thts(icell), &
1717 this%thtr(icell), this%eps(icell), this%vks(icell))
1718 this%nwavst(icell) = this%nwavst(icell) + 1
1719 if (this%nwavst(icell) > this%nwav(icell))
then
1726 else if (this%uzthst(1, icell) > this%thtr(icell) + extwc1)
then
1727 if (thetaout > dem30)
then
1728 this%uzthst(2, icell) = this%thtr(icell) + extwc1
1729 this%uzflst(2, icell) = &
1730 this%vks(icell) * (((this%uzthst(2, icell) - &
1731 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1732 this%uzdpst(2, icell) = this%extdpuz(icell)
1733 theta2 = this%uzthst(2, icell)
1734 flux2 = this%uzflst(2, icell)
1735 flux1 = this%uzflst(1, icell)
1736 theta1 = this%uzthst(1, icell)
1737 this%uzspst(2, icell) = &
1738 leadspeed(theta1, theta2, flux1, flux2, this%thts(icell), &
1739 this%thtr(icell), this%eps(icell), this%vks(icell))
1740 this%nwavst(icell) = this%nwavst(icell) + 1
1741 if (this%nwavst(icell) > this%nwav(icell))
then
1752 if (this%uzdpst(1, icell) - this%extdpuz(icell) > dem7)
then
1758 diff = this%uzdpst(j, icell) - this%extdpuz(icell)
1759 if (diff > dzero)
then
1766 if (this%uzthst(j, icell) > this%thtr(icell) + extwc1)
then
1769 if (abs(diff) > dem5)
then
1770 if (this%nwavst(icell) + 1 > this%nwav(icell))
then
1776 call this%wave_shift(this, icell, icell, -1, &
1777 this%nwavst(icell) + 1, j, -1)
1778 this%uzdpst(j, icell) = this%extdpuz(icell)
1779 this%nwavst(icell) = this%nwavst(icell) + 1
1780 if (this%nwavst(icell) > this%nwav(icell))
then
1789 jhold = this%nwavst(icell)
1791 do while (i < this%nwavst(icell))
1792 if (this%uzthst(i, icell) > this%thtr(icell) + extwc1)
then
1794 i = this%nwavst(icell) + 1
1806 do while (kk <= this%nwavst(icell))
1807 if (ietflag == 2)
then
1808 tho = this%uzthst(kk, icell)
1809 fktho = this%uzflst(kk, icell)
1810 hcap = this%caph(icell, tho)
1811 thetaout = this%rate_et_z(icell, factor, fktho, hcap)
1813 if (this%uzthst(kk, icell) > this%thtr(icell) + extwc1)
then
1814 if (this%uzthst(kk, icell) - thetaout > &
1815 this%thtr(icell) + extwc1)
then
1816 this%uzthst(kk, icell) = this%uzthst(kk, icell) - thetaout
1817 else if (this%uzthst(kk, icell) > this%thtr(icell) + extwc1)
then
1818 this%uzthst(kk, icell) = this%thtr(icell) + extwc1
1821 this%uzflst(kk, icell) = &
1823 (((this%uzthst(kk, icell) - &
1824 this%thtr(icell)) * thtsrinv)**this%eps(icell))
1828 this%vks(icell) * ((this%uzthst(kk - 1, icell) - &
1829 this%thtr(icell)) * thtsrinv)**this%eps(icell)
1831 this%vks(icell) * ((this%uzthst(kk, icell) - &
1832 this%thtr(icell)) * thtsrinv)**this%eps(icell)
1833 this%uzflst(kk, icell) = flux2
1834 theta2 = this%uzthst(kk, icell)
1835 theta1 = this%uzthst(kk - 1, icell)
1836 this%uzspst(kk, icell) = leadspeed(theta1, theta2, flux1, flux2, &
1839 this%eps(icell), this%vks(icell))
1848 do while (kj <= this%nwavst(icell) - 1)
1849 if (abs(this%uzthst(kj, icell) - this%uzthst(kj + 1, icell)) < dem6)
then
1850 call this%wave_shift(this, icell, icell, 1, kj + 1, &
1851 this%nwavst(icell) - 1, 1)
1853 this%nwavst(icell) = this%nwavst(icell) - 1
1857 depth = this%uzdpst(1, icell)
1858 fm = this%unsat_stor(icell, depth)
1859 this%etact(icell) = st - fm
1860 fm = this%etact(icell) / delt
1861 if (this%etact(icell) < dzero)
then
1862 call this%wave_shift(uzfktemp, icell, 1, 0, 1, nwv, 1)
1863 this%nwavst(icell) = nwv
1864 this%etact(icell) = dzero
1865 elseif (petsub - fm < -dem15 .AND. ietflag == 2)
then
1868 call this%wave_shift(uzfktemp, icell, 1, 0, 1, nwv, 1)
1869 this%nwavst(icell) = nwv
1870 this%etact(icell) = dzero
1879 elseif (ietflag < 2)
then
1887 call uzfktemp%dealloc()