Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curl_curl function shoud be k * k' - I abs2(k) #12

Merged
merged 29 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
49095ca
faster is approx makes tests ~15% faster
jwscook Jul 8, 2023
8e89f56
typo in comment
jwscook Jul 11, 2023
9b04530
testing against Bramilla - it passes phew
jwscook Jul 11, 2023
9086dac
Merge branch 'main' into fastisapprox
jwscook Jul 17, 2023
ec31eb2
allow dual numbers to flow through kperp
jwscook Jul 27, 2023
2578495
better memoisation tests
jwscook Jul 27, 2023
5eba147
handle Duals in makepositive
jwscook Jul 27, 2023
152c7db
indentation of Memo test
jwscook Jul 28, 2023
658366a
ensure fastisapprox for DualNumbers
jwscook Jul 30, 2023
ec38dd3
Memoize is a test dependency
jwscook Aug 3, 2023
a9eff44
add function for slowing down distribution
jwscook Aug 3, 2023
80ef1a3
better testing of perp kernels
jwscook Aug 5, 2023
bd9fbbe
it works - needs better normalisation
jwscook Aug 5, 2023
8cc302b
breaks at ratio of 16
jwscook Aug 5, 2023
bbeb246
it works okay, but not great
jwscook Aug 7, 2023
93bfcec
make FWideRings faster
jwscook Aug 21, 2023
c2a2727
bump semver
jwscook Aug 21, 2023
bff19ed
corner case coupled fix
jwscook Aug 22, 2023
ba47a7e
FWide works with BigFloat
jwscook Aug 23, 2023
de462dd
removing Wide Rings from this branch
jwscook Aug 23, 2023
2d1e1f6
performance bugfix for numerically integrating parallel integrals
jwscook Sep 7, 2023
37fab3e
Merge branch 'main' into next
jwscook Sep 7, 2023
217f791
Use Lerche / Newberger bessel trick to make coupled distribution func…
jwscook Oct 14, 2023
fc7e5a8
Dualbesselix (#11)
jwscook Oct 20, 2023
3d1b0cf
curl_curl should have been named k * k'- I * abs2(k)
jwscook Nov 4, 2023
7c733dd
Merge branch 'main' into next
jwscook Nov 4, 2023
9ac0203
bump bugfix semver
jwscook Nov 4, 2023
130db10
put back curlcurl but with minus sign in both places
jwscook Nov 5, 2023
64b5ecf
revert to curl curl
jwscook Nov 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.8"
version = "0.1.9"

[deps]
CommonSubexpressions = "bbf7d656-a473-5ed7-a52c-81e309532950"
Expand Down
3 changes: 2 additions & 1 deletion src/Tensors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,12 @@ end
Calculate the tensor representing the linear Maxwell-Vlasov set of equations.
The determinant is zero when the wavenumber and frequency represent a solution
to the linear Maxwell-Vlasov system of equations for these species.
Note that the curlcurl operator keeps track of the factor of -1 from im^2.
"""
function tensor(plasma::AbstractPlasma, config::Configuration,
cache::Cache=Cache())
ϵᵢⱼ = dielectric(plasma, config, cache)
return ϵᵢⱼ + curl_curl(config.wavenumber) * (c₀ / config.frequency)^2
return ϵᵢⱼ - curlcurl(config.wavenumber) * (c₀ / config.frequency)^2
end

"""
Expand Down
21 changes: 18 additions & 3 deletions src/Wavenumbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,24 @@ Base.angle(K::Wavenumber) = propagationangle(K)

@inline cartesian_vector(K::Wavenumber) = @SArray [perp(K), 0.0, para(K)]

@inline function curl_curl(K::Wavenumber)
k = cartesian_vector(K)
return k*k' - dot(k, k) * I
"""
julia> using Symbolics
julia> @syms kx ky kz;
julia> k = [kx, ky, kz];
julia> curl = im * [0 -k[3] k[2]; k[3] 0 -k[1]; -k[2] k[1] 0];
julia> curl * curl
3×3 Matrix{Any}:
ky^2 + kz^2 -kx*ky -kx*kz
-kx*ky kx^2 + kz^2 -ky*kz
-kx*kz -ky*kz kx^2 + ky^2

"""
@inline function curlcurl(K::Wavenumber)
kx = perp(K) # ky = 0
kz = para(K)
return @SArray [ kz^2 0 -kx * kz;
0 kx^2 + kz^2 0 ;
-kx * kz 0 kx^2 ]
end

Base.abs(K::Wavenumber) = sqrt(abs2(K))
Expand Down
12 changes: 7 additions & 5 deletions test/Wavenumbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ const k0 = -1.234
end

@testset "curl curl operator" begin
K = Wavenumber(wavenumber=k0, propagationangle=π/4)
k_x_k = LMV.curl_curl(K)
c = LMV.cartesian_vector(K)
for k1 in (k0, k0 + im)
K = Wavenumber(wavenumber=k0, propagationangle=π/4)
∇x∇x = LMV.curlcurl(K)
c = LMV.cartesian_vector(K)

x = [0.0 -c[3] c[2]; c[3] 0.0 -c[1]; [-c[2] c[1] 0.0]]
@test all(x*x .== k_x_k)
curl = im * [0.0 -c[3] c[2]; c[3] 0.0 -c[1]; [-c[2] c[1] 0.0]]
@test all(curl * curl .== ∇x∇x)
end
end

@testset "Costructor wavenumber propagationangle" begin
Expand Down
Loading