computational plasma physics - webhome · or numpy and those programming in a low level language...

74
Computational plasma physics Eric Sonnendr¨ ucker Max-Planck-Institut f¨ ur Plasmaphysik und Zentrum Mathematik, TU M¨ unchen Lecture notes Sommersemester 2015 July 13, 2015

Upload: others

Post on 10-Feb-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Computational plasma physics

Eric SonnendruckerMax-Planck-Institut fur Plasmaphysik

undZentrum Mathematik, TU Munchen

Lecture notesSommersemester 2015

July 13, 2015

Page 2: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Contents

1 Introduction 3

2 Plasma models 52.1 Plasmas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 The N -body model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3 Kinetic models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.3.1 The Vlasov-Maxwell model . . . . . . . . . . . . . . . . . . . . . . 72.3.2 Reduction of Maxwell’s equation . . . . . . . . . . . . . . . . . . . 92.3.3 Collisions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.4 Fluid models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3 Steady-state problems 153.1 The Finite difference method . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.1.1 The 1D Poisson equation and boundary conditions . . . . . . . . . 153.1.2 Obtaining a Finite Difference scheme . . . . . . . . . . . . . . . . . 163.1.3 Higher order finite differences . . . . . . . . . . . . . . . . . . . . . 18

3.2 Convergence of finite difference schemes . . . . . . . . . . . . . . . . . . . 183.2.1 Homogeneous Dirichlet boundary conditions . . . . . . . . . . . . . 203.2.2 Periodic boundary conditions . . . . . . . . . . . . . . . . . . . . . 213.2.3 The method of manufactured solutions . . . . . . . . . . . . . . . . 25

3.3 Finite difference methods in 2D . . . . . . . . . . . . . . . . . . . . . . . . 253.4 The Finite element method . . . . . . . . . . . . . . . . . . . . . . . . . . 27

3.4.1 Principle of the method . . . . . . . . . . . . . . . . . . . . . . . . 273.4.2 The variational (or weak) form of a boundary value problem . . . 313.4.3 Lagrange Finite Elements . . . . . . . . . . . . . . . . . . . . . . . 333.4.4 Formal definition of a Finite Element . . . . . . . . . . . . . . . . 363.4.5 Convergence of the Finite Element method . . . . . . . . . . . . . 37

3.5 The spectral method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

4 Fluid models 434.1 An isothermal Euler-Poisson model . . . . . . . . . . . . . . . . . . . . . . 43

4.1.1 The model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434.1.2 Study of the linearised equations . . . . . . . . . . . . . . . . . . . 444.1.3 Hyperbolicity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

4.2 A model problem - 1D advection . . . . . . . . . . . . . . . . . . . . . . . 474.2.1 Obtaining a Finite Difference scheme . . . . . . . . . . . . . . . . . 474.2.2 The first order explicit upwind scheme . . . . . . . . . . . . . . . . 474.2.3 The first order upwind implicit scheme . . . . . . . . . . . . . . . . 48

1

Page 3: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

4.2.4 The explicit downwind and centred schemes . . . . . . . . . . . . . 494.2.5 Stability and convergence . . . . . . . . . . . . . . . . . . . . . . . 49

4.3 The Finite Volume method . . . . . . . . . . . . . . . . . . . . . . . . . . 504.3.1 The first order Finite Volume schemes . . . . . . . . . . . . . . . . 504.3.2 Higher order schemes . . . . . . . . . . . . . . . . . . . . . . . . . 524.3.3 The method of lines . . . . . . . . . . . . . . . . . . . . . . . . . . 53

4.4 Systems of conservation laws . . . . . . . . . . . . . . . . . . . . . . . . . 564.4.1 Linear systems - The Riemann problem . . . . . . . . . . . . . . . 56

4.5 Nonlinear systems of conservation laws . . . . . . . . . . . . . . . . . . . . 584.5.1 The Rusanov flux . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594.5.2 The Roe flux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

5 Kinetic models 615.1 The Vlasov-Poisson model . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

5.1.1 The model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615.1.2 The Vlasov equation in a given potential . . . . . . . . . . . . . . 625.1.3 Conservation properties . . . . . . . . . . . . . . . . . . . . . . . . 635.1.4 Solution of the linearised 1D Vlasov-Poisson equation . . . . . . . 65

5.2 The particle in cell (PIC) method . . . . . . . . . . . . . . . . . . . . . . . 665.2.1 Time scheme for the particles. . . . . . . . . . . . . . . . . . . . . 675.2.2 Particle mesh coupling for Finite Elements . . . . . . . . . . . . . 675.2.3 Particle-Mesh coupling for point based Poisson solvers . . . . . . . 685.2.4 Time loop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695.2.5 Conservation properties at the semi-discrete level. . . . . . . . . . 69

2

Page 4: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Chapter 1

Introduction

Understanding an experiment in physics relies on a model which is generally a differentialequation or a partial differential equation or a system involving many of these. Insufficiently simple cases analytical solutions of these exist and then this can be used topredict the behaviour of a similar experiment. However in many cases, especially whenthe model is based on first principles, it is so complex that there is no analytical solutionavailable. Then there are two options: the first is to simplify the model until it can beanalytically solved, the second is to compute an approximate solution using a computer.In practice both are usually done, the simplified models being used to verify that thecode is working properly. Due to the enormous development of computer resources inthe last 50 years, quite realistic simulations of physical problems become now possible. Alot of theoretical work in physics and related disciplines, in particular in plasma physicsnow rely quite heavily on numerical simulation.

Computational sciences have emerged next to theory and experiments as a third pillarin physics and engineering. Designing efficient, robust and accurate simulation codes is achallenging task that is at the interface of the application domain, plasma physics in ourcase, applied mathematics and computer science. The main difficulties are to make surethat the implemented algorithms provide a good approximation of the physics model andalso that the algorithms use efficiently the available computer resources which are costly.Even though many basic simulations can be performed nowadays on a laptop, state ofthe art computations require huge super-computers that consists of many computingunits and nowadays often heterogeneous computing elements (CPU, GPU, MIC, ...).These require parallel algorithms and often to achieve optimal efficiency a very goodknowledge of the computer architecture.

This lecture will provide an introduction to scientific computing. Its aim is to in-troduce the process of developing a simulation code and some standard methods andnumerical issues. The models we will consider come from plasma physics, but the modelsand even more so the techniques and ideas will be useful for many other applications.Specific skills and methodologies for high performance computing that are also very im-portant in computational physics are beyond the scope of this lecture. We refer to [5]for an introduction.

The first step is to find an appropriate model, which is often a set of coupled differ-ential or partial differential equations. If the model is continuous the solution lives in aninfinite dimensional space which cannot be represented on a computer. The second stepthen will be to discretise it, i.e. represent the unknowns by a large but finite number ofvalues, typically its values on a finite grid or the coefficients of its expression on the basis

3

Page 5: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

of a a finite dimensional linear space. Then from the equations of the starting modelsrelations between the values representing the discrete unknowns should be found. Thisyields a finite number of linear or non linear equations that can be solved on a com-puter. This will require methods of numerical linear algebra, which are introduced in[16] or iterative methods for linear or nonlinear equations, a good introduction of whichis available in [7]. We won’t focus on these either. They are generally taught in NumericsBachelor classes. They are generally available in numerical software tools like Matlabor Numpy and those programming in a low level language like Fortran, C or C++ canuse efficient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos, to name a few, arefreely available.

There are many possible ways to discretise a differential or partial differential equa-tion. They are not all equal and many things need to be considered, when choosingan appropriate one. The most important is naturally that the discrete model convergestowards the initial model when the number of discrete values goes to infinity. Becausecomputer arithmetics is not exact, as real numbers cannot be represented exactly on acomputer, sensitivity to round-off errors is very important. Then some algorithms needmore operations than other. Optimally an algorithm dealing with an unknown vector ofN points can use O(N) operations, but some can use O(N logN) or O(Nd) or even more,which will make a huge difference for large values of N . Then again some algorithmswill be easier to parallelise than others, which is an important issue when developing asimulation code on a massively parallel computer.

Also, before choosing a discretisation, it is important to understand the structureof the equations that are being discretised. Analytical theory plays an essential role inthis aspect. What are the conserved quantities? Are there analytical solution in somespecial cases? What is the evolution of the solution or some quantities depending onthe solution? And so on. The more information is available from analytical theory,the easiest it will be to check whether the code is correctly approximating the analyticalmodel. The process of verification of a computer code, consists precisely in checking thatthe code can reproduce as expected information available from the theory. Verification ofa computer code is essential to gain confidence in its correctness. Only once the computercode has been appropriately verified, one can proceed with the validation process, whichconsists in comparing the code to actual experiments and checking that those can bereproduced within the available error bars. If this is not the case, one needs to checkthe initial model, including initial and boundary conditions and all external parametersthat could have an influence on the results. Possibly one also needs to develop moreverification tests to check that there is no error in the implementation. This process ofVerification and validation (V & V) is essential for developing a simulation code withreliable predictive capabilities.

In this lecture, starting from a few classical models from plasma physics, we willlearn how to write a simulation code for solving them. This includes finding a gooddiscrete model, implementing it and verifying it. This is the scope of applied numericalmathematics. The physics exploitation of the code can start after those steps. We willcover most of the classical discretisation methods, finite differences, finite elements, finitevolumes and also spectral methods.

4

Page 6: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Chapter 2

Plasma models

2.1 Plasmas

When a gas is brought to a very high temperature (104K or more) electrons leave theirorbit around the nuclei of the atom to which they are attached. This gives an overallneutral mixture of charged particles, ions and electrons, which is called plasma. Plasmasare considered beside solids, liquids and gases, as the fourth state of matter.

You can also get what is called a non-neutral plasma, or a beam of charged particles,by imposing a very high potential difference so as to extract either electrons or ionsof a metal chosen well. Such a device is usually located in the injector of a particleaccelerator.

The use of plasmas in everyday life has become common. This includes, for example,neon tubes and plasma displays. There are also a number industrial applications: am-plifiers in telecommunication satellites, plasma etching in microelectronics, productionof X-rays. Some examples are given in Figure 2.1.

Figure 2.1: Examples of plasmas at different densities and temperatures

5

Page 7: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

We should also mention that while it is almost absent in the natural state on Earth,except the Northern Lights at the poles, the plasma is 99% of the mass of the visibleuniverse. Including the stars are formed from plasma and the energy they release fromthe process of fusion of light nuclei such as protons. More information on plasmas andtheir applications can be found on the web site http://www.plasmas.org.

2.2 The N-body model

At the microscopic level, a plasma or a particle beam is composed of a number ofparticles that evolve following the laws of classical or relativistic dynamics. So eachparticle, characterised by its position x, velocity x, as well as its mass m and charge q,obeys Newton’s law

dγmv

dt=∑

Fext,

where m is the mass of the particle, v its velocity γ = (1− |v|2

c2)−

12 is the Lorentz factor (c

being the speed of light). The right hand side Fext is composed of all the forces appliedto the particle, which in our case reduce to the Lorentz force induced by the externaland self-consistent electromagnetic fields. Other forces, as the weight of the particles,are in general negligible. Whence we have, labelling the different particles in the plasma,

dγimividt

=∑j

qi(Ej + vi ×Bj) + qi(Eext + vi ×Bext).

The sum on the right hand side is over all the particles in the plasma and Ej ,Bj denotethe electric and magnetic fields fields generated by particle j and Eext,Bext denote theexternal electric and magnetic fields fields, i.e. those that are not generate by particlesof the plasma itself. The latter could be for example coils in an accelerator or in atokamak. On the other hand the velocity of a particle vi is linked to its position xi by

dxidt

= vi.

Thus, if the initial positions and velocities of the particles are known as well as theexternal fields, the evolution of the particles is completely determined by the equations

dxidt

= vi, (2.1)

dγimvidt

=∑j

q(Ej + v ×Bj), (2.2)

where the sum contains the electric and magnetic field generated by each of the otherparticles as well as the external fields.

In general a plasma consists of a large number of particles, 1010 and more. Themicroscopic model describing the interactions of particles with each other is not used ina simulation because it would be far too expensive. We must therefore find approximatemodels which, while remaining accurate enough can reach a reasonable computationalcost. There is actually a hierarchy of models describing the evolution of a plasma. Thebase model of the hierarchy and the most accurate model is the N -body model wehave described, then there are intermediate models called kinetic and which are based

6

Page 8: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

on a statistical description of the particle distribution in phase space and finally themacroscopic or fluid models that identify each species of particles of a plasma with afluid characterized by its density, its velocity and energy. Fluid models are becoming agood approximation when the particles are close to thermodynamic equilibrium, to whichthey return in long time do to the effects of collisions and for which the distribution ofparticle velocities is a Gaussian.

When choosing a model for a simulation code, one should try to take into accountaccuracy and computational cost and take the model that will allow us to find a solutionthat is accurate enough for the problem we are considering in the shortest possible time.In particular because of the very large number of particles in a plasma, kinetic modelsobtained by statistical arguments are almost always accurate enough. The question willthen be if a further model reduction, which could diminish cost, can be performed atleast for part of the plasma.

2.3 Kinetic models

In a kinetic model, each particle species s in the plasma is characterized by a distributionfunction fs(x,v, t) which corresponds to a statistical mean of the repartition of particlesin phase space for a large number of realisations of the considered physical system. Notethat phase space consists of the subspace of R6 containing all possible positions andvelocities of the particles. The product fs dx dv is the average number of particles ofspecies s, whose position and velocity are in the box of volume dx dv centred at (x,v).Normalising fs to one, fs becomes the probability density related to the probability ofa particle of species s if being at point (x,v) in phase space.

The distribution function contains much more information than a fluid descriptionas it includes information on the distributions of particle velocities at each position. Akinetic description of a plasma is essential when the distribution function is far awayfrom the Maxwell-Boltzmann distribution (also called Maxwellian) that corresponds tothe thermodynamic equilibrium of plasma. Otherwise a fluid description is sufficient.

2.3.1 The Vlasov-Maxwell model

In the limit where the collective effects are dominant on binary collisions between par-ticles, the kinetic equation that is derived, by methods of statistical physics from theN -body model is the Vlasov equation which reads

∂fs∂t

+ v · ∇xfs +qsms

(E + v ×B) · ∇vfs = 0, (2.3)

in the non relativistic case. In the relativistic case it becomes

∂fs∂t

+ v(p) · ∇xfs + qs(E + v(p)×B) · ∇pfs = 0. (2.4)

We denote by ∇xfs, ∇vfs and ∇pfs, the respective gradients of fs with respect to thethree position, velocity and momentum variables. The constants qs and ms denote thecharge and mass of the particle species. The velocity is linked to the momentum by therelation v(p) = p

msγs, where γ is the Lorentz factor which can be expressed from the

momentum by γs =√

1 + |p|2/(m2sc

2).

7

Page 9: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

This equation expresses that the distribution function fs is conserved along the tra-jectories of the particles which are determined by the mean electric field. We denoteby fs,0(x,v) the initial value of the distribution function. The Vlasov equation, whenit takes into account the self-consistent electromagnetic field generated by the parti-cles, is coupled to the Maxwell equations which enable to computed this self-consistentelectromagnetic field from the particle distribution:

− 1

c2

∂E

∂t+∇× B = µ0 J, (Ampere)

∂B

∂t+∇× E = 0, (Faraday)

∇ · E =ρ

ε0, (Gauss)

∇ · B = 0. (magnetic Gauss)

The source terms for Maxwell’s equation, the charge density ρ(x, t) and the currentdensity J(x, t) can be expressed from the distribution functions of the different speciesof particles fs(x,v, t) using the relations

ρ(x, t) =∑s

qs

∫fs(x,v, t) dv,

J(x, t) =∑s

qs

∫fs(x,v, t)v dv.

Note that in the relativistic case the distribution function becomes a function of positionand momentum (instead of velocity): fs ≡ fs(x,p, t) and charge and current densitiesverify

ρ(x, t) =∑s

qs

∫fs(x,p, t) dp, J(x, t) =

∑s

qs

∫fs(x,p, t)v(p) dp.

The Maxwell equations need to be supplemented by boundary and initial conditionsso that they admit a unique solution. A classical boundary condition is the perfectconductor boundary condition E × n = 0, where n denotes the unit outgoing normal.No additional condition on B is needed in that case.

The macroscopic quantities, associated to each particle species are defined as follows:

• The particle density, in physical space, for species s, is defined by

ns(x, t) =

∫fs(x,v, t) dv,

• The mean velocity us(x, t) verifies

ns(x, t)us(x, t) =

∫fs(x,v, t)v dv,

• The kinetic energy is defined by

ns(x, t)Es(x, t) =m

2

∫fs(x,v, t)|v|2 dv,

• The temperature Ts(x, t) is related to the kinetic energy, mean velocity and densityby

Ts(x, t) = Es(x, t)− u2s(x, t).

8

Page 10: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

2.3.2 Reduction of Maxwell’s equation

In some cases the frequency of the phenomena of interest is sufficiently small that theelectric and magnetic fields can be considered quasi-static. This means that the timederivatives can be neglected in Maxwell’s equations. We then get two decoupled set ofequations. The electric field is then determined by

∇× E = 0, ∇ · E =ρ

ε0,

and appropriate boundary conditions.Moreover, provided the computational domain is simply connected, ∇ × E = 0

implies that there exists a scalar potential φ such that E = −∇φ and φ is determinedby −∇ · ∇φ = ρ/ε0, which becomes that standard Poisson equation:

−∆φ =ρ

ε0.

The perfectly conducting boundary condition E × n = 0 implies that φ is constant onthe boundary, and as E and not φ is the physically meaningful field, φ is determined upto a constant, and so is generally set to 0 on the boundary for perfect conductors.

Note that in many low frequency plasma, E is by far the dominating term in theLorentz force, and hence a good model consists just of the Vlasov-Poisson equations(where the magnetic field is set to 0 or is a known external field).

When still the magnetic field needs to be considered it is solution of

∇× B = µ0J, ∇ · B = 0.

Because of the vanishing divergence, provided again some geometric assumptions on thedomain, B derives from a vector potential: B = ∇× A and A is a solution of

∇× ∇× A = µ0J,

along with appropriate boundary conditions.

2.3.3 Collisions

The Vlasov equation describes a smoothed interaction of the plasma particles, for whichthe electromagnetic field is averaged over all the plasma particles. In practice, however,when two particles of the same charge get close together there is a strong repulsionbetween the two particles and this force dominates the force generated by all the otherparticles. This is called a binary collision. In this case the interaction is modelled by abinary collision operator, like the Boltzmann operator that is used in neutral gases.

When binary collisions between particles are dominant with respect to mean fieldeffects, the distribution function satisfies the Boltzmann equation

∂f

∂t+ v · ∂f

∂x=∑s

Q(f, fs),

where Q is the non linear Boltzmann operator. This operator is sometimes replaced bysimpler models. A sum on the collisions with all the species of particles represented byfs, including the particles of the same species, is considered. In many cases not all the

9

Page 11: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

collisions might be considered. In most plasmas either binary collisions are completelyneglected or only represent a complement to the averaged interaction. In this casethe collision operator appears on the right-hand side of the full Vlasov equation. Thecollision operator considered appropriate in most cases then is the Fokker-Planck-Landauoperator.

The Fokker-Planck-Landau operator, which is the most commonly used in plasmaphysics, is the limit of the Boltzmann operator for grazing collisions [8]. It reads forcollisions with particles of the same species

QL(f, f)(v) = ∇v ·∫A(v − v∗)[f(v∗)∇vf(v)− f(v)∇v∗f(v∗)] dv∗] (2.5)

where, for the case of Coulomb collisions, Λ being a positive constant,

A(v − v∗) =Λ

|v − v∗|

(I3 −

(v − v∗)⊗ (v − v∗)

|v − v∗|2

).

As for the Boltzmann operator, the first three velocity moments of the Landau opera-tor vanish, which implies conservation of mass, momentum and kinetic energy. Moreoverthe H-theorem is satisfied, so that the equilibrium states are also the Maxwellians.

