GW_templates

GW_templates.py is a Python routine that contains analytical and semi-analytical templates of cosmological GW backgrounds, usually based on spectral fits, either from GW models (see GW_models) or from numerical simulations

Currently part of the cosmoGW code:

https://github.com/cosmoGW/cosmoGW/ https://github.com/cosmoGW/cosmoGW/blob/main/src/cosmoGW/GW_templates.py

Note

For full documentation, visit Read the Docs.

To use it, first install cosmoGW:

pip install cosmoGW

Author

Dates

References

  • [Espinosa:2010hh]: J. R. Espinosa, T. Konstandin, J. M. No, G. Servant, “Energy Budget of Cosmological First-order Phase Transitions,” JCAP 06 (2010), 028, arXiv:1004.4187.

  • [Hindmarsh:2017gnf]: M. Hindmarsh, S. J. Huber, K. Rummukainen, D. J. Weir, “Shape of the acoustic gravitational wave power spectrum from a first order phase transition,” Phys.Rev.D 96 (2017) 10, 103520, Phys.Rev.D 101 (2020) 8, 089902 (erratum), arXiv:1704.05871.

  • [Hindmarsh:2019phv]: M. Hindmarsh, M. Hijazi, “Gravitational waves from first order cosmological phase transitions in the Sound Shell Model,” JCAP 12 (2019) 062, arXiv:1909.10040.

  • [Caprini:2019egz]: [LISA CosWG], “Detecting gravitational waves from cosmological phase transitions with LISA: an update,” JCAP 03 (2020) 024, arXiv:1910.13125.

  • [Hindmarsh:2020hop]: M. Hindmarsh, M. Lueben, J. Lumma, M. Pauly, “Phase transitions in the early universe,” SciPost Phys. Lect. Notes 24 (2021), 1, arXiv:2008.09136.

  • [Jinno:2022mie]: R. Jinno, T. Konstandin, H. Rubira, I. Stomberg, “Higgsless simulations of cosmological phase transitions and gravitational waves,” JCAP 02, 011 (2023), arXiv:2209.04369.

  • [RoperPol:2022iel]: A. Roper Pol, C. Caprini, A. Neronov, D. Semikoz, “The gravitational wave signal from primordial magnetic fields in the Pulsar Timing Array frequency band,” Phys. Rev. D 105, 123502 (2022), arXiv:2201.05630.

  • [RoperPol:2023bqa]: A. Roper Pol, A. Neronov, C. Caprini, T. Boyer, D. Semikoz, “LISA and γ-ray telescopes as multi-messenger probes of a first-order cosmological phase transition,arXiv:2307.10744 (2023)

  • [EPTA:2023xxk]: [EPTA and InPTA Collaborations], “The second data release from the European Pulsar Timing Array - IV. Implications for massive black holes, dark matter, and the early Universe,” Astron. Astrophys. 685, A94 (2024), arXiv:2306.16227

  • [RoperPol:2023dzg]: A. Roper Pol, S. Procacci, C. Caprini, “Characterization of the gravitational wave spectrum from sound waves within the sound shell model,” Phys. Rev. D 109, 063531 (2024), arXiv:2308.12943.

  • [Caprini:2024gyk]: A. Roper Pol, I. Stomberg, C. Caprini, R. Jinno, T. Konstandin, H. Rubira, “Gravitational waves from first-order phase transitions: from weak to strong,” JHEP 07 (2025) 217, arXiv:2409.03651.

  • [Caprini:2024hue]: E. Madge, C. Caprini, R. Jinno, M. Lewicki, M. Merchand, G. Nardini, M. Pieroni, A. Roper Pol, V. Vaskonen, “Gravitational waves from first-order phase transitions in LISA: reconstruction pipeline and physics interpretation,” JCAP 10 (2024) 020, arXiv:2403.03723.

  • [RoperPol:2025b]: A. Roper Pol, A. Midiri, M. Salomé, C. Caprini, “Modeling the gravitational wave spectrum from slowly decaying sources in the early Universe: constant-in-time and coherent-decay models,” in preparation

  • [RoperPol:2025a]: A. Roper Pol, S. Procacci, A. S. Midiri, C. Caprini, “Irrotational fluid perturbations from first-order phase transitions,” in preparation

Comments

