Skip to content

Commit

Permalink
put back curlcurl but with minus sign in both places
Browse files Browse the repository at this point in the history
  • Loading branch information
jwscook committed Nov 5, 2023
1 parent 9ac0203 commit 130db10
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
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 ϵᵢⱼ + kkT_Ik²(config.wavenumber) * (c₀ / config.frequency)^2
return ϵᵢⱼ - curlcurl(config.wavenumber) * (c₀ / config.frequency)^2
end

"""
Expand Down
4 changes: 2 additions & 2 deletions src/Wavenumbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
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.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
Expand Down

0 comments on commit 130db10

Please sign in to comment.