Skip to content

Commit

Permalink
create inverse functions for brooks, garnder and fredlund
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvonk committed Oct 4, 2023
1 parent 7796b5d commit e6cdfd0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/pedon/soilmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ def k(self, h: FloatArray, s: FloatArray | None = None) -> FloatArray:
return self.k_s * self.k_r(h=h, s=s)

def h(self, theta: FloatArray) -> FloatArray:
pass
h = full(theta.shape, self.h_b)
mask = theta >= self.theta_r
h[mask] = self.h_b * ((theta[mask] - self.theta_r) / (self.s(theta[mask]))) ** (
-1 / self.l
)
return h

def plot(self, ax: plt.Axes | None = None) -> plt.Axes:
return plot_swrc(self, ax=ax)
Expand Down Expand Up @@ -165,7 +170,7 @@ def k(self, h: FloatArray, s: FloatArray | None = None) -> FloatArray:
return self.k_s * self.k_r(h=h, s=s)

def h(self, theta: FloatArray) -> FloatArray:
pass
return (abs(theta) / self.a) ** (-1 / self.b)

def plot(self, ax: plt.Axes | None = None) -> plt.Axes:
return plot_swrc(self, ax=ax)
Expand Down Expand Up @@ -284,7 +289,9 @@ def k(self, h: FloatArray, s: FloatArray | None = None) -> FloatArray:
return self.k_s * self.k_r(h=h, s=s)

def h(self, theta: FloatArray) -> FloatArray:
pass
return self.a * (exp ** (self.theta_s / theta) ** (1 / self.m) - exp(1)) ** (
1 / self.n
)

def plot(self, ax: plt.Axes | None = None) -> plt.Axes:
return plot_swrc(self, ax=ax)
Expand Down

0 comments on commit e6cdfd0

Please sign in to comment.