pttools.ssmtools.calculators
Numerical utilities for SSMtools
Functions
- pttools.ssmtools.calculators.envelope(xi, f, v_wall=None, v_sh=None)
Helper function for
sin_transform_approx(). Assumes that\(\max(v)\) is achieved at a discontinuity (bubble wall)
\(f(\xi)\) finishes at a discontinuity (shock)
at least the first element of \(f\) is zero
xi1: last zero value of f, xi_w: position of maximum f (wall) x12: last non-zero value of f (def) or 1st zero after wall (det) f1: value just before xi1 f_m: value just before wall f_p: value just after wall f2: (at shock, or after wall)
- pttools.ssmtools.calculators.resample_uniform_xi(xi, f, n_xi=const.NPTDEFAULT[0])
Provide uniform resample of function defined by \((x,y) = (\xi,f)\). Returns f interpolated and the uniform grid of n_xi points in range [0,1].
- pttools.ssmtools.calculators.sin_transform(z, xi, f, z_st_thresh=const.Z_ST_THRESH, v_wall=None, v_sh=None)
sin transform of \(f(\xi)\), Fourier transform variable z. For z > z_st_thresh, use approximation rather than doing the integral. Interpolate between z_st_thresh - dz_blend < z < z_st_thresh.
Without the approximations this function would compute
\[\hat{f}(z) = f(\xi) \int_{{\xi}_\text{min}}^{{\xi}_\text{max}} \sin(z \xi) d\xi\].Used in Hindmarsh et al., 2019 eq. 4.5, 4.8
- Parameters:
z (float | float64 | ndarray) – Fourier transform variable (any shape)
xi (ndarray) – \(\xi\) points over which to integrate
f (ndarray) – function values at the points \(\xi\), same shape as \(\xi\)
z_st_thresh (float) – for \(z\) values above z_sh_tresh, use approximation rather than doing the integral.
v_wall (float) – wall speed
v_sh (float) – shock speed
- Returns:
sine transformed values \(\hat{f}(z)\)
- Return type:
float | float64 | ndarray | callable | CPUDispatcher
- pttools.ssmtools.calculators.sin_transform_approx(z, xi, f, v_wall=None, v_sh=None)
Approximate sin transform of \(f(\xi)\). For values \(f_a\) and \(f_b\), we have
\[ \int_{\xi_a}^{\xi_b} d\xi f(\xi) \sin(z \xi) \to - \frac{1}{z} \left(f_b \cos(z \xi_b) - f_a \cos(z \xi_a)\right) + O(1/z^2) \]as \(z \to \infty\). Function assumed piecewise continuous in intervals \([\xi_1, \xi_w]\) and \([\xi_w,\xi_2]\).
- pttools.ssmtools.calculators.sin_transform_core(t, f, freq)
The sine transform for multiple values of \(\omega\) without any approximations. Computes the following for each angular frequency \(\omega\).
\[\hat{f}(\omega) = \int_{{t}_\text{min}}^{{t}_\text{max}} f(t) \sin(\omega t) dt\]
- pttools.ssmtools.calculators.sin_transform_old(z, xi, v)
Old sin transform of \(v(\xi)\)
Deprecated since version 0.0.1.