invlapnumba#

Inverse Laplace transform implementation using Numba.

Provides optimized inverse Laplace transform functions using the De Hoog, Knight and Stokes algorithm, accelerated with Numba JIT compilation.

Copyright 2019 Kristopher L. Kuhlman <klkuhlm _at_ sandia _dot_ gov>

Functions#

invlap(t, tmax, fp, M[, alpha, tol])

Inverse Laplace tansform with algorithm of De Hoog, Knight and Stokes.

invlapcomp(time, pot, npint, M, tintervals, enumber, ...)

Compute time domain solution for given laplace domain solution.

invlapgen(time, pot, M, tintervals, tstart, ebc)

Compute time domain solution for given Laplace domain solution.

Module Contents#

invlap(t, tmax, fp, M, alpha=1e-10, tol=1e-09)[source]#

Inverse Laplace tansform with algorithm of De Hoog, Knight and Stokes.

Parameters:
  • t (array) – times for which inverse is computed

  • tmax (float) – maximum time

  • fp (complex array) – Laplace transformed solution

  • M (integer) – number of terms (number of values of fp)

  • alpha (is the real part of the rightmost pole or singularity, which) – is chosen based on the desired accuracy (assuming the rightmost singularity is 0), and tol=10α is the desired tolerance

Returns:

  • result (array) – time domain solution for specified times

  • Reference

  • ———

  • de Hoog, F., J. Knight, A. Stokes (1982). An improved method for

  • numerical inversion of Laplace transforms. SIAM Journal of Scientific

  • and Statistical Computing 3 (357-366, http://dx.doi.org/10.1137/0903022)

  • https (//bitbucket.org/klkuhlm/invlap/src/default/invlap.py)

invlapcomp(time, pot, npint, M, tintervals, enumber, etstart, ebc, nlayers)[source]#

Compute time domain solution for given laplace domain solution.

Parameters:
  • time (array, must be ordered) – times for which time domain solution is computed, must start at 0

  • pot (array) – laplace domain solution conform the timflow.transient shape

  • npint (int) – number of p values per interval (=2M + 1)

  • M (int) – order of the approximation

  • tintervals – time intervals

  • enumber (array) – number of element

  • etstart (array) – starting time of bc in element

  • ebc (array) – boundary condition value of element

  • nlayers (integer, optional) – number of layers, default is None

Notes

enumber, etstart, and ebc are used because numba cannot deal with a list of arrays of different lengths (makes sense, actually)

Returns:

  • pot[naq, ntimes] if layers=None,

  • otherwise pot[len(layers) ,ntimes]

  • t must be ordered

invlapgen(time, pot, M, tintervals, tstart, ebc)[source]#

Compute time domain solution for given Laplace domain solution.

Parameters:
  • time (array, must be ordered) – times for which time domain solution is computed, must start at 0

  • pot (1D array of laplace domain solution of length nint * (2M + 1))

  • M (int order of the approximation (i.e., (2M + 1) p values per interval))

  • tintervals (1D array of time intervals, length nint + 1)

  • tstart (1D array with starting times of bc in element, length nstart)

  • ebc (1D array with change in boundary condition value, length nstart)

Notes

ebc is the difference with the previous value

Return type:

rv[ntimes]