# fronts.inverse¶

fronts.inverse(o, S)

Solve an inverse problem.

Given a function S of r and t, and scalars $$S_i$$, $$S_b$$ and $$o_b$$, finds a positive function D of the values of S such that:

$\begin{split}\begin{cases} \dfrac{\partial S}{\partial t} = \dfrac{\partial}{\partial r}\left(D\left(S\right)\dfrac{\partial S} {\partial r}\right) & r>r_b(t),t>0\\ S(r, 0) = S_i & r>0 \\ S(r_b(t), t) = S_b & t>0 \\ r_b(t) = o_b\sqrt t \end{cases}\end{split}$

S is taken as its values on a discrete set of points expressed in terms of the Boltzmann variable. Problems in radial coordinates are not supported.

Parameters
• o (numpy.array_like, shape (n,)) – Points where S is known, expressed in terms of the Boltzmann variable. Must be strictly increasing.

• S (numpy.array_like, shape (n,)) – Values of the solution at o. Must be monotonic (either non-increasing or non-decreasing) and S[-1] must be $$S_i$$.

Returns

D – 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.

Return type

callable

Notes

An o function of S is constructed by interpolating the input data with a PCHIP monotonic cubic spline. The function D is then constructed by applying the expressions that result from solving the Boltzmann-transformed equation for D.

While very fast, the scheme used by this function is somewhat limited in its practical precision because of the use of interpolation (see the Notes) and the fact that two S functions that differ little in their values may actually be the consequence of very different D functions. If the goal is to find the parameters for a parameterized D, you may opt to perform an optimization run using solve instead.

Depending on the number of points, the returned D may take orders of magnitude more time to be evaluated than an analytical function. In that case, you may notice that solvers work significantly slower when called with this D.

This function also works if the problem has different boundary condition, as long as it is compatible with the Boltzmann transformation so that S can be considered a function of o only.