我的循环似乎过早退出。基本上,我想要以下条件:
当 WC(j-1)+WCinit*dz 大于 pwp 如果 fc-WC(j-1)+WCinit+RefEF*dz 小于 Precip *dz
那么径流和渗流等于 precip-fc- (WC+WCinit)+RefET*dz*0.5 和 WJ(j)=fc
否则径流和渗流=0 和 WC(j)=WC(j-1)+WCinit+precip-RefET*dz
但是如果 WC(j - 1) + WCinit(i) <= pwp 那么 prin WC(j)=pwp
我希望整个循环在 i 和 j =12 时结束
当 j=2 时,循环似乎正在结束
Dim fc As Double
fc = Cells(4, 7).Value
NumMonth = 12
i = 1
j = 2
Dim pwp As Double
pwp = Cells(4, 8).Value
Dim dz As Double
dz = 0.5 'm
While (WC(j - 1) + WCinit(i) * dz > pwp * dz) And (j <= NumMonth)
If (fc - (WC(j - 1) + WCinit(i)) + RefET(i) * dz) < (Precip(i) * dz) Then
Runoff(i) = (Precip(i) - fc - (WC(j - 1) + WCinit(i)) + RefET(i) * dz) * 0.5
Percolation(i) = (Precip(i) - fc - (WC(j - 1) + WCinit(i)) + RefET(i) * dz) * 0.5
WC(j) = fc
Else
Runoff(i) = 0
Percolation(i) = 0
WC(j) = WC(j - 1) + WCinit(i) + Precip(i) - RefET(i) * dz
End If
j = j + 1
i = i + 1
Wend
If WC(j - 1) + WCinit(i) <= pwp Then
Runoff(i) = 0
Percolation(i) = 0
WC(j) = pwp
End If