Reference values for turbulence template are based on RoperPol:2023bqa and RoperPol:2022iel. Template used in Caprini:2024hue for LISA and in EPTA:2023xxk

Note that the values used for a_turb, b_turb, bPi_vort, fPi are found assuming that the spectrum of the source is defined such that

\[\langle v^2 \rangle \propto 2 E_\ast \int \zeta(K) d \ln K, \quad {\rm as \ in \ RoperPol:2025b},\]

which is a different normalization than that in previous papers, where zeta is defined such that

\[\langle v^2 \rangle \propto 2 E_\ast k_\ast \int \zeta(K) dK, \quad {\rm in \ RoperPol:2022iel}.\]

Hence, the values are considered for the former \(\zeta\) (this choice yields different coefficients). However, the final result is not affected by this choice. See RoperPol:2025b for details

cosmoGW.GW_templates.OmGW_spec_sw(s, alphas, betas, vws=1.0, cs2=0.3333333333333333, quiet=True, a_sw=3, b_sw=1, c_sw=3, alp1_sw=0, alp2_sw=0, corrRs=True, expansion=True, Nsh=1.0, model_efficiency='fixed_value', OmGW_tilde=0.01, bs_HL_eff=20, model_K0='Espinosa', bs_k1HL=40, model_decay='sound_waves', interpolate_HL_decay=True, b=0, model_shape='sw_LISA', strength='weak', interpolate_HL_shape=False, interpolate_HL_n3=False, redshift=False, gstar=100, gS=0, T=<Quantity 100. GeV>, h0=1.0, Neff=3)

Compute the GW spectrum for sound waves, normalized to radiation energy density.

The GW spectrum is calculated as:

\[\Omega_{\rm GW} (f) = 3 \times {\rm ampl\_GWB} \times {\rm pref\_GWB} \times S(f)\]

where ampl_GWB is the efficiency, pref_GWB is the amplitude prefactor, and \(S(f)\) is the normalized spectral shape.

The GW spectrum as an observable at present time is then computed using

\[\Omega_{\rm GW}^0 (f) = \Omega_{\rm GW} (f) \times F_{\rm GW, 0},\]

where \(F_{\rm GW, 0}\) is the redshift from the time of generation to present time, computed in GW_back.py that depends on the degrees of freedom at the time of generation.

Parameters

sarray_like

Normalized wave number, divided by the mean bubble size Rstar, \(s = f R_\ast\).

alphasarray_like

Strength of the phase transition, \(\alpha\).

betasarray_like

Rate of nucleation of the phase transition, \(\beta/H_\ast\).

vwsarray_like, optional

Array of wall velocities, \(v_w\).

cs2float, optional

Square of the speed of sound (default 1/3).

quietbool, optional

Suppress debugging output.

a_sw, b_sw, c_swfloat, optional

Slopes of the sound wave template.

alp1_sw, alp2_swfloat, optional

Transition parameters of the sound wave template.

corrRsbool, optional

Correct Rstar beta with max(vw, cs).

expansionbool, optional

Include Universe expansion.

Nshfloat, optional

Number of shock formation times for source duration.

model_efficiencystr, optional

Model for GW efficiency (‘fixed_value’ or ‘higgsless’).

OmGW_tildefloat, optional

Value of GW efficiency, \(\tilde \Omega_{\rm GW}\) for fixed_value model.

bs_HL_effint, optional

Box size for Higgsless simulation interpolation.

model_K0str, optional

Model for kinetic energy ratio K0 (‘Espinosa’ or ‘higgsless’).

bs_k1HLint, optional

Box size for Higgsless simulation interpolation for k1.

model_decaystr, optional

Model for GW amplitude prefactor (‘sound_waves’ or ‘decay’).

interpolate_HL_decaybool, optional

Use Higgsless simulations to interpolate decay law.

bfloat, optional

Decay law exponent for kinetic energy density.

model_shapestr, optional

Model for spectral shape.

strengthstr, optional

Strength of the phase transition for sw_HLnew.

interpolate_HL_shapebool, optional

Use Higgsless simulations to interpolate k1 and k2.

interpolate_HL_n3bool, optional

Use Higgsless simulations to interpolate c_sw.

redshiftbool, optional

Redshift the GW spectrum and frequencies to present time.

gstar, gSint, optional

Degrees of freedom for redshift calculation.

Tastropy.units.Quantity

