fronts.Solution

class fronts.Solution(sol, ob, oi, D)

Continuous solution to a problem.

A subclass of BaseSolution, its methods describe a continuous solution to a problem of finding a function S of r and t such that:

\[\dfrac{\partial S}{\partial t} = \nabla\cdot\left[D\left(S\right) \dfrac{\partial S}{\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 the corresponding ODE obtained with ode. For any o in the closed interval [ob, oi], sol(o)[0] is the value of S at o, and sol(o)[1] is the value of the derivative \(dS/do\) at o. sol will only be evaluated in this interval.

  • ob (float) – \(o_b\), which determines the behavior of the boundary.

  • oi (float) – Value of the Boltzmann variable at which the solution can be considered to be equal to the initial condition. Must be \(\geq o_b\).

  • D (callable) – D used to obtain sol. Must be the same function that was passed to ode.

__init__(sol, ob, oi, D)

Initialize self. See help(type(self)) for accurate signature.

Methods

S([r, t, o])

S, the unknown function.

__init__(sol, ob, oi, D)

Initialize self.

dS_do([r, t, o])

\(dS/do\), derivative of S with respect to the Boltzmann variable.

dS_dr(r, t)

\(\partial S/\partial r\), spatial derivative of S.

dS_dt(r, t)

\(\partial S/\partial t\), time derivative of S.

flux(r, t)

Diffusive flux of S.

rb(t)

\(r_b\), the location of the boundary.

S(r=None, t=None, o=None)

S, the unknown function.

May be called either with parameters r and t, or with just o.

Parameters
  • r (float or numpy.ndarray, optional) – Location(s). If a numpy.ndarray, it must have a shape broadcastable with t. If this parameter is used, you must also pass t and cannot pass o.

  • t (float or numpy.ndarray, optional) – Time(s). If a numpy.ndarray, it must have a shape broadcastable ith r. Values must be positive. If this parameter is used, you must also pass r and cannot pass o.

  • o (float or numpy.ndarray, optional) – Value(s) of the Boltzmann variable. If this parameter is used, you cannot pass r or t.

Returns

S – If o is passed, the return is of the same type and shape as o. Otherwise, return is a float if both r and t are floats, or a numpy.ndarray of the shape that results from broadcasting r and t.

Return type

float or numpy.ndarray

dS_do(r=None, t=None, o=None)

\(dS/do\), derivative of S with respect to the Boltzmann variable.

May be called either with parameters r and t, or with just o.

Parameters
  • r (float or numpy.ndarray, optional) – Location(s). If a numpy.ndarray, it must have a shape broadcastable with t. If this parameter is used, you must also pass t and cannot pass o.

  • t (float or numpy.ndarray, optional) – Time(s). If a numpy.ndarray, it must have a shape broadcastable with r. Values must be positive. If this parameter is used, you must also pass r and cannot pass o.

  • o (float or numpy.ndarray, optional) – Value(s) of the Boltzmann variable. If this parameter is used, you cannot pass r or t.

Returns

dS_do – If o is passed, the return is of the same type and shape as o. Otherwise, the return is a float if both r and t are floats, or a numpy.ndarray of the shape that results from broadcasting r and t.

Return type

float or numpy.ndarray

dS_dr(r, t)

\(\partial S/\partial r\), spatial derivative of S.

Parameters
  • r (float or numpy.ndarray) – Location(s) along the coordinate. If a numpy.ndarray, it must have a shape broadcastable with t.

  • t (float or numpy.ndarray) – Time(s). If a numpy.ndarray, it must have a shape broadcastable with r. Values must be positive.

Returns

dS_dr – The return is a float if both r and t are floats. Otherwise it is a numpy.ndarray of the shape that results from broadcasting r and t.

Return type

float or numpy.ndarray

dS_dt(r, t)

\(\partial S/\partial t\), time derivative of S.

Parameters
  • r (float or numpy.ndarray) – Location(s). If a numpy.ndarray, it must have a shape broadcastable with t.

  • t (float or numpy.ndarray) – Time(s). If a numpy.ndarray, it must have a shape broadcastable with r. Values must be positive.

Returns

dS_dt – The return is a float if both r and t are floats. Otherwise it is a numpy.ndarray of the shape that results from broadcasting r and t.

Return type

float or numpy.ndarray

flux(r, t)

Diffusive flux of S.

Returns the diffusive flux of S in the direction \(\mathbf{\hat{r}}\), equal to \(-D(S)\partial S/\partial r\).

Parameters
  • r (float or numpy.ndarray) – Location(s). If a numpy.ndarray, it must have a shape broadcastable with t.

  • t (float or numpy.ndarray) – Time(s). If a numpy.ndarray, it must have a shape broadcastable with r. Values must be positive.

Returns

flux – The return is a float if both r and t are floats. Otherwise it is a numpy.ndarray of the shape that results from broadcasting r and t.

Return type

float or numpy.ndarray

rb(t)

\(r_b\), the location of the boundary.

This is the point where the boundary condition of the problem is imposed.

Parameters

t (float or numpy.ndarray) – Time(s). Values must be positive.

Returns

rb – The return is of the same type and shape as t.

Return type

float or numpy.ndarray

Notes

Depending on \(o_b\), the boundary may be fixed at \(r=0\) or it may move with time.