pttools.bubble.integrate
Functions
- pttools.bubble.integrate.add_df_dtau(name, cs2_fun)
Add a new differential equation to the cache based on the given sound speed function.
- Parameters:
- Returns:
- Return type:
(float64, float64*, float64*, float64*) -> none*
- pttools.bubble.integrate.fluid_integrate_param(v0, w0, xi0, phase=-1., t_end=const.T_END_DEFAULT, n_xi=const.N_XI_DEFAULT, df_dtau_ptr=DF_DTAU_BAG_PTR, method='odeint')
Integrates parametric fluid equations in df_dtau from an initial condition. Positive t_end integrates along curves from \((v,w) = (0,c_{s,0})\) to \((1,1)\). Negative t_end integrates towards \((0,c_s{s,0})\).
- Parameters:
v0 (float) – \(v_0\)
w0 (float) – \(w_0\)
xi0 (float) – \(\xi_0\)
phase (float) – phase \(\phi\)
t_end (float) – \(t_\text{end}\)
n_xi (int) – number of \(\xi\) points
df_dtau_ptr ((float64, float64*, float64*, float64*) -> none*) – pointer to the differential equation function
method (str) – differential equation solver to be used
- Returns:
\(v, w, \xi, t\)
- Return type:
- pttools.bubble.integrate.fluid_integrate_param_numba(t, y0, data, df_dtau_ptr)
Integrate a differential equation using NumbaLSODA.
- pttools.bubble.integrate.fluid_integrate_param_odeint(t, y0, data, df_dtau_ptr)
Integrate a differential equation using
scipy.integrate.odeint().
- pttools.bubble.integrate.fluid_integrate_param_solve_ivp(t, y0, data, df_dtau_ptr, method)
Integrate a differential equation using
scipy.integrate.solve_ivp().- Parameters:
t (ndarray) – time
y0 (ndarray) – starting point
df_dtau_ptr ((float64, float64*, float64*, float64*) -> none*) – pointer to the differential equation function, which is already in the cache
method (str) – name of the integrator to be used. See the
scipy.integrate.solve_ivp()documentation.data (ndarray)
- pttools.bubble.integrate.gen_df_dtau(cs2_fun)
Generate a function for the differentials of fluid variables \((v, w, \xi)\) in parametric form. The parametrised differential equation is as in Hindmarsh et al., 2019 eq. B.14-16:
\(\frac{dv}{dt} = 2v c_s^2 (1-v^2) (1 - \xi v)\)
\(\frac{dw}{dt} = \frac{w}{1-v^2} \frac{\xi - v}{1 - \xi v} (\frac{1}{c_s^2}+1) \frac{dv}{dt}\)
\(\frac{d\xi}{dt} = \xi \left( (\xi - v)^2 - c_s^2 (1 - \xi v)^2 \right)\)
- Parameters:
cs2_fun (Callable[[float | float64 | ndarray, float | float64 | ndarray], float | float64 | ndarray] | CPUDispatcher) – function, which gives the speed of sound squared \(c_s^2\).
- Returns:
function for the differential equation
- Return type:
Callable[[float, ndarray, ndarray, ndarray | None], None] | CFunc
- pttools.bubble.integrate.precompile()
Attributes
- pttools.bubble.integrate.differentials = <pttools.speedup.differential.DifferentialCache object>
Cache for the differential equations. New differential equations have to be added here before usage so that they can be found by
scipy.integrate.odeint()andscipy.integrate.solve_ivp().
- pttools.bubble.integrate.DF_DTAU_BAG_PTR = 136082897293584
Pointer to the differential equation of the bag model