Sometimes it is more convenient to express the Landau collision operator using theRosenbluth potentials [11], which reads

QL,R(f, f∗)(v) = Λ∇v · [∇v · (f∇v ⊗∇vG(f∗))− 4f∇v ·H(f∗)]

where the Rosenbluth potentials are defined by

G(f∗)(v) =

∫|v−v∗|f∗(v∗) dv∗, Σpace10mmH(f∗)(v) =

∫1

|v − v∗|f∗(v∗) dv∗. (2.6)

When the distribution function is close enough to a Maxwellian, the Fokker-Planck-Landau operator can be linearised around a Maxwellian, the collision operator takes amuch simpler for as can be seen from the Rosenbluth potential for by taking f∗ in theexpression of the potentials G and H to be a given Maxwellian. Then we get the linearFokker-Planck operator, which takes the form

QFP (f)(v) = ν∇v · (µfv +D2

2∇vf). (2.7)

This operator is also known as the Lenard-Bernstein operator in the plasma physicscommunity [9]. For given constants ν, µ and D, the Lenard-Bernstein operator conservesmass, but not momentum and energy and its equilibrium function is a Maxwellian of

the form αe−µv2

D2 , where the constant α is determined by the total mass (or number ofparticles).

The linear Fokker-Planck operator can be made to conserve also total momentumand kinetic energy by using the mean velocity u and the temperature T associated tof . Then the operator reads

QFPC(f)(v) = ν∇v · (fv − u

T+∇vf).

A simplified collision operator that has been build to conserve mass, momentum andkinetic energy and have the Maxwellian as equilibrium states, as the Boltzmann and

10

Page 12: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Fokker-Planck-Landau operators, has been derived by Bhatnagar, Gross and Krook [2].In the mathematics community this is known as the BGK operator and in the physicscommunity it is called the Krook operator. It simply reads

QK(f)(v) = ν(fM [f ]− f),

where fM [f ] is the Maxwellian, which has the same mass, mean velocity and temperatureas f . It reads

fM (t,x,v) =n(t,x)

(2πT (t,x)/m)32

e− |v−u(x,t)|2

2T (x,t)/m .

2.4 Fluid models

Due to collisions, the particles relax in long time to a Maxwellian, which is a ther-modynamical equilibrium. When this state is approximately attained particles can bedescribed by a fluid like model, where each particle species is modelled as a chargedfluid.

This fluid model for each particle species can be derived from the correspondingVlasov equation. The fluid models then replace the Vlasov equations and are stillcoupled to Maxwell’s equation, or some reduced model, for the determination of theself-consistent electromagnetic field.

We start from the Vlasov-Boltzmann equation:

∂f

∂t+ v · ∂f

∂x+

q

m(E + v ×B) · ∂f

∂v= Q(f, f). (2.8)

Remark 1 The Boltzmann collision operator Q(f, f) on the right hand side is necessaryto provide the relaxation to thermodynamic equilibrium. However it will have no directinfluence on our derivation, as we will consider only the first three velocity momentswhich vanish for the Boltzmann operator.

The macroscopic quantities on which the fluid equations will be established are de-fined using the first three velocity moments of the distribution function f(x,v, t)

• The particle density is defined by

n(x, t) =

∫f(x,v, t) dv,

• The mean velocity u(x, t) verifies

n(x, t)u(x, t) =

∫f(x,v, t)v dv,

• The pressure tensor P(x, t) is defined by

P(x, t) = m

∫f(x,v, t)(v − u(x, t))⊗ (v − u(x, t)) dv.

• The scalar pressure is one third of the trace of the pressure tensor

p(x, t) =m

3

∫f(x,v, t)|v − u(x, t)|2 dv,

11

Page 13: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

• The temperature T (x, t) is related to the pressure and the density by

T (x, t) =p(x, t)

n(x, t).

• The energy flux is a vector defined by

Q(x, t) =m

2

∫f(x,v, t)|v|2v(x, t)) dv.

where we denote by |v| =√

v · v and for two vectors a = (a1, a2, a3)T and b =(b1, b2, b3)T , their tensor product a ⊗ b is the 3 × 3 matrix whose components are(aibj)1≤i,j≤3.

We obtain equations relating these macroscopic quantities by taking the first velocitymoments of the Vlasov equation. In the actual computations we shall make use thatf vanishes at infinity and that the plasma is periodic in space. This takes care of allboundary condition problems.

Let us first notice that as v is a variable independent of x, we have v·∇xf = ∇x ·(fv).Moreover, as E(x, t) does not depend on v and that the ith component of

v ×B(x, t) =

v2B3(x, t)− v3B2(x, t)v3B1(x, t)− v1B3(x, t)v1B2(x, t)− v2B1(x, t)

is independent of vi, we also have

(E(x, t) + v ×B(x, t)) · ∇vf = ∇v · (f(E(x, t) + v ×B(x, t))).

Integrating the Vlasov equation (2.8) with respect to velocity v we obtain

∂t

∫f(x,v, t) dv +∇x ·

∫f(x,v, t)v dv + 0 = 0.

Whence, as n(x, t)u(x, t) =∫f(x,v, t)v dv, we get

∂n

∂t+∇x · (nu) = 0. (2.9)

Multiplying the Vlasov by mv and integrating with respect to v, we get

m∂

∂t

∫f(x,v, t)v dv +m∇x ·

∫(v ⊗ v)f(x,v, t) dv

− q(E(x, t)

∫f(x,v, t) dv +

∫f(x,v, t)v dv ×B(x, t) = 0.

Moreover, ∫v ⊗ vf(x,v, t) dv =

∫(v − u)⊗ (v − u)f(x,v, t) dv + nu⊗ u.

Whence

m∂

∂t(nu) +m∇ · (nu⊗ u) +∇ · P = qn(E + u×B). (2.10)

12

Page 14: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Finally multiplying the Vlasov equation by 12m|v|

2 = 12mv · v and integrating with

respect to v, we obtain

1

2m∂

∂t

∫f(x,v, t)|v|2 dv +

1

2m∇x ·

∫(|v|2v)f(x,v, t) dv

+1

2q

∫|v|2∇v · [(E(x, t) + v ×B(x, t))f(x,v, t)] dv = 0.

An integration by parts then yields∫|v|2∇v · (E(x, t) + v ×B(x, t))f(x,v, t) dv

= −2

∫v · [(E(x, t) + v ×B(x, t))f(x,v, t)] dv.

Then, developing∫f |v − u|2 dv we get∫

f |v − u|2 dv =

∫f |v|2 dv − 2u ·

∫vf dv + |u|2

∫f dv =

∫f |v|2 dv − n|u|2,

whence∂

∂t(3

2p+

1

2mn|u|2) +∇ · Q = E · (qnu). (2.11)

We could continue to calculate moments of f , but we see that each new expressionreveals a moment of higher order. So we need additional information to have as manyunknowns as equations to solve these equations. This additional information is called aclosure relation.

In our case, we will use as a closure relation the physical property that at ther-modynamic equilibrium the distribution function approaches a Maxwellian distributionfunction that we will note fM (x,v, t) and that can be expressed as a function of themacroscopic quantities n(x, t), u(x, t) and T (x, t) which are the density, mean velocityand temperature of the charged fluid:

fM (x,v, t) =n(x, t)

(2πT (x, t)/m)3/2e− |v−u(x,t)|2

2T (x,t)/m .

We also introduce a classical quantity in plasma physics which is the thermal velocity ofthe particle species considered

vth =

√T

m.

It is easy to verify that the first three moments of the distribution function fM areconsistent with the definition of the macroscopic quantities n, u and T defined for anarbitrary distribution function. We have indeed performing each time the change ofvariable w = v−u

vth ∫fM (x,v, t) dv = n(x, t),∫fM (x,v, t)v dv = n(x, t)u(x, t),∫

fM (x,v, t)|v − u|2 dv = 3n(x, t)T (x, t)/m.

13

Page 15: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

On the other hand, replacing f by fM in the definitions of the pressure tensor P andthe energy flux Q, we can express these terms also in function of n, u and T whichenables us to obtain a closed system in these three unknowns as opposed to the case ofan arbitrary distribution function f . Indeed, we first notice that, denoting by wi the ith

component of w, ∫wiwje

− |w|2

2 dw =

∣∣∣∣∣ 0 if i 6= j,∫e−|w|2

2 dw if i = j.

It follows that the pressure tensor associated to the Maxwellian is

P = mn

(2πT/m)3/2

∫e− |v−u|2

2T/m (v − u)⊗ (v − u) dv,

and so, thanks to our previous computation, the off diagonal terms of P vanish, and bythe change of variable w = v−u

vth, we get for the diagonal terms

Pii = mn

(2π)3/2

T

m

∫e−

w2

2 w2i dv = nT.

It follows that P = nT I = pI where I is the 3 × 3 identity matrix. It now remains tocompute in the same way Q as a function of n, u and T for the Maxwellian with thesame change of variables, which yields

Q =m

2

n

(2πT/m)3/2

∫e− |v−u|2

2T/m |v|2v(x, t)) dv,

=m

2

n

(2π)3/2

∫e−

w2

2 (vthw + u)2(vthw + u) dw,

=m

2

n

(2π)3/2

∫e−

w2

2 (v2thw

2u + 2v2thu ·w w + |u|2 u) dw,

=m

2n(3

T

mu + 2

T

mu + |u|2u),

as the odd moments in w vanish. We finally get

Q =5

2nTu +

m

2n|u|2u =

5

2pu +

m

2n|u|2u.

Then, plugging the expressions of P and of Q in (2.9)-(2.10)-(2.11) we obtain the fluidequations for one species of particles of a plasma:

∂n

∂t+∇x · (nu) = 0 (2.12)

m∂

∂t(nu) +m∇ · (nu⊗ u) +∇p = qn(E + u×B) (2.13)

∂t(3

2p+

1

2mn|u|2) +∇ · (

5

2pu +

m

2n|u|2u) = E · (qnu), (2.14)

which corresponds in three dimensions to a system of 5 scalar equation with 5 scalarunknowns which are the density n, the three components of the mean velocity u and thescalar pressure p. These equations need of course to be coupled to Maxwell’s equationsfor the computation of the self-consistent electromagnetic field with, in the case of onlyone particle species ρ = q n and J = q nu. Let us also point out that an approximationoften used in plasma physics is that of a cold plasma, for which T = 0 and thus p = 0.Only the first two equations are needed in this case.

14

Page 16: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Chapter 3

Steady-state problems

3.1 The Finite difference method

3.1.1 The 1D Poisson equation and boundary conditions

We consider the Poisson equation in an interval [a, b]. For the problem to be well posed,boundary conditions are need for x = a and x = b. We will consider here three classicaltypes of boundary conditions.

1. Dirichlet boundary conditions: φ is given at x = a and x = b

−φ′′(x) = ρ in [a, b] (3.1)

φ(a) = α, (3.2)

φ(b) = β. (3.3)

2. Neumann boundary conditions: φ′ is given at boundary. Note that we can dothis only at one end of the interval, else there is still an undetermined constant.Moreover as the potential φ is determined up to a constant, we can always set itto zero at one point for example at x = a. In this case the problem becomes

−φ′′(x) = ρ in [a, b] (3.4)

φ(a) = 0, (3.5)

φ′(b) = α. (3.6)

3. Periodic boundary conditions. In this case all the functions are assume to beperiodic of period L and we can restrict the interval of computation to [0, L].Then, there are mathematically no boundaries and no boundary conditions areneeded. The terminology ”periodic boundary conditions” is somewhat misleading.

−φ′′(x) = ρ (3.7)

Note however in this case that φ is only determined up to a constant, which needsto be set for a numerical computation. Moreover, integrating (3.7) on a period,e.g. [0, L] yields

φ′(L)− φ′(0) =

∫ L

0ρ(x) dx = 0,

as φ′(L) = φ′(0) because φ′ is L-periodic. So a necessary condition for a solution

to exist is∫ L

0 ρ(x) dx = 0.

15

Page 17: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

3.1.2 Obtaining a Finite Difference scheme

We first consider a uniform mesh of the 1D computational domain, i.e. of the interval[0, L] where we want to compute the solution, see Figure 3.1. The cell size or space step

. .

0 L

x1x0 x2 xNxN−1

Figure 3.1: Uniform mesh of [0, L]

is defined by h = LN where N is the number of cells in the mesh. The coordinates of

the grid points are then defined by xj = x0 + jh = jh as x0 = 0. The solution will bedefined by its values at xj for 0 ≤ j ≤ N .

The principle of Finite Differences is to replace derivatives by finite differences in-volving neighbouring points approximating those derivatives. The simplest way to dothis is to use Taylor expansions around the considered point. We do this for all pointson the grid. The Taylor expansion will also enable us to see the order of approximationof the derivative.

φ(xj+1) = φ(xj) + hφ′(xj) +h2

2φ′′(xj) +

h3

6φ(3)(xj) +

h4

24φ(4)(xj + θ+

j h), (3.8)

φ(xj−1) = φ(xj)− hφ′(xj) +h2

2φ′′(xj)−

h3

6φ(3)(xj) +

h4

24φ(4)(xj − θ−j h). (3.9)

We deduce

φ(xj+1)− 2φ(xj) + φ(xj−1) = h2φ′′(xj) +h4

24(φ(4)(xj + θ+

j h) + φ(4)(xj − θ−j h)). (3.10)

So that

φ′′(xj) =φ(xj+1)− 2φ(xj) + φ(xj−1)

h2− h2

24(φ(4)(xj + θ+

j h) + φ(4)(xj − θ−j h)).

Plugging this into the equation −φ′′(xj) = ρ(xj) we get

−φ(xj+1)− 2φ(xj) + φ(xj−1)

h2= ρ(xj) +

h2

24(φ(4)(xj + θ+

j h) + φ(4)(xj − θ−j h)). (3.11)

Let us now define φj such that for (1 ≤ j ≤ N − 1), we have

−φj+1 + 2φj − φj−1

h2= ρ(xj),

and we use the boundary conditions to determine the additional unknowns. Then φjwill give an approximation of φ(xj) for all the points on the grid 0 ≤ j ≤ N .

1. Dirichlet: φ0 = φ(x0) = α, φN = φ(xN ) = β. So there remain N − 1 unknownsφ1, . . . , φN−1 determined by the N − 1 equations

−φj+1 + 2φj − φj−1

h2= ρ(xj) 1 ≤ j ≤ N − 1.

16

Page 18: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

This can be written as a linear system AhΦh = Rh with

Ah =1

h2

2 −1 0−1 2 −1 0

0. . .

. . .. . .

. . .. . .

. . . −10 −1 2

, Φh =

φ1

φ2...

φN−1

, Rh =

ρ(x1) + α

h2

ρ(x2)...

ρ(xN−1) + βh2

.

2. Neumann. Because we need to set the constant for the potential at one point, weconsider now the boundary conditions φ(0) = 0 and φ′(L) = α. In this case theunknown are φ1, . . . , φN . So there are N unknown. We can still use like before thefinite difference approximations of −φ′′(xj) = ρ(xj) at the N − 1 interior points.Then the missing equation needs to be obtained from the Neumann boundarycondition φ′(L) = α. This needs to be expressed from the point values. For thiswe can simply set

φN − φN−1

h= α.

This is only a first order approximation of the derivative, but this is enough tokeep the second order approximation on φ at the end.

In this case we get the linear system AhΦh = Rh with

Ah =1

h2

2 −1 0−1 2 −1 0

0. . .

. . .. . .

. . .. . .

. . . −10 −1 2 −10 −1 1

, Φh =

φ1

φ2...φN

, Rh =

ρ(x1)ρ(x2)

...ρ(xN−1)

αh

.

3. Periodic. This case is the simplest as there is no boundary. Here all points areinterior points and can be used to express −φ′′(xj) = ρ(xj). Because of the pe-riodicity φ(xj+N ) = φ(xj). Hence only the values of φj 0 ≤ N − 1 need to becomputed, the others being deduced by periodicity. So there will be N unknownsin our system that are determined by the N approximations to −φ′′(xj) = ρ(xj),0 ≤ j ≤ N − 1 which are expressed by

−φj+1 + 2φj − φj−1

h2= ρ(xj) 2 ≤ j ≤ N − 2.

Moreover for j = 0 we have φj−1 = φ−1 = φN−1 so that the equation reads

−φ1 + 2φ0 − φN−1

h2= ρ(x0)

and for j = N − 1 we have φj+1 = φN = φ0 so that

−φN−2 + 2φN−1 − φ0

h2= ρ(xN−1).

17

Page 19: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

So that in this case the system in Matrix form reads AhΦh = Rh with

Ah =1

h2

2 −1 0 0 −1−1 2 −1 0 . . . 0

0. . .

. . .. . . 0

.... . .

. . .. . . −1 0

0 −1 2 −1−1 0 −1 2

, Φh =

φ0

φ1...

φN−1

, Rh =

ρ(x0)ρ(x1)

...ρ(xN−1)

.

We notice that each diagonal of Ah has everywhere the same term. We see alsothat the vector (1, . . . , 1)> is in the kernel of Ah as the sum of all the terms of eachline vanishes. This means that the matrix is not invertible. Its kernel has rank oneand invertibility can be recovered by assuming zero average, which in the discretecase reads

φ0 + · · ·+ φN−1 = 0.

3.1.3 Higher order finite differences

A fourth order formula for the second derivative can be obtained by adding Taylor ex-pansions expressing in addition φ(xj+2) and φ(xj−2) with respect to φ and its derivativesat the point xj . Taking linear combinations of the four Taylor expansions such that allterms up to h5, except of course the function values and the second derivative vanish.We then get the formula

φ′′(xj) ≈−φ(xj+2) + 16φ(xj+1)− 30φ(xj) + 16φ(xj−1)− φ(xj−2)

12h2.

This can be used everywhere for periodic boundary conditions. For other types ofboundary conditions a non centred formula of the same order needs to be applied atx1 and xN−1.

3.2 Convergence of finite difference schemes

Some theory on the convergence of finite difference schemes will help us understandwhat is needed for a good scheme and also provide verification tests for checking thatthe code implementing the scheme behaves correctly. In particular, checking the orderof convergence of a scheme is a very good verification test that should be used wheneversome theoretical order exists.

In this lecture, we will use mostly the decomposition in eigenmodes for our proofs.Sometimes easier and more general proofs exist, but understanding the behaviour ofthe eigenmodes is in general very useful to understand a scheme. Some continuous anddiscrete norms are needed to define rigorously the convergence. We will use mostly theL1, L2 and L∞ (or max) norms defined as follows. In the continuous setting

‖f‖1 =

∫ b

a|f(x)|dx, ‖f‖2 =

∫ b

a|f(x)|2 dx, ‖f‖∞ = max

a≤x≤b|f(x)|.

In the discrete setting

‖v‖1 =N∑j=1

|vi|, ‖v‖2 = (N∑j=1

|vi|2)1/2, ‖v‖∞ = maxi

(|vi|).

18

Page 20: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

A simple calculation yields the comparison inequalities between the 2-norm and themax-norm

‖v‖∞ ≤ ‖v‖2 ≤√N‖v‖∞, ∀v ∈ RN . (3.12)

After discretisation with Finite Differences we obtained in each case a linear systemof the form AhΦh = Rh. If the matrix Ah is invertible, this enables to compute Φh.For this to provide a good approximation of the corresponding solution of the Poissonequation, we need to verify that for some norm ‖ · ‖ we have ‖Φ− Φh‖ ≤ Chp for someinteger p ≥ 1 and a constant C independent of h (we then say that ‖Φ−Φh‖ = O(hp)).In the case of Dirichlet boundary conditions Φ = (φ(x1), . . . , φ(xN−1))> is the vectorcontaining the exact solution of Poisson’s equation at the grid points.

Because of (3.11), we have that AhΦ = Rh+h2Sh, where Sh is the vector containingthe rest term of the Taylor expansions. Then as AhΦh = Rh, it follows that Ah(Φ−Φh) =h2Sh and also that

