fronts.Solution
- class fronts.Solution(sol, ob, oi, D)
Solution to a problem.
Represents a continuously differentiable function \(\theta\) of r and t such that:
\[\dfrac{\partial\theta}{\partial t} = \nabla\cdot\left[D(\theta) \dfrac{\partial \theta}{\partial r}\mathbf{\hat{r}}\right]\]with r bounded at \(r_b(t)=o_b\sqrt t\) on the left and unbounded to the right. For \(r<r_b(t)\), the methods will evaluate to NaNs.
- Parameters:
sol (callable) – Solution to an ODE obtained with ode. For any float or one-dimensional NumPy array
o
with values in the closed interval [ob, oi],sol(o)[0]
are the values of \(\theta\) ato
, andsol(o)[1]
are the values of the derivative \(d\theta/do\) at o`. sol will only be evaluated in this interval.ob (float) – Parameter \(o_b\), which determines the behavior of the boundary in the problem.
oi (float) – Value of the Boltzmann variable at which the solution can be considered to be equal to the initial condition. Cannot be less than ob.
D (callable) – Function to evaluate \(D\) at arbitrary values of the solution. Must be callable with a float or NumPy array as its argument.
- __init__(sol, ob, oi, D)
Methods
__init__
(sol, ob, oi, D)d_do
([r, t, o])Boltzmann-variable derivative of the solution.
d_dr
(r, t)Spatial derivative of the solution.
d_drb
(t)Spatial derivative of the solution at the boundary.
d_dt
(r, t)Time derivative of the solution.
d_dtb
(t)Time derivative of the solution at the boundary.
flux
(r, t)Diffusive flux.
fluxb
(t)Boundary flux.
rb
(t)Boundary location.
sorptivity
(*[, o])Sorptivity.
Attributes
Boundary value of the solution.
boundary Boltzmann derivative.
Initial value of the solution.
Parameter \(o_b\).
Parameter \(o_i\).
- __call__(r=None, t=None, o=None)
Evaluate the solution.
Evaluates and returns \(\theta\). May be called either with arguments r and t, or with just o.
- Parameters:
r (None or float or numpy.ndarray, shape (n,), optional) – Location(s). If this parameter is used, t must also be given.
t (None or float or numpy.ndarray, optional) – Time(s). Values must be positive.
o (None or float or numpy.ndarray, shape (n,) optional) – Value(s) of the Boltzmann variable. If this parameter is used, neither r nor t can be given.
- Return type:
float or numpy.ndarray, shape (n,)
- d_do(r=None, t=None, o=None)
Boltzmann-variable derivative of the solution.
Evaluates and returns \(d\theta/do\), the derivative of \(\theta\) with respect to the Boltzmann variable. May be called either with arguments r and t, or with just o.
- Parameters:
r (None or float or numpy.ndarray, shape (n,), optional) – Location(s). If this parameter is used, t must also be given.
t (None or float or numpy.ndarray, shape (n,), optional) – Time(s). Values must be positive.
o (None or float or numpy.ndarray, shape (n,), optional) – Value(s) of the Boltzmann variable. If this parameter is used, neither r nor t can be given.
- Return type:
float or numpy.ndarray, shape (n,)
- property d_dob
boundary Boltzmann derivative.
Derivative of the solution with respect to the Boltzmann variable at the boundary.
- Type:
- d_dr(r, t)
Spatial derivative of the solution.
Evaluates and returns \(\partial\theta/\partial r\).
- Parameters:
r (float or numpy.ndarray, shape (n,)) – Location(s) along the coordinate.
t (float or numpy.ndarray, shape (n,)) – Time(s). Values must be positive.
- Return type:
float or numpy.ndarray, shape (n,)
- d_drb(t)
Spatial derivative of the solution at the boundary.
Evaluates and returns \(\partial\theta/\partial r|_b\). Equivalent to
self.d_dr(self.rb(t), t)
.- Parameters:
t (float or numpy.ndarray, shape (n,)) – Time(s). Values must be positive.
- Return type:
float or numpy.ndarray, shape (n,)
- d_dt(r, t)
Time derivative of the solution.
Evaluates and returns \(\partial\theta/\partial t\).
- Parameters:
r (float or numpy.ndarray, shape (n,)) – Location(s).
t (float or numpy.ndarray, shape (n,)) – Time(s). Values must be positive.
- Return type:
float or numpy.ndarray, shape (n,)
- d_dtb(t)
Time derivative of the solution at the boundary.
Evaluates and returns \(\partial\theta/\partial t|_b\). Equivalent to
self.d_dt(self.rb(t), t)
.- Parameters:
t (float or numpy.ndarray, shape (n,)) – Time(s). Values must be positive.
- Return type:
float or numpy.ndarray, shape (n,)
- flux(r, t)
Diffusive flux.
Returns the diffusive flux of \(\theta\) in the direction \(\mathbf{\hat{r}}\), equal to \(-D(\theta)\partial\theta/\partial r\).
- Parameters:
r (float or numpy.ndarray, shape (n,)) – Location(s).
t (float or numpy.ndarray, shape (n,)) – Time(s). Values must be positive.
- Return type:
float or numpy.ndarray, shape (n,)
- fluxb(t)
Boundary flux.
Returns the diffusive flux of \(\theta\) at the boundary, in the direction \(\mathbf{\hat{r}}\). Equivalent to
self.flux(self.rb(t), t)
.- Parameters:
t (float or numpy.ndarray, shape (n,)) – Time(s). Values must be positive.
- Return type:
float or numpy.ndarray, shape (n,)
- property oi
Parameter \(o_i\).
The value of the Boltzmann variable at which the solution can be considered to be equal to the initial condition.
- Type:
- rb(t)
Boundary location.
Returns \(r_b\), the location of the boundary.
Depending on \(o_b\), the boundary may be fixed at \(r=0\) or it may move with time.
- Parameters:
t (float or numpy.ndarray) – Time(s). Values must not be negative.
- Returns:
rb – The return is of the same type and shape as t.
- Return type:
- sorptivity(*, o=None)
Sorptivity.
Returns the sorptivity \(S\) of \(\theta\), equal to \(-2D(\theta)\partial\theta/\partial o\).
- Parameters:
o (float or numpy.ndarray, shape (n,), optional) – Value(s) of the Boltzmann variable. If not given, the method will return the sorptivity at the boundary.
- Return type:
float or numpy.ndarray, shape (n,)
References
[1] PHILIP, J. R. The theory of infiltration: 4. Sorptivity and algebraic infiltration equations. Soil Science, 1957, vol. 84, no. 3, pp. 257-264.