Temperature scale for redshift calculation.

h0float, optional

Hubble rate at present time.

Neffint, optional

Effective number of neutrino species.

Returns

freqsndarray

Array of frequencies (normalized or in Hz).

OmGWndarray

GW spectrum normalized to radiation energy density (or present critical density).

References

RoperPol:2023bqa, Caprini:2024gyk, Hindmarsh:2019phv

cosmoGW.GW_templates.OmGW_spec_turb(s, Oms, lfs, N=2, cs2=0.3333333333333333, a_turb=5, b_turb=0.6666666666666666, alp=0.35294117647058826, expansion=True, tdecay='eddy', tp='magnetic', alpPi=2.15, fPi=2.2, bPi=3, redshift=False, gstar=100, gS=0, T=<Quantity 100. GeV>, h0=1.0, Neff=3)

Compute the GW spectrum for turbulence, normalized to radiation energy density. The general shape of the GW spectrum is based on that of reference

\[\Omega_{\rm GW} (f) = 3 * ampl_GWB * pref_GWB * S(f),\]

where:

  • ampl_GWB is the efficiency of GW production by the specific source,

  • pref_GWB is the dependence of the GW amplitude on the source parameters (e.g. length scale and strength of the source),

  • S(f) is a normalized spectral shape, such that \(\int S(f) d \ln f = 1\).

The GW spectrum as an observable at present time is then computed using

\[\Omega_{\rm GW0} (f) = \Omega_{\rm GW} x F_{\rm GW, 0},\]

where \(F_{\rm GW, 0}\) is the redshift from the time of generation to present time, computed in GW_back.py that depends on the degrees of freedom at the time of generation.

Parameters

sarray_like

Normalized wave number, divided by the mean bubble size \(R_\ast\), \(s = f R_\ast\).

Omsfloat or array_like, optional

Energy density of the source, \(\Omega_\ast = {1 \over 2} v_{\rm rms}^2)\).

lfsfloat or array_like, optional

Characteristic scale of the turbulence as a fraction of the Hubble radius, \(l_\ast H_\ast\).

Nint, optional

Ratio between decay time and effective source duration.

cs2float, optional

Square of the speed of sound (default 1/3).

quietbool, optional

Suppress debugging output.

a_turb, b_turb, alpfloat, optional

Slopes and smoothness of the turbulent source spectrum.

expansionbool, optional

Include Universe expansion.

tdecaystr, optional

Determines finite duration in the cit model.

tpstr, optional

Type of source (‘magnetic’, ‘kinetic’, or ‘max’).

alpPi, fPi, bPifloat, optional

Parameters for the anisotropic stress fit.

redshiftbool, optional

Redshift the GW spectrum and frequencies to present time.

gstar, gSint, optional

Degrees of freedom for redshift calculation.

Tastropy.units.Quantity

Temperature scale for redshift calculation.

h0float, optional

Hubble rate at present time.

Neffint, optional

Effective number of neutrino species.

Returns

freqsndarray

Array of frequencies (normalized or in Hz).

OmGWndarray

GW spectrum normalized to radiation energy density (or present critical density).

Reference

RoperPol:2023bqa, equations 3 and 9.

cosmoGW.GW_templates.OmGW_spec_turb_alphabeta(s, alphas, betas, vws=1.0, eps_turb=1.0, model_K0='Espinosa', bs_HL_eff=20, N=2, cs2=0.3333333333333333, corrRs=True, quiet=True, a_turb=5, b_turb=0.6666666666666666, alp=0.35294117647058826, expansion=True, tdecay='eddy', tp='both', alpPi=2.15, fPi=2.2, bPi=3, redshift=False, gstar=100, gS=0, T=<Quantity 100. GeV>, h0=1.0, Neff=3)

Compute the GW spectrum for turbulence using \(\alpha\) and \(\beta\) (i.e., the parameters of the phase transition), following the description of RoperPol:2023bqa.

It is assumed that turbulence has two contributions (from velocity and magnetic fields), which are in equipartition,

\[\Omega_\ast = \Omega_v + \Omega_B \rightarrow \Omega_v = \Omega_B = 0.5 \Omega_\ast.\]

It takes the kinetic energy density from the PT, \(K = \rho_{\rm kin}/\rho_{\rm total}\), and assumes that the turbulence energy density is a fraction \(\epsilon_{\rm turb}\) of it,

