Skip to content

Commit 82aee9a

Browse files
committed
Use proper 1/τ cutoff in lmax equations
1 parent 54785e2 commit 82aee9a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/models/neutrinos.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function massless_neutrinos(g; lmax = 6, name = :ν, kwargs...)
2121
D(F0) ~ -k*F[1] + 4*D(g.Φ)
2222
D(F[1]) ~ k/3*(F0-2*F[2]+4*g.Ψ)
2323
[D(F[l]) ~ k/(2*l+1) * (l*F[l-1] - (l+1)*F[l+1]) for l in 2:lmax-1]...
24-
D(F[lmax]) ~ k*F[lmax-1] - (lmax+1) * g. * F[lmax] # τ ≈ 1/ℰ
24+
D(F[lmax]) ~ k*F[lmax-1] - (lmax+1) / τ * F[lmax]
2525
δ ~ F0
2626
θ ~ 3*k*F[1]/4
2727
σ ~ F[2]/2
@@ -118,7 +118,7 @@ function massive_neutrinos(g; nx = 5, lmax = 4, name = :h, kwargs...)
118118
D(ψ0[i]) ~ -k * x[i]/E[i] * ψ[i,1] - D(g.Φ) * dlnf₀_dlnx(x[i])
119119
D(ψ[i,1]) ~ k/3 * x[i]/E[i] * (ψ0[i] - 2*ψ[i,2]) - k/3 * E[i]/x[i] * g.Ψ * dlnf₀_dlnx(x[i])
120120
[D(ψ[i,l]) ~ k/(2*l+1) * x[i]/E[i] * (l*ψ[i,l-1] - (l+1) * ψ[i,l+1]) for l in 2:lmax-1]...
121-
D(ψ[i,lmax]) ~ k/(2*lmax+1) * x[i]/E[i] * (lmax*ψ[i,lmax-1] - (lmax+1) * ((2*lmax+1) * E[i]/x[i] * ψ[i,lmax] * g./k - ψ[i,lmax-1])) # explicitly inserted ψ[lmax+1] to avoid array allocations in newer MTK (see example in https://github.com/SciML/ModelingToolkit.jl/issues/3708)
121+
D(ψ[i,lmax]) ~ k/(2*lmax+1) * x[i]/E[i] * (lmax*ψ[i,lmax-1] - (lmax+1) * ((2*lmax+1) * E[i]/x[i] * ψ[i,lmax] / (k*τ) - ψ[i,lmax-1])) # explicitly inserted ψ[lmax+1] to avoid array allocations in newer MTK (see example in https://github.com/SciML/ModelingToolkit.jl/issues/3708)
122122
])
123123
append!(ics, [
124124
ψ0[i] ~ -1//4 * (-2*g.Ψ) * dlnf₀_dlnx(x[i])

src/models/photons.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function photons(g; polarization = true, lmax = 6, name = :γ, kwargs...)
3131
D(F0) ~ -k*F[1] + 4*D(g.Φ)
3232
D(F[1]) ~ k/3*(F0-2*F[2]+4*g.Ψ) - 4//3 * κ̇/k * (θb - θ) # D(θ) ~ -κ̇ (θb-θγ)
3333
[D(F[l]) ~ k/(2l+1) * (l*F[l-1] - (l+1)*F[l+1]) + κ̇ * (F[l] - δkron(l,2)//10*Π) for l in 2:lmax-1]...
34-
D(F[lmax]) ~ k*F[lmax-1] - (lmax+1) * g. * F[lmax] + κ̇ * F[lmax] # τ ≈ 1/ℰ
34+
D(F[lmax]) ~ k*F[lmax-1] - (lmax+1) / τ * F[lmax] + κ̇ * F[lmax] # τ ≈ 1/ℰ
3535
δ ~ F0
3636
θ ~ 3*k*F[1]/4
3737
σ ~ F[2]/2
@@ -51,7 +51,7 @@ function photons(g; polarization = true, lmax = 6, name = :γ, kwargs...)
5151
D(G0) ~ k * (-G[1]) + κ̇ * (G0 - Π/2)
5252
D(G[1]) ~ k/(2*1+1) * (1*G0 - 2*G[2]) + κ̇ * G[1]
5353
[D(G[l]) ~ k/(2l+1) * (l*G[l-1] - (l+1)*G[l+1]) + κ̇ * (G[l] - δkron(l,2)//10*Π) for l in 2:lmax-1]...
54-
D(G[lmax]) ~ k*G[lmax-1] - (lmax+1) * g. * G[lmax] + κ̇ * G[lmax]
54+
D(G[lmax]) ~ k*G[lmax-1] - (lmax+1) / τ * G[lmax] + κ̇ * G[lmax]
5555
])
5656
append!(ics, [
5757
G0 ~ 5//16 * F[2],

0 commit comments

Comments
 (0)