geff.utility.eom
A module containing equations of motions for common quantities in GEF models.
1""" 2A module containing equations of motions for common quantities in GEF models. 3""" 4import numpy as np 5import math 6from typing import Tuple 7 8def friedmann(*rhos) -> float: 9 r""" 10 Calculate the Hubble rate $H$ from the Friedmann equation. 11 12 Parameters 13 ---------- 14 rhos 15 list of energy densities 16 17 Returns 18 ------- 19 H : float 20 the Hubble rate 21 """ 22 Hsq = (1/3) * (sum(rhos)) 23 return np.sqrt(Hsq) 24 25def check_accelerated_expansion(rhos, ps): 26 r""" 27 Compute $6 M_{\rm P}^2 \ddot{a}/a$. 28 29 Parameters 30 ---------- 31 rhos : list 32 energy densities 33 ps : list 34 pressures 35 """ 36 return -(sum(rhos) + 3*sum(ps)) 37 38 39def klein_gordon(dphi : float, dV : float, H : float, friction : float) -> float: 40 r""" 41 Calculate the Klein–Gordon equation (including gauge-field friction). 42 43 Parameters 44 ---------- 45 dphi : float 46 the inflaton velocity, $\dot{\varphi}$ 47 dV : float 48 the inflaton potential gradient, $V_{,\varphi}$ 49 H : float 50 the Hubble rate, $H$ 51 friction : float 52 friction term, (e.g., $\beta/M_{\rm P} \langle \boldsymbol{E}\cdot \boldsymbol{B} \rangle$) 53 54 Returns 55 ------- 56 ddphi : float 57 the inflaton acceleration $\ddot{\varphi}$ 58 """ 59 return (-3*H * dphi - dV + friction) 60 61def dlnkh(kh : float, dphi : float, ddphi : float, 62 dI : float, ddI : float, xi : float, 63 a : float, H : float) -> float: 64 r""" 65 Calculate the ${\rm d} \log k_{\rm h} / {\rm d}t$. 66 67 Parameters 68 ---------- 69 kh : float 70 the instability scale $k_{\rm h}$ 71 dphi : float 72 the inflaton velocity, $\dot{\varphi}$ 73 ddphi : float 74 the inflaton acceleration, $\ddot{\varphi}$ 75 dI : float 76 the inflaton--gauge-field coupling, $I_{,\varphi}$ 77 ddI : float 78 derivative of the inflaton--gauge-field coupling, $I_{,\varphi \varphi}$ 79 xi : float 80 the instability parameter, $\xi$ 81 a : float 82 the scale factor, $a$ 83 H : float 84 the Hubble rate, $H$ 85 86 Returns 87 ------- 88 dlnkh : float 89 ${\rm d} \log k_{\rm h} / {\rm d}t$. 90 """ 91 92 r = 2*abs(xi) 93 94 fc = a * H * r 95 96 dHdt = 0. #approximation (quasi de Sitter) 97 xiprime = (-dHdt * xi + ( ddI*dphi**2 + dI*ddphi)/2)/H 98 rprime = 2*np.sign(xi)*xiprime 99 fcprime = H*fc + dHdt*a*r + a*H*rprime 100 101 return fcprime/kh 102 103def gauge_field_ode(F : np.ndarray, a : float, kh : float, sclrCpl : float, 104 W : np.ndarray, dlnkhdt : float, L : int=10) -> np.ndarray: 105 r""" 106 Calculate the derivative of 107 108 $$\mathcal{F}_\mathcal{E}^{(n)} = \frac{a^4}{k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{E} \cdot \operatorname{rot}^n \boldsymbol{E}\rangle \, ,$$ 109 $$\mathcal{F}_\mathcal{B}^{(n)} = \frac{a^4}{k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{B} \cdot \operatorname{rot}^n \boldsymbol{B}\rangle \, , $$ 110 $$\mathcal{F}_\mathcal{G}^{(n)} = -\frac{a^4}{2 k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{E} \cdot \operatorname{rot}^n \boldsymbol{B} + \boldsymbol{B} \cdot \operatorname{rot}^n \boldsymbol{E}\rangle \, . $$ 111 112 113 Parameters 114 ---------- 115 F : NDArray 116 array [$\mathcal{F}_\mathcal{E}^{(n)}$, $\mathcal{F}_\mathcal{B}^{(n)}$, $\mathcal{F}_\mathcal{G}^{(n)}$] in shape (3,ntr) 117 a : float 118 the scale factor, $a$ 119 kh : float 120 the instability scale $k_{\rm h}$ 121 sclrCpl : float 122 the inflaton gauge-field coupling, $2H\xi$ 123 W : NDarray 124 boundary terms, shape (3,2) 125 dlnkhdt : float 126 logarithmic derivative of the instability scale, ${\rm d} \log k_{\rm h} / {\rm d}t$ 127 L : int 128 polynomial order for closing ode at ntr 129 130 Returns 131 ------- 132 dFdt : NDArray 133 the time derivative of [$\mathcal{F}_\mathcal{E}^{(n)}$, $\mathcal{F}_\mathcal{B}^{(n)}$, $\mathcal{F}_\mathcal{G}^{(n)}$], shape (3,ntr) 134 """ 135 136 FE = F[:,0] 137 FB = F[:,1] 138 FG = F[:,2] 139 140 scale = kh/a 141 142 W[2,1] = -W[2,1] 143 144 ns = np.arange(0, FE.shape[0]) 145 146 lams = (-1)**ns 147 148 bdrF = ( 149 dlnkhdt / (4*np.pi**2) 150 * (np.tensordot(np.ones_like(lams), W[:,0], axes=0) 151 + np.tensordot(lams, W[:,1], axes=0)) 152 ) 153 154 dFdt = np.zeros_like(bdrF) 155 156 dFdt[:-1,0] = (bdrF[:-1,0] - (4+ns[:-1])*dlnkhdt*FE[:-1] 157 - 2*scale*FG[1:] + 2*sclrCpl*FG[:-1]) 158 dFdt[:-1,1] = (bdrF[:-1,1] - (4+ns[:-1])*dlnkhdt*FB[:-1] 159 + 2*scale*FG[1:]) 160 dFdt[:-1,2] = (bdrF[:-1,2] - (4+ns[:-1])*dlnkhdt*FG[:-1] 161 + scale*(FE[1:] - FB[1:]) + sclrCpl*FB[:-1]) 162 163 #truncation conditions: 164 L = FE.shape[0]//5 165 ls = np.arange(1, L+1, 1) 166 facl = np.array([math.comb(L, j) for j in range(1,L+1)]) 167 FEtr = np.sum( (-1)**(ls-1) * facl * FE[-2*ls], axis=0 ) 168 FBtr = np.sum( (-1)**(ls-1) * facl * FB[-2*ls], axis=0 ) 169 FGtr = np.sum( (-1)**(ls-1) * facl * FG[-2*ls], axis=0 ) 170 171 dFdt[-1,0] = (bdrF[-1,0] - (4+ns[-1])*dlnkhdt*FE[-1] 172 - 2*scale*FGtr + 2*sclrCpl*FG[-1]) 173 dFdt[-1,1] = (bdrF[-1,1] - (4+ns[-1])*dlnkhdt*FB[-1] 174 + 2*scale*FGtr) 175 dFdt[-1,2] = (bdrF[-1,2] - (4+ns[-1])*dlnkhdt*FG[-1] 176 + scale*(FEtr - FBtr) + sclrCpl*FB[-1]) 177 178 return dFdt 179 180def dlnkh_schwinger(kh : float, dphi : float, ddphi : float, 181 dI : float, ddI : float,xieff : float, s : float, 182 a : float, H : float) -> float: 183 r""" 184 Calculate the ${\rm d} \log k_{\rm h} / {\rm d}t$ in presence of conductivities. 185 186 Parameters 187 ---------- 188 kh : float 189 the instability scale $k_{\rm h}$ 190 dphi : float 191 the inflaton velocity, $\dot{\varphi}$ 192 ddphi : float 193 the inflaton acceleration, $\ddot{\varphi}$ 194 dI : float 195 the inflaton--gauge-field coupling, $I_{,\varphi}$ 196 ddI : float 197 derivative of the inflaton--gauge-field coupling, $I_{,\varphi \varphi}$ 198 xieff : float 199 the effective instability parameter, $\xi + \sigma_{\rm B}/(2H)$ 200 s : float or val 201 the effective electric conductivity, $\sigma_{\rm E}/(2H)$ 202 a : float 203 the scale factor, $a$ 204 H : float 205 the Hubble rate, $H$ 206 207 Returns 208 ------- 209 dlnkh : float 210 ${\rm d} \log k_{\rm h} / {\rm d}t$. 211 """ 212 sqrtterm = np.sqrt(xieff**2 + s**2 + s) 213 r = (abs(xieff) + sqrtterm) 214 215 fc = a * H * r 216 217 #approximations 218 dsigmaEdt = 0. 219 dsigmaBdt = 0. 220 dHdt = 0.#vals.vals["Hprime"]# #approximation dHdt = alphaH**2 (slow-roll) 221 222 xieffprime = (-dHdt * xieff + (ddI*dphi**2 + dI*ddphi + a*dsigmaBdt)/2)/H 223 sEprime = (-dHdt * s + a*dsigmaEdt/2)/H 224 rprime = ( (np.sign(xieff)+xieff/sqrtterm)*xieffprime 225 + sEprime*(s+1/2)/sqrtterm ) 226 fcprime = H*fc + dHdt*a*r + a*H*rprime 227 228 return fcprime/kh 229 230def ddelta(delta : float, sigmaE : float) -> float: 231 r""" 232 Calculate the derivative of the cumulative electric damping, $\Delta = \exp \left(-\int \sigma_{\rm E} {\rm d} t\right)$. 233 234 Parameters 235 ---------- 236 delta : float 237 cumulative electric damping, $\Delta$ 238 sigmaE : float 239 electric conductivity, $\sigma_{\rm E}$ 240 241 Returns 242 ------- 243 ddelta : float 244 the time derivative of $\Delta$ 245 """ 246 return -delta*sigmaE 247 248def drhoChi(rhoChi : float, E : float, G : float, 249 sigmaE : float, sigmaB : float, H : float) -> float: 250 r""" 251 Calculate the derivative of the fermion energy density. 252 253 Parameters 254 ---------- 255 rhoChi : float 256 the fermion energy density, $\rho_{\chi}$ 257 E : float 258 the electric field expecation value, $\langle \boldsymbol{E}^2 \rangle$ 259 G : float 260 the expectation value of $-\langle \boldsymbol{E} \cdot \boldsymbol{B} \rangle$ 261 sigmaE : float 262 electric conductivity, $\sigma_{\rm E}$ 263 sigmaB : float 264 magnetic conductivity, $\sigma_{\rm B}$ 265 H : float 266 the Hubble rate, $H$ 267 268 Returns 269 ------- 270 float 271 the time derivative of rhoChi 272 """ 273 return (sigmaE*E - sigmaB*G - 4*H*rhoChi) 274 275def gauge_field_ode_schwinger(F : np.ndarray, a : float, kh : float, sclrCpl : float, 276 sigmaE : float, delta : float, 277 W : np.ndarray, dlnkhdt : float, L : int=10) -> np.ndarray: 278 r""" 279 Calculate the derivative of 280 281 $$\mathcal{F}_\mathcal{E}^{(n)} = \frac{a^4}{k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{E} \cdot \operatorname{rot}^n \boldsymbol{E}\rangle \, ,$$ 282 $$\mathcal{F}_\mathcal{B}^{(n)} = \frac{a^4}{k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{B} \cdot \operatorname{rot}^n \boldsymbol{B}\rangle \, , $$ 283 $$\mathcal{F}_\mathcal{G}^{(n)} = -\frac{a^4}{2 k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{E} \cdot \operatorname{rot}^n \boldsymbol{B} + \boldsymbol{B} \cdot \operatorname{rot}^n \boldsymbol{E}\rangle \, , $$ 284 285 in the presence of Schwinger conductivities. 286 287 Parameters 288 ---------- 289 F : NDArray 290 array [$\mathcal{F}_\mathcal{E}^{(n)}$, $\mathcal{F}_\mathcal{B}^{(n)}$, $\mathcal{F}_\mathcal{G}^{(n)}$] in shape (3,ntr) 291 a : float 292 the scale factor, $a$ 293 kh : float 294 the instability scale $k_{\rm h}$ 295 sclrCpl : float 296 the inflaton gauge-field coupling, $2H\xi_{\rm eff}$ 297 delta : float 298 cumulative electric damping, $\Delta$ 299 W : NDarray 300 boundary terms, shape (3,2) 301 dlnkhdt : float 302 logarithmic derivative of the instability scale, ${\rm d} \log k_{\rm h} / {\rm d}t$ 303 L : int 304 polynomial order for closing ode at ntr 305 306 Returns 307 ------- 308 dFdt : NDArray 309 the time derivative of [$\mathcal{F}_\mathcal{E}^{(n)}$, $\mathcal{F}_\mathcal{B}^{(n)}$, $\mathcal{F}_\mathcal{G}^{(n)}$], shape (3,ntr) 310 """ 311 FE = F[:,0] 312 FB = F[:,1] 313 FG = F[:,2] 314 315 scale = kh/a 316 317 W[2,1] = -W[2,1] 318 319 ns = np.arange(0, FE.shape[0]) 320 321 lams = (-1)**ns 322 323 bdrF = (dlnkhdt*delta / (4*np.pi**2) 324 * (np.tensordot(np.ones_like(lams), W[:,0], axes=0) 325 + np.tensordot(lams, W[:,1], axes=0)) 326 ) 327 328 dFdt = np.zeros(bdrF.shape) 329 330 dFdt[:-1,0] = (bdrF[:-1,0] - (4+ns[:-1])*dlnkhdt*FE[:-1] 331 - 2*sigmaE*FE[:-1] - 2*scale*FG[1:] + 2*sclrCpl*FG[:-1]) 332 dFdt[:-1,1] = (bdrF[:-1,1] - (4+ns[:-1])*dlnkhdt*FB[:-1] 333 + 2*scale*FG[1:]) 334 dFdt[:-1,2] = (bdrF[:-1,2] - (4+ns[:-1])*dlnkhdt*FG[:-1] 335 - sigmaE*FG[:-1] + scale*(FE[1:] - FB[1:]) + sclrCpl*FB[:-1]) 336 337 #truncation conditions: 338 ls = np.arange(1, L+1, 1) 339 facl = np.array([math.comb(L, j) for j in range(1,L+1)]) 340 FEtr = np.sum( (-1)**(ls-1) * facl * FE[-2*ls], axis=0 ) #-2*ls instead of -2*ls+1 since -1 is ntr not ntr-1 341 FBtr = np.sum( (-1)**(ls-1) * facl * FB[-2*ls], axis=0 ) 342 FGtr = np.sum( (-1)**(ls-1) * facl * FG[-2*ls], axis=0 ) 343 344 #bilinears at truncation order ntr 345 dFdt[-1,0] = (bdrF[-1,0] - (4+ns[-1])*dlnkhdt*FE[-1] 346 - 2*sigmaE*FE[-1] - 2*scale*FGtr + 2*sclrCpl*FG[-1]) 347 dFdt[-1,1] = (bdrF[-1,1] - (4+ns[-1])*dlnkhdt*FB[-1] 348 + 2*scale*FGtr) 349 dFdt[-1,2] = (bdrF[-1,2] - (4+ns[-1])*dlnkhdt*FG[-1] 350 - sigmaE*FG[-1] + scale*(FEtr - FBtr) + sclrCpl*FB[-1]) 351 352 return dFdt 353 354def conductivities_collinear(a : float, H : float, 355 E : float, B : float, G : float, 356 picture : int, omega : float) -> Tuple[float, float, float]: 357 r""" 358 Compute electric & magnetic conductivities and the damping scale $k_{\rm S}$ 359 assuming collinear E & M fields. 360 361 Parameters 362 ---------- 363 a : float 364 the scale factor, $a$ 365 H : float 366 the Hubble rate, $H$ 367 E : float 368 the electric field expecation value, $\langle \boldsymbol{E}^2 \rangle$ 369 E : float 370 the magnetic field expecation value, $\langle \boldsymbol{B}^2 \rangle$ 371 G : float 372 the expectation value of $-\langle \boldsymbol{E} \cdot \boldsymbol{B} \rangle$ 373 picture : int 374 an integer specifying electric (=-1) or magnetic pictures (=1) 375 omega : float 376 the reference frequency to convert from numerical to physical units 377 378 Returns 379 ------- 380 float 381 the electric damping, $\sigma_{\rm E}$ 382 float 383 the magnetic damping, $\sigma_{\rm B}$ 384 float 385 the damping scale, $k_{\rm S}$ 386 """ 387 mu = (E+B) 388 if mu<=0: 389 return 0., 0., 1e-4*a*H 390 else: 391 mu = (mu/2)**(1/4) 392 mz = 91.2/(2.43536e18) 393 gmz = 0.35 394 gmu = np.sqrt(gmz**2/(1 + gmz**2*41./(48.*np.pi**2)*np.log(mz/(mu*omega)))) 395 396 C = 41/12 397 398 sigma = (C*gmu**3/(6*np.pi**2 * H * np.tanh(np.pi*np.sqrt(B/E)))) 399 sigmaE = np.sqrt(B) * (min(1., (1.- picture))*E + max(-picture, 0.)*B) * sigma / (E+B) 400 sigmaB = -np.sign(G) * np.sqrt(E)*(min(1., (1.+ picture))*B + max(picture,0.)*E)* sigma/(E+B) 401 402 ks = C**(1/3)*gmu*E**(1/4)*a 403 404 return sigmaE, sigmaB, ks 405 406def conductivities_mixed(a : float, H : float, 407 E : float, B : float, G : float, 408 omega : float) -> Tuple[float, float, float]: 409 r""" 410 Compute electric & magnetic conductivities and the damping scale $k_{\rm S}$ 411 in the mixed picture. 412 413 Parameters 414 ---------- 415 a : float 416 the scale factor, $a$ 417 H : float 418 the Hubble rate, $H$ 419 E : float 420 the electric field expecation value, $\langle \boldsymbol{E}^2 \rangle$ 421 E : float 422 the magnetic field expecation value, $\langle \boldsymbol{B}^2 \rangle$ 423 G : float 424 the expectation value of $-\langle \boldsymbol{E} \cdot \boldsymbol{B} \rangle$ 425 omega : float 426 the reference frequency to convert from numerical to physical units 427 428 Returns 429 ------- 430 float 431 the electric damping, $\sigma_{\rm E}$ 432 float 433 the magnetic damping, $\sigma_{\rm B}$ 434 float 435 the damping scale, $k_{\rm S}$ 436 """ 437 Sigma = np.sqrt((E - B)**2 + 4*G**2) 438 if Sigma<=0: 439 return 0., 0., 1e-4*a*H 440 else: 441 mz = 91.2/(2.43536e18) 442 mu = ((Sigma)/2)**(1/4) 443 gmz = 0.35 444 gmu = np.sqrt(gmz**2/(1 + gmz**2*41./(48.*np.pi**2)*np.log(mz/(mu*omega)))) 445 446 Eprime = np.sqrt( (E - B + Sigma)/2 ) 447 Bprime = np.sqrt( (B- E + Sigma)/2 ) 448 Sum = E + B + Sigma 449 450 C = 41/12 451 452 sigma = ( C*gmu**3/(6*np.pi**2) / (np.sqrt(Sigma*Sum)*H * np.tanh(np.pi*Bprime/Eprime))) 453 454 ks = C**(1/3)*gmu*Eprime**(1/2)*a 455 456 return 2**(1/2)*abs(G)*Eprime*sigma, -2**(1/2)*G*Bprime*sigma, ks
9def friedmann(*rhos) -> float: 10 r""" 11 Calculate the Hubble rate $H$ from the Friedmann equation. 12 13 Parameters 14 ---------- 15 rhos 16 list of energy densities 17 18 Returns 19 ------- 20 H : float 21 the Hubble rate 22 """ 23 Hsq = (1/3) * (sum(rhos)) 24 return np.sqrt(Hsq)
Calculate the Hubble rate $H$ from the Friedmann equation.
Parameters
- rhos: list of energy densities
Returns
- H (float): the Hubble rate
26def check_accelerated_expansion(rhos, ps): 27 r""" 28 Compute $6 M_{\rm P}^2 \ddot{a}/a$. 29 30 Parameters 31 ---------- 32 rhos : list 33 energy densities 34 ps : list 35 pressures 36 """ 37 return -(sum(rhos) + 3*sum(ps))
Compute $6 M_{\rm P}^2 \ddot{a}/a$.
Parameters
- rhos (list): energy densities
- ps (list): pressures
40def klein_gordon(dphi : float, dV : float, H : float, friction : float) -> float: 41 r""" 42 Calculate the Klein–Gordon equation (including gauge-field friction). 43 44 Parameters 45 ---------- 46 dphi : float 47 the inflaton velocity, $\dot{\varphi}$ 48 dV : float 49 the inflaton potential gradient, $V_{,\varphi}$ 50 H : float 51 the Hubble rate, $H$ 52 friction : float 53 friction term, (e.g., $\beta/M_{\rm P} \langle \boldsymbol{E}\cdot \boldsymbol{B} \rangle$) 54 55 Returns 56 ------- 57 ddphi : float 58 the inflaton acceleration $\ddot{\varphi}$ 59 """ 60 return (-3*H * dphi - dV + friction)
Calculate the Klein–Gordon equation (including gauge-field friction).
Parameters
- dphi (float): the inflaton velocity, $\dot{\varphi}$
- dV (float): the inflaton potential gradient, $V_{,\varphi}$
- H (float): the Hubble rate, $H$
- friction (float): friction term, (e.g., $\beta/M_{\rm P} \langle \boldsymbol{E}\cdot \boldsymbol{B} \rangle$)
Returns
- ddphi (float): the inflaton acceleration $\ddot{\varphi}$
62def dlnkh(kh : float, dphi : float, ddphi : float, 63 dI : float, ddI : float, xi : float, 64 a : float, H : float) -> float: 65 r""" 66 Calculate the ${\rm d} \log k_{\rm h} / {\rm d}t$. 67 68 Parameters 69 ---------- 70 kh : float 71 the instability scale $k_{\rm h}$ 72 dphi : float 73 the inflaton velocity, $\dot{\varphi}$ 74 ddphi : float 75 the inflaton acceleration, $\ddot{\varphi}$ 76 dI : float 77 the inflaton--gauge-field coupling, $I_{,\varphi}$ 78 ddI : float 79 derivative of the inflaton--gauge-field coupling, $I_{,\varphi \varphi}$ 80 xi : float 81 the instability parameter, $\xi$ 82 a : float 83 the scale factor, $a$ 84 H : float 85 the Hubble rate, $H$ 86 87 Returns 88 ------- 89 dlnkh : float 90 ${\rm d} \log k_{\rm h} / {\rm d}t$. 91 """ 92 93 r = 2*abs(xi) 94 95 fc = a * H * r 96 97 dHdt = 0. #approximation (quasi de Sitter) 98 xiprime = (-dHdt * xi + ( ddI*dphi**2 + dI*ddphi)/2)/H 99 rprime = 2*np.sign(xi)*xiprime 100 fcprime = H*fc + dHdt*a*r + a*H*rprime 101 102 return fcprime/kh
Calculate the ${\rm d} \log k_{\rm h} / {\rm d}t$.
Parameters
- kh (float): the instability scale $k_{\rm h}$
- dphi (float): the inflaton velocity, $\dot{\varphi}$
- ddphi (float): the inflaton acceleration, $\ddot{\varphi}$
- dI (float): the inflaton--gauge-field coupling, $I_{,\varphi}$
- ddI (float): derivative of the inflaton--gauge-field coupling, $I_{,\varphi \varphi}$
- xi (float): the instability parameter, $\xi$
- a (float): the scale factor, $a$
- H (float): the Hubble rate, $H$
Returns
- dlnkh (float): ${\rm d} \log k_{\rm h} / {\rm d}t$.
104def gauge_field_ode(F : np.ndarray, a : float, kh : float, sclrCpl : float, 105 W : np.ndarray, dlnkhdt : float, L : int=10) -> np.ndarray: 106 r""" 107 Calculate the derivative of 108 109 $$\mathcal{F}_\mathcal{E}^{(n)} = \frac{a^4}{k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{E} \cdot \operatorname{rot}^n \boldsymbol{E}\rangle \, ,$$ 110 $$\mathcal{F}_\mathcal{B}^{(n)} = \frac{a^4}{k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{B} \cdot \operatorname{rot}^n \boldsymbol{B}\rangle \, , $$ 111 $$\mathcal{F}_\mathcal{G}^{(n)} = -\frac{a^4}{2 k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{E} \cdot \operatorname{rot}^n \boldsymbol{B} + \boldsymbol{B} \cdot \operatorname{rot}^n \boldsymbol{E}\rangle \, . $$ 112 113 114 Parameters 115 ---------- 116 F : NDArray 117 array [$\mathcal{F}_\mathcal{E}^{(n)}$, $\mathcal{F}_\mathcal{B}^{(n)}$, $\mathcal{F}_\mathcal{G}^{(n)}$] in shape (3,ntr) 118 a : float 119 the scale factor, $a$ 120 kh : float 121 the instability scale $k_{\rm h}$ 122 sclrCpl : float 123 the inflaton gauge-field coupling, $2H\xi$ 124 W : NDarray 125 boundary terms, shape (3,2) 126 dlnkhdt : float 127 logarithmic derivative of the instability scale, ${\rm d} \log k_{\rm h} / {\rm d}t$ 128 L : int 129 polynomial order for closing ode at ntr 130 131 Returns 132 ------- 133 dFdt : NDArray 134 the time derivative of [$\mathcal{F}_\mathcal{E}^{(n)}$, $\mathcal{F}_\mathcal{B}^{(n)}$, $\mathcal{F}_\mathcal{G}^{(n)}$], shape (3,ntr) 135 """ 136 137 FE = F[:,0] 138 FB = F[:,1] 139 FG = F[:,2] 140 141 scale = kh/a 142 143 W[2,1] = -W[2,1] 144 145 ns = np.arange(0, FE.shape[0]) 146 147 lams = (-1)**ns 148 149 bdrF = ( 150 dlnkhdt / (4*np.pi**2) 151 * (np.tensordot(np.ones_like(lams), W[:,0], axes=0) 152 + np.tensordot(lams, W[:,1], axes=0)) 153 ) 154 155 dFdt = np.zeros_like(bdrF) 156 157 dFdt[:-1,0] = (bdrF[:-1,0] - (4+ns[:-1])*dlnkhdt*FE[:-1] 158 - 2*scale*FG[1:] + 2*sclrCpl*FG[:-1]) 159 dFdt[:-1,1] = (bdrF[:-1,1] - (4+ns[:-1])*dlnkhdt*FB[:-1] 160 + 2*scale*FG[1:]) 161 dFdt[:-1,2] = (bdrF[:-1,2] - (4+ns[:-1])*dlnkhdt*FG[:-1] 162 + scale*(FE[1:] - FB[1:]) + sclrCpl*FB[:-1]) 163 164 #truncation conditions: 165 L = FE.shape[0]//5 166 ls = np.arange(1, L+1, 1) 167 facl = np.array([math.comb(L, j) for j in range(1,L+1)]) 168 FEtr = np.sum( (-1)**(ls-1) * facl * FE[-2*ls], axis=0 ) 169 FBtr = np.sum( (-1)**(ls-1) * facl * FB[-2*ls], axis=0 ) 170 FGtr = np.sum( (-1)**(ls-1) * facl * FG[-2*ls], axis=0 ) 171 172 dFdt[-1,0] = (bdrF[-1,0] - (4+ns[-1])*dlnkhdt*FE[-1] 173 - 2*scale*FGtr + 2*sclrCpl*FG[-1]) 174 dFdt[-1,1] = (bdrF[-1,1] - (4+ns[-1])*dlnkhdt*FB[-1] 175 + 2*scale*FGtr) 176 dFdt[-1,2] = (bdrF[-1,2] - (4+ns[-1])*dlnkhdt*FG[-1] 177 + scale*(FEtr - FBtr) + sclrCpl*FB[-1]) 178 179 return dFdt
Calculate the derivative of
$$\mathcal{F}_\mathcal{E}^{(n)} = \frac{a^4}{k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{E} \cdot \operatorname{rot}^n \boldsymbol{E}\rangle \, ,$$ $$\mathcal{F}_\mathcal{B}^{(n)} = \frac{a^4}{k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{B} \cdot \operatorname{rot}^n \boldsymbol{B}\rangle \, , $$ $$\mathcal{F}_\mathcal{G}^{(n)} = -\frac{a^4}{2 k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{E} \cdot \operatorname{rot}^n \boldsymbol{B} + \boldsymbol{B} \cdot \operatorname{rot}^n \boldsymbol{E}\rangle \, . $$
Parameters
- F (NDArray): array [$\mathcal{F}_\mathcal{E}^{(n)}$, $\mathcal{F}_\mathcal{B}^{(n)}$, $\mathcal{F}_\mathcal{G}^{(n)}$] in shape (3,ntr)
- a (float): the scale factor, $a$
- kh (float): the instability scale $k_{\rm h}$
- sclrCpl (float): the inflaton gauge-field coupling, $2H\xi$
- W (NDarray): boundary terms, shape (3,2)
- dlnkhdt (float): logarithmic derivative of the instability scale, ${\rm d} \log k_{\rm h} / {\rm d}t$
- L (int): polynomial order for closing ode at ntr
Returns
- dFdt (NDArray): the time derivative of [$\mathcal{F}_\mathcal{E}^{(n)}$, $\mathcal{F}_\mathcal{B}^{(n)}$, $\mathcal{F}_\mathcal{G}^{(n)}$], shape (3,ntr)
181def dlnkh_schwinger(kh : float, dphi : float, ddphi : float, 182 dI : float, ddI : float,xieff : float, s : float, 183 a : float, H : float) -> float: 184 r""" 185 Calculate the ${\rm d} \log k_{\rm h} / {\rm d}t$ in presence of conductivities. 186 187 Parameters 188 ---------- 189 kh : float 190 the instability scale $k_{\rm h}$ 191 dphi : float 192 the inflaton velocity, $\dot{\varphi}$ 193 ddphi : float 194 the inflaton acceleration, $\ddot{\varphi}$ 195 dI : float 196 the inflaton--gauge-field coupling, $I_{,\varphi}$ 197 ddI : float 198 derivative of the inflaton--gauge-field coupling, $I_{,\varphi \varphi}$ 199 xieff : float 200 the effective instability parameter, $\xi + \sigma_{\rm B}/(2H)$ 201 s : float or val 202 the effective electric conductivity, $\sigma_{\rm E}/(2H)$ 203 a : float 204 the scale factor, $a$ 205 H : float 206 the Hubble rate, $H$ 207 208 Returns 209 ------- 210 dlnkh : float 211 ${\rm d} \log k_{\rm h} / {\rm d}t$. 212 """ 213 sqrtterm = np.sqrt(xieff**2 + s**2 + s) 214 r = (abs(xieff) + sqrtterm) 215 216 fc = a * H * r 217 218 #approximations 219 dsigmaEdt = 0. 220 dsigmaBdt = 0. 221 dHdt = 0.#vals.vals["Hprime"]# #approximation dHdt = alphaH**2 (slow-roll) 222 223 xieffprime = (-dHdt * xieff + (ddI*dphi**2 + dI*ddphi + a*dsigmaBdt)/2)/H 224 sEprime = (-dHdt * s + a*dsigmaEdt/2)/H 225 rprime = ( (np.sign(xieff)+xieff/sqrtterm)*xieffprime 226 + sEprime*(s+1/2)/sqrtterm ) 227 fcprime = H*fc + dHdt*a*r + a*H*rprime 228 229 return fcprime/kh
Calculate the ${\rm d} \log k_{\rm h} / {\rm d}t$ in presence of conductivities.
Parameters
- kh (float): the instability scale $k_{\rm h}$
- dphi (float): the inflaton velocity, $\dot{\varphi}$
- ddphi (float): the inflaton acceleration, $\ddot{\varphi}$
- dI (float): the inflaton--gauge-field coupling, $I_{,\varphi}$
- ddI (float): derivative of the inflaton--gauge-field coupling, $I_{,\varphi \varphi}$
- xieff (float): the effective instability parameter, $\xi + \sigma_{\rm B}/(2H)$
- s (float or val): the effective electric conductivity, $\sigma_{\rm E}/(2H)$
- a (float): the scale factor, $a$
- H (float): the Hubble rate, $H$
Returns
- dlnkh (float): ${\rm d} \log k_{\rm h} / {\rm d}t$.
231def ddelta(delta : float, sigmaE : float) -> float: 232 r""" 233 Calculate the derivative of the cumulative electric damping, $\Delta = \exp \left(-\int \sigma_{\rm E} {\rm d} t\right)$. 234 235 Parameters 236 ---------- 237 delta : float 238 cumulative electric damping, $\Delta$ 239 sigmaE : float 240 electric conductivity, $\sigma_{\rm E}$ 241 242 Returns 243 ------- 244 ddelta : float 245 the time derivative of $\Delta$ 246 """ 247 return -delta*sigmaE
Calculate the derivative of the cumulative electric damping, $\Delta = \exp \left(-\int \sigma_{\rm E} {\rm d} t\right)$.
Parameters
- delta (float): cumulative electric damping, $\Delta$
- sigmaE (float): electric conductivity, $\sigma_{\rm E}$
Returns
- ddelta (float): the time derivative of $\Delta$
249def drhoChi(rhoChi : float, E : float, G : float, 250 sigmaE : float, sigmaB : float, H : float) -> float: 251 r""" 252 Calculate the derivative of the fermion energy density. 253 254 Parameters 255 ---------- 256 rhoChi : float 257 the fermion energy density, $\rho_{\chi}$ 258 E : float 259 the electric field expecation value, $\langle \boldsymbol{E}^2 \rangle$ 260 G : float 261 the expectation value of $-\langle \boldsymbol{E} \cdot \boldsymbol{B} \rangle$ 262 sigmaE : float 263 electric conductivity, $\sigma_{\rm E}$ 264 sigmaB : float 265 magnetic conductivity, $\sigma_{\rm B}$ 266 H : float 267 the Hubble rate, $H$ 268 269 Returns 270 ------- 271 float 272 the time derivative of rhoChi 273 """ 274 return (sigmaE*E - sigmaB*G - 4*H*rhoChi)
Calculate the derivative of the fermion energy density.
Parameters
- rhoChi (float): the fermion energy density, $\rho_{\chi}$
- E (float): the electric field expecation value, $\langle \boldsymbol{E}^2 \rangle$
- G (float): the expectation value of $-\langle \boldsymbol{E} \cdot \boldsymbol{B} \rangle$
- sigmaE (float): electric conductivity, $\sigma_{\rm E}$
- sigmaB (float): magnetic conductivity, $\sigma_{\rm B}$
- H (float): the Hubble rate, $H$
Returns
- float: the time derivative of rhoChi
276def gauge_field_ode_schwinger(F : np.ndarray, a : float, kh : float, sclrCpl : float, 277 sigmaE : float, delta : float, 278 W : np.ndarray, dlnkhdt : float, L : int=10) -> np.ndarray: 279 r""" 280 Calculate the derivative of 281 282 $$\mathcal{F}_\mathcal{E}^{(n)} = \frac{a^4}{k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{E} \cdot \operatorname{rot}^n \boldsymbol{E}\rangle \, ,$$ 283 $$\mathcal{F}_\mathcal{B}^{(n)} = \frac{a^4}{k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{B} \cdot \operatorname{rot}^n \boldsymbol{B}\rangle \, , $$ 284 $$\mathcal{F}_\mathcal{G}^{(n)} = -\frac{a^4}{2 k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{E} \cdot \operatorname{rot}^n \boldsymbol{B} + \boldsymbol{B} \cdot \operatorname{rot}^n \boldsymbol{E}\rangle \, , $$ 285 286 in the presence of Schwinger conductivities. 287 288 Parameters 289 ---------- 290 F : NDArray 291 array [$\mathcal{F}_\mathcal{E}^{(n)}$, $\mathcal{F}_\mathcal{B}^{(n)}$, $\mathcal{F}_\mathcal{G}^{(n)}$] in shape (3,ntr) 292 a : float 293 the scale factor, $a$ 294 kh : float 295 the instability scale $k_{\rm h}$ 296 sclrCpl : float 297 the inflaton gauge-field coupling, $2H\xi_{\rm eff}$ 298 delta : float 299 cumulative electric damping, $\Delta$ 300 W : NDarray 301 boundary terms, shape (3,2) 302 dlnkhdt : float 303 logarithmic derivative of the instability scale, ${\rm d} \log k_{\rm h} / {\rm d}t$ 304 L : int 305 polynomial order for closing ode at ntr 306 307 Returns 308 ------- 309 dFdt : NDArray 310 the time derivative of [$\mathcal{F}_\mathcal{E}^{(n)}$, $\mathcal{F}_\mathcal{B}^{(n)}$, $\mathcal{F}_\mathcal{G}^{(n)}$], shape (3,ntr) 311 """ 312 FE = F[:,0] 313 FB = F[:,1] 314 FG = F[:,2] 315 316 scale = kh/a 317 318 W[2,1] = -W[2,1] 319 320 ns = np.arange(0, FE.shape[0]) 321 322 lams = (-1)**ns 323 324 bdrF = (dlnkhdt*delta / (4*np.pi**2) 325 * (np.tensordot(np.ones_like(lams), W[:,0], axes=0) 326 + np.tensordot(lams, W[:,1], axes=0)) 327 ) 328 329 dFdt = np.zeros(bdrF.shape) 330 331 dFdt[:-1,0] = (bdrF[:-1,0] - (4+ns[:-1])*dlnkhdt*FE[:-1] 332 - 2*sigmaE*FE[:-1] - 2*scale*FG[1:] + 2*sclrCpl*FG[:-1]) 333 dFdt[:-1,1] = (bdrF[:-1,1] - (4+ns[:-1])*dlnkhdt*FB[:-1] 334 + 2*scale*FG[1:]) 335 dFdt[:-1,2] = (bdrF[:-1,2] - (4+ns[:-1])*dlnkhdt*FG[:-1] 336 - sigmaE*FG[:-1] + scale*(FE[1:] - FB[1:]) + sclrCpl*FB[:-1]) 337 338 #truncation conditions: 339 ls = np.arange(1, L+1, 1) 340 facl = np.array([math.comb(L, j) for j in range(1,L+1)]) 341 FEtr = np.sum( (-1)**(ls-1) * facl * FE[-2*ls], axis=0 ) #-2*ls instead of -2*ls+1 since -1 is ntr not ntr-1 342 FBtr = np.sum( (-1)**(ls-1) * facl * FB[-2*ls], axis=0 ) 343 FGtr = np.sum( (-1)**(ls-1) * facl * FG[-2*ls], axis=0 ) 344 345 #bilinears at truncation order ntr 346 dFdt[-1,0] = (bdrF[-1,0] - (4+ns[-1])*dlnkhdt*FE[-1] 347 - 2*sigmaE*FE[-1] - 2*scale*FGtr + 2*sclrCpl*FG[-1]) 348 dFdt[-1,1] = (bdrF[-1,1] - (4+ns[-1])*dlnkhdt*FB[-1] 349 + 2*scale*FGtr) 350 dFdt[-1,2] = (bdrF[-1,2] - (4+ns[-1])*dlnkhdt*FG[-1] 351 - sigmaE*FG[-1] + scale*(FEtr - FBtr) + sclrCpl*FB[-1]) 352 353 return dFdt
Calculate the derivative of
$$\mathcal{F}_\mathcal{E}^{(n)} = \frac{a^4}{k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{E} \cdot \operatorname{rot}^n \boldsymbol{E}\rangle \, ,$$ $$\mathcal{F}_\mathcal{B}^{(n)} = \frac{a^4}{k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{B} \cdot \operatorname{rot}^n \boldsymbol{B}\rangle \, , $$ $$\mathcal{F}_\mathcal{G}^{(n)} = -\frac{a^4}{2 k_{\mathrm{h}}^{n+4}}\langle \boldsymbol{E} \cdot \operatorname{rot}^n \boldsymbol{B} + \boldsymbol{B} \cdot \operatorname{rot}^n \boldsymbol{E}\rangle \, , $$
in the presence of Schwinger conductivities.
Parameters
- F (NDArray): array [$\mathcal{F}_\mathcal{E}^{(n)}$, $\mathcal{F}_\mathcal{B}^{(n)}$, $\mathcal{F}_\mathcal{G}^{(n)}$] in shape (3,ntr)
- a (float): the scale factor, $a$
- kh (float): the instability scale $k_{\rm h}$
- sclrCpl (float): the inflaton gauge-field coupling, $2H\xi_{\rm eff}$
- delta (float): cumulative electric damping, $\Delta$
- W (NDarray): boundary terms, shape (3,2)
- dlnkhdt (float): logarithmic derivative of the instability scale, ${\rm d} \log k_{\rm h} / {\rm d}t$
- L (int): polynomial order for closing ode at ntr
Returns
- dFdt (NDArray): the time derivative of [$\mathcal{F}_\mathcal{E}^{(n)}$, $\mathcal{F}_\mathcal{B}^{(n)}$, $\mathcal{F}_\mathcal{G}^{(n)}$], shape (3,ntr)
355def conductivities_collinear(a : float, H : float, 356 E : float, B : float, G : float, 357 picture : int, omega : float) -> Tuple[float, float, float]: 358 r""" 359 Compute electric & magnetic conductivities and the damping scale $k_{\rm S}$ 360 assuming collinear E & M fields. 361 362 Parameters 363 ---------- 364 a : float 365 the scale factor, $a$ 366 H : float 367 the Hubble rate, $H$ 368 E : float 369 the electric field expecation value, $\langle \boldsymbol{E}^2 \rangle$ 370 E : float 371 the magnetic field expecation value, $\langle \boldsymbol{B}^2 \rangle$ 372 G : float 373 the expectation value of $-\langle \boldsymbol{E} \cdot \boldsymbol{B} \rangle$ 374 picture : int 375 an integer specifying electric (=-1) or magnetic pictures (=1) 376 omega : float 377 the reference frequency to convert from numerical to physical units 378 379 Returns 380 ------- 381 float 382 the electric damping, $\sigma_{\rm E}$ 383 float 384 the magnetic damping, $\sigma_{\rm B}$ 385 float 386 the damping scale, $k_{\rm S}$ 387 """ 388 mu = (E+B) 389 if mu<=0: 390 return 0., 0., 1e-4*a*H 391 else: 392 mu = (mu/2)**(1/4) 393 mz = 91.2/(2.43536e18) 394 gmz = 0.35 395 gmu = np.sqrt(gmz**2/(1 + gmz**2*41./(48.*np.pi**2)*np.log(mz/(mu*omega)))) 396 397 C = 41/12 398 399 sigma = (C*gmu**3/(6*np.pi**2 * H * np.tanh(np.pi*np.sqrt(B/E)))) 400 sigmaE = np.sqrt(B) * (min(1., (1.- picture))*E + max(-picture, 0.)*B) * sigma / (E+B) 401 sigmaB = -np.sign(G) * np.sqrt(E)*(min(1., (1.+ picture))*B + max(picture,0.)*E)* sigma/(E+B) 402 403 ks = C**(1/3)*gmu*E**(1/4)*a 404 405 return sigmaE, sigmaB, ks
Compute electric & magnetic conductivities and the damping scale $k_{\rm S}$ assuming collinear E & M fields.
Parameters
- a (float): the scale factor, $a$
- H (float): the Hubble rate, $H$
- E (float): the electric field expecation value, $\langle \boldsymbol{E}^2 \rangle$
- E (float): the magnetic field expecation value, $\langle \boldsymbol{B}^2 \rangle$
- G (float): the expectation value of $-\langle \boldsymbol{E} \cdot \boldsymbol{B} \rangle$
- picture (int): an integer specifying electric (=-1) or magnetic pictures (=1)
- omega (float): the reference frequency to convert from numerical to physical units
Returns
- float: the electric damping, $\sigma_{\rm E}$
- float: the magnetic damping, $\sigma_{\rm B}$
- float: the damping scale, $k_{\rm S}$
407def conductivities_mixed(a : float, H : float, 408 E : float, B : float, G : float, 409 omega : float) -> Tuple[float, float, float]: 410 r""" 411 Compute electric & magnetic conductivities and the damping scale $k_{\rm S}$ 412 in the mixed picture. 413 414 Parameters 415 ---------- 416 a : float 417 the scale factor, $a$ 418 H : float 419 the Hubble rate, $H$ 420 E : float 421 the electric field expecation value, $\langle \boldsymbol{E}^2 \rangle$ 422 E : float 423 the magnetic field expecation value, $\langle \boldsymbol{B}^2 \rangle$ 424 G : float 425 the expectation value of $-\langle \boldsymbol{E} \cdot \boldsymbol{B} \rangle$ 426 omega : float 427 the reference frequency to convert from numerical to physical units 428 429 Returns 430 ------- 431 float 432 the electric damping, $\sigma_{\rm E}$ 433 float 434 the magnetic damping, $\sigma_{\rm B}$ 435 float 436 the damping scale, $k_{\rm S}$ 437 """ 438 Sigma = np.sqrt((E - B)**2 + 4*G**2) 439 if Sigma<=0: 440 return 0., 0., 1e-4*a*H 441 else: 442 mz = 91.2/(2.43536e18) 443 mu = ((Sigma)/2)**(1/4) 444 gmz = 0.35 445 gmu = np.sqrt(gmz**2/(1 + gmz**2*41./(48.*np.pi**2)*np.log(mz/(mu*omega)))) 446 447 Eprime = np.sqrt( (E - B + Sigma)/2 ) 448 Bprime = np.sqrt( (B- E + Sigma)/2 ) 449 Sum = E + B + Sigma 450 451 C = 41/12 452 453 sigma = ( C*gmu**3/(6*np.pi**2) / (np.sqrt(Sigma*Sum)*H * np.tanh(np.pi*Bprime/Eprime))) 454 455 ks = C**(1/3)*gmu*Eprime**(1/2)*a 456 457 return 2**(1/2)*abs(G)*Eprime*sigma, -2**(1/2)*G*Bprime*sigma, ks
Compute electric & magnetic conductivities and the damping scale $k_{\rm S}$ in the mixed picture.
Parameters
- a (float): the scale factor, $a$
- H (float): the Hubble rate, $H$
- E (float): the electric field expecation value, $\langle \boldsymbol{E}^2 \rangle$
- E (float): the magnetic field expecation value, $\langle \boldsymbol{B}^2 \rangle$
- G (float): the expectation value of $-\langle \boldsymbol{E} \cdot \boldsymbol{B} \rangle$
- omega (float): the reference frequency to convert from numerical to physical units
Returns
- float: the electric damping, $\sigma_{\rm E}$
- float: the magnetic damping, $\sigma_{\rm B}$
- float: the damping scale, $k_{\rm S}$