\[\Omega_\ast = \epsilon_{\rm turb} K.\]

The duration of the GW production \(\delta t_{\rm fin}\) is assumed to be

\[\delta t_{\rm fin} = N_{\rm turb} \frac{l_\ast}{u_\ast},\]

where \(u_\ast\) is a characteristic velocity,

\[u_\ast = \sqrt{\max(\Omega_v, \frac{2}{1 + c_s^2} \Omega_B)}.\]

Parameters

sarray_like

Normalized wave number, divided by the mean bubble size \(R_\ast\), \(s = f R_\ast\).

alphasarray_like

Strength of the phase transition \(\alpha\).

betasarray_like

Rate of nucleation of the phase transition \(\beta/H_\ast\).

vwsarray_like, optional

Array of wall velocities.

eps_turbfloat, optional

Fraction of kinetic energy converted to turbulence.

model_K0str, optional

Model for kinetic energy ratio K0 (‘Espinosa’ or ‘higgsless’).

bs_HL_effint, optional

Box size for Higgsless simulation interpolation.

Nint, optional

Ratio between decay time and effective source duration.

cs2float, optional

Square of the speed of sound.

corrRsbool, optional

Correct Rstar beta with max(vw, cs).

quietbool, optional

Suppress debugging output.

a_turb, b_turb, alpfloat, optional

Slopes and smoothness of the turbulent source spectrum.

expansionbool, optional

Include Universe expansion.

tdecaystr, optional

Determines finite duration in the cit model.

tpstr, optional

Type of source (‘both’, ‘magnetic’, ‘kinetic’).

alpPi, fPi, bPifloat, optional

Parameters for the anisotropic stress fit.

redshiftbool, optional

Redshift the GW spectrum and frequencies to present time.

gstar, gSint, optional

Degrees of freedom for redshift calculation.

Tastropy.units.Quantity

Temperature scale for redshift calculation.

h0float, optional

Hubble rate at present time.

Neffint, optional

Effective number of neutrino species.

Returns

freqsndarray

Array of frequencies (normalized or in Hz).

OmGWndarray

GW spectrum normalized to radiation energy density (or present critical density).

cosmoGW.GW_templates.Sf_shape_sw(s, model='sw_LISA', Dw=1.0, a_sw=3, b_sw=1, c_sw=3, alp1_sw=0, alp2_sw=0, strength='weak', interpolate_HL=False, bs_k1HL=40, bs_k2HL=20, vws=None, alphas=None, quiet=False, interpolate_HL_n3=False, corrRs=True, cs2=0.3333333333333333)

Compute the GW spectral shape generated by sound waves based on different templates.

Several models are available, including analytic fits and interpolation from Higgsless simulations.

Parameters

sarray_like

Normalized wave number, divided by the mean bubble size, \(s = f R_\ast\).

modelstr, optional

Model for the sound-wave template (‘sw_SSM’, ‘sw_HL’, ‘sw_LISA’, ‘sw_LISAold’, ‘sw_HLnew’).

Dwfloat or array_like, optional

Ratio between peak frequencies \(\Delta_w\), determined by the fluid shell thickness.

a_sw, b_sw, c_swfloat, optional

Slopes for sound wave template (default 3, 1, 3).

alp1_sw, alp2_swfloat, optional

Transition smoothness parameters for sound wave template.

strengthstr, optional

Phase transition strength (‘weak’, ‘interm’, ‘strong’), used to determine peak2 in sw_HLnew.

interpolate_HLbool, optional

Use numerical data from Caprini:2024gyk for slope and peak positions.

bs_k1HL, bs_k2HLint, optional

Box size \(L/v_w\) of Higgsless simulations for peak interpolation.

vws, alphasarray_like, optional

Wall velocities and alpha values for parameter estimation.

quietbool, optional

Suppress warnings about interpolation range.

interpolate_HL_n3bool, optional

Use Higgsless simulations to estimate value of high-frequency slope c_sw.

corrRsbool, optional

Correct Rstar beta with max(vw, cs).

cs2float, optional

Square of the speed of sound (default 1/3).

Returns

Sndarray

Spectral shape of the GW spectrum as a function of \(s = f R_\ast\). If interpolate_HL is True, returns an array of shape (s, alphas, vws).

References