‖Ah(Φ− Φh)‖ ≤ h2‖Sh‖.

Assuming that the fourth derivative of φ is bounded, it follows that

‖Sh‖∞ ≤ C = ( maxx∈[0,L]

|φ(4)(x)|)/12,

‖Ah(Φ− Φh)‖∞ ≤ Ch2,

where C is independent of h. We then say that the numerical scheme defined by thematrix Ah is consistent of order 2 for the max-norm. For the 2-norm, we can use thenorm comparison (3.12) and h = L/N to get that

‖Ah(Φ− Φh)‖2 ≤ C1h3/2, or equivalently

1√N‖Ah(Φ− Φh)‖2 ≤ C2h

2,

where C1 and C2 are constants independent of h.Consistency gives us convergence of Ah(Φ − Φh) to zero. This is not yet enough

to prove that Φh converges to Φ. This requires another property of the discretisationscheme, which is called stability, namely that the norm of the inverse of Ah, ‖A−1

h ‖, isbounded independently of h.

Definition 1 For a given vector norm ‖ · ‖, we define the induced matrix norm by

‖A‖ = supx 6=0

‖Ax‖‖x‖

.

The consistency of a Finite Difference scheme comes directly from its derivation usingTaylor expansions. Its stability is often more difficult to verify. One possible way to doit is to check its eigenvalues. This relies on the following proposition:

Proposition 1 Let A be diagonalisable in basis of orthonormal eigenvectors and λ1, . . . , λNdenote the eigenvalues of A. Then we have

‖A‖2 ≤ max |λi|, ‖A‖∞ ≤ max |λi|.

19

Page 21: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Proof. Any vector x 6= 0 in RN can be expressed in the basis of orthogonal eigenvectorsof A, denote by e1, . . . , eN

x = x1e1 + · · ·+ xNeN .

Then assuming that ei is an eigenvalue of A associated to the eigenvalue λi, we have

Ax = λ1x1e1 + · · ·+ λNxNeN . (3.13)

Hence for the 2-norm, using the orthonormality of the ei

‖Ax‖22 = λ21x

21 + + · · ·+ λ2

Nx2N ≤ max(λ2

i )‖x‖22.

From which it follows that ‖A‖2 ≤√

max(λ2i ) = max |λi|.

For the max-norm, we get from (3.13) that

‖Ax‖∞ = max |λixi| ≤ max |λi|‖x‖∞,

from which the result follows.

Hence if Ah is an invertible symmetric matrix, it is diagonalisable in a basis oforthogonal eigenvectors and its eigenvalues are real and different from zero. Denotingby P the matrix whose columns are the eigenvectors of Ah, we have Ah = PΛP>, whereΛ is the diagonal matrix containing the eigenvalues. Then A−1

h = PΛ−1P>, where Λ−1

contains the inverse of the eigenvalues.It follows that for the 2-norm and max-norm that we are interested in, we have

‖A−1h ‖ ≤

1

min |λi|.

This leads us to the sufficient condition for stability that for all the eigenvalues λi of Ahwe have

|λi| ≥ C, for some constant C independent of h.

Let us now check this for Dirichlet and periodic boundary conditions.

3.2.1 Homogeneous Dirichlet boundary conditions

In the continuous case for homogeneous Dirichlet boundary conditions the eigenvectorsand eigenvalues of the Laplace operator − d2

dx2 in 1D verify

−d2φkdx2

= λkφk, φ(0) = φ(L) = 0.

They can be computed by a sine transform and read:

λk =k2π2

L2, φk(x) =

√2

Lsin

kπx

L.

In the case of second order finite differences, the corresponding discrete eigenvalueproblem reads AhΦk = λkΦk, with h = L/N and the (N − 1)× (N − 1) matrix

Ah =1

h2

2 −1 0−1 2 −1 0

0. . .

. . .. . .

. . .. . .

. . . −10 −1 2

.

20

Page 22: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

We can check that the components of the discrete eigenvectors (or eigenmodes), up tonormalisation, are the values of the continuous eigenmodes at the grid points

(Φk)j =

√2

Nsin

kjπ

N,

and the corresponding eigenvalues are

λk =4

h2sin2 kπ

2N=

4

h2sin2 khπ

2L, 1 ≤ k ≤ N − 1.

As 0 < k < N , we have 0 ≤ kπ/(2N) ≤ π/2, so that the eigenvalues are positive and inincreasing order as sinus is increasing on this interval. It follows that λ1 is the smallesteigenvalue. Moreover, as h→ 0, we have

λ1 =4

h2sin2 hπ

2L∼ 4

h2

h2π2

4L2→ π2

L2.

This corresponds to the continuous eigenvalue. Then because of the convergence prop-erty there exists h0 = L/N0 such that for h ≤ h0 we have for all N ≥ N0 thatλ1 = λN1 ≥ (1/2)π2/L2, where we use the exponent N to show the dependency ofλN1 on N (or equivalently on h). Thus for any N ≥ 1, we have

λN1 ≥ C = min

(λ1

1, . . . , λN0−11 ,

1

2

π2

L2

),

where C is a constant independent on N which proves the stability.

3.2.2 Periodic boundary conditions

The Dirichlet theorem tells us that any periodic C1 function u can be expanded in aconverging Fourier series:

u(x) =

+∞∑k=−∞

uke2iπkxL , with uk =

1

L

∫ L

0u(x)e−

2iπkxL .

As the Fourier coefficient of a derivative is simply obtained by multiplying the Fouriercoefficient of the function, the Fourier transform diagonalises linear partial differentialequations with constant coefficients and provides a very simple way to solve it. Histor-ically Fourier series where used by Joseph Fourier at the beginning of the 19th centuryas a general tool to solve the heat equation.

Indeed, consider the following partial differential equation, with a, b, c ∈ R constants,in a periodic domain

−ad2u

dx2+ b

du

dx+ cu = f.

Plugging in the expression of the Fourier series of u this becomes

+∞∑k=−∞

uk

(a

4π2k2

L2+ b

2iπk

L+ c

)e

2iπkxL =

+∞∑k=−∞

fke2iπkxL .

Identifying the Fourier coefficients gives a closed expression of uk as a function of fk

uk =fk

a4π2k2

L2 + b2iπkL + c

21

Page 23: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

and provides a solution of the PDE in form of a Fourier series.There exists a corresponding tool for solving linear constant coefficient finite differ-

ence equations on a uniform grid, namely the discrete Fourier transform (DFT), whichis extremely useful for analysing Finite Difference equations and in particular their sta-bility.

Discrete Fourier transform

Let P be the symmetric matrix formed with the powers of the N th roots of unity the

coefficients of which are given by Pjk = 1√Ne

2iπjkN . Denoting by ωN = e

2iπN , we have

Pjk = 1√NωjkN . The adjoint, or conjugate transpose of P is the matrix P ∗ with coefficients

P ∗jk = 1√Nω−jkN .

Notice that the columns of P , denoted by Pi, 0 ≤ i ≤ N − 1 are the vectors Xk

normalised so that P ∗kPl = δk,l, where the vector Xk corresponds to a discretisation ofthe function x 7→ e−2iπkx at the grid points xj = j/N of the interval [0, 1]. So theexpression of a periodic function in the base of the vectors Xk is naturally associated tothe Fourier series of a periodic function.

Definition 2 Discrete Fourier Transform.

• The dicrete Fourier transform of a vector x ∈ CN is the vector y = P ∗x.

• The inverse discrete Fourier transform of a vector y ∈ CN is the vectorx = P ∗−1x = Px.

Lemma 1 The matrix P is unitary and symmetric, i.e. P−1 = P ∗ = P .

Proof. We clearly have P T = P , so P ∗ = P . There remains to prove that PP = I.But we have

(PP )jk =1

N

N−1∑l=0

ωjlω−lk =1

N

N−1∑l=0

e2iπNl(j−k) =

1

N

1− e2iπNN(j−k)

1− e2iπN

(j−k),

and so (PP )jk = 0 if j 6= k and (PP )jk = 1 if j = k.

Corollary 1 Let F,G ∈ CN and denote by F = P ∗F and G = P ∗G, their discreteFourier transforms. Then we have

• the discrete Parseval identity:

(F,G) = F T G = F T¯G = (F , G), (3.14)

• The discrete Plancherel identity:

‖F‖ = ‖F‖, (3.15)

where (., .) and ‖.‖ denote the usual euclidian dot product and norm in CN .

22

Page 24: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Proof. The dot product in CN of F = (f1, . . . , gN )T and G = (g1, . . . , gN )T is definedby

(F,G) =N∑i=1

figi = F T G.

Then using the definition of the inverse discrete Fourier transform, we have F = PF ,G = PG, we get

F T G = (PF )TPG = F TP T P¯G = F T

¯G,

as P T = P and P = P−1. The Plancherel identity follows from the Parseval identity bytaking G = F .

Remark 2 The discrete Fourier transform is defined as a matrix-vector multiplication.Its computation hence requires a priori N2 multiplications and additions. But becauseof the specific structure of the matrix there exists a very fast algorithm, called FastFourier Transform (FFT) for performing it in O(N log2N) operations. This makes itparticularly interesting for many applications, and many fast PDE solvers make use ofit.

Circulant matrices

Note that on a uniform grid if the PDE coefficients do not explicitly depend on x aFinite Diffference scheme is identical at all the grid points. This implies that a matrixAh defined with such a scheme has the same coefficients on any diagonal including theperiodicity. Such matrices, which are of the form

C =

c0 c1 c2 . . . cN−1

cN−1 c0 c1 cN−2

cN−2 cN−1 c0 cN−3...

. . ....

c1 c2 c3 . . . c0

with c0, c1, . . . , cN−1 ∈ R are called circulant.

Proposition 2 The eigenvalues of the circulant matrix C are given by

λk =N−1∑j=0

cjωjk, (3.16)

where ω = e2iπ/N .

Proof. Let J be the circulant matrix obtained from C by taking c1 = 1 and cj = 0 forj 6= 1. We notice that C can be written as a polynomial in J

C =N−1∑j=0

cjJj .

23

Page 25: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

As JN = I, the eigenvalues of J are the N-th roots of unity that are given by ωk =e2ikπ/N . Looking for Xk such that JXk = ωkXk we find that an eigenvector associatedto the eigenvalue λk is

Xk =

1ωk

ω2k

...

ω(N−1)k

.

We then have that

CXk =N−1∑j=0

cjJjXk =

N−1∑j=0

cjωjkXk,

and so the eigenvalues of C associated to the eigenvectors Xk are

λk =

N−1∑j=0

cjωjk.

Proposition 3 Any circulant matrix C can be written in the form C = PΛP ∗ whereP is the matrix of the discrete Fourier transform and Λ is the diagonal matrix of theeigenvalues of C. In particular all circulant matrices have the same eigenvectors (whichare the columns of P ), and any matrix of the form PΛP ∗ is circulant.

Corollary 2 We have the following properties:

• The product of two circulant matrix is circulant matrix.

• A circulant matrix whose eigenvalues are all non vanishing is invertible and itsinverse is circulant.

Proof. The key point is that all circulant matrices can be diagonalized in the samebasis of eigenvectors. If C1 and C2 are two circulant matrices, we have C1 = PΛ1P

∗ andC2 = PΛ2P

∗ so C1C2 = PΛ1Λ2P∗.

If all eigenvalues of C = PΛP ∗ are non vanishing, Λ−1 is well defined and

PΛP ∗PΛ−1P ∗ = I.

So the inverse of C is the circulant matrix PΛ−1P ∗.

Stability of the discrete Laplacian with periodic boundary conditions

For periodic boundary conditions the matrix of the discrete Laplacian is circulant, withc0 = 2/h2, c1 = −1/h2, cN−1 = −1/h2 and all the other terms vanish. Hence the formulafor computing its eigenvalues can be used to verify its stability. It yields

λk =1

h2(2− e2ikπ/N − e2ikπ(N−1)/N ) =

2

h2(1− cos

2kπ

N) =

4

h2sin2 kπ

N, 0 ≤ k ≤ N − 1.

24

Page 26: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

In order to fix the constant, we assume that Φ0 + · · · + ΦN−1 = 0, this sets theconstant Fourier mode Φ0 to 0 and discards the eigenvalue λ0 = 0, so that the rest ofthe matrix is invertible and the smallest eigenvalue corresponds to

λ1 = λN−1 =4

h2sin2 π

N=

4

h2sin2 πh

L.

We can now proceed like in the case of homogeneous Dirichlet boundary conditions. Assinx ∼ x for x close to 0, we find

limh→0

λ1 =4π2

L2,

which is strictly larger than 0, so that all eigenvalues are bounded from below by thehalf of that number, after some small enough h0, and the others are a finite number ofstrictly positive values. This proves that for all N all eigenvalues of Ah are positive andbounded from below by a constant independent of h which proves stability.

3.2.3 The method of manufactured solutions

A simple and standard way of checking the correctness of the code implementing anumerical method is to use a known analytical solution. This can be done by usinga known solution in a specific case or also by picking a solution and constructing theproblem around it. This is called the method of manufactured solutions.

For example, for periodic boundary conditions one can pick any periodic function uand apply the operator to it, in our case the Laplacian, to find the corresponding righthand side ρ, and then solve the problem with this ρ for different mesh sizes and checkthe convergence order in some given norm.

For non periodic boundary conditions, one can pick a function satisfying homoge-neous Dirichlet or Neumann boundary conditions or on can pick any smooth functionand determine the boundary conditions according to the function we chose. In any caseit is important not to forget the boundary conditions when defining the problem.

3.3 Finite difference methods in 2D

Let us now extend the finite difference method to a cartesian 2D grid, which is a tensorproduct of 1D grids. We shall assume that the cell size is uniform and equal in the twodirections for simplicity, but this is not required. We will see that the notion of tensorproduct enables to construct the linear system directly from the 1D system, enablingeasy implementation and also extension of the analysis from the 1D case. For simplicitywe will only consider homogeneous Dirichlet boundary conditions. Other boundaryconditions can be adapted from the 1D case in the same manner.

The 2D Laplace operator is defined by

∆φ =∂2φ

∂x2+∂2φ

∂y2.

The second order finite difference approximation of the second derivative in x and y are

25

Page 27: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

obtained from Taylor expansions

−∆φ(xi, yj) =−φ(xi+1, yj) + 2φ(xi, yj)− φ(xi−1, yj)

h2

+−φ(xi, yj+1) + 2φ(xi, yj)− φ(xi, yj−1)

h2+O(h2). (3.17)

Let us consider the natural numbering of the grid values of the approximate solutionΦh which is now a matrix with entries φi,j ≈ φ(xi, yj) for all the grid points 0 ≤ i, j ≤N . Considering the Poisson problem with homogenous Dirichlet boundary conditions:−∆φ = ρ in the domain and φ = 0 on the boundary, there are (N − 1)2 unknownssatisfying the (N − 1)2 equations

1

h2(−φi+1,j − φi−1,j + 4φi,j − φi,j+1 − φi,j−1) = ρ(xi, yj), 1 ≤ i, j ≤ N − 1. (3.18)

Introducing the right hand side matrixRh = (ρ(xi, yj))1≤i,j≤N−1 and the 1D Dirichletsecond order discrete Dirichlet matrix

Ah =1

h2

2 −1 0

−1 2 −1. . .

0. . .

. . .. . .

. . .. . .

. . .. . . −1 0

. . . −1 2 −10 −1 1

we notice that the matrix multiplication AhΦh applies the 1D Finite Difference stencil tothe columns of Φh which corresponds to the differentiation in y and the left multiplicationof Φh by Ah, ΦhAh, applies the 1D Finite Difference stencil to the lines of Φ whichcorresponds to the differentiation in x.

AhΦh =1

h2

2φ1,1 − φ2,1 2φ1,2 − φ2,2 . . .

−φ1,1 + 2φ2,1 − φ3,1 −φ1,2 + 2φ2,2 − φ3,2 . . .−φ2,1 + 2φ3,1 − φ4,1 −φ2,2 + 2φ3,2 − φ4,2 . . .

......

,

ΦhAh =1

h2

2φ1,1 − φ1,2 −φ1,1 + 2φ1,2 − φ1,3 . . .2φ2,1 − φ2,2 −φ2,1 + 2φ2,2 − φ2,3 . . .2φ3,1 − φ3,2 −φ3,1 + 2φ3,2 − φ3,3 . . .

......

,

Then adding the two, yields at each matrix entry the 2D Laplacian stencil, so that theequations (3.18) can be written in matrix form

ΦhAh +AhΦh = Rh.

Denoting by Ih the identity matrix of the same size as Ah and Φh this reads equivalently

IhΦhAh +AhΦhIh = Rh. (3.19)

26

Page 28: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

In order to solve such a matrix system it needs to be brought into the standard matrix-vector multiplication form. The Kronecker product formalism does that for us. Adetailed presentation can be found in the textbooks by Steeb [13, 14]. A nice reviewarticle on the properties and applications of the Kronecker product was written by VanLoan [17].

For our application, we first need to replace the matrix unknown Φh by a columnvector, which is called vec(Φh) in the Kronecker product formalism and is obtained bystacking the columns of Φh or equivalently numbering the grid points line by line:

vec(Φh) = (φ1,1, φ2,1, . . . , φN−1,1, φ1,2, φ2,2, . . . , φN−1,2, φ3,1, . . . φN−1,N−1)>.

We then have for any two matrices B and C of appropriate dimensions and their Kro-necker product B ⊗ C

CXB> = (B ⊗ C)vec(X).

This is all we need to rewrite our 2D discrete Poisson equation using Kronecker products.As Ah is symmetric, (3.19) is equivalent to

(Ah ⊗ Ih + Ih ⊗Ah)vec(Φh) = vec(Rh).

As the Kronecker product is available in numerical computing languages like Matlab ornumpy, this can be used directly to assemble the linear system in 2D, which means thatonly the 1D Finite Difference matrices need to be assembled explicitly.

As the eigenvalues of the Kronecker product of two square matrices is the productof the eigenvalues of each matrix, the stability of the 2D problem can also be studiedusing the eigenvalues of the 1D problems.

The tensor product ideas generalises to arbitrary dimensions and has the propertyof separating a nD problem into a sequence of 1D problem enabling to obtain some veryfast algorithms.

3.4 The Finite element method

3.4.1 Principle of the method

For solving a problem on a computer that can only store a finite amount of informationa discrete form of the problem is needed. In the Finite Difference method one simplycomputes an approximation of the solution at a finite number of grid points. In theFinite Element method, which is mathematically more involved, the idea is to look forthe solution in a finite dimensional vector space, i.e. for some well chosen vector spaceVh, with basis (ϕi)0≤i≤N−1, the approximate solution has the form

uh(x) =

N−1∑i=0

uiϕi(x).

The basis being given, the approximate solution uh is fully determined by its coefficientsui in this basis, which need not be values of uh at some points in the computationaldomain, but can be in some cases.

The question now becomes how to choose Vh and determine the coefficients ui suchthat uh is a good approximation of the solution u of the original problem, that we takeas a start as the Poisson problem with homogeneous Dirichlet boundary conditions:

−∆u = f, in Ω, u = 0, on ∂Ω. (3.20)

27

Page 29: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

The first idea, introduced by Ritz in his thesis in Gottingen in 1902, was to transform theboundary problem into an equivalent minimisation problem. Indeed, via the Dirichletprinciple (3.20) is equivalent to the minimisation problem

minu∈H1

0 (Ω)

(1

2

∫Ω|∇u(x)|2 dx−

∫Ωf(x)u(x) dx

). (3.21)

We shall need the following Hilbert spaces, defined for a domain Ω ∈ Rd

H1(Ω) = u ∈ L2(Ω), ∇u ∈ (L2(Ω))d, H10 (Ω) = u ∈ H1(Ω), u = 0 on ∂Ω.

The scalar product associated to these Hilbert spaces is

(u, v)H1 =

∫Ω∇u(x) · ∇v(x) dx+

∫Ωu(x)v(x) dx.

