Skip to content

Commit

Permalink
use upper as cutoff speed in integration (#4)
Browse files Browse the repository at this point in the history
* use upper as cutoff speed in integration

* increment bug semver number
  • Loading branch information
jwscook authored Oct 17, 2022
1 parent b4b6a7e commit fb8937d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LinearMaxwellVlasov"
uuid = "b1137d70-0135-468f-bb3e-ace6f597c457"
authors = ["James Cook <[email protected]>"]
version = "0.1.2"
version = "0.1.3"

[deps]
CommonSubexpressions = "bbf7d656-a473-5ed7-a52c-81e309532950"
Expand Down
7 changes: 4 additions & 3 deletions src/tensors/CoupledVelocity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,17 @@ function coupledvelocity(S::AbstractCoupledVelocitySpecies,
end

output = @SArray [M11 M12 M13; M21 M22 M23; M31 M32 M33]
@assert !any(isnan, output) "output = $output, vz⊥=$vz⊥"
@assert !any(isnan, output) "output = $output, vz⊥=$vz⊥, $dfdvz, $dfdv⊥"

return output
end

integrand(vz⊥) = numerator(vz⊥) * invdenominator(vz⊥[1])

function integral2D()
return first(HCubature.hcubature(integrand,
(-S.F.upper, S.F.lower), (S.F.upper, S.F.upper), initdiv=64,
∫dvrdθ(vrθ) = vrθ[1] * integrand(parallelperpfrompolar(vrθ))
return first(HCubature.hcubature(∫dvrdθ,
(S.F.lower, -π / 2), (S.F.upper, π / 2), initdiv=64,
rtol=C.options.quadrature_tol.rel, atol=C.options.quadrature_tol.abs))
end

Expand Down
9 changes: 3 additions & 6 deletions test/tensors/CoupledVsSeparable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ using Test, Random
using LinearMaxwellVlasov
const LMV = LinearMaxwellVlasov


Random.seed!(0)

@testset "Separable vs Coupled velocity tensors" begin
Expand Down Expand Up @@ -33,15 +32,13 @@ Random.seed!(0)
for (coupled, separable) ((coupledMaxwellian, separableMaxwellian),
(coupledRingBeam, separableRingBeam), )
k = Ω / Va / 2
ω0 = abs(vth * k) / 2
ωr = real(abs(vth * abs(k))) # real ωr must be > 0
rtol=1e-4
atol=eps()
ωrs = (ω0, 2ω0, ω0 + Ω)
σs = (-1, 0, 1)
kzs = (-k, 0k, k)
for params zip(ωrs, σs, kzs)
(ωr, σ, kz) = params
ωr = abs(real(ωr)) # real ωr must be > 0
for params zip(σs, kzs)
(σ, kz) = params
F = ComplexF64(ωr, σ * ωr / 100)
K = Wavenumber(kz=kz, k⊥=k)
config = Configuration(F, K)
Expand Down
6 changes: 2 additions & 4 deletions test/tensors/NumericalVsMaxwellian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ using Test
using LinearMaxwellVlasov
const LMV = LinearMaxwellVlasov



@testset "Maxwellian vs Numerical tensors" begin
mₑ = LMV.mₑ
mi = 1836*mₑ
Expand Down Expand Up @@ -59,14 +57,14 @@ const LMV = LinearMaxwellVlasov
@inferred LMV.contribution(species, C, 0)
@test true
catch
@warn "contribution not inferred for $(nameof(typeof(species)))"
@warn "contribution not inferred for $(nameof(typeof(species)))"
@test_broken false
end
try
@inferred LMV.contribution(species, C)
@test true
catch
@warn "contribution not inferred for $(nameof(typeof(species)))"
@warn "contribution not inferred for $(nameof(typeof(species)))"
@test_broken false
end
end
Expand Down

0 comments on commit fb8937d

Please sign in to comment.