fronts.BaseSolution

class fronts.BaseSolution(sol, D)

Base class for solutions using the Boltzmann transformation.

Its methods describe a continuous solution to any 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]\]
Parameters
  • sol (callable) – Solution to an ODE obtained with ode. For any float or numpy.ndarray o, sol(o)[0] are the values of S at o, and sol(o)[1] the values of the derivative dS/do at o.

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

See also

ode

__init__(sol, D)

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

Methods

S([r, t, o])

S, the unknown function.

__init__(sol, 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.

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