Then, the original problem being transformed into a minimisation problem in becomesquite natural to look for an approximation in a finite dimensional subspace of the functionspace in which the minimisation problem is posed (in our case H1

0 (Ω)), which meansthat the minimisation is performed by considering only minima in a finite dimensionalsubspace. Then if the form of finite dimensional space is chosen such that any functionof the original space can be approximated to any given tolerance, by a function of theapproximation space, we should be able to get a good approximation. Ritz who wasactually looking at solutions for the bilaplacian equation, chose as basis functions for Vha finite number of eigenfunctions of his operator.

The standard method to solve a minimisation problem with a cost functional Jdefined on a Hilbert space V , of the form

minu∈V

J [u],

is to solve the associated Euler equation J ′[u] = 0 obtained by computing the Frechetderivative of the functional that we want to minimise. Note that the Frechet derivativegives a rigorous definition of the functional derivative used in physics for functions thatare in a Banach (including Hilbert) space. Consider a functional J from a Hilbert spaceV into R. Its Frechet derivative J ′, assuming it exists, is a linear form on V , whichmeans that it maps any function from V to a scalar. It can be computed using theGateaux formula:

J ′[u](v) = limε→0

J [u+ εv]− J [u]

ε. (3.22)

Let us apply this formula to our problem for which

J [u] =1

2

∫Ω|∇u(x)|2 dx−

∫Ωf(x)u(x) dx.

We have for any v ∈ V = H10 (Ω)

J [u+ εv] =1

2

∫Ω|∇u(x) + εv(x)|2 dx−

∫Ωf(x)(u(x) + εv(x)) dx

=1

2

(∫Ω|∇u(x)|2 dx+ 2ε

∫Ω∇u(x) · ∇v(x) dx+ ε2

∫Ω|∇u(x)|2 dx

)−∫

Ωf(x)u(x) dx− ε

∫Ωf(x)v(x) dx.

28

Page 30: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

From which we deduce, using the Gateaux formula (3.22) that

J ′[u](v) =

∫Ω∇u(x) · ∇v(x) dx−

∫Ωf(x)v(x) dx.

Note that J ′[u] being a linear form on V is defined by applying it to some vector v ∈V . Finally the solution of our minimisation problem (3.21), is a solution of the Eulerequation J ′[u] = 0 or equivalently J ′[u](v) = 0 for all v ∈ V , which reads∫

Ω∇u(x) · ∇v(x) dx =

∫Ωf(x)v(x) dx ∀v ∈ H1

0 (Ω). (3.23)

This is also what is called the variational formulation, or the weak formulation of theoriginal boundary value problem (3.20). Note that this variational formulation expressesin some sense the orthogonality of the residual to the space in which the solution issought. This is more general than Euler equations of minimisation problems as noticedby Galerkin and has a wide range of applications. One can even extend this concept bymaking the residual orthogonal to a different function space, than the one in which thesolution lives. Such methods are called Petrov-Galerkin methods and are beyond thescope of this lecture.

So the principle of the Galerkin Finite Element method is to look for a solution in afinite dimensional subspace Vh ⊂ V of the original space and to use the same variationalformulation (3.23) as the one defining the exact solution, with test functions also in Vhto characterise the solution. What remains to be done now is to choose Vh with goodapproximation properties. As we will see later, the stability of the Galerkin methodfollows directly from the well-posedness of the variational problem (3.23).

The finite dimensional space Vh is in general defined by its basis functions. Forthose, Ritz used eigenfunctions of the problem. But those are in general cumbersometo compute. Galerkin proposed to use general classes of simple functions, trigonomet-ric functions or polynomials, that are know to be able to approximate any continuousfunction with a finite number of basis functions. Trigonometric polynomials which arelinked to Fourier series are very good in periodic domains, with a few simple extensions.Polynomials enjoy more widespread applications, however to get a good conditioning ofthe linear system that is obtained at the end, care needs to be taken in the choice ofthe basis functions. The monomial basis (1, x, x2, . . . ) has very bad properties. Bestapproximations are provided by the orthogonal Legendre polynomials or by the Cheby-shev polynomials which are used in practice. Note that all the basis functions we havementioned up to now have a global support in the computational domain and thus leadto full matrices in the linear system, which can be computationally expensive. Meth-ods using such bases are actually not known as Finite Element methods but rather asspectral methods. We will come back to those later.

Another ingredient is needed to define what is known as Finite Element methods.This was introduced by Courant in 1943 and consists in using basis functions witha small support in the computational domain, so that its product with other basisfunctions vanishes for most of the other basis functions leading to a very sparse matrixin the linear system, which can be solved very efficiently on a computer. For this thecomputational domain is decomposed into small elements, in general triangles or quadsin 2D and the basis functions are chosen to be relatively low order polynomials, on eachof these elements. Convergence being achieved by taking smaller elements like the cells inthe Finite Difference method. In 1D a finite element mesh will look like a finite difference

29

Page 31: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

mesh. An example of an unstructured Finite Element mesh in 2D is displayed in Figure3.2, which shows the great flexibility in particular to handle complicated boundarieswith finite elements, which finite differences do not provide. This is a key to its verywide usage.

0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35

0.0

0.1

0.2

0.3

0.4

Figure 3.2: Example of a 2D finite element mesh consisting of triangles.

The article by Gander and Wanner [6] provides a clear and well documented overviewof the historical developments of the Finite Element method. For more technical his-torical developments of the Finite Difference and Finite Element methods on can alsoconsult [15].

In summary, the finite element method consists in looking for a solution of a vari-ational problem like (3.23), in a finite dimensional subspace Vh of the space V wherethe exact solution is defined. The space Vh is characterised by a basis (ϕ1, . . . , ϕN ) sothat finding the solution of the variational problem amounts to solving a linear system.Indeed, express the trial function uh and the test function vh on this basis:

uh(x) =

N∑j=1

ujϕj(x), vh(x) =

N∑i=1

viϕi(x),

and plug these expressions in the variational problem (3.23). This yields

N∑i=1

N∑j=1

ujvi

∫Ω∇ϕi(x) · ∇ϕj(x) dx =

∑i=1

Nvi

∫Ωf(x)ϕi(x) dx.

This can be expressed in matrix form, U>h AhUh = U>h bh, which is equivalent to thelinear system AhUh = bh as the previous equality is true for all Uh, where

Uh = (u1, . . . , uN )>, Uh = (v1, . . . , vN )>, bh = (

∫Ωf(x)ϕ1(x) dx, . . . ,

∫Ωf(x)ϕN (x) dx)>

30

Page 32: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

and the matrix Ah whose entries are

(

∫Ω∇ϕi(x) · ∇ϕj(x) dx)1≤i,j≤N .

3.4.2 The variational (or weak) form of a boundary value problem

The variational form of a boundary value problem contains all its elements, which arethe partial differential equation in the interior of the domain and the boundary condi-tions. There are two very distinct ways to handle the boundary conditions depending onhow they appear when deriving the variational formulation. If they appear on the testfunction they are called essential boundary conditions and need to be included in thespace where the solution is looked for. If they appear on the trial function, which willbe the approximate solution, they can be handled in a natural way in the variationalformulation. Such boundary conditions are called natural boundary conditions. We willsee on the examples of Dirichlet and Neumann boundary conditions how this works inpractice.

In order to define the variational formulation, we will need the following Greenformula: For u ∈ H2(Ω) and v ∈ H1(Ω)

−∫

Ω∆u v dx =

∫Ω∇u · ∇v dx−

∫∂Ω

∂u

∂nv dσ. (3.24)

Here H2(Ω) denotes the Hilbert space of the functions whose partial derivatives up tosecond order are in L2(Ω) and ∂u

∂n = ∇u · n, where n is the outbound normal at anypoint of the boundary.

Case of homogeneous Dirichlet boundary conditions

Let f ∈ L2(Ω). Consider the boundary value problem

−∆u = f in Ω, (3.25)

u = 0 on ∂Ω. (3.26)

Assume that u ∈ H2(Ω), multiply (3.25) by v ∈ H1(Ω) and integrate using the Greenformula (3.24), which yields∫

Ω∇u · ∇v dx−

∫∂Ω

∂u

∂nv dσ =

∫Ωfv dx.

Here u does not appear in the boundary integral, so we cannot apply the boundarycondition directly. But in the end u will be in the same function space as the testfunction v, which appears directly in the boundary integral. This is the case of anessential boundary condition. So we take test functions v vanishing on the boundary.We then get the following variational formulation:Find u ∈ H1

0 (Ω) such that∫Ω∇u · ∇v dx =

∫Ωfv dx ∀v ∈ H1

0 (Ω). (3.27)

The solutions of this variational formulation are called weak solutions of the originalboundary value problem. The solutions which are also in H2(Ω) are called strong solu-tions. Indeed we can prove that such a solution is also a solution of the initial boundary

31

Page 33: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

value problem (3.25)-(3.26). If u ∈ H2(Ω), the Green formula (3.24) can be used, andas ϕ vanishes on the boundary it yields

−∫

Ω∆uϕdx =

∫Ωfϕdx ∀v ∈ H1

0 (Ω).

This implies, as H10 (Ω) is dense in L2(Ω), that −∆u = f in L2(Ω) and so almost

everywhere. On the other hand as u ∈ H10 (Ω), u = 0 on ∂Ω. So u is a strong solution of

(3.25)-(3.26).

Case of non homogeneous Dirichlet boundary conditions

Let f ∈ L2(Ω) and u0 ∈ H1(Ω). We consider the problem

−∆u = f in Ω, (3.28)

u = u0 on ∂Ω. (3.29)

As the value of u on the boundary cannot be directly put in the function space if it isnot zero, as else the function space would not be stable by linear combinations, we needto bring the problem back to the homogeneous case. To this aim let u = u − u0. Wethen show as previously that u is a solution of the variational problemFind u ∈ H1

0 (Ω) such that∫Ω∇u · ∇v dx =

∫Ωfv −

∫Ω∇u0 · ∇v dx ∀v ∈ H1

0 (Ω). (3.30)

This is the variational problem that needs to be solved for non homogeneous Dirichletboundary conditions. As u0 will only have non zero entries on the boundary for standardFinite Elements, the problem can be simplified in different manners in practice.

Case of Neumann boundary conditions

Let f ∈ L2(Ω) and g ∈ H1(Ω). We consider the problem

−∆u+ u = f in Ω, (3.31)

∂u

∂n= g on ∂Ω. (3.32)

Assuming that u ∈ H2(Ω), we multiply by a test function v ∈ H1(Ω) and integrate usingthe Green formula (3.24), which yields∫

Ω∇u · ∇v dx−

∫∂Ω

∂u

∂nv dσ +

∫Ωuv dx =

∫Ωfv dx.

Replacing ∂u∂n by its value g on the boundary, we obtain the variational formulation

Find u ∈ H1(Ω) such that∫Ω∇u · ∇v dx+

∫Ωuv dx =

∫Ωfv dx+

∫∂Ωgv dσ ∀v ∈ H1(Ω). (3.33)

Let us now show that u is a strong solution of the boundary value problem, providedit is in H2(Ω). As H1

0 (Ω) ⊂ H1(Ω) one can first take only test functions in H10 (Ω). Then

32

Page 34: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

as in the case of homogeneous Dirichlet conditions it follows from the Green formula(3.24) that ∫

Ω(−∆u+ u)ϕdx =

∫Ωfϕdx ∀ϕ ∈ H1

0 (Ω).

This implies, as H10 (Ω) is dense in L2(Ω), that −∆u + u = f in L2(Ω) and so almost

everywhere.It now remains to verify that we have the boundary condition

∂u

∂n= g on ∂Ω.

For that we start from (3.33) and apply the Green formula (3.24), which yields

−∫

Ω∆u v dx+

∫∂Ω

∂u

∂nv dσ +

∫Ωuv dx =

∫Ωfv dx+

∫∂Ωgv dσ ∀v ∈ H1(Ω),

and as −∆u+ u = f , it remains∫∂Ω

∂u

∂nv dσ =

∫∂Ωgv dσ ∀v ∈ H1(Ω),

which yields that ∂u∂n = g on ∂Ω.

3.4.3 Lagrange Finite Elements

Finite Elements are used to construct a finite dimensional space Vh with basis functionsthat have a small support so that the resulting matrix is sparse, i.e. most of its entriesvanish. The simplest Finite Elements are determined by points values and related toLagrange interpolation, whence their name. In order to construct a basis of Vh, onestarts by decomposing the computational domain into non overlapping intervals in 1D(like the Finite Difference mesh), triangles or quads in 2D, tetrahedra or hexahedra in3D. This defines a mesh of the computational domain. Then the basis functions aredefined locally on each cell (or element).

Let us start with a non uniform 1D mesh of the domain [a, b] defined by the gridpoints a = x0 < x1 < · · · < xN = b. The elements of the mesh are here the intervals[xν , xν+1]. The restriction of Vh to each element is defined to be the space of polynomialsof degree k, denote by Pk([xν , xν+1]). The basis restricted to each element is definedvia a reference element, which is conveniently chosen, for later Gauss integration, as theinterval [−1, 1] and an affine map

Fν : [−1, 1]→ [xν , xν+1]

x 7→ xν + xν+1

2+

(xν+1 − xν

2

)x.

An important aspect when choosing the local basis of a finite element is the globalcontinuity requirement coming from the fact that Vh ⊂ V . Indeed a function withdiscontinuities is not in H1, this is why we need to choose Vh as a subset of C0([a, b]). Inorder to make this requirement easy to implement in practice it is convenient to definethe basis of Pk([xν , xν+1]) as being defined by its value at k + 1 points in [xν , xν+1],including the endpoints of the interval xν and xν+1. Such a basis is called a nodal basisand the naturally associated basis functions are the Lagrange basis functions.

33

Page 35: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

So the subspace Vh on the mesh x0 < x1 < · · · < xN is defined by

Vh =vh ∈ C0([a, b]) | vh|[xν ,xν+1] ∈ Pk([xν , xν+1])

.

As an affine mapping maps polynomials of degree k to polynomials of degree k, thebasis can be defined on the reference element [−1, 1]. Given k + 1 interpolation points−1 = y0 < y1 < · · · < yk = 1 the Lagrange basis functions of degree k denoted by lk,i,0 ≤ i ≤ k, are the unique polynomials of degree k verifying lk,i(yj) = δi,j . Because of this

property, any polynomial p(x) ∈ Pk([−1, 1]) can be expressed as p(x) =∑k

j=0 p(yj)lj,k(x)and conversely any polynomial p(x) ∈ Pk([−1, 1]) is uniquely determined by its valuesat the interpolation points yj , 0 ≤ j ≤ k. Hence in order to ensure the continuityof the piecewise polynomial at the cell interface xν it is enough that the values of thepolynomials on both sides of xν have the same value at xν . This constraint removesone degree of freedom in each cell, moreover the two end points are known for Dirichletboundary conditions, which removes two other degrees of freedom so that the totaldimension of Vh is Nk − 1 and the functions of Vh are uniquely defined in each cellby their value at the degrees of freedom (which are the interpolation points) in all thecells. The basis functions denoted of Vh denoted by (ϕi)0≤j≤Nk−1 are such that theirrestriction on each cell is a Lagrange basis function.

Note that for k = 1, corresponding to P1 finite elements, the degrees of freedom arejust the grid points. For higher order finite elements internal degrees of freedom areneeded. For stability and conveniency issues this are most commonly taken to be theGauss-Lobatto points on each cell. We are now ready to assemble the linear system

The discrete variational problem in 1D reads: Find uh ∈ Vh such that∫ b

a

duhdx

dvhdx

dx =

∫ b

af(x)vh(x) dx ∀vh ∈ Vh.

Now expressing uh (and vh) in the basis of Vh as uh(x) =∑Nk−1

j=1 uj(t)ϕj(x), vh(x) =∑Nk−1j=1 vjϕj(x) and plugging these expression in the variational formulation, denoting

by U = (u1, · · · , uNk−1)> and similarly for V yields: Find U ∈ RNk−1 such that

∑i,j

ujvi

∫ b

a

∂ϕi(x)

∂x

∂ϕj(x)

∂xdx =

∑i,j

vi

∫ b

af(x)ϕi(x) dx ∀V ∈ RNk−1,

which can be expressed in matrix form

V >AU = V >b ∀V ∈ Rnk,

which is equivalent toAU = b

where the square (Nk − 1)× (Nk − 1) matrix A and right hand side b are defined by

A = (

∫ L

0

dϕi(x)

dx

dϕj(x)

dxdx)i,j , b = (

∫ L

0f(x)ϕi(x) dx)i.

Another option for computing the right-hand side and which yields the same orderof approximation is to project first the unknown f onto fh in the space Vh, then fh(x) =

34

Page 36: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

∑i fiϕi(x), and the right hand side can be approximated with b = MF , with F the

vector of components fi and the mass matrix

M = (

∫ L

0ϕi(x)ϕj(x) dx)i,j .

Note that these matrices can be computed exactly as they involve integration ofpolynomials on each cell. Moreover because the Gauss-Lobatto quadrature rule is exactfor polynomials of degree up to 2k−1, A can be computed exactly with the Gauss-Lobattoquadrature rule. Moreover, approximating the mass matrix M with the Gauss-Lobattorule introduces an error which does not decrease the order of accuracy of the scheme [4]and has the big advantage of yielding a diagonal matrix. This is what is mostly done inpractice.

Usually for Finite Elements the matricesM and A are computed from the correspond-ing elementary matrices which are obtained by change of variables onto the referenceelement [−1, 1] for each cell. So∫ L

0ϕi(x)ϕj(x) dx =

n−1∑ν=0

∫ xν+1

ϕi(x)ϕj(x) dx,

and doing the change of variable x = xν+1−xν2 x+ xν+1+xν

2 , we get∫ xν+1

ϕi(x)ϕj(x) dx =xν+1 − xν

2

∫ 1

−1ϕα(x)ϕβ(x) dx,

where ϕα(x) = ϕi(xν+1−xν

2 x+ xν+1+xν2 ). The local indices α on the reference element go

from 0 to k and the global numbers of the basis functions not vanishing on element νare j = kν + α. The ϕα are the Lagrange polynomials at the Gauss-Lobatto points inthe interval [−1, 1].

The mass matrix in Vh can be approximated with no loss of order of the finiteelement approximation using the Gauss-Lobatto quadrature rule. Then because theproducts ϕα(x)ϕβ(x) vanish for α 6= β at the Gauss-Lobatto points by definition of theϕα which are the Lagrange basis functions at these points, the elementary matrix M isdiagonal and we have ∫ 1

−1ϕα(x)2 dx ≈

k∑β=0

wGLβ ϕα(xβ)2 = wGLα

using the quadrature rule, where wGLα is the Gauss-Lobatto weight at Gauss-Lobattopoint (xα) ∈ [−1, 1]. So that finally M = diag(wGL0 , . . . wGLk ) is the matrix with k + 1lines and columns with the Gauss-Lobatto weights on the diagonal.

Let us now compute the elements of A. As previously we go back to the interval[−1, 1] with the change of variables x = xν+1−xν

2 x + xν+1+xν2 and we define ϕα(x) =

ϕi(xν+1−xν

2 x+ xν+1+xν2 ). Note that a global basis function ϕi associated to a grid point

has a support which overlaps two cells and is associated to two local basis functions.Thus one needs to be careful to add the two contributions as needed in the final matrix.

35

Page 37: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

We get ϕ′α(x) = xν+1−xν2 ϕ′i(

xν+1−xν2 (x+ 1) + xν). It follows that

∫ xν+1

ϕ′j(x)ϕ′i(x) dx =

∫ 1

−1

(2

xν+1 − xν

)2

ϕ′β(x)ϕ′α(x)xν+1 − xν

2dx

=2

xν+1 − xν

∫ 1

−1ϕ′β(x)ϕ′α(x) dx =

2

xν+1 − xν

k∑m=0

wGLm ϕ′β(xm)ϕ′α(xm).