RoperPol:2023bqa, Hindmarsh:2019phv, Jinno:2022mie, Caprini:2024gyk

cosmoGW.GW_templates.Sf_shape_turb(s, Oms=0.1, lf=0.01, N=2, cs2=0.3333333333333333, expansion=True, tdecay='eddy', tp='magnetic', b_turb=0.6666666666666666, alpPi=2.15, fPi=2.2, bPi=3)

Compute the spectral shape for GWs generated by MHD turbulence.

Parameters

sarray_like

Normalized wave number, divided by the mean bubble size, \(s = f R_\ast\).

Omsfloat or array_like, optional

Energy density of the source, \(\Omega_\ast = {1 \over 2} v_{\rm rms}^2)\).

lffloat or array_like, optional

Characteristic scale of the turbulence as a fraction of the Hubble radius, \(l_\ast H_\ast\).

Nint, optional

Ratio between decay time and effective source duration.

cs2float, optional

Square of the speed of sound (default 1/3).

expansionbool, optional

Include Universe expansion.

tdecaystr, optional

Determines finite duration in the cit model.

tpstr, optional

Type of source (‘magnetic’, ‘kinetic’, or ‘max’).

b_turbfloat, optional

Slope of the velocity/magnetic field spectrum in the UV.

alpPi, fPi, bPifloat, optional

Parameters for the anisotropic stress fit.

Returns

Sndarray

Spectral shape for turbulence.

References

RoperPol:2023bqa, equation 9, based on RoperPol:2022iel, section II D. Also used in EPTA:2023xxk, Caprini:2024hue.

Also used in EPTA:2023xxk, Caprini:2024hue.

See further details in RoperPol:2025b.

cosmoGW.GW_templates.ampl_GWB_sw(model='fixed_value', OmGW_sw=0.01, vws=None, alphas=None, numerical=False, bs_HL=20, quiet=False)

Compute the GW efficiency parameter for sound waves.

This function returns the normalized amplitude (efficiency) of the GW spectrum from sound waves, based on either a fixed reference value or interpolation from Higgsless simulation results.

  • For model=’fixed_value’, the amplitude is set to a constant value (default: 1e-2), based on Hindmarsh:2019phv and Hindmarsh:2017gnf.

  • For model=’higgsless’, the amplitude is interpolated from simulation data (Caprini:2024gyk) for given wall velocities and alpha values. The simulation data is available for \(\alpha\) = 0.0046, 0.05, 0.5 and wall velocities in the range 0.32 to 0.8.

Parameters

modelstr, optional

Model for GW efficiency (‘fixed_value’ or ‘higgsless’).

OmGW_swfloat, optional

Reference value for GW efficiency, \(\tilde \Omega_{\rm GW}\) (default: 1e-2).

vwsarray_like, optional

Array of wall velocities for interpolation (required for ‘higgsless’).

alphasarray_like, optional

Array of alpha values for interpolation (required for ‘higgsless’).

numericalbool, optional

If True and model is ‘higgsless’, also return the full grid of simulation values and available alpha and v_wall values.

bs_HLint, optional

Box size (L/vw) used in the simulation (default: 20).

quietbool, optional

If False, print warnings about the validity range of the interpolation.

Returns

Omegasndarray

GW efficiency parameter for the requested values.

Omnumndarray, optional

Full grid of simulation values (only if numerical=True and model=’higgsless’).

val_alphasndarray, optional

Available alpha values in the simulation (only if numerical=True and model=’higgsless’).

val_vwsndarray, optional

Available wall velocity values in the simulation (only if numerical=True and model=’higgsless’).

References

Hindmarsh:2019phv, Hindmarsh:2017gnf, Caprini:2024gyk

cosmoGW.GW_templates.ampl_GWB_turb(a_turb=5, b_turb=0.6666666666666666, alp=0.35294117647058826)

Compute the GW efficiency parameter for turbulence.

Parameters

a_turbfloat, optional

Low-frequency slope of the turbulent source spectrum.

b_turbfloat, optional

High-frequency slope of the turbulent source spectrum.

alpfloat, optional

Smoothness parameter.

Returns

amplfloat

GW efficiency parameter for turbulence.

References

RoperPol:2023bqa, equation 9, based on the template of RoperPol:2022iel, section 3 D.

