fronts.ode

fronts.ode(D, radial=False)

Transform the PDE into an ODE.

Given a positive function D and coordinate unit vector \(\mathbf{\hat{r}}\), transform the partial differential equation (PDE) in which S is the unknown function of r and t:

\[\dfrac{\partial S}{\partial t} = \nabla\cdot\left[D\left(S\right)\dfrac{\partial S}{\partial r} \mathbf{\hat{r}}\right]\]

into an ordinary differential equation (ODE) where S is an unknown function of the Boltzmann variable o.

This function returns the fun and jac callables that may be used to solve the ODE with the solvers included with SciPy (scipy.integrate module). The second-order ODE is expressed as a system of first-order ODEs with independent variable o where y[0] in fun and jac correspond to the value of the function S itself and y[1] to its first derivative \(dS/do\).

fun and jac support both non-vectorized usage (where their first argument is a float) as well as vectorized usage (when numpy.ndarray objects are passed as both arguments).

Parameters
  • D (callable) – Twice-differentiable function that maps the range of S to positive values. It can be called as D(S) to evaluate it at S. It can also be called as D(S, n) with n equal to 1 or 2, in which case the first n derivatives of the function evaluated at the same S are included (in order) as additional return values. While mathematically a scalar function, D operates in a vectorized fashion with the same semantics when S is a numpy.ndarray.

  • radial ({False, 'cylindrical', 'spherical'}, optional) –

    Choice of coordinate unit vector \(\mathbf{\hat{r}}\). Must be one of the following:

    • False (default)

      \(\mathbf{\hat{r}}\) is any coordinate unit vector in rectangular (Cartesian) coordinates, or an axial unit vector in a cylindrical coordinate system

    • 'cylindrical'

      \(\mathbf{\hat{r}}\) is the radial unit vector in a cylindrical coordinate system

    • 'spherical'

      \(\mathbf{\hat{r}}\) is the radial unit vector in a spherical coordinate system

Returns

  • fun (callable) – Function that returns the right-hand side of the system. The calling signature is fun(o, y).

  • jac (callable) – Function that returns the Jacobian matrix of the right-hand side of the system. The calling signature is jac(o, y).

See also

BaseSolution(), o()

Notes

If radial is not False, the PDE is undefined at \(r=0\), and therefore the returned ODE is also undefined for \(o=0\).