As the polynomial being integrated is of degree 2(k − 1) = 2k − 2 the Gauss-Lobattoquadrature rule with k+1 points is exact for the product which is of order 2k−1. Usingthis rule ∫ 1

−1ϕ′β(x)ϕα(x) dx =

k∑m=0

wGLm ϕ′β(xm)ϕα(xm) = wGLα ϕ′β(xα),

As before, because ϕα are the Lagrange polynomials at the Gauss-Lobatto points, onlythe value at xα in the sum is one and the others are 0. On the other hand evaluatingthe derivatives of the Lagrange polynomial at the Gauss-Lobatto points at these Gauss-Lobatto points can be done using the formula

ϕ′α(xβ) =pβ/pαxβ − xα

for β 6= α and ϕ′α(xα) = −∑β 6=α

ϕ′β(xα),

where pα =∏β 6=α(xα − xβ). This formula is obtained straightforwardly by taking the

derivative of the explicit formula for the Lagrange polynomial

ϕα(x) =

∏β 6=α

(x− xβ)∏β 6=α

(xα − xβ)

and using this expression at the Gauss-Lobatto point xβ 6= xα. We refer to [1] for adetailed description.

This can be extended via Kronecker product to tensor product meshes in 2D or 3Dor more.

3.4.4 Formal definition of a Finite Element

Let (K,P,Σ) be a triple(i) K is a closed subset of Rn of non empty interior,(ii) P is a finite dimensional vector space of function defined on K,(iii) Σ is a set of linear forms on P of finite cardinal N , Σ = σ1, . . . , σN.

Definition 3 Σ is said to be P -unisolvent if for any N -tuple (α1, . . . , αN ), there existsa unique element p ∈ P such that σi(p) = αi pour i = 1, . . . , N .

Definition 4 The triple (K,P,Σ) of Rn is called Finite Element of Rn if it satisfies(i), (ii) and (iii) and if Σ is P -unisolvent.

36

Page 38: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Example 1: Pk in 1D. Let a, b ∈ R, a < b. Let K = [a, b], P = Pk the set ofpolynomials of degree k on [a, b], Σ = σ0, . . . , σk, where a = x0 < x1 < · · · < xk = bare distinct points and

σk : P → R,p 7→ p(xi).

Moreover Σ is P -unisolvant as for k distinct values (α0, . . . , αk) there exists a uniquepolynomial p ∈ P such that p(xi) = αi, 0 ≤ i ≤ k. This corresponds to the Lagrangeinterpolation problem, which has a unique solution.

Example 2: Pk in 2D. For 3 non aligned points a, b, and c in R2 let K be the triangledefined by a, b and c. Let P = Pk be the vector space of polynomials of degree k in 2D

Pk = Span(xαyβ), (α, β) ∈ N2, 0 ≤ α+ β ≤ k.

Σ is defined by the point values at (k+1)(k+2)2 points such that the Lagrange interpolation

problem at these points is well defined.

Example 3: Qk in 2D. For 4 points a, b, c and d in R2 such that not 3 of them arealign let K be the quadrangle defined by a, b, c and d. Let P = Pk be the vector spaceof polynomials of degree k in 2D

Qk = Span(xαyβ), (α, β) ∈ N2, 0 ≤ α, β ≤ k.

Σ is defined by the point values at (k + 1)2 points on a lattice.

We also end up with a total of 6 basis functions, with each basis having a value 1 at its assigned node and avalue of zero at all the other mesh nodes in the element.

Again this has the form

so we can easily determine the coefficients of all 6 basis functions in the quadratic case by inverting the matrixM. Each column of the inverted matrix is a set of coefficients for a basis function.

P3 Cubic ElementsP3 Cubic Elements

In the case of cubic finite elements, the basis functions are cubic polynomials of degree 3 with the designationP3

We now have 10 unknowns so we need a total of 10 node points on the triangle element to determine thecoefficients of the basis functions in the same manner as the P2 case.

Experiment 1Experiment 1In this experiment we will solve Poisson’s equation over a square region using Finite Elements with linear,quadratic and cubic elements and compare the results. We will solve

Similarly, here are the interpolation functions of the nine-node Lagrange element. The nodes in the x-direction are placed at x = , x = 0, and x

= while the the nodes in the y-direction are at y = , y = 0, and y = .

In[28]:=Transpose[HermiteElement1D[-L1,0,L1,0,x]].HermiteElement1D[-L2,0,L2,0,y]

Out[28]=

However, the situation becomes more complicated when you consider the elements whose nodes are not equally spaced in a grid. For example,

you cannot generate the shape functions for triangular elements or the rectangular elements with irregular node locations by using the above

tensor product approach. Here are two examples in which the interpolation functions cannot be generated.

In[29]:=p1=ElementPlot[1,-1,-1,-1,0,3/2,0,0, AspectRatio->1, Axes->True, PlotRange->-2,2,-2,2, NodeColor->RGBColor[0,0,1], DisplayFunction->Identity];

In[30]:=p2=ElementPlot[1,1,1,-1,-1,-1,-1,1,0,0, AspectRatio->1, Axes->True, PlotRange->-2,2,-2,2, NodeColor->RGBColor[0,0,1], DisplayFunction->Identity];

In[31]:=

5.3.2 Triangular Elements

Use the functions TriangularCompleteness, RectangularCompleteness, and ShapeFunction2D to generate interpolation

functions for triangular and general rectangular elements.

First, consider the triangular element with four nodal points and obtain a set of Lagrange-type shape functions, namely c = 0. Do not specify the

minimum number of symmetric terms to be dropped from the full polynomial.

Figure 3.3: (Left) P3 Finite Element, (Right) Q2 Finite Element

3.4.5 Convergence of the Finite Element method

The variational problems we consider can be written in the following abstract formFind u ∈ V such that

a(u, v) = l(v) ∀v ∈ V, (3.34)

where V is a Hilbert space, a is a symmetric continuous and coercive bilinear form andl a continuous linear form.

The most convenient tool for provient existence and uniqueness of the solution of avariational problem is the Lax-Milgram theorem that we recall here:

37

Page 39: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Theorem 1 (Lax-Milgram) Let V a Hilbert space with the norm ‖.‖V . Let a(., .)continuous, symmetric and coercive bilinear form on V × V , i.e.

1. (Continuity): there exists C such that for all u, v ∈ V

|a(u, v)| ≤ C‖u‖V ‖v‖V .

2. (Coercivity): there exists a constant α > 0 such that for all u ∈ V

a(u, u) > α‖u‖2V .

Let l(.) a continuous linear form on V , i.e. there exists C such that for all v ∈ V

|l(v)| ≤ C‖v‖V .

Then there exists a unique u ∈ V such that

a(u, v) = l(v) ∀v ∈ V.

The Ritz-Galerkin method consists in finding an approximate solution uh in a finitedimensional subspace of V . For convergence studies one needs to consider a sequence ofsubspaces of V of larger and larger dimension so that they get closer to V . One thendefines a sequence of problems parametrised by h that read :Find uh ∈ Vh such that

a(uh, vh) = l(vh) ∀vh ∈ Vh, (3.35)

where Vh ⊂ V is a vector space of dimension N . Let (ϕ1, . . . , ϕN ) a basis of Vh. Anelement uh ∈ Vh can then be expanded as uh(x) =

∑Nj=1 ujϕj(x). Taking vh = ϕi the

equation (3.35) becomes using the linearity

N∑j=1

uja(ϕj , ϕi) = l(ϕi).

Then using the symmetry of a, we notice that the discrete variational formulation(3.35)is equivalent to the linear system

AUh = L, (3.36)

where A = (a(ϕi, ϕj))1≤i,j≤N , L is the column vector with components l(ϕi) and Uis the column vector with the unknowns ui that are the coefficients of uh in the basis(ϕ1, . . . , ϕN ).

Theorem 2 Assume that a is a symmetric continuous and coercive bilinear form ona Hilbert space V and l a continuous linear form on V . Then the system (3.36) isequivalent to the discrete variational form (3.35) and admits a unique solution

Proof. For vh ∈ Vh, we denote by V the vector of its components in the basis(ϕ1, . . . , ϕN ).

• Thanks to the bilinearity of a and the linearity of l the relation (3.35) can bewritten equivalently

tV AUh = tV L ∀V ∈ RN , (3.37)

which means that the vector AUh−L ∈ RN is orthogonal to all the vectors of RN ,and so is the zero vector. Conversely it is clear that (3.36) implies (3.37) and so(3.35).

38

Page 40: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

• Let vh ∈ Vh. Then, as a is coercive, there exists α > 0 such that

tV AV = a(vh, vh) ≥ α‖vh‖2 ≥ 0,

and tV AV = 0 = a(vh, vh) ⇒ ‖vh‖ = 0, which implies that vh = 0 and so V = 0.So A is symmetric, positive definite and therefore invertible.

After making sure the approximate solution exists for some given space Vh, oneneeds to make sure the approximation converges towards the exact solution. This resultsfrom two properties: 1) The Galerkin orthogonality, which comes from the conformingGakerkin approximation, 2) The approximability property, which confirms that for anyv ∈ V there exist vh in some finite dimensional space of the family which is close enoughto v.

Lemma 2 (Cea) Let u ∈ V the solution of (3.34) and uh ∈ Vh the solution of (3.35),with Vh ⊂ V . Then

‖u− uh‖ ≤ C infv∈Vh‖u− v‖.

Proof. We have

a(u, v) = l(v) ∀v ∈ V,a(uh, vh) = l(vh) ∀vh ∈ Vh,

as Vh ⊂ V , we can take v = vh in the first equality and take the difference which yields

a(u− uh, vh) = 0 ∀vh ∈ Vh.

It results that a(u − uh, u − uh) = a(u − uh, u − vh + vh − uh) = a(u − uh, u − vh), asvh − uh ∈ Vh and so a(u− uh, vh − uh) = 0. Then there exists α > 0 and β such that

α‖u− uh‖2 ≤ a(u− uh, u− uh) as a is coercive,

≤ a(u− uh, u− vh) ∀vh ∈ Vh,≤ β‖u− uh‖‖u− vh‖ as a is continuous.

Whence ‖u − uh‖ ≤ βα‖u − vh‖ for all vh ∈ Vh. We get the desired results taking the

infimum in Vh.

For the global error estimates, we make the following hypotheses on the triangulationTh:

(H1) We assume that the family of triangulations is regular in the following sense:

(i) There existes a constant σ such that

∀K ∈ ∪hThhKρK≤ σ.

(ii) The quantity h = maxK∈h

hK tend to 0.

39

Page 41: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

(H2) All finite elements (K,P,Σ), K ∈ ∪hTh are affine equivalent to a unique referenceelement (K, P , Σ).

(H3) All finite elements (K,P,Σ), K ∈ ∪hTh are of class C0.

Theorem 3 We assume the hypotheses (H1), (H2) and (H3) are verified. Moreover weassume that there exists an integer k ≥ 1 such that

Pk ⊂ P ⊂ H1(K),

Hk+1(K) ⊂ C0(K) (true if k + 1 >n

2).

Then there exists a constant C independent of h such that for any function v ∈ Hk+1(Ω)we have

‖v − πhv‖k+1 ≤ Chk|v|k+1,Ω,

where πh is the finite element interpolation operator defined by

πhv =

N∑i=1

v(xi) pi.

We consider a variational problem posed in V ⊂ H1(Ω).

Theorem 4 We assume that (H1), (H2) and (H3) are verified. Moreover we assumethat there exists an integer k ≥ 1 such that k + 1 > n

2 with Pk(K) ⊂ P ⊂ H1(K) andthat the exact solution of the variational problem is in Hk+1(Ω), then

‖u− uh‖1,Ω ≤ Chk|u|k+1,Ω,

where uh ∈ Vh is the discrete solution.

Proof. We have because of the polynomial approximation theorem

‖u− πhu‖1,Ω ≤ Chk|u|k+1,Ω.

On the other hand Cea’s lemma gives us

‖u− uh‖1,Ω ≤ C infvh∈Vh

‖u− vh‖1,Ω ≤ C‖u− πhu‖1,Ω.

The result follows.

3.5 The spectral method

For approximating a linear PDE with constant coefficients on a periodic domain theFFT is the simplest and often fastest method. If the solution is smooth it providesmoreover spectral convergence, which means that it converges faster than a polynomialapproximation of any order, so that very good accuracy can be obtained with relativelyfew points. The exact number depends of course on the variation of the solution. Letus explain how this works for the Poisson equation on a periodic domain that we shallneed for our simulations.

40

Page 42: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Consider the Poisson equation −∆φ = ρ on a periodic domain of R3 of periodL1, L2, L3 in each direction. The solution is uniquely defined provided we assume thatthe integral of φ on one period vanishes.

We look for an approximation of φ in the form of a truncated Fourier series

φh(x1, x2, x3) =

N1/2−1∑k1=−N1/2

N2/2−1∑k2=−N2/2

N3/2−1∑k3=−N3/2

φk1,k2,k3eik·x,

where we denote by k = (2πk1/L1, 2πk2/L2, 2πk3/L3) and by x = (x1, x2, x3).

Remark 3 Note that in principle, it would be natural to truncate the Fourier series in asymmetric way around the origin, i.e. from −N/2 to N/2. However, because the FFT ismost efficient when the number of points is a power of 2, we need to use an even numberof points which leads to the truncation we use here. See Canuto, Hussaini, Quarteroniand Zang for more details [3].

We assume the same decomposition for ρh. Then taking explicitly the Laplace of φhwe get

−∆φh(x1, x2, x3) =

N1/2−1∑k1=−N1/2

N2/2−1∑k2=−N2/2

N3/2−1∑k3=−N3/2

|k|2φk1,k2,k3eik·x.

Then using the collocation principle, we identify this expression with that of ρh at thediscretisation points j = (j1L1/N1, j2L2/N2, j3L3/N3) with 0 ≤ ji ≤ Ni − 1:∑

k1,k2,k3

|k|2φk1,k2,k3eik·j =

∑k1,k2,k3

ρk1,k2,k3eik·j.

Then as the (eik·j)(k1,k2,k3) form a basis of RN1 ×RN2 ×RN2 we can identify the coeffi-cients, so that we have a simple expression of the Fourier coefficients of φh with respectto those of ρh for |k| 6= 0:

φk1,k2,k3 =ρk1,k2,k3

|k|2, −Ni/2 ≤ ki ≤ Ni/2− 1,

and because we have assumed that the integral of φ is 0, we have in addition φ0,0,0 = 0.Now, to complete the algorithm, we shall describe how these coefficients can be

computed from the grid values by a 3D discrete Fourier transform.In 1D, φk is defined by φk = 1√

N

∑N−1i=0 φie

2iπjk/N from which it is easy to see

that φk+lN = φk for any integer l. So after having computed φk using a Fast FourierTransform for 0 ≤ k ≤ N − 1 we get the negative coefficients φk for −N/2 ≤ k ≤ −1from the known coefficients by the relation φk = φk+N . Finally to go to the 3D case,it is enough to see that the 3D discrete Fourier transform is nothing but a series of 1Dtransforms in each direction.

Remark 4 In order to compute the electric field E = −∇φ in the pseudo-spectral ap-proximation, we just multiply each mode φk1,k2,k3 by the corresponding ik. Beware how-ever, that because we use an unsymmetric truncated Fourier series, the mode −N/2 ofthe electric field needs to be set to 0 in order to get back a real electric field by inverseFourier transform. Indeed for a real field (uj)0≤j≤N−1, the corresponding N/2 mode is

41

Page 43: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

∑N−1j=0 (−1)juj which is real. Hence, as ρ and then φ are real, their corresponding N/2

mode is real, and thus the same mode for E would be purely imaginary and not realunless it is 0. Note that setting this mode to 0 introduces an additional error of theorder of truncation error of the series, and thus is acceptable.

42

Page 44: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Chapter 4

Fluid models

The aim of this chapter is to introduce the main numerical methods, finite differences,finite volumes and stabilised finite elements, used for solving the fluid models of plasmaphysics. We shall concentrate on a simple 1D model for isothermal electrons and station-ary ions. Moreover the numerical methods will be first explained on the model problemof 1D advection diffusion with constant advection and diffusion coefficients.

4.1 An isothermal Euler-Poisson model

4.1.1 The model

For simplicity, we consider here only the 1D case. Our computational domain will thenbe the interval [0, L], with periodic boundary conditions. Due to their much larger mass,on small time scales on can assume that the ions do no move. They are then characterisedby their density n0. The electrons are characterised by their density n(t, x) and averagevelocity u(t, x). Their temperature T is assumed to be uniform and constant. Their massis denoted by m and their charge by −e. Due to the global neutrality of the plasma,assuming singly charged ions, ∫ L

0n(t, x) dx = Ln0.

Moreover, electron density and average velocity obey the conservation of mass equation(2.9)

∂n

∂t+∂nu

∂x= 0, (4.1)

and the conservation of momentum equation (2.10) along with the isothermal pressurelaw p = nT (note that in most plasma physics textbooks an adiabatic pressure law,which reads ∂xp = γT∂xn with γ = 3 in 1D, is used)

∂(nu)

∂t+∂(nu2)

∂x+T

m

∂n

∂x+

e

mnE = 0. (4.2)

We assume in addition that the magnetic field can be neglected and that the electricfield is given by Poisson’s equation

− d2φ

dx2=

e

ε0(n0 − n), E(t, x) = − dφ

dx. (4.3)

43

Page 45: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

These completely characterise the unknowns, along with initial and boundary conditions,as the temperature is given. Else the conservation of energy equation would also beneeded, but this does not add any new difficulty for the numerical simulation.

Let us now check that the model is conservative, in the sense that it conserves exactlythe number of particles

∫ L0 n(t, x) dx and also

∫ L0 n(t, x)u(t, x) dx in time. Integrating

(4.1) over one period [0, L] immediately yields

d

dt

∫ L

0n(t, x) dx = 0.

Then, integrating (4.2) over one period [0, L] yields

d

dt

∫ L

0n(t, x)u(t, x) dx+

e

m

∫ L

0nE dx = 0.

One the other hand multiplication the Poisson equation by E and integrating yields∫ L

0E

dE

dxdx =

1

2

∫ L

0

dE2

dxdx = 0 =

e

ε0

∫ L

0(n0 − n)E dx = − e

ε0

∫ L

0nE dx

as E = − dφdx . If follows that

∫ L0 nE dx = 0 and then the conservation property

d

dt

∫ L

0n(t, x)u(t, x) dx = 0.

4.1.2 Study of the linearised equations

In order to understand the linear behaviour of the model and also to get a verificationtest for our codes, we shall perform a linear analysis of this model. Let us for thislinearise the model around a constant steady state, assuming

n(t, x) = n0 + εn1(t, x), u(t, x) = u0 + εu1(t, x) with u0 = 0.

Performing the same expansion for the electrostatic potential and the electric field, wefollows from Poisson’s equation (4.3), identifying the terms of same order in ε that E0 = 0and

− d2φ1

dx2= − e

ε0n1, E1(t, x) = − dφ1

dx.

Then, plugging these expressions into our equations (4.1)-(4.2), we get

ε∂n1

∂t+ εn0

∂u1

∂x+ ε2

∂(n1u1)

∂x= 0,

εn0∂u1

∂t+ ε2

∂(n1u1)

∂x+ ε2

∂(n0u21)

∂x+ ε3

∂(n1u21)

∂x+ ε

T

m

∂n1

∂x+ ε

e

mn0E1 + ε2

e

mn1E1 = 0.

Now, dividing these equations by ε and letting ε go to zero, we get the linearised equations

∂n1

∂t+ n0

∂u1

∂x= 0, (4.4)

n0∂u1

∂t+T

m

∂n1

∂x+

e

mn0E1 = 0, (4.5)

44

Page 46: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

that are coupled to the Poisson equation

− d2φ1

dx2= − e

ε0n1, E1(t, x) = − dφ1

dx. (4.6)

These linearised equations can be exactly solved by performing a Fourier expansion inspace and time, assuming also time periodic solutions. This amounts to looking forsolutions of the form nke

