Skip to content

Commit 4840dae

Browse files
committed
Interpolate smoother polarization source multiplied by (kχ)²
1 parent 0ffc702 commit 4840dae

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/models/cosmologies.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function ΛCDM(;
5555
ST0_SW(τ, k),
5656
ST0_ISW(τ, k), ST1_ISW(τ, k),
5757
ST0_Doppler(τ, k), ST1_Doppler(τ, k),
58-
ST0_polarization(τ, k), ST1_polarization(τ, k), ST2_polarization(τ, k)
58+
ST0_polarization(τ, k), ST1_polarization(τ, k), ST2_polarization(τ, k), SE_kχ²(τ, k)
5959
end
6060
defs = Dict(
6161
C => 1//2,
@@ -100,6 +100,7 @@ function ΛCDM(;
100100
ST2_polarization ~ 3/16 * b.v*γ.Π / (k*χ)^2
101101
ST0 ~ ST0_SW + ST0_ISW + ST0_Doppler + ST0_polarization
102102
ST1 ~ 0
103+
SE_kχ² ~ 3/16 * b.v*γ.Π
103104
])
104105
# TODO: do various initial condition types (adiabatic, isocurvature, ...) from here?
105106
# TODO: automatically solve for initial conditions following e.g. https://arxiv.org/pdf/1012.0569 eq. (1)?

src/observables/angular.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,17 @@ function spectrum_cmb(modes::AbstractVector, prob::CosmologyProblem, jl::Spheric
207207
iE = 'E' in join(modes) ? iT + 1 : 0
208208
Ss = Num[]
209209
iT > 0 && push!(Ss, prob.M.ST0)
210-
iE > 0 && push!(Ss, prob.M.ST2_polarization)
210+
iE > 0 && push!(Ss, prob.M.SE_kχ²)
211211
ks_coarse = range(ks_fine[begin], ks_fine[end]; length = 2)
212212
ks_coarse, Ss_coarse = source_grid_adaptive(prob, Ss, τs, ks_coarse; bgopts, ptopts, verbose, sourceopts...) # TODO: thread flag # TODO: pass kτ0 and x # TODO: pass bgsol
213213

214214
# Interpolate source function to finer k-grid
215215
Ss_fine = source_grid(Ss_coarse, ks_coarse, ks_fine)
216-
Ss_fine[:, end, :] .= 0.0
216+
if iE > 0
217+
χs = τs[end] .- τs
218+
Ss_fine[iE, :, :] ./= (ks_fine' .* χs) .^ 2
219+
end
220+
Ss_fine[:, end, :] .= 0.0 # can be Inf, but is always weighted by zero-valued spherical Bessel function in LOS integration
217221

218222
ΘlTs = iT > 0 ? los_integrate(@view(Ss_fine[iT, :, :]), ls, τs, ks_fine, jl; integrator, verbose, kwargs...) : nothing
219223
ΘlEs = iE > 0 ? los_integrate(@view(Ss_fine[iE, :, :]), ls, τs, ks_fine, jl; integrator, verbose, kwargs...) .* transpose(@. ((ls+2)*(ls+1)*(ls+0)*(ls-1))) : nothing

0 commit comments

Comments
 (0)