See footnote 3 of RoperPol:2023bqa for clarification (extra factor 1/2 for oscillation average).

cosmoGW.GW_templates.interpolate_HL_vals(df, vws, alphas, value='Omega_tilde_int_extrap', boxsize=40, numerical=False, quiet=False)

Interpolate Higgsless simulation results to arbitrary wall velocities (\(v_w\)) and alpha (\(\alpha\)).

This function uses numerical results from Caprini:2024gyk to interpolate quantities (such as GW efficiency or spectral parameters) for different values of wall velocity and phase transition strength. The data is read from:

resources/higgsless/parameters_fit_sims.csv

If numerical is True, the function also returns the full grid of simulation values and the available \(\alpha\) and \(v_w\) values.

Parameters

dfpandas.DataFrame

DataFrame containing the simulation results.

vwsarray_like

Array of wall velocities for interpolation.

alphasarray_like

Array of alpha values (phase transition strength) for interpolation.

valuestr, optional

Name of the column in the DataFrame to interpolate (default: ‘Omega_tilde_int_extrap’).

boxsizeint, optional

Box size (L/vw) used in the simulation (default: 40).

numericalbool, optional

If True, also return the full grid of simulation values and available alpha and v_wall values.

quietbool, optional

If False, print warnings about the validity range of the interpolation.

Returns

Omsssndarray

Interpolated values for the requested quantity.

Omegasndarray, optional

Full grid of simulation values (only if numerical=True).

val_alphasndarray, optional

Available alpha values in the simulation (only if numerical=True).

val_vwsndarray, optional

Available wall velocity values in the simulation (only if numerical=True).

References

Caprini:2024gyk

cosmoGW.GW_templates.pPi_fit(s, b=0.6666666666666666, alpPi=2.15, fPi=2.2, bPi=3)

Fit the spectrum of the anisotropic stresses for turbulence.

The spectrum can be computed numerically for a Gaussian source using EPi_correlators in GW_models. Default values are valid for a purely vortical velocity or magnetic field following a von Kárman spectrum, as indicated in RoperPol:2023bqa, equation 17.

The fit is:

\[p_\Pi = \left[1 + \left(\frac{f}{f_\Pi}\right)^{\alpha_\Pi} \right]^{-\frac{(b + b_\Pi)}{\alpha_\Pi}}.\]

Parameters

sarray_like

Array of frequencies, normalized by the characteristic scale, \(s = f R_\ast\).

bfloat, optional

High-frequency slope \(f^{-b}\).

alpPifloat, optional

Smoothness parameter of the fit, \(\alpha_\Pi\).

fPifloat, optional

Position of the fit break, \(f_\Pi\).

bPifloat, optional

Extra power law decay of the spectrum of the stresses compared to b, \(b_\Pi\).

Returns

Pindarray

Spectrum of the anisotropic stresses, \(p_\Pi(f)\).

fGWfloat

Frequency where \(s p_\Pi(s)\), which determines amplitude of GW spectrum for MHD turbulence, is maximum, \(f_{\rm GW}\).

pimaxfloat

Maximum value of \(p_\Pi\), i.e., at \(s = f_{\rm GW}\).

References

RoperPol:2023bqa, RoperPol:2025b

cosmoGW.GW_templates.pref_GWB_sw(Oms=0.1, lf=0.01, alpha=0, model='sound_waves', Nshock=1.0, b=0.0, expansion=True, beta=array([-20., -19.98666222, -19.97332444, ..., 19.97332444, 19.98666222, 20.], shape=(3000,)), cs2=0.3333333333333333)

Compute the prefactor for the GW spectrum from sound waves.

This function calculates the dependence of the GW spectrum amplitude on the kinetic energy density, \(\Omega_\ast\) and the mean bubble size \(l_\ast = R_\ast H_\ast\), for different physical models of the source duration and decay.

\[\Omega_\ast = v_{\rm rms}^2 = \frac{\langle w v^2 \rangle} {\langle w \rangle},\]

related to \(K = \kappa \alpha/(1 + \alpha)\) used in Caprini:2024gyk as

\[\Omega_\ast = \frac{K}{\Gamma} = \frac{\kappa \alpha}{(1 + c_s^2)}, \quad {\rm \ where \ } \Gamma = \frac{\langle w \rangle}{\langle \rho \rangle} = \frac{1 + c_{\rm s}^2}{1 + \alpha}\]