i(kx+ωt), ukei(kx+ωt). We assume here for simplicity that the

length of the computational domain is L = 2π. We then get

ωnk + n0kuk = 0, (4.7)

iωn0uk +T

miknk +

e

mn0Ek = 0, (4.8)

and Poisson’s equations becomes

ikEk = − e

ε0nk.

Plugging this into (4.8), we get

ωn0uk +T

mknk +

e2n0

mε0

nkk

= 0.

Introducing the electron plasma frequency ωp =√e2n0/(nε0), and the electron thermal

velocity vth =√T/m, we get the following two equations relating nk and uk.

ωnk + n0kuk = 0, (4.9)

(ω2p + v2

thk2)nk + ωn0kuk = 0, (4.10)

which has non trivial solution only if the determinant of the 2× 2 matrix associated tothe system is zero, which yields

n0k(ω2 − (ω2p + v2

thk2)) = 0

As the average of n1 and u1 is zero, this relation is empty for k = 0, then as n0 6= 0, fork 6= 0 this yields the so-called dispersion relation

ω2 = ω2p + v2

thk2. (4.11)

This corresponds to the plasma oscillations or Langmuir waves. Replacing the isothermalpressure law by the adiabatic pressure law, one gets the more familiar dispersion relation

ω2 = ω2p + 3v2

thk2.

4.1.3 Hyperbolicity

Numerical methods are designed for and adapted to the different classes of PDE’s:

• Elliptic PDE’s are in general steady state equations which satisfy some coercivityproperty, the prototype of which is the Poisson equation

−∆φ = f

45

Page 47: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

• Parabolic equation are first order in time, with an elliptic differential operator inspace, the prototype is the heat equation

∂u

∂t−∆u = 0.

• Hyperbolic equation are either first order transport equation, with advection as aprototype

∂u

∂t+ a · ∇u = 0,

or second order PDEs with the wave equation as a prototype

∂2u

∂t2−∆u = 0.

The Euler system is a first order non linear transport equation, which falls intothe important category of hyperbolic systems of conservation laws, which have theabstract form

∂u

∂t+∂F(u)

∂x= 0,

where u is a vector of unknown values. This can be written also

∂u

∂t+A(u)

∂u

∂x= 0,

where A(u) is the Jacobian matrix with components ((∂Fi∂uj))i,j . The system is called

hyperbolic if for all u the matrix A has only real eigenvalues and is diagonalisable.It is called strictly hyperbolic if all eigenvalues are distinct.

Let us write our isothermal Euler-Poisson equations as a hyperbolic system, thecoupling term between Euler and Poisson being handled as a source term. For thisit is important to work with the conserved variables n and nu and not with thenatural physical variables n and u. So our vector of unknowns u and flux F(u) are

u =

(nnu

)=

(u1

u2

), F(u) =

(nu

nu2 + Tmn

)=

(u2

u22/u1 + T

mu1

).

Then we can compute the jacobian matrix of the flux

A(u) =

(0 1

−u22/u

21 + T

m 2u2/u1

)=

(0 1

−u2 + v2th 2u

).

In order to check that the corresponding system is hyperbolic we need to computethe eigenvalues of A(u). They are the solutions λ of det(λI−A(u)) = 0:

−λ(2u− λ)− (v2th − u2) = 0.

Grouping the terms of same degree yields the quadratic equation

λ2 − 2uλ− (v2th − u2) = 0.

The discriminant is ∆ = 12v2th ≥ 0, so that the matrix has only real eigenvalues,

which areλ1 = u+ vth, λ2 = u− vth.

46

Page 48: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

4.2 A model problem - 1D advection

The Euler-Poisson system is a 1D hyperbolic-elliptic system. We have already seen howto deal with the elliptic Poisson equation, let us now investigate numerical methods forhyperbolic problems on the simplest example, which is the 1D advection equation, in aperiodic domain.

∂u

∂t+ a

∂u

∂x= 0 pour x ∈ [0, L], t ≥ 0. (4.12)

Let us assume for simplicity that the boundary conditions are periodic. This means thatu and all its derivatives are periodic of period L. We have in particular u(0) = u(L). Theconstant a is given. As the problem is time dependent, we also need an initial conditionu(x, 0) = u0(x).

4.2.1 Obtaining a Finite Difference scheme

We first consider a uniform mesh of the 1D computational domain, i.e. of the interval[a, b] where we want to compute the solution, see Figure 4.1. The cell size or space step

. .

0 L

x1x0 x2 xNxN−1

Figure 4.1: Uniform mesh of [a, b]

is defined by ∆x = LN where N is the number of cells in the mesh. The coordinates of

the grid points are then defined by xi = x0 + i∆x. We then need a time step ∆t and wewill compute approximations of the solution at discrete times tn = n∆t, n ∈ N. As weassume the solution to be periodic of period L it will be defined by its values at xi for0 ≤ i ≤ N − 1 and we shall have u(xN , tn) = u(x0, tn).

We shall denote by unj = u(xj , tn).

4.2.2 The first order explicit upwind scheme

A Finite Difference scheme is classically obtained by approximating the derivatives ap-pearing in the partial differential equation by a Taylor expansion up to some given orderwhich will give the order of the scheme. As we know only the values of the unknownfunction at the grid points, we use Taylor expansions at different grid points and linearlycombine them so as to eliminate all derivatives up to the needed order.

The same can be done for the time discretisation. For an approximation of order 1in space and time, we can simply write

∂u

∂t(xj , tn) =

u(xj , tn+1)− u(xj , tn)

∆t+O(∆t), (4.13)

∂u

∂x(xj , tn) =

u(xj , tn)− u(xj−1, tn)

∆x+O(∆x). (4.14)

47

Page 49: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Denoting by unj , the approximation of the solution at point xj and time tn and usingthe above formulas for the approximation of the partial derivatives we get the followingapproximation (4.12) at point xj and time tn:

un+1j − unj

∆t+ a

unj − unj−1

∆x= 0. (4.15)

We thus obtain the following explicit formula which enables to compute un+1j in function

of the values of u at time tn and points xj−1, xj and xj−1:

un+1j = unj − a

∆t

∆x(unj − unj−1). (4.16)

Denote by Un the vector of RN whose components are un0 , . . . , unN−1 and

A =

(1− a∆t

∆x ) 0 a∆t∆x

a∆t∆x

. . .. . .

. . .. . . 0

0 a∆t∆x (1− a∆t

∆x )

.

The terms at the end of the first line comes from the periodic boundary conditions. Weuse that un−1 = unN−1 and unN = un0 . Except on the two diagonals all the terms vanish.

So, with this matrix A and denoting the unknown at time tn Un = (un0 , . . . , u

nN−1)> the

scheme (4.16) can be written in matrix form

Un+1 = AUn.

4.2.3 The first order upwind implicit scheme

When using an uncentered difference scheme in the other direction for the time derivative,we get

∂u

∂t(xj , tn) =

u(xj , tn)− u(xj , tn−1)

∆t+O(∆t), (4.17)

We use the same finite difference approximation for the space derivative. We then getthe following formula

unj + a∆t

∆x(unj − unj−1) = un−1

j . (4.18)

In this case the unj are defined implicitly from the un−1j as solutions of a linear system.

This is why this scheme is called implicit.Denote by B the matrix of the linear system:

B =

(1 + a∆t

∆x ) 0 −a∆t∆x

−a∆t∆x

. . .. . .

. . .. . . 0

0 −a∆t∆x (1 + a∆t

∆x )

.

The term at the end of the first line comes from the periodic boundary conditions. Weuse that un−1 = unN−1 and unN = un0 . The terms not on the two diagonals vanish.

Going now from time step n to n+ 1 the implicit scheme in matrix form becomes

BUn+1 = Un.

48

Page 50: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

4.2.4 The explicit downwind and centred schemes

Rather than using an upwind approximation of the ∂xu(xj), one could in principle alsouse either downwind or centred finite difference schemes. These read respectively

∂u

∂x(xj , tn) =

u(xj+1, tn)− u(xj , tn)

∆x+O(∆x),

for a positive a and

∂u

∂x(xj , tn) =

u(xj+1, tn)− u(xj−1, tn)

2∆x+O(∆x2).

This one is the same for positive and negative a, and is of second order in x.Both those schemes are consistent as they derive from a Taylor approximation, but

they cannot be used in practice because they are unstable. The update matrices of thesescheme, for a first order explicit method in time read respectively

Adown =

(1 + a∆t

∆x ) −a∆t∆x 0

0. . .

. . .. . .

. . . −a∆t∆x

−a∆t∆x 0 (1 + a∆t

∆x )

, Acen =

1 − a∆t

2∆xa∆t2∆x

a∆t2∆x

. . .. . .

. . .. . . −a∆t

∆x

− a∆t2∆x + a∆t

2∆x 1

.

(4.19)

4.2.5 Stability and convergence

As for steady-state problems, a scheme is consistent if the exact solution verifies it upto some power in ∆x and ∆t, which is called the order of consistency in space and timerespectively. Stability is defined in the following way:

Definition 5 A numerical scheme for a time dependent problem is called stable for somegiven norm ‖.‖ if there exist constants K and τ independent of ∆t such that

‖Un‖ ≤ K‖U0‖ ∀∆t such that 0 < ∆t < τ.

Theorem 5 (Lax) A linear scheme is convergent if it is stable and consistent.

Let us now check the stability in the L2 norm of our three explicit schemes (upwind,downwind and centred). A useful tool to do this, for periodic boundary conditions iscalled the von Neumann stability analysis. Due to the fact that the discrete Fouriertransform conserves the L2 norm because of the discrete Plancherel inequality and thatit diagonalises the Finite Difference operators (provided the original PDE has constantcoefficients), it is particularly well adapted for studying the L2 stability. The von Neu-mann analysis consists in applying the discrete Fourier transform to the discretisedequation. This is equivalent to using the theory of circulant matrices and checking thatthe modulus of all eigenvalues is smaller that 1. Using the formula of the eigenvalues ofour update matrices, we find denoting by ξ = 2πk/N for the upwind scheme

λk = 1− a∆t

∆x+a∆t

∆xe−

2iπkN = 1− a∆t

∆x(1− cos ξ − i sin ξ),

49

Page 51: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

so that

|λk|2 = (1− a∆t

∆x(1− cos ξ))2 +

a2∆t2

∆x2sin2 ξ,

= 1− 2a∆t

∆x(1− cos ξ) +

a2∆t2

∆x2(1− 2 cos ξ + cos2 ξ) +

a2∆t2

∆x2sin2 ξ,

= 1− 2a∆t

∆x

(1− a∆t

∆x

)(1− cos ξ).

If 0 ≤ a∆t/∆x ≤ 1 all the factors in the second term are positive, so that |λk| ≤ 1. Hencewe find that the first order explicit upwind scheme is stable provided a∆t/∆x ≤ 1. Thisis a condition on the time step for a given spatial mesh. This condition is the well-knownCourant-Friedrichs-Lewy (CFL) condition.

For the downwind scheme

λk = 1 +a∆t

∆x− a∆t

∆xe

2iπkN ⇒ λN/2 = 1 + 2

a∆t

∆x> 1,

for k = N/2 so that the scheme is unstable. And for the centred scheme

λk = 1 +a∆t

2∆x(e

2iπkN − e

−2iπkN ) = 1 + i

a∆t

∆xsin ξ,

which implies obviously that |λk| > 1 whenever sin ξ 6= 0, so that this scheme is alsounstable.

One can check similarly that all the corresponding first order in time implicit schemeare stable.

4.3 The Finite Volume method

4.3.1 The first order Finite Volume schemes

Let us introduce the Finite Volume method on the generic scalar conservation law of theform

∂u

∂t+∂f(u)

∂x= 0. (4.20)

In the case of our linear advection equation, we have f(u) = au.In the Finite Volume method, the computational domain is divided into cells (inter-

vals in 1D) and the unknown quantity that is numerically computed is the cell averageof u on each cell. Recall that for Finite Differences the unknowns were the point valuesof u at the grid points. We need to number the cells. In 1D a convenient way to do itin order to avoid confusion with the grid points, is to assign half integers. Let us denoteby

ui+ 12(t) =

1

xi+1 − xi

∫ xi+1

xi

u(t, x) dx.

The Finite Volume numerical scheme is then obtained by integrating the originalequation on each cell of the domain. As for the time scheme there are at least twoclassical ways, the first is to also integrate in time between tn and tn+1 and then use aquadrature formula to compute the integral, for example, the left hand rectangle ruleyields a first order explicit formula. The second is to use the method of lines and separate

50

Page 52: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

space discretisation from time discretisation. Then standard ODE discretisation schemescan be used. This is what we shall do mostly in this lecture.

So integrating (4.20) on the cell [xi, xi+1] and dividing by ∆xi+ 12

= xi+1 − xi yields

dui+ 12(t)

dt+

1

∆xi+ 12

(f(u(t, xi+1))− f(u(t, xi))) = 0.

Here we see that a second ingredient is needed in order to define the algorithm. Weonly know the cell averages of u, how do we define the value at u at the cell interfaces.The simplest scheme, which is first order accurate in space consists in assuming thatu is constant on each cell and thus equal to its cell average. But it is not defined atthe cell interface. In order to complete the Finite Volume scheme we need to define aso called numerical flux at each cell interface denoted by gi that needs to be consistentwith f(xi), i.e. gi = f(u(xi)) + O(∆xp) for some positive p. A numerical flux of order2 is the centred flux gi = 1

2(f(ui− 12) + f(ui+ 1

2)). This yields the following scheme for a

uniform ∆x:dui+ 1

2(t)

dt+

(f(ui+ 32)− f(ui− 1

2))

2∆x= 0.

Coupling it with an explicit Euler scheme in time this becomes, and applying it to thelinear advection (f(u) = au) we get

un+1i+ 1

2

= uni+ 1

2

− a∆t

2∆x(ui+ 3

2− ui− 1

2). (4.21)

We recognise here the centred Finite Difference scheme shifted to the cell centres. Re-member that this scheme is unstable, so that it cannot be used in practice. In orderto get a stable scheme, we need to introduce the notion of upwinding like for FiniteDifferences. This can be done very easily in the definition of the numerical flux by sim-ply choosing the value of u in the upwind cell only to define the numerical flux. Wehave ∂f(u)

∂x = f ′(u)∂u∂x . This means that locally at each cell interface the direction of thetransport is defined by the sign of f ′(u) (in the case of the linear advection f ′(u) = aand the upwind direction is determined by the sign of a). So the upwind numerical fluxis defined by

gi =

∣∣∣∣∣∣ f(ui− 12) if f ′(

ui− 1

2+u

i+ 12

2 ) ≥ 0

f(ui+ 12) if f ′(

ui− 1

2+u

i+ 12

2 ) < 0

Again, combining the Finite Volume scheme with an upwind flux and an explicit Eulertime discretisation yields for the linear advection with a > 0

un+1i+ 1

2

= uni+ 1

2

− a∆t

∆x(uni+ 1

2

− uni− 1

2

). (4.22)

We also recognise here the first order in time and space upwind scheme shifted to thecell centres.

Remark 5 Using the midpoint rule

ui+ 12

=1

∆x

∫ xi+1

xi

u(x) dx = u(xi+ 12) +O(∆x2).

51

Page 53: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Then we can reinterpret the Finite Volume as a Finite Difference scheme at the cellcentres, which explains that we get the same formulas. However this is not true forhigher orders, for which Finite Volume and Finite Difference schemes are genuinelydifferent.

4.3.2 Higher order schemes

In order to get high order Finite Volume schemes, the idea is to reconstruct polynomialsof some given degree from the cell averages that are obtained with the Finite Volumeprocedure. The main idea for doing this is to construct an interpolation polynomial forthe primitive of the polynomial we are looking for.

At time step tn we know unj+ 1

2

known average value of un on cell [xj , xj+1] of length

∆xj+ 12

= xj+1 − xj . We want to construct a polynomial pm(x) of degree m such that

1

∆xj+ 12

∫ xj+1

xj

pm(x) dx = unj+ 1

2

.

To this aim we look for pm(x) such that ddx pm(x) = pm(x). Then

∆xj+ 12unj+ 1

2

=

∫ xj+1

xj

pm(x) dx = pm(xj+1)− pm(xj).

Let W (x) =∫ xx0un(x) dx a primitive of the piecewise constant function un with value

unj+ 1

2

on [xj , xj+1]. Then W (xj+1) =∑j

k=1 hk+ 12unk+ 1

2

and

W (xj+1)−W (xj) = ∆xj+ 12unj+ 1

2

= pm(xj+1)− pm(xj).

Then we take for pm an interpolating polynomial at points xj of W so that

1

∆xj+ 12

∫ xj+1

xj

pm(x) dx =1

∆xj+ 12

(pm(xj+1)− pm(xj))

=1

∆xj+ 12

(W (xj+1)−W (xj)) = unj+ 1

2

.

There are many ways to choose an interpolating polynomial, one could use spline in-terpolation or Hermite interpolation, but the simplest and most used choice is to use aLagrange interpolation polynomial. This being said, a Lagrange interpolating polyno-mial of degree k is defined with k + 1 interpolation points. So we need to use as manyvalues in neighbouring cells as needed.

In order to reconstruct a polynomial of a given degree in a given cell there are manypossible stencils, i.e. ensembles of cells, that can be used. For the reconstruction of apolynomial of degree k exactly k average values corresponding to k neighbouring cellsare needed. The only constraint is that the value on the cell where the polynomial beingreconstructed is used. High-order methods are prone to oscillations especially arounddiscontinuities. So one good idea is to use the stencil which minimises the oscillations.This can be easily done by choosing automatically the stencil based on the Newtondivided differences which can be used to construct the interpolating polynomial. Thismethod is called ENO (Essentially Non Oscillatory). See for example [10] for a detaileddescription.

52

Page 54: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

The ENO method can be still improved by taking all possible stencils but putting aweight on each of the polynomials obtained. This is called the WENO method (WeightedEssentially Non Oscillatory) A good review of this technique is given in [12].

4.3.3 The method of lines

It is generally more convenient to separate the space and time discretisation for a betterunderstanding. The method of lines consists in applying only a discretisation scheme inspace first (this can be Finite Differences, Finite Volumes or any other scheme). Thenone obtains a system of ordinary differential equations of the form

dU

dt= AU,

where U(t) is the vector whose components are ui(t) the unknown values at the gridpoint at any time t. Then one can use any Ordinary Differential Equation (ODE) solverfor the time discretisation. For example using an explicit Euler method with the upwindmethod in space yields the previous explicit upwind scheme and when we use an implicitEuler method we get the implicit upwind scheme.

When working with linear homogeneous equations with no source term, the simplestway to derive high order time schemes is to use a Taylor expansion in time and plug inthe expression of the successive time derivatives obtained from the differential systemresulting from the semi-discretization in space. Consider for example that after semi-discretization in space using Finite Differences (or any other space discretisation method)we obtain the differential systems

dU

dt= AU, with U =

u0(t)...

un−1(t)

,

and A the appropriate matrix coming from the semi-discretization in space. Then aTaylor expansion in time up to order p yields

U(tn+1) = U(tn) + ∆tdU

dt(tn) + · · ·+ ∆tp

p!

dpU

dtp(tn) +O(∆tp+1).

Now if A does not depend on time and dUdt = AU , we get that

dpU

dtp= ApU, for any integer p.

Hence, denoting Un an approximation of U(tn), we get a time scheme of order p usingthe formula

Un+1 = Un + ∆tAUn + · · ·+ ∆tp

p!ApUn = (I + ∆tA+ · · ·+ ∆tp

p!Ap)Un. (4.23)

For p = 1 this boils down to the standard explicit Euler scheme.Writing Un the solution in vector form at time tn, we define the propagation matrix

A such thatUn+1 = AUn.

53

Page 55: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Proposition 4 The numerical scheme defined by the propagation matrix A is stable ifthere exists τ > 0 such that for all ∆t < τ all eigenvalues of A are of modulus less orequal to 1.

