Vlasov-Ampere

Vlasov-Ampere

notebook

Compute Landau damping by solving Vlasov-Ampere system.

\[ \frac{∂f}{∂t} + υ \frac{∂f}{∂x} - E(t,x) \frac{∂f}{∂υ} = 0\]
\[\frac{∂E}{∂t} = - J = ∫ fυ dυ\]

Algorithm

\[f_{n+1}(υ_j) = f^n_k(υ_j), E^{n+1}_k = E^n_k.\]
import Splittings: advection!, Ampere, UniformMesh
import Splittings: @Strang, compute_rho, compute_e
using Plots, LinearAlgebra
function push_t!( f, fᵀ, mesh1, mesh2, e,  dt)

    advection!( f, fᵀ, mesh1, mesh2, e,  dt, Ampere(), 1 )

end
push_t! (generic function with 1 method)
function push_v!(f, fᵀ, mesh1, mesh2, e, dt)

    advection!( f, fᵀ, mesh1, mesh2, e, dt, Ampere(), 2)

end
push_v! (generic function with 1 method)
function vm1d( n1, n2, x1min, x1max, x2min, x2max , tf, nt)

    mesh1 = UniformMesh(x1min, x1max, n1, endpoint=false)
    mesh2 = UniformMesh(x2min, x2max, n2, endpoint=false)

    x = mesh1.points
    v = mesh2.points
    ϵ, kx = 0.001, 0.5

    f = zeros(Complex{Float64},(n1,n2))
    fᵀ= zeros(Complex{Float64},(n2,n1))

    f .= (1.0.+ϵ*cos.(kx*x))/sqrt(2π) .* transpose(exp.(-0.5*v.*v))
    transpose!(fᵀ,f)

    e = zeros(Complex{Float64},n1)

    ρ  = compute_rho(mesh2, f)
    e .= compute_e(mesh1, ρ)

    nrj = Float64[]

    dt = tf / nt

    for i in 1:nt

	push!(nrj, 0.5*log(sum(real(e).^2)*mesh1.step))

        @Strang(  push_v!(f, fᵀ, mesh1, mesh2, e, dt),
                  push_t!(f, fᵀ, mesh1, mesh2, e, dt)
               )

    end
    nrj
end
vm1d (generic function with 1 method)
n1, n2 = 32, 64
x1min, x1max =  0., 4π
x2min, x2max = -6., 6.
tf = 50
nt = 500

t = range(0,stop=tf,length=nt)
nrj = vm1d(n1, n2, x1min, x1max, x2min, x2max, tf, nt)
plot(t, nrj)
plot!(t, -0.1533*t.-5.50)
savefig("va-plot.png"); nothing

This page was generated using Literate.jl.