is the adiabatic index.

Note that RoperPol:2023dzg uses \(\Omega_K = {1 \over 2} v_{\rm rms}^2\) so an extra factor of 2 appears in its relation to \(K\).

  • For model=’sound_waves’, the prefactor is computed using the stationary sound wave assumption, including the effect of Universe expansion via the suppression factor Upsilon (Caprini:2024gyk eqs. 2.16 and 2.30). It corresponds to the linear growth with the source duration, which is set to

    \[t_{\rm dur} = N_{\rm shock} t_{\rm shock} = N_{\rm shock} R_\ast/\sqrt{\Omega_\ast},\]

    assuming sound waves do not decay and their UETC is stationary:

    \[\Omega_{\rm GW} \sim K^2 R_\ast t_{\rm dur} = K^2 R_\ast N_{\rm shock} t_{\rm shock}.\]

    When the Universe expansion is included, \(t_{\rm dur}\) is substituted by the suppression factor \(\Upsilon\) describing the growth with the source duration. For a radiation-dominated Universe (see RoperPol:2023dzg):

    \[\Upsilon = \frac{t_{\rm dur}}{1 + t_{\rm dur}}\]

    This choice includes Universe expansion and assumes sourcing occurs during the radiation-dominated era

    \[\Omega_{\rm GW} \sim K^2 R_\ast \Upsilon(t_{\rm dur}) = K^2 R_\ast \frac{t_{\rm dur}}{1 + t_{\rm dur}}.\]

    When \(N_{\rm shock} = 1, t_{\rm dur} = t_{\rm shock} = R_\ast/\sqrt{\Omega_{\rm s}}\) and it becomes equation 3 of RoperPol:2023bqa, based on Hindmarsh:2020hop, equation 8.24.

  • For model=’decay’, the prefactor includes the decay of the source and uses a power-law decay for the kinetic energy density. It uses Caprini:2024gyk, eq. 5.6, assuming a locally stationary UETC. For Minkowski space-time:

    \[\Omega_{\rm GW} \sim K^2_{\rm int} R_\ast, \quad {\rm \ where \ } K^2_{\rm int} = \int K^2 dt,\]

    while for a radiation-dominated expanding Universe:

    \[\Omega_{\rm GW} \sim K^2_{\rm int, exp} R_\ast, \quad {\rm \ where \ } K^2_{\rm int, exp} = \int \frac{K^2}{t^2} dt.\]

Parameters

Omsfloat or array_like, optional

Kinetic energy density, defined as \(v_{\rm rms}^2\), such that \(\Omega_\ast = K/\Gamma = (1 + c_s^2) \kappa \alpha\).

lffloat or array_like, optional

Mean bubble size as a fraction of the Hubble radius.

alphafloat, optional

Ratio of vacuum to radiation energy densities.

modelstr, optional

Model for the prefactor (‘sound_waves’ or ‘decay’).

Nshockfloat, optional

Duration time in units of the shock time.

bfloat, optional

Power law decay exponent for the kinetic energy source. Default 0 recovers stationary sound waves.

expansionbool, optional

If True, include Universe expansion (radiation-dominated era).

betafloat, optional

Rate of nucleation of the phase transition.

cs2float, optional

Square of the speed of sound (default is 1/3 for radiation domination).

Returns

preffloat or ndarray

Prefactor for the GW spectrum, consisting of \(K^2 R_\ast\) or \(K^2_{\rm int, exp} R_\ast\), depending on the chosen model.

References

Caprini:2024gyk, RoperPol:2023bqa, RoperPol:2023dzg

cosmoGW.GW_templates.pref_GWB_turb(Oms=0.1, lf=0.01)

Compute the prefactor for the GW spectrum from turbulence.

The GW spectrum depends on the turbulence length scale (lf) and the fraction of turbulent to radiation energy density (Oms).

Parameters

Omsfloat or array_like, optional

Energy density of the source (i.e., 1/2 vrms^2).

lffloat or array_like, optional

Mean-size of the bubbles, as a fraction of the Hubble radius.

Returns

preffloat or ndarray

Prefactor for the GW spectrum from turbulence.

References

RoperPol:2023bqa, equation 9, based on RoperPol:2022iel, section II D.

Also used in EPTA:2023xxk, Caprini:2024hue.