Stability of Taylor schemes. For a Taylor scheme of order p applied to dUdt = AU ,

we have A = I + ∆tA + · · · + ∆tp! A

p. Then denoting by λ an eigenvalue of A, the

corresponding eigenvalue of A is µ = 1 +λ∆t+ · · ·+λp∆tp

p! . And one can plot the regionof the complex plane in which |µ(λ∆t)| ≤ 1 using for example ezplot in Matlab, whichare the stability regions. This means that the time scheme associate to the semi-discreteform dU

dt = AU is stable provided all the eigenvalues λ of A are such that λ∆t is in thestability region.

Examples.

1. The Upwind scheme: dui(t)dt = −aui(t)−ui−1(t)

∆x corresponds to the circulant matrix

A with c0 = − a∆x = −c1. So its eigenvalues verify λk∆t = −a∆t

∆x (1 − e2iπkn ).

Obviously, for any integer value of k, λk∆t is on a circle in the complex plane ofradius a∆t

∆x centred at (−a∆t∆x , 0). The stability region of the explicit Euler method

is the circle of radius 1 centred at (−1, 0), so that in this case we see again thatthe scheme is stable provided a∆t

∆x ≤ 1. For the higher order schemes the limit ofthe stability region is reached when the circle of the eigenvalues of A is tangentto the left side of the stability region. The radius corresponding to the maximalstability can thus be found by computing the second real root (in addition to 0)α of the equation |µ(λ∆t)| = 1, see Fig. 4.2. We find that for the order 2 schemeα = −2, so that the stability condition is the same as for the order 1 scheme. Forthe order 3 scheme we find that α = −2.5127 and for the order 4 scheme we findthat α = −2.7853. The value of α corresponds to the diameter of the largest circleof eigenvalues that is still completely enclosed in the stability region. This yieldsthe stability condition a∆t

∆x ≤|α|2 . We notice that the maximal stable time step is

larger for the schemes of order 3 and 4.

x

y

Maximal stability, order 2

−4 −3 −2 −1 0 1 2−3

−2

−1

0

1

2

3

x

y

Maximal stability, order 3

−4 −3 −2 −1 0 1 2−3

−2

−1

0

1

2

3

x

y

Maximal stability, order 4

−4 −3 −2 −1 0 1 2−3

−2

−1

0

1

2

3

Figure 4.2: Location of eigenvalues (blue circle) corresponding to maximal stability zonefor explicit time schemes of order 2, 3, 4 (left to right).

54

Page 56: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

2. The centred scheme: dui(t)dt = −aui+1(t)−ui−1(t)

2∆x corresponds to the circulant matrixA with c1 = − a

2∆x = −cn−1. The corresponding eigenvalues are such that

λk∆t = − a∆t

2∆x(e

2iπjkn − e

−2iπjkn ) = − ia∆t

∆xsin

2πjk

n.

Hence the eigenvalues are all purely imaginary and the modulus of the largest oneis a∆t

∆x . The stability zones for the schemes of order 1 to 6 are represented in Fig.4.3. Note that for the order 1 and 2 scheme the intersection of the stability zonewith the imaginary axis is reduced to the point 0. So that when all eigenvaluesare purely imaginary as is the case here, these schemes are not stable for anypositive ∆t. On the other hand the schemes of order 3 and 4 have a non vanishingstability zone on the imaginary axis, larger for the order 4 scheme. By computingthe intersection of the curve |µ(λ∆t)| = 1 with the imaginary axis we find thestability conditions for the order 3 scheme: a∆t

∆x ≤√

3 and for the order 4 schemea∆t∆x ≤ 2

√2.

Remark 6 The order 5 and 6 schemes are more problematic for eigenvalues of Aon the imaginary axis as the zooms of Figure 4.4 tell us. Even though there is a partof the imaginary axis in the stability zone, there is also a part in the neighborhood of0 which is not. Therefore small eigenvalues of A will lead to instability on longertime scales. This is problematic, as unlike usual Courant condition instabilityproblems which reveal themselves very fast, this leads to a small growth in time.

0.0

0.0

−1.0 −0.5−1.5−2.0

1.0

0.5

y

−1.0

x

−0.5y

−0.5

1.5

x

−0.5−1.5

0.0

0.5

−1.5

−1.0

0.0−2.0 −1.0

1.0

−1.0

1

−2.5

x

−1.5

y

0.0−2.0

0

2

−2

−0.5

−1

x

0

−0.5−2.0

−1

2

−2

−1.5

y

−2.5

3

0.0

1

−3

−1.0 −3.2 −1.6

−1

0.0−2.4

1

−3

−0.4−1.2

2

0

−2.0−2.8 −0.8

y

x

3

−2

0.4

2.4

1.6

4.0

−2.4

1−3

3.2

−1

0.0

−3.2

−0.8x

0−2

y

−4.0

−1.6

0.8

Figure 4.3: Stability zone for Taylor schemes. From top to bottom and left to rightorder 1, 2, 3, 4, 5, 6.

55

Page 57: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

3

5−5

−3

2010

−2y

0

−10

10−3

15

−1

1

x

0

2

−0.5

−1*10−4 −5*10−5

0.0

x

y

0*100

0.5

Figure 4.4: Stability zone for Taylor schemes. Zoom around imaginary axis. Left order5, right order 6.

4.4 Systems of conservation laws

4.4.1 Linear systems - The Riemann problem

Let us know consider linear systems of conservation laws in 1D. This can be written inthe general form

∂U

∂t+A

∂U

∂x= 0,

where U(t, x) is a vector in Rn and A a given matrix with constant coefficients. We willfocus on the Finite Volume method.

The main numerical issue when constructing a Finite Volume scheme is to find agood numerical flux that is consistent (i.e. converges towards the exact flux when thecell size goes to 0) and stable. As we saw previously in the linear scalar case enhancedstability is given by upwinding. We now need to generalise the idea of upwinding to thecase of systems.

The construction of a numerical flux is a local procedure at the interface betweentwo cells, where a different value is given on the left side and on the right side from thepolynomial reconstruction. In order to get information from the equation itself the ideais to solve it locally using an initial condition which is a step function. The Riemannproblem is the corresponding initial value problem:

∂U

∂t+A

∂U

∂x= 0,

U(0, x) =

∣∣∣∣ UL if x < 0,UR if x ≥ 0,

where UL and UR are two given constant vectors.The system being hyperbolic implies that A has real eigenvalues and can be diago-

nalised. Hence A = PΛP−1, where Λ is the diagonal matrix containing the eigenvalues.Then introducing the so-called characteristic variables V = P−1U , and multiplying thesystem by P−1 on the left we get

P−1∂U

∂t+ P−1APP−1∂U

∂x=∂V

∂t+ Λ

∂V

∂x= 0.

56

Page 58: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

So in the variable V the system is diagonal and reduces to the set of linear advectionequations

∂vi∂t

+ λi∂vi∂x

= 0, 1 ≤ i ≤ n

where the vi are the components of V and the λi the eigenvalues of A. The exactsolution of these equations is given by vi(t, x) = vi(0, x− λit), where the vi(0, x) are thecomponents of the initial vector which take the constant values VL = P−1UL if x < 0and VR = P−1UR if x ≥ 0. In other terms

vi(t, x) =

∣∣∣∣ vi,L if x < λit,vi,R if x ≥ λit.

In practice we want to use the Riemann problem to determine the value of V (and U) atthe cell interface, corresponding to x = 0, the discontinuity point at any strictly positivetime. And we deduce from the previous solution that

vi(t, 0) =

∣∣∣∣ vi,L if 0 < λi,vi,R if 0 ≥ λi.

In order to get a vector expression, we introduce the diagonal matrices Λ+ where thenegative eigenvalues are replaced by 0 and Λ− where the positive eigenvalues are replacedby 0. Obviously Λ = Λ+ + Λ−. Then for t > 0 we have

ΛV (t, 0) = Λ+V (t, 0) + Λ−V (t, 0) = Λ+VL + Λ−VR,

as for all positive eigenvalues the corresponding component of V (t, 0) is vi,L and forall negative eigenvalues the corresponding component of V (t, 0) is vi,R. Note that asV (t, 0) is multiplied by Λ the components of V (t, 0) corresponding to 0 eigenvalues donot need to be considered as they are multiplied by 0 anyway. So the side where thestrict inequality is used for the initial condition of the Riemann problem plays no role.

Denoting by A+ = PΛ+P−1 and A− = PΛ−P

−1 the flux AU(t, 0) associated to thesolution of the Riemann problem at the cell interface can also be expressed convenientlydirectly in terms of U

AU(t, 0) = PΛ+V (t, 0) + PΛ−V (t, 0) = PΛ+VL + PΛ−VR = A+UL +A−UR.

This expression AU(t, 0) = A+UL + A−UR can be used to define the numerical fluxat the cell interface, using the value UL coming from the left-hand side of the interfaceand UR coming from the right-hand side of the interface. For actual computations,the matrices A+ and A− need to be computed explicitely from the eigenvalues andeigenvectors of the matrix A. Notice that in the case of a scalar equation the matrixA is reduced to the scalar a which is then obviously the only eigenvalue of the 1 × 1matrix and if a > 0 we have A+ = a and A− = 0, so that the numerical flux becomesau(t, 0) = auL and the same way if a < 0 au(t, 0) = auR, so that the numerical fluxobtained from the solution of the Riemann problem reduces to the upwind flux.

Example. We consider the 1D Maxwell equations which can be written in dimension-less units:

∂E

∂t+∂B

∂x= 0,

∂B

∂t+∂E

∂x= 0.

57

Page 59: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

This can be written in the form of a linear system

∂U

∂t+A

∂U

∂x= 0, with U =

(EB

), A =

(0 11 0

).

The eigenvalues of A are the solutions of det(A−λI) = 0, i.e. λ2 = 1. So the eigenvaluesare λ1 = −1 and λ2 = 1. They are real and distinct so that the system is strictlyhyperbolic. Let Vi be a normalised eigenvector associated to the eigenvalue λi, i = 1, 2.We have AV1 = −V1 so that V1 = 1√

2(1,−1)T and AV2 = V2 so that V1 = 1√

2(1, 1)T . We

define P the matrix whose columns are V1 and V2. P is obviously orthonormal, so thatits inverse is its transpose. Then we have PA = ΛP . So that we can define:

A+ = PΛ+PT =

1

2

(1 1−1 1

)(0 00 1

)(1 −11 1

)=

1

2

(1 11 1

),

A− = PΛ−PT =

1

2

(1 1−1 1

)(−1 00 0

)(1 −11 1

)=

1

2

(−1 11 −1

)Hence, the upwind flux is given by

AU(t, 0) = A+UL +A−UR =1

2

(UL,1 + UL,2 + (−UR,1 + UR,2)UL,1 + UL,2 + (UR,1 − UR,2)

).

Remark 7 As for the scalar problem, the numerical flux can be taken as a linear com-bination of the centred flux and the upwind flux (solution the Riemann problem):

Gj = µ1

2A(UL + UR) + (1− µ)(A+UL +A−UR), 0 ≤ µ ≤ 1.

4.5 Nonlinear systems of conservation laws

The specificity of non linear conservations laws as opposed to linear conservation laws isthat discontinuities, called shocks, can appear during the evolution even when startingfrom smooth solutions. Then derivatives are not longer well defined and the conceptof weak solutions, as for finite elements, putting the derivative on a test function mustbe defined. The major problem of weak solutions is that they are not unique. Howeverthe concept of vanishing viscosity, considering a conservation law as the limit, when theviscosity term tends to zero of the same equation with an added diffusion term. For a1D scalar conservation law this has the form

∂u

∂t+∂f(u)

∂x− ε∂

2u

∂x2= 0,

where ε is the small viscosity parameter. This PDE has a unique solution for all ε > 0and the unique physical solution of the conservation law is the limit of this equationwhen ε goes to zero. This solution is called the vanishing viscosity solution or entropysolution. Non conservative schemes can converge to a wrong weak solution and evensome conservative schemes which do not have enough numerical viscosity can convergeto a non entropic solution. In order to avoid this, one should always use conservativeschemes that have locally enough viscosity to make sure that the solution convergestowards the right entropy solution.

58

Page 60: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Going from the scalar case to systems in the non linear case, is similar to what isdone in the linear case. The hyperbolicity of the system is essential so that the systemcan be locally diagonalised and the eigenvalues explicitely used in the definition of theflux.

The derivation of a Finite Volume scheme can be done component by componentand so reduces to the scalar case except for the definition of the numerical flux which ingeneral mixes the different components and needs to be specific to the system at hand.We shall restrict in this lecture to the introduction of two of the most used numericalfluxes, namely the Rusanov (or local Lax-Friedrichs) flux and the Roe flux.

4.5.1 The Rusanov flux

As in the scalar case, the main idea here is to use a centred flux to which just enoughdissipation is added to ensure stability in all cases. In the scalar case the needed viscositywas given by the largest local wave speed. A system of n components corresponds tothe superposition of n waves the local speed of each being given by the correspondingeigenvalue. So taking the viscosity coefficient in the flux as the maximum over alleigenvalues should do the job. This yields the Rusanov flux for systems, which is thesimplest stable flux. It is defined for a nonlinear system of the form

∂U

∂t+∂F(U)

∂x= 0,

as

G(UL,UR) =1

2

(F(UL) + F(UR)− max

U∈[UL,UR]|λ(F′(U))|(UR −UL)

),

where maxU∈[UL,UR] |λ(F′(U))| denotes the maximum modulus of the eigenvalues of theJacobian matrix F′(U).

4.5.2 The Roe flux

Roe’s method consists in locally linearising the non linear flux with a well chosen pro-cedure. The linearised matrix between two constant states UL and UR is denoted byA(UL,UR) and constructed such that the following properties are verified:

• F(UR)− F(UL) = A(UL,UR)(UR −UL).

• A(U,U) = F′(U).

• A(UL,UR) is diagonalisable, has real eigenvalues and a complete system of eigen-vectors.

Such a matrix is not always easy to find, but there are procedures, described in [10] forexample, to construct them. Moreover classical Roe matrices are known for the mostusual systems [10].

Once the Roe matrix is defined, the flux can be computed by solving the correspond-ing linear Riemann problem that we treated previously. Let us rewrite the formula, sothat we can also include the entropy fix, which is needed for non linear systems to makesure that the scheme always converges to the correct entropy solution.

59

Page 61: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

In the case of linear systems, the flux was defined as AU(t, 0) = A+UL + A−UR.Defining the absolute value of a matrix as |A| = A+−A−, the flux can also be expressedas

AU(t, 0) =1

2(AUL +AUR − |A|(UR − UL)) .

Using the properties of the Roe matrix in the non linear case, the same expressionwill be used to define the Roe flux:

G(UL,UR) =1

2(A(UL,UR)UL +A(UL,UR)UR − |A(UL,UR)|(UR −UL)) .

Here we also see that the numerical viscosity vanishes when the eigenvalues of A(uL, uR)are close to zero, which can happen close to the minimum of the convex function f .Then a non entropic shock might be selected by the scheme. A simple fix, introducedby Harten, consists in smoothing the graph of the absolute value close to 0 (see [10] fordetails). This consists in replacing the absolute value in the formula defining the flux by

φ(λ) =

∣∣∣∣ |λ| |λ| ≥ ε,(λ2 + ε2)/(2ε) |λ| < ε.

This ensures that φ(λ) ≥ ε and that there is always some dissipation. This works andyields the correct entropy solution provided ε is well tuned to the problem at hand.

60

Page 62: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Chapter 5

Kinetic models

Kinetic models provide the most accurate presently used description of plasmas. It isvery satisfying in almost all situations. The simplest such model is the collisionlessVlasov-Poisson model that we are going to study in this chapter.

5.1 The Vlasov-Poisson model

5.1.1 The model

Starting from the Vlasov-Maxwell equations, consisting of a Vlasov equation for eachparticle species non linearly coupled by the Maxwell equations determining the evolutionof the electromagnetic field of the plasma, we make the assumption, that on the time scaleof interest, due to their much larger mass the ions do not move and also that the electricand magnetic fields are slowly varying. If the particles’ energy is considered small, thev×B term can be neglected in the Lorentz force, and the remaining simplified model isthe Vlasov-Poisson equation for electrons with a neutralizing background. Setting thephysical constants to one, the model reads

∂f

∂t+ v · ∇xf −E · ∇vf = 0, (5.1)

−∆φ = 1− ρ, E = −∇φ, (5.2)

with

ρ(x, t) =

∫f(x,v, t) dv.

The domain on which the system is posed is considered periodic in x and the wholespace R3 in velocity.

Denoting by A = (v,−E)> the advection field in phase space (x,v), the Vlasovequation can be written as an advection equation in phase space of the form

∂f

∂t+ A · ∇x,vf = 0. (5.3)

Moreover, as∇x,v · (Af) = A · ∇f + f∇x,v ·A

and ∇x,v ·A = 0, the Vlasov equation (5.1) can also be written in conservative form

∂f

∂t+∇x,v · (Ff) = 0. (5.4)

61

Page 63: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

5.1.2 The Vlasov equation in a given potential

First verification tests for the Vlasov solver consist in considering the Vlasov equationin simple given potentials where the solution can be computed exactly with the methodof characteristics.

Consider the Vlasov equation in advective form:

∂f

∂t+ A · ∇f = 0, (5.5)

with f : Rd × R+ → R and A : Rd × R+ → Rd.Consider now for s ∈ R+ given, the differential system

dX

dt= A(X, t), (5.6)

X(s) = x, (5.7)

which is naturally associated to the advection equation (5.5).

Definition 6 The solutions of the system (5.6) are called characteristics of the linearadvection equation (5.5). We denote by X(t; s,x) the solution of (5.6) – (5.7).

An essential property of the Vlasov equation is that its solution is invariant along thecharacteristics. This can be verified by computing

d

dtf(t,X(t)) =

∂f

∂t(t,X(t)) +

dX

dt· ∇f(t,X(t)) =

∂f

∂t(t,X(t)) + A · ∇f(t,X(t)).

Hence the solution of the Vlasov equation can be expressed using the characteristics.

Proposition 5 Assuming that the Vlasov equation admits a smooth solution and itscharacteristics are well defined. The solution can be expressed using the initial conditionf0 and the characteristics X as

f(t,x) = f0(X(0; t,x)).

Examples

1. The free streaming equation∂f

∂t+ v

∂f

∂x= 0.

The characteristics are solution of

dX

dt= V,

dV

dt= 0.

This we have V (t; s, x, v) = v and X(t; s, x, v) = x + (t − s)v which gives us thesolution

f(x, v, t) = f0(x− vt, v).

2. Uniform focusing in a particle accelerator (1D model). We then have E(x, t) = −xand the Vlasov writes

∂f

∂t+ v

∂f

∂x− x∂f

∂v= 0.

dX

dt= V,

dV

dt= −X.

Whence get X(t; s, x, v) = x cos(t− s) + v sin(t− s) and V (t; s, x, v) = −x sin(t−s) + v cos(t− s) form which we compute the solution

f(x, v, t) = f0(x cos t− v sin t, x sin t+ v cos t).

62

Page 64: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

5.1.3 Conservation properties

The Vlasov-Poisson system has a number of conservation properties that need specialattention when developing numerical methods. In principle it is beneficial to retain theexact invariants in numerical methods and when it is not possible to keep them all as isthe case here, they can be use to monitor the validity of the simulation by checking thatthey are approximately conserved with good accuracy.

Proposition 6 The Vlasov-Poisson system verifies the following conservation proper-ties:

• Maximum principle0 ≤ f(x,v, t) ≤ max

(x,v)(f0(x,v)). (5.8)

• Conservation of Lp, norms for p integer, 1 ≤ p ≤ ∞

d

dt

(∫(f(x,v, t))p dx dv

)= 0 (5.9)

• Conservation of total momentum

d

dt

∫vf dxdv =

d

dt

∫J dx = 0. (5.10)

• Conservation of total energy

d

dt

