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 secondorder ODE is expressed as a system of firstorder ODEs with independent variable o where
y[0]
in fun and jac correspond to the value of the function S itself andy[1]
to its first derivative \(\tfrac{dS}{do}\).fun and jac support both nonvectorized 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) – Twicedifferentiable 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 asD(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 righthand side of the system. The calling signature is
fun(o, y)
.jac (callable) – Function that returns the Jacobian matrix of the righthand side of the system. The calling signature is
jac(o, y)
.
See also
Notes
If radial is not False, the PDE is undefined at \(r=0\), and therefore the returned ODE is also undefined for \(o=0\).