From 130db108c041e8bd049e9a2a6eeb0bc371f1acc0 Mon Sep 17 00:00:00 2001 From: James Cook Date: Sun, 5 Nov 2023 14:50:40 +0000 Subject: [PATCH] put back curlcurl but with minus sign in both places --- src/Tensors.jl | 3 ++- src/Wavenumbers.jl | 4 ++-- test/Wavenumbers.jl | 12 +++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Tensors.jl b/src/Tensors.jl index 483c9e6..fb25188 100644 --- a/src/Tensors.jl +++ b/src/Tensors.jl @@ -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 ϵᵢⱼ + kkT_Ik²(config.wavenumber) * (c₀ / config.frequency)^2 + return ϵᵢⱼ - curlcurl(config.wavenumber) * (c₀ / config.frequency)^2 end """ diff --git a/src/Wavenumbers.jl b/src/Wavenumbers.jl index 614341b..eaf5c1d 100644 --- a/src/Wavenumbers.jl +++ b/src/Wavenumbers.jl @@ -47,9 +47,9 @@ Base.angle(K::Wavenumber) = propagationangle(K) @inline cartesian_vector(K::Wavenumber) = @SArray [perp(K), 0.0, para(K)] -@inline function kkT_Ik²(K::Wavenumber) +@inline function curlcurl(K::Wavenumber) k = cartesian_vector(K) - return k*k' - dot(k, k) * I + return sum(x->x^2, k) * I - k*transpose(k) # defend against complex k end Base.abs(K::Wavenumber) = sqrt(abs2(K)) diff --git a/test/Wavenumbers.jl b/test/Wavenumbers.jl index c37029f..63f5747 100644 --- a/test/Wavenumbers.jl +++ b/test/Wavenumbers.jl @@ -48,12 +48,14 @@ const k0 = -1.234 end @testset "curl curl operator" begin - K = Wavenumber(wavenumber=k0, propagationangle=π/4) - k_x_k = LMV.kkT_Ik²(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