[1

2

∫v2f dxdv +

1

2

∫E2 dx

]= 0. (5.11)

Proof. The system defining the associated characteristics writes

dX

dt= V(t), (5.12)

dV

dt= −E(X(t), t). (5.13)

We denote by (X(t; x,v, s),V(t; x,v, s)), or more concisely (X(t),V(t)) when the depen-dency with respect to the initial conditions is not explicitly needed, the unique solutionat time t of this system which takes the value (x,v) at time s.

Using (5.12)-(5.13), the Vlasov equation (5.1) can be expressed equivalently

d

dt(f(X(t),V(t)) = 0.

We thus havef(x,v, t) = f0(X(0; x,v, t),V(0; x,v)).

From this expression, we deduce that f verifies a maximum principle which can bewritten as f0 is non negative

0 ≤ f(x,v, t) ≤ max(x,v)

(f0(x, v)).

63

Page 65: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Multiplying the Vlasov equation by (5.1) par fp−1 and integrating on the wholephase-space we obtain

d

dt

(∫(f(x,v, t))p dx dv

)= 0,

so that the Lp norms of f are conserved for all p ∈ N∗. Let us notice that the L∞ is alsoconserved thanks to the maximum principle (5.8).

Let us now proceed to the conservation of momentum. We shall use the followingequality that is verified for any vector u depending on x in a periodic domain∫

(∇× u)× u dx = −∫ (

u(∇ · u) +1

2∇u2

)dx = −

∫u(∇ · u) dx. (5.14)

Let us notice in particular that taking u = E in the previous equality with E solutionof the Poisson equation (5.2), we get, as ∇ × E = 0 and ∇ · E = −∆φ = 1 − ρ, that∫

E(1 − ρ) dx = 0. As moreover E = −∇φ and as we integrate on a periodical domain∫E dx = 0. It results that ∫

Eρ dx = 0. (5.15)

Let us now introduce the Green formula on the divergence:∫Ω∇ · Fq +

∫Ω

F · ∇q =

∫∂Ω

(F · n) q ∀F ∈ H(div,Ω), q ∈ H1(Ω), (5.16)

where classically H1(Ω) is the subset of L2(Ω) the square integrable functions, of thefunctions whose gradient is in L2(Ω); andH(div,Ω) is the subset of L2(Ω) of the functionswhose divergence is in L2(Ω).

Let’s multiply the Vlasov equation (5.1) by v and integrate in x and in v

d

dt

∫vf dxdv +

∫∇x · (v ⊗ vf) dxdv −

∫v∇v · (Ef) dxdv = 0.

The second integral vanishes as the domain is periodic in x and the Green formula onthe divergence (5.16) gives for the last integral

−∫

v∇v · (Ef) dxdv =

∫Ef dxdv =

∫Eρ dx = 0,

using (5.15). It finally follows that

d

dt

∫vf dxdv =

d

dt

∫J dx = 0.

In order to obtain the energy conservation property, we start by multiplying theVlasov equation by v · v = |v|2 and we integrate on phase space

d

dt

∫|v|2f dxdv +

∫∇x · (|v|2vf) dxdv −

∫|v|2∇v · (Ef) dxdv = 0.

As f is periodic in x, we get, integrating in x that∫∇x · (|v|2vf) dxdv = 0

64

Page 66: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

and the Green formula on the divergence (5.16) yields∫|v|2∇v ·E dxdv = −2

∫v · (Ef) dxdv = −2

∫E · J dx.

Sod

dt

∫|v|2f dxdv = −2

∫E · J dx = 2

∫∇φ · J dx. (5.17)

On the other hand, integrating the Vlasov equation (5.1) with respect to v, we getthe charge conservation equation, generally called continuity equation: ∂ρ

∂t +∇ · J = 0.Then, using again the Green formula (5.16), the Poisson equation (5.2) and the continuityequation, we obtain∫

∇φ · J dx =

∫φ∇ · J dx = −

∫φ∂ρ

∂tdx =

∫φ∂∆φ

∂tdx = −1

2

d

dt

∫∇φ · ∇φdx.

And so, plugging this equation in (5.17) and using that E = −∇φ, we get the conserva-tion of energy.

5.1.4 Solution of the linearised 1D Vlasov-Poisson equation

Another important verification test, which is often also important for a better under-standing of the physics, is to consider the problem linearised around and equilibriumsolution, as we already did for fluid models.

For the Vlasov-Poisson system, let us first realise that any constant homogeneousdistribution function, i.e. a distribution function which does not depend on t and x, butonly on v is an equilibrium solution of Vlasov-Poisson. Indeed, in this case the partialderivatives with respect to t and x are obviously zero and the third term in the Vlasovequation vanishes because for a homogeneous f , the electric field vanishes as the chargedensity is uniform and equal to the background density.

Let us now consider the simplest and important case of thermodynamic equilibriumfor which the equilibrium distribution that we denote by f0 is the Maxwellian

f0(v) =n0

2πe−

v2

2 .

We can now linearise Vlasov-Poisson around this equilibrium state by expanding thedistribution function and the electric field in the form of the equilibrium solution plus asmall perturbation:

f(x, v, t) = f0(x, v) + εf1(x, v, t), E(x, t) = E0(x) + εE1(x, t), (with E0(x) = 0).

The distribution function f verifies the Vlasov-Poisson equations

∂f

∂t+ v

∂f

∂x− E(x)

∂f

∂v= 0,

dE

dx= (1−

∫ +∞

−∞f(x, v, t) dv),

with an initial condition that we assume of the form

f0(x, v) = f0(v) + εf10 (x, v).

65

Page 67: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Plugging the expansions of f and E in this equation

ε

(∂f1

∂t+ v

∂f1

∂x

)− (E0 + εE1)(

df0

dv+ ε

∂f1

∂v) = 0,

εdE1

dx=

e

ε0(1−

∫ +∞

−∞(f0(v) + εf1(x, v, t)) dv).

Neglecting the terms in ε2, we obtain, knowing that E0 = 0

∂f1

∂t+ v

∂f1

∂x− E1(x)

df0

dv= 0, (5.18)

dE1

dx= −

∫ +∞

−∞f1(x, v, t) dv, (5.19)

with the initial condition f1(x, v, 0) = f10 (x, v). As f0 is a known function of v, this

equation, the unknowns of which are f1 and E1, is linear and displays derivatives in xand t. We can thus compute an analytic solution analytic using, as f1 is periodic in x,a Fourier series in x and a Laplace transform in t.

After a long a quite involved computation due to the Laplace transform and a singu-larity in the velocity integral, one can obtain a dispersion relation and explicit solutionof the linearised problem in form of a series. The dispersion relation can be expressedsimply by

D(k, ω) = 1 +ω2p

k2

[1 +

ω√2kZ(

ω√2k

)

], (5.20)

using the so-called plasma dispersion function Z defined by

Z(ξ) =√πe−ζ

2[−i− erfi(ζ)]

where erfi(ζ) = 2√π

∫ ζ0 e

t2 dt is the complex error function.

To obtain an explicit value of this expression of the electric field, it remains to com-pute numerically for k fixed the values of ω for which D(k, ω) vanishes. The simplestway to this is to use the Newton method, but this needs a good initial guess. We obtainthe following values ω for different k:

k ω

0.5 1, 4156− 0, 1533i0.4 1, 2850− 0, 0661i0.3 1, 1598− 0, 0126i0.2 1, 0640− 5, 510× 10−5i

Newton’s method is very sensitive to the initial guess and gives no insurance to find themost unstable or the least damped mode. A more robust method to compute the zerosof an analytic function will be given in the next section.

5.2 The particle in cell (PIC) method

As the Vlasov equation can be expressed as conservation law, it is quite natural touse the Finite Volume method or the related Discontinuous Galerkin method for its

66

Page 68: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

solution, and this has been done. However due to its simplicity and its efficiency in highdimensions, the most used method is still the particle in cell method, which consists indrawing randomly a finite number of origins for the characteristics and follow them intime by solving the equations of motion. These need the electric field which is in turncomputed on a grid, using any standard grid based method for the Poisson equation, ingeneral Finite Difference, Fourier spectral or Finite Element. The distribution functionis then approximated by a sum of Dirac masses

fh(t,x,v) =∑k

wkδ(x− xk)δ(v − vk).

Note that the charge density, source of the Poisson equation, needs to be computed fromthe particles. A crucial part is the particle mesh coupling. In Finite Element methods,the Finite Element basis function provide a natural was to express the electric fieldseverywhere in space and also the weak formulation of the right-hand-side is compatiblewith the expression of the distribution function as a sum of Dirac masses.

5.2.1 Time scheme for the particles.

Let us consider first only the case when the magnetic field vanishes (Vlasov-Poisson).Then the macro-particles obey the following equations of motion:

dxkdt

= vk,dvkdt

=q

mE(xk, t).

This system being hamiltonian, it should be solved using a symplectic time scheme inorder to enjoy long time conservation properties. The scheme which is used most of thetime is the Verlet scheme, which is defined as follows. We assume xnk , vnk and En

k known.

vn+ 1

2k = vnk +

q∆t

2mEnk(xnk), (5.21)

xn+1k = xnk + ∆tv

n+ 12

k , (5.22)

vn+1k = v

n+ 12

k +q∆t

2mEn+1k (xn+1

k ). (5.23)

We notice that step (5.23) needs the electric field at time tn+1. It can be computed afterstep (5.22) by solving the Poisson equation which uses as input ρn+1

h that needs onlyxn+1k and not vn+1

k .

5.2.2 Particle mesh coupling for Finite Elements

The coupling between mesh and particles is obtained in a natural way in the Finite Ele-ment method. Indeed once the degrees of freedom have been computed, the electrostaticpotential is given by

φh(t,x) =

Ng∑j=1

φj(t)Λj(x). (5.24)

At least locally on each cell the gradient of φ is well defined and so the electric field ata particle position is directly defined by

Eh(t,xk) =

Ng∑j=1

φj(t)∇Λj(xk).

67

Page 69: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

On the other hand, the weak form of the Poisson equation reads∫∇φh · ∇ψ dx = n0 −

∫fh(t,x,v) dv =

Np∑k=1

wkψ(xk). (5.25)

5.2.3 Particle-Mesh coupling for point based Poisson solvers

The particle approximation fh of the distribution function does not naturally give anexpression for this function at all points of phase space. Thus for the coupling with thefield solver which is defined on the mesh a regularizing step is necessary. To this aim weneed to define convolution kernels which can be used the this regularization procedure.On cartesian meshes B-splines are mostly used as this convolution kernel. B-splines canbe defined recursively: The degree 0 B-spline that we shall denote by S0 is defined by

S0(x) =

1

∆x if − ∆x2 ≤ x <

∆x2 ,

0 else.

Higher order B-splines are then defined by:For all m ∈ N∗,

Sm(x) = (S0)∗m(x),

= S0 ∗ Sm−1(x),

=1

∆x

∫ x+ ∆x2

x−∆x2

Sm−1(u) du.

In particular the degree 1 spline is

S1(x) =

1

∆x(1− |x|∆x) si |x| < ∆x,0 sinon,

the degree 2 spline is

S2(x) =1

∆x

12(3

2 −|x|∆x)2 si 1

2∆x < |x| < 32∆x,

34 − ( x

∆x)2 si |x| < 12∆x,

0 sinon,

the degree 3 spline is

S3(x) =1

6∆x

(2− |x|∆x)3 si ∆x ≤ |x| < 2∆x,

4− 6(x

∆x

)2+ 3

(|x|∆x

)3si 0 ≤ |x| < ∆x,

0 sinon.

B-splines verify the following important properties

Proposition 7 • Unit mean ∫Sm(x) dx = 1.

• Partition of unit. For xj = j∆x,

∆x∑j

Sm(x− xj) = 1.

68

Page 70: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

• ParitySm(−x) = Sm(x).

The sources for Maxwell’s equations ρh and Jh are defined from the numerical dis-tribution function fh. In order to be able to defined them at the grid points, we applythe convolution kernel S to define them at any point of space and in particular at thegrid points:

ρh(x, t) =

∫S(x− x′)fh(t,x′,v′) dx′ dv′ = q

∑k

wkS(x− xk), (5.26)

Jh(x, t) =

∫S(x− x′)vfh(t,x′,v′) dx′ dv′ = q

∑k

wkS(x− xk)vk. (5.27)

In order to get conservation of total momentum, when a regularization kernel isapplied to the particles, the same kernel needs to be applied to the field seen as Diracmasses at the grid points in order to compute the field at the particle positions. Wethen obtain

Eh(x, t) =∑j

Ej(t)S(x− xj), Bh(x, t) =∑j

Bj(t)S(x− xj). (5.28)

Note that in the classical case where S = S1 this regularization is equivalent to a linearinterpolation of the fields defined at the grid points to the positions of the particles, butfor higher order splines this is not an interpolation anymore and the regularized field atthe grid points is not equal to its original value Ej anymore, but for example in the caseof S3, to 1

6Ej−1 + 23Ej + 1

6Ej+1.

5.2.4 Time loop.

Let us now summarize the main stages to go from time tn to time tn+1:

1. We compute the charge density ρh and current density Jh on the grid using relations(5.26)-(5.27).

2. We update the electromagnetic field using a classical mesh based solver (finitedifferences, finite elements, spectral, ....).

3. We compute the fields at the particle positions using relations (5.28).

4. Particles are advanced using a numerical scheme for the characteristics for exampleVerlet (5.21)-(5.23).

5.2.5 Conservation properties at the semi-discrete level.

Conservation of mass . The discrete mass is defined as∫fh(x,v, t) dxdv =

∑k wk.

This is obviously conserved if no particle gets in or out of the domain, as wk is conservedfor each particle when the particles move.

69

Page 71: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Conservation of momentum . The total momentum of the system is defined as

P = m

∫vfh(x,v, t) dxdv =

∑k

mwkvk(t).

SodPdt

=∑k

mwkdvkdt

=∑k

wkqkEh(xk, t).

In the case Eh is computed using a Finite Difference approximation, its value at theparticle position should be computed using the same convolution kernel as is used forcomputing the charge and current densities from the particle positions. Then Eh(xk, t) =∑

j Ej(t)S(xk − xj) and so

dPdt

=∑k

wkqk∑j

Ej(t)S(xk − xj).

Then exchanging the sum on the grid points i and the sum on the particles k we get

dPdt

=∑j

Ej(t)∑k

wkqkS(xk − xj) =∑j

Ej(t)ρj(t),

so that the total momentum is conserved provided the field solver is such that∑

j Ej(t)ρj(t).This is in particular true for a Fourier spectral Poisson solver for which

ρj =

n/2∑m=−n/2

ρme− 2iπjm

n , Ej =

n/2∑m=−n/2

Eme− 2iπjm

n ,

with Em = iρmm . Hence

∑j

ρjEj =∑j

n/2∑m=−n/2

ρjEme− 2iπjm

n .

Then inverting the sums in j and m, we get as E−m = Em because Ej is real

∑j

ρjEj =

n/2∑m=−n/2

ρmEm = i

n/2∑m=−n/2

mE2m = 0.

This is also true for the standard second order Finite Difference Poisson solver pro-vided the electric field is computed from the potential with a centred finite differenceapproximation. Indeed in this case∑

j

Ejρj = −φj+1 − φj−1

2∆x

2φi − φi+1 − φi−1

∆x2

=1

2∆x3

∑j

((φ2j+1 − φ2

j−1)− 2φjφj+1 − 2φjφj−1

)= 0, (5.29)

using the periodicity of the grid and changing the indices in the last term.The classical Finite Element PIC solver we introduced above does not conserve total

momentum.

70

Page 72: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Remark 8 Note the conservation of momentum is linked to the self-force problem thatis often mentioned in the PIC literature. Indeed if the system is reduced to one particle.The conservation of momentum is equivalent to the fact that a particle does not apply aforce on itself.

Conservation of energy . Classical point-based solvers based on Finite Differenceof spectral methods do not conserve total energy, but the semi-discrete Finite Elementsolver does.

Indeed consider, the equations of motions for the particles

dxkdt

= vk,dvkdt

= − qsms∇φh(t,xk),

coupled with a finite element discretisation of the Poisson equation∫∇φh · ∇ψ dx =

∑k

qsψ(xk) ∀ψ ∈ Vh.

The the following semi-discrete energy is exactly conserved

Eh(t) =∑k

ms

2|vk|2 +

1

2

∫|∇φh|2 dx.

Let us verify this by direct computation. First taking ψ = φh as a test function, theweak Poisson equation yields

d

dt

∫|∇φh|2 dx =

∑k

qs

(∂φh∂t

(t, xk) +dxkdt· ∇φh(t,xk)

). (5.30)

On the other hand taking ψ = ∂tφh(t,xk) in the weak Poisson equation, we also havethat ∑

k

qs∂φh∂t

(t, xk) =

∫∇φh · ∇

∂φh∂t

dx =1

2

d

dt

∫|∇φh|2 dx,

so that equation (5.30) becomes

1

2

d

dt

∫|∇φh|2 dx =

∑k

qsdxkdt· ∇φh(t,xk) =

∑k

qsvk · ∇φh(t,xk).

Now using this, we find

dEh(t)

dt=∑k

(msvk ·

dvkdt

+ qsvk · ∇φh(t,xk)

)= 0

asdvkdt

= − qsms∇φh(t,xk).

71

Page 73: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

Bibliography

[1] Jean-Paul Berrut and Lloyd N Trefethen. Barycentric lagrange interpolation. SiamReview, 46(3):501–517, 2004.

[2] Prabhu Lal Bhatnagar, Eugene P Gross, and Max Krook. A model for collision pro-cesses in gases. i. small amplitude processes in charged and neutral one-componentsystems. Physical review, 94(3):511, 1954.

[3] Claudio Canuto, M Hussaini, A Quarteroni, and TAJ Zang. Spectral Methods inFluid Dynamics (Scientific Computation). Springer-Verlag, New York-Heidelberg-Berlin, 1987.

[4] Gary Cohen. Higher-Order Numerical Methods for Transient Wave equation.Springer-Verlag, 2001.

[5] Victor Eijkhout. Introduction to High Performance Scientific Computing. Lulu.com, 2010.

[6] Martin J Gander and Gerhard Wanner. From euler, ritz, and galerkin to moderncomputing. SIAM Review, 54(4):627–666, 2012.

[7] Carl T Kelley. Iterative methods for optimization, volume 18. Siam, 1999.

[8] LD Landau. The transport equation in the case of coulomb interactions. CollectedPapers of LD Landau, Pergamon press, Oxford, pages 163–170, 1981.

[9] Andrew Lenard and Ira B Bernstein. Plasma oscillations with diffusion in velocityspace. Physical Review, 112(5):1456, 1958.

[10] Randall J LeVeque. Finite volume methods for hyperbolic problems, volume 31.Cambridge university press, 2002.

[11] Marshall N Rosenbluth, William M MacDonald, and David L Judd. Fokker-planckequation for an inverse-square force. Physical Review, 107(1):1, 1957.

[12] Chi-Wang Shu. High order weighted essentially nonoscillatory schemes for convec-tion dominated problems. SIAM review, 51(1):82–126, 2009.

[13] Willi-Hans Steeb. Kronecker product of matrices and applications. BI-Wissenschaftsvlg, 1991.

[14] Willi-Hans Steeb. Matrix calculus and Kronecker product with applications andC++ programs. World Scientific, 1997.

72

Page 74: Computational plasma physics - WebHome · or Numpy and those programming in a low level language like Fortran, C or C++ can use e cient libraries, like LAPACK, ScaLAPACK, PETSc, Trilinos,

[15] Vidar Thomee. From finite differences to finite elements: A short history of numer-ical analysis of partial differential equations. Journal of Computational and AppliedMathematics, 128(1):1–54, 2001.

[16] Lloyd N Trefethen and David Bau III. Numerical linear algebra, volume 50. Siam,1997.

[17] Charles F Van Loan. The ubiquitous kronecker product. Journal of computationaland applied mathematics, 123(1):85–100, 2000.

73