Top | ![]() |
![]() |
![]() |
![]() |
Two fluids Perturbation ObjectTwo fluids Perturbation Object — Perturbation object for a two fluids system |
Functions
Description
This object provides the computation of the two fluid system of cosmological perturbations. This problem is decribed by two fluids with energy density and pressure given respectively by $\bar{\rho}_i$ and $\bar{p}_i$ for $i = 1,2$.
The system is written in terms of the gauge invariant variable $$\zeta \equiv \Psi - \frac{2\bar{K}}{\kappa(\bar{\rho} + \bar{p})} + E\mathcal{V},$$ and the entropy mode $$S = \frac{\kappa\varpi}{x^3 H}(\mathcal{U}_1 - \mathcal{U}_2),$$ where $\mathcal{U}_i \equiv \psi + E\mathcal{V}_i$ and $$\varpi \equiv \frac{(\bar{\rho}_1+\bar{p}_1)(\bar{\rho}_2+\bar{p}_2)}{\bar{\rho}+\bar{p}}.$$
Their momentum are \begin{split} P_\zeta &= \frac{2\bar{D}^2_\bar{K}\Psi}{x^3E}, \\ P_S &= \frac{\delta\rho_2}{\bar{\rho}_2+\bar{p}_2} - \frac{\delta\rho_1}{\bar{\rho}_1 + \bar{p}_1}. \end{split}
The equations of motion in their first order form are
\begin{align}
\zeta^\prime &= \frac{P_\zeta}{m_\zeta} + Y S, \\
P_\zeta^\prime &= -m_\zeta\mu_\zeta^2\zeta, \\
S^\prime &= \frac{P_S}{m_S} + Y \zeta, \\
P_S^\prime &= -m_S\mu_S^2S.
\end{align}
The mass $m_\zeta$ and the frequency $\mu_\zeta$ are defined by
\begin{align}
m_\zeta &= \frac{3\Delta_\bar{K}(\bar{\rho} + \bar{p})}{\rho_\text{crit0} N x^3 c_s^2 E^2}, \\
\mu_\zeta^2 &= x^2N^2c_s^2k^2, \\
m_S &= \frac{x^3}{c_m^2\varpi N}, \\
\mu_S^2 &= x^2N^2c_m^2k^2, \\
Y &= \frac{c_n^2}{c_s^2c_m^2}\frac{1}{m_\zeta m_S \Delta_\bar{K} N E}.
\end{align}
where $\bar{\rho} + \bar{p}$ is the background total energy density plus pressure defined by nc_hicosmo_rhopp()
,
$E^2 = H^2/H_0^2$ is the adimensional Hubble function squared (nc_hicosmo_E2()
), $c_s^2$ the speed of sound (nc_hicosmo_cs2()
),
$N$ is the lapse function that in this case (using $\alpha$ as time variable) is $N \equiv \vert{}E\vert^{-1}$, $\rho_\text{crit0}$
is the critical density today defined by $\rho_\text{crit0} \equiv 3H_0^2/\kappa$ and $$\Delta_\bar{K} \equiv \frac{k^2}{k^2 + \Omega_k}.$$
Functions
nc_hipert_two_fluids_new ()
NcHIPertTwoFluids *
nc_hipert_two_fluids_new (void
);
Creates a new NcHIPertTwoFluids object.
nc_hipert_two_fluids_ref ()
NcHIPertTwoFluids *
nc_hipert_two_fluids_ref (NcHIPertTwoFluids *ptf
);
Increases the reference count of ptf
.
nc_hipert_two_fluids_free ()
void
nc_hipert_two_fluids_free (NcHIPertTwoFluids *ptf
);
Decreases the reference count of ptf
.
nc_hipert_two_fluids_clear ()
void
nc_hipert_two_fluids_clear (NcHIPertTwoFluids **ptf
);
Decreases the reference count of *ptf
and sets *ptf
to NULL.
nc_hipert_two_fluids_prepare_wkb_zeta ()
void nc_hipert_two_fluids_prepare_wkb_zeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha_i
,gdouble alpha_f
);
Prepare the zeta component of the object for WKB calculations using the cosmology cosmo
.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha_i |
initial log-redshift time. |
|
alpha_f |
final log-redshift time. |
nc_hipert_two_fluids_prepare_wkb_S ()
void nc_hipert_two_fluids_prepare_wkb_S (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha_i
,gdouble alpha_f
);
Prepare the zeta component of the object for WKB calculations using the cosmology cosmo
.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha_i |
initial log-redshift time. |
|
alpha_f |
final log-redshift time. |
nc_hipert_two_fluids_prepare_ewkb_zeta ()
void nc_hipert_two_fluids_prepare_ewkb_zeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha_i
,gdouble alpha_f
);
Prepare the zeta component of the object for the exact WKB calculations using the cosmology cosmo
.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha_i |
initial log-redshift time. |
|
alpha_f |
final log-redshift time. |
nc_hipert_two_fluids_prepare_ewkb_S ()
void nc_hipert_two_fluids_prepare_ewkb_S (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha_i
,gdouble alpha_f
);
Prepare the zeta component of the object for the exact WKB calculations using the cosmology cosmo
.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha_i |
initial log-redshift time. |
|
alpha_f |
final log-redshift time. |
nc_hipert_two_fluids_prepare_patched_zeta ()
void nc_hipert_two_fluids_prepare_patched_zeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble prec
,gdouble alpha_i
,gdouble alpha_f
);
Prepare the zeta component of the object for the patched calculations using the cosmology cosmo
.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
prec |
Required precision. |
|
alpha_i |
initial log-redshift time. |
|
alpha_f |
final log-redshift time. |
nc_hipert_two_fluids_prepare_patched_S ()
void nc_hipert_two_fluids_prepare_patched_S (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble prec
,gdouble alpha_i
,gdouble alpha_f
);
Prepare the zeta component of the object for the patched calculations using the cosmology cosmo
.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
prec |
Required precision. |
|
alpha_i |
initial log-redshift time. |
|
alpha_f |
final log-redshift time. |
nc_hipert_two_fluids_wkb_zeta ()
void nc_hipert_two_fluids_wkb_zeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble *Re_zeta
,gdouble *Im_zeta
);
Computes the WKB solution $\zeta_\text{WKB}$ for the mode $k$ at the time $\alpha$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
Re_zeta |
Real part of the wkb solution. |
[out caller-allocates] |
Im_zeta |
Imaginary part of the wkb solution. |
[out caller-allocates] |
nc_hipert_two_fluids_wkb_zeta_Pzeta ()
void nc_hipert_two_fluids_wkb_zeta_Pzeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble *Re_zeta
,gdouble *Im_zeta
,gdouble *Re_Pzeta
,gdouble *Im_Pzeta
);
Computes the WKB solution $\zeta_\text{WKB}$ and its momentum for the mode $k$ at the time $\alpha$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
Re_zeta |
Real part of the wkb solution. |
[out caller-allocates] |
Im_zeta |
Imaginary part of the wkb solution. |
[out caller-allocates] |
Re_Pzeta |
Real part of the wkb solution momentum. |
[out caller-allocates] |
Im_Pzeta |
Imaginary part of the wkb solution momentum. |
[out caller-allocates] |
nc_hipert_two_fluids_wkb_Q ()
void nc_hipert_two_fluids_wkb_Q (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble *Re_Q
,gdouble *Im_Q
);
Computes the WKB solution $Q_\text{WKB}$ for the mode $k$ at the time $\alpha$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
Re_Q |
Real part of the wkb solution. |
[out caller-allocates] |
Im_Q |
Imaginary part of the wkb solution. |
[out caller-allocates] |
nc_hipert_two_fluids_wkb_Q_PQ ()
void nc_hipert_two_fluids_wkb_Q_PQ (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble *Re_Q
,gdouble *Im_Q
,gdouble *Re_PQ
,gdouble *Im_PQ
);
Computes the WKB solution $Q_\text{WKB}$ and its momentum for the mode $k$ at the time $\alpha$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
Re_Q |
Real part of the wkb solution. |
[out caller-allocates] |
Im_Q |
Imaginary part of the wkb solution. |
[out caller-allocates] |
Re_PQ |
Real part of the wkb solution momentum. |
[out caller-allocates] |
Im_PQ |
Imaginary part of the wkb solution momentum. |
[out caller-allocates] |
nc_hipert_two_fluids_ewkb_zeta ()
void nc_hipert_two_fluids_ewkb_zeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble *Re_zeta
,gdouble *Im_zeta
);
Computes the exact WKB solution $\zeta_\text{WKB}$ for the mode $k$ at the time $\alpha$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
Re_zeta |
Real part of the wkb solution. |
[out caller-allocates] |
Im_zeta |
Imaginary part of the wkb solution. |
[out caller-allocates] |
nc_hipert_two_fluids_ewkb_zeta_Pzeta ()
void nc_hipert_two_fluids_ewkb_zeta_Pzeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble *Re_zeta
,gdouble *Im_zeta
,gdouble *Re_Pzeta
,gdouble *Im_Pzeta
);
Computes the exact WKB solution $\zeta_\text{WKB}$ and its momentum for the mode $k$ at the time $\alpha$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
Re_zeta |
Real part of the wkb solution. |
[out caller-allocates] |
Im_zeta |
Imaginary part of the wkb solution. |
[out caller-allocates] |
Re_Pzeta |
Real part of the wkb solution momentum. |
[out caller-allocates] |
Im_Pzeta |
Imaginary part of the wkb solution momentum. |
[out caller-allocates] |
nc_hipert_two_fluids_ewkb_Q ()
void nc_hipert_two_fluids_ewkb_Q (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble *Re_Q
,gdouble *Im_Q
);
Computes the exact WKB solution $Q_\text{WKB}$ for the mode $k$ at the time $\alpha$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
Re_Q |
Real part of the wkb solution. |
[out caller-allocates] |
Im_Q |
Imaginary part of the wkb solution. |
[out caller-allocates] |
nc_hipert_two_fluids_ewkb_Q_PQ ()
void nc_hipert_two_fluids_ewkb_Q_PQ (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble *Re_Q
,gdouble *Im_Q
,gdouble *Re_PQ
,gdouble *Im_PQ
);
Computes the exact WKB solution $Q_\text{WKB}$ and its momentum for the mode $k$ at the time $\alpha$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
Re_Q |
Real part of the wkb solution. |
[out caller-allocates] |
Im_Q |
Imaginary part of the wkb solution. |
[out caller-allocates] |
Re_PQ |
Real part of the wkb solution momentum. |
[out caller-allocates] |
Im_PQ |
Imaginary part of the wkb solution momentum. |
[out caller-allocates] |
nc_hipert_two_fluids_patched_zeta ()
void nc_hipert_two_fluids_patched_zeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble *Re_zeta
,gdouble *Im_zeta
);
Computes the patched WKB solution $\zeta_\text{WKB}$ for the mode $k$ at the time $\alpha$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
Re_zeta |
Real part of the wkb solution. |
[out caller-allocates] |
Im_zeta |
Imaginary part of the wkb solution. |
[out caller-allocates] |
nc_hipert_two_fluids_patched_zeta_Pzeta ()
void nc_hipert_two_fluids_patched_zeta_Pzeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble *Re_zeta
,gdouble *Im_zeta
,gdouble *Re_Pzeta
,gdouble *Im_Pzeta
);
Computes the patched WKB solution $\zeta_\text{WKB}$ and its momentum for the mode $k$ at the time $\alpha$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
Re_zeta |
Real part of the wkb solution. |
[out caller-allocates] |
Im_zeta |
Imaginary part of the wkb solution. |
[out caller-allocates] |
Re_Pzeta |
Real part of the wkb solution momentum. |
[out caller-allocates] |
Im_Pzeta |
Imaginary part of the wkb solution momentum. |
[out caller-allocates] |
nc_hipert_two_fluids_patched_Q ()
void nc_hipert_two_fluids_patched_Q (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble *Re_Q
,gdouble *Im_Q
);
Computes the patched WKB solution $Q_\text{WKB}$ for the mode $k$ at the time $\alpha$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
Re_Q |
Real part of the wkb solution. |
[out caller-allocates] |
Im_Q |
Imaginary part of the wkb solution. |
[out caller-allocates] |
nc_hipert_two_fluids_patched_Q_PQ ()
void nc_hipert_two_fluids_patched_Q_PQ (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble *Re_Q
,gdouble *Im_Q
,gdouble *Re_PQ
,gdouble *Im_PQ
);
Computes the patched WKB solution $Q_\text{WKB}$ and its momentum for the mode $k$ at the time $\alpha$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
Re_Q |
Real part of the wkb solution. |
[out caller-allocates] |
Im_Q |
Imaginary part of the wkb solution. |
[out caller-allocates] |
Re_PQ |
Real part of the wkb solution momentum. |
[out caller-allocates] |
Im_PQ |
Imaginary part of the wkb solution momentum. |
[out caller-allocates] |
nc_hipert_two_fluids_wkb_full_zeta ()
void nc_hipert_two_fluids_wkb_full_zeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble **vars
);
Computes the approximated solution for the mode $Q$ and its momentum for the mode $k$
at the time $\alpha$ using the solution for the mode $\zeta$ present in vars
.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
vars |
Perturbations variables conforming to NcHIPertTwoFluidsVars. |
[inout][array fixed-size=8][element-type double] |
nc_hipert_two_fluids_wkb_full_Q ()
void nc_hipert_two_fluids_wkb_full_Q (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha
,gdouble **vars
);
Computes the approximated solution for the mode $\zeta$ and its momentum for the mode $k$
at the time $\alpha$ using the solution for the mode $Q$ present in vars
.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha |
the log-redshift time. |
|
vars |
Perturbations variables conforming to NcHIPertTwoFluidsVars. |
[inout][array fixed-size=8][element-type double] |
nc_hipert_two_fluids_wkb_zeta_maxtime ()
gdouble nc_hipert_two_fluids_wkb_zeta_maxtime (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha0
,gdouble alpha1
);
Search for the root of $\nu_A^2$ between $\alpha_0$ and $\alpha_1$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha0 |
the initial log-redshift time. |
|
alpha1 |
the final log-redshift time. |
nc_hipert_two_fluids_wkb_S_maxtime ()
gdouble nc_hipert_two_fluids_wkb_S_maxtime (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alpha0
,gdouble alpha1
);
Search for the root of $\nu_B^2$ between $\alpha_0$ and $\alpha_1$.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alpha0 |
the initial log-redshift time. |
|
alpha1 |
the final log-redshift time. |
nc_hipert_two_fluids_wkb_zeta_maxtime_prec ()
gdouble nc_hipert_two_fluids_wkb_zeta_maxtime_prec (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble prec
,gdouble alpha0
,gdouble alpha1
);
Search for the instant at which the WKB approximation starts to fails within the asked precision.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
prec |
Required precision. |
|
alpha0 |
the initial log-redshift time. |
|
alpha1 |
the final log-redshift time. |
nc_hipert_two_fluids_wkb_S_maxtime_prec ()
gdouble nc_hipert_two_fluids_wkb_S_maxtime_prec (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble prec
,gdouble alpha0
,gdouble alpha1
);
Search for the instant at which the WKB approximation starts to fails within the asked precision.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
prec |
Required precision. |
|
alpha0 |
the initial log-redshift time. |
|
alpha1 |
the final log-redshift time. |
nc_hipert_two_fluids_set_init_cond ()
void nc_hipert_two_fluids_set_init_cond (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alphai
,gdouble *vars
);
Sets the initial conditions for the two fluids system evolution.
Parameters
ptf |
||
cosmo |
a NcHICosmo. |
|
alphai |
the log-redshift time. |
|
vars |
Perturbations variables conforming to NcHIPertTwoFluidsVars. |
[in][array fixed-size=8][element-type double] |
nc_hipert_two_fluids_set_init_cond_wkb_zeta ()
void nc_hipert_two_fluids_set_init_cond_wkb_zeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alphai
);
Sets the initial conditions for the system evolution using the value of the WKB solution at alphai
with main mode $\zeta$.
nc_hipert_two_fluids_set_init_cond_ewkb_zeta ()
void nc_hipert_two_fluids_set_init_cond_ewkb_zeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alphai
);
Sets the initial conditions for the system evolution using the value of the exact WKB solution at alphai
with main mode $\zeta$.
nc_hipert_two_fluids_set_init_cond_patched_zeta ()
void nc_hipert_two_fluids_set_init_cond_patched_zeta (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alphai
);
Sets the initial conditions for the system evolution using the value of the patched WKB solution at alphai
with main mode $\zeta$.
nc_hipert_two_fluids_set_init_cond_wkb_Q ()
void nc_hipert_two_fluids_set_init_cond_wkb_Q (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alphai
);
Sets the initial conditions for the system evolution using the value of the WKB solution at alphai
with main mode $Q$.
nc_hipert_two_fluids_set_init_cond_ewkb_Q ()
void nc_hipert_two_fluids_set_init_cond_ewkb_Q (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alphai
);
Sets the initial conditions for the system evolution using the value of the exact WKB solution at alphai
with main mode $Q$.
nc_hipert_two_fluids_set_init_cond_patched_Q ()
void nc_hipert_two_fluids_set_init_cond_patched_Q (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alphai
);
Sets the initial conditions for the system evolution using the value of the patched WKB solution at alphai
with main mode $Q$.
nc_hipert_two_fluids_evolve ()
void nc_hipert_two_fluids_evolve (NcHIPertTwoFluids *ptf
,NcHICosmo *cosmo
,gdouble alphaf
);
Evolve the system until alphaf
.
nc_hipert_two_fluids_get_values ()
void nc_hipert_two_fluids_get_values (NcHIPertTwoFluids *ptf
,gdouble *alphai
,gdouble **vars
);
Get the current time and values of the numerical solution.
Parameters
ptf |
||
alphai |
Current time. |
[out caller-allocates] |
vars |
Perturbations variables conforming to NcHIPertTwoFluidsVars. |
[inout][array fixed-size=8][element-type double] |