Monday, April 6, 2015

VB - Get the DTHETA value for each of the grid cell


This is a VB code inserted in a Manifold program. Here is the task to compute DTHETA value to assign each of the grid cell as per the soil condition. The weighted average DTHETA value for the each of the grid cell has been computed as well.


Function DTHETA
Sat = Record.Data("InitSat")
XKSAT = Record.DataText("AvgXKSAT")
If Sat = "Dry" Then
If XKSAT <= 0.15 Then
DTHETA = EXP(-0.2394+(0.3616*log(XKSAT)))
ElseIf XKSAT <= 0.25 Then
DTHETA = EXP(-1.4122-(0.2614*log(XKSAT)))
Else
DTHETA = 0.35
End If
ElseIf Sat = "Normal" Then
If XKSAT <= 0.02 Then
DTHETA = EXP(1.6094+log(XKSAT))
ElseIf XKSAT <= 0.04 Then
DTHETA = EXP(-0.0142+(0.5850*log(XKSAT)))
ElseIf XKSAT <= 0.1 Then
DTHETA = 0.15
ElseIf XKSAT <= 0.15 Then
DTHETA = EXP(1.0038+(1.2599*log(XKSAT)))
ElseIf XKSAT <= 0.4 Then
DTHETA = 0.25
Else
DTHETA = EXP(-1.2342+(0.1660*log(XKSAT)))
End If
Else
DTHETA = 0
End If
End Function

Function ADTHETA
D = Record.Data("DTHETA")
A = Record.Data("Area (I)")
ADTHETA = D*A
End Function

Function WDTHETA
W = Record.Data("ADTHETA")
A = Record.Data("Area (I)")
WDTHETA = W/A
End Function








No comments:

Post a Comment