Dimensionality reduction using an edge finite …+days/2016/pdf/CA.pdf1 Dimensionality reduction...

Post on 08-Jul-2020

26 views 0 download

Transcript of Dimensionality reduction using an edge finite …+days/2016/pdf/CA.pdf1 Dimensionality reduction...

1

Dimensionality reduction for periodic magnetostatic fields

Dimensionality reduction using an edge finite element methodfor periodic magnetostatic fields in a symmetric domain

C.G. Albert1 O. Biro2 M.F. Heyn1 W. Kernbichler1 S.V. Kasilov1,3 P. Lainer1

1Fusion@ÖAW, Institute of Theoretical and Computational Physics2Institute of Fundamentals and Theory in Electrical Engineering

Graz University of Technology

3Institute of Plasma Physics, National Science CenterKharkov Institute of Physics and Technology

8th FreeFEM++ workshop, Dec 8th 2016

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

2

Dimensionality reduction for periodic magnetostatic fields

Who are we?

Theoretical plasma physics group at TU Graz

General topic: magnetic confinement fusionTrap a hot plasma to allow for nuclear fusion

Work within the EUROfusion framework (ITER, W7-X, ...)

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

3

Dimensionality reduction for periodic magnetostatic fields

What do we do?

Our tasks include:

Understand non-axisymmetric perturbations in tokamaks

Compute transport and 3D equilibria in stellarators

Our strategy:

Use a kinetic Monte Carlo model for the plasma

Couple to Maxwell’s equations solved by FEM

More complete but slower than magnetohydrodynamics

optimisations needed

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

4

Dimensionality reduction for periodic magnetostatic fields

Tokamak and stellarator geometry

make use of axisymmetry / periodicity

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

5

Dimensionality reduction for periodic magnetostatic fields

About today’s talk

Most things are well-known

Goal: calculate 3D magnetic field from known currents

Systematic way of "2.5D" reduction of curl curl equation

Starting from Maxwell’s equations

symmetric and oscillatory part (Fourier series)

Generalisation to curvilinear coordinates

Efficient realisation with edge elements in FreeFEM++

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

6

Dimensionality reduction for periodic magnetostatic fields

Maxwell’s equations of electrodynamics

div εE = ρ (1)curl E + ∂tB = 0 (2)

curl νB-∂t (εE) = J (3)div B = 0 (4)

Unknowns: Electric field E and magnetic field B

Source terms: Free charge density ρ, currents density J

Material parameters: Permittivity ε, inverse permeability ν = µ−1

Can lead to discontinous (weak) solutions for E and B

Continuity equation for charges as a concequence:

∂ρ

∂t+ divJ = 0

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

7

Dimensionality reduction for periodic magnetostatic fields

Scalar and vector potential

div εE= ρ

curl E + ∂tB = 0curl νB − ∂t (εE)= J

div B = 0 .

Simply connected domains: can find potentials Φ and A with

E = −grad Φ− ∂tA, B = curl A (5)

Equations fulfiled since curl grad Φ = 0 and div curl A = 0 ∀Φ, A

Proof: special case of Poincaré lemma

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

8

Dimensionality reduction for periodic magnetostatic fields

Potential equations

−div εgrad Φ− div ε∂tA = ρ (6)curl νcurl A− ∂t εgrad Φ + ∂t ε∂tA = J (7)

with E = −grad Φ− ∂A∂t

, B = curl A

Singular (non-unique solution) due to gauge freedom

A = A′ + gradχ , Φ = Φ′ +∂χ

∂t

since curl gradχ = 0

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

9

Dimensionality reduction for periodic magnetostatic fields

Textbook example: Lorenz gauge

For constant ε, ν, c2 := ν/ε decouple equations by gauge

div A + ∂t Φ/c2 = 0

Wave equations follow with Laplacian ∆Φ := div grad Φand Vector Laplacian ∆A := grad div A− curl curl A

−∆Φ− ∂2t Φ/c2 = ρ/ε (8)

−∆A + ∂2t A/c2 = J/ν (9)

Often better to stay with curl curl equation

∆A = ∆Axex + ∆Ay ey + ∆Azez only in Cartesian coords

Numerical troubles of (9) in nodal basis (spurious modes)

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

10

Dimensionality reduction for periodic magnetostatic fields

Static case

−div εgrad Φ−div ε∂tA = ρ (10)curl νcurl A−∂t εgrad Φ− ∂t ε∂tA = J (11)

Changes of fields over time are neglected

Relevant to find equilibrium configurations

equations decouple into electrostatics and magnetostatics

in particular, Eq. (11) leads to

div J = 0 (12)

(continuity equation without sources)

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

11

Dimensionality reduction for periodic magnetostatic fields

FEM for the 3D curl-curl equation – weak form

curl νcurl A = J (13)

Standard procedure: domain Ω with Neumann data AN × n on ΓN

1. Scalar multiplication by test function W2. Do partial integration⇒ weak form∫

Ω

curl W · ν curl A dΩ =

∫W · J dΩ−

∫ΓN

νW · curl AN × n dΩ

(14)

3. Discretise locally on mesh by Galerkin method

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

12

Dimensionality reduction for periodic magnetostatic fields

FEM for the 3D curl-curl equation – discretisation

∫Ω

curl W · ν curl A dΩ =

∫W · J dΩ−

∫ΓN

νW · curl AN × n dΓN

Edge (Nédélec) elements for A, W ∈ Hcurl

DOFs: integral of vector along edgesStokes’ law

∮A · dl =

∫curl A · dS given directly

Face (Raviart-Thomas) elements for B = curl A ∈ Hdiv

DOFs: integral of vector across facesGauss’ law

∮A · dS =

∫div A dV given directly

Either gauged (tree-cotree) or ungauged (iterative solver)

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

13

Dimensionality reduction for periodic magnetostatic fields

Example: Cartesian coordinates

Prism with BCs and parameters 2π-periodic in z

z

Ωt

Γt

x

y

Ω

Γ

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

14

Dimensionality reduction for periodic magnetostatic fields

Reduction to 2D - symmetric part (z-independent)

Curl splits into independent transversal b and longitudinal Bzez

B = curl A = ∂y Az ex − ∂xAz ey︸ ︷︷ ︸b=curltAz

+ (∂xAy − ∂y Ax︸ ︷︷ ︸Bz =curlta

)ez

Two distinct equations follow from curl curl Eq. (13)

curltνcurlta = j (15)curlt νcurltAz = Jz (16)

Weak forms of homogenous Neumann problems:∫Ω

curlt w ν curlt a dΩt =

∫w · j dΩt (→ edge elements)∫

Ω

curlt W · ν curlt Az dΩt =

∫W Jz dΩt (→ nodal elements)

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

15

Dimensionality reduction for periodic magnetostatic fields

Reduction to 2D - oscillatory part

All quantities oscillatory in symmetry direction, e.g. z

f (x , y , z) = Re∑n 6=0

fn(x , y) exp(inz)

Curl also contains extra terms with ∂z = in

B = (∂y Az − inAy )ex + (inAx − ∂xAz)ey + (∂xAy − ∂y Ax )ez

n 6= 0 – why not eliminate Az by gauge transformation?

A→ A + gradχ,

χ = −∫

Azdz = −Az

in(single harmonic)

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

16

Dimensionality reduction for periodic magnetostatic fields

Reduction to 2D - oscillatory part

Now only transversal a ⊥ b remains

B = −inay ex + inaxey + (∂xay − ∂y ax )ez

Splits into "Helmholtz" (+ means decay here) and other

curltνcurlta + n2ν a = j (17)−in divt νa = Jz (18)

Eq. (18) automatically fulfilled with Eq. (17) & div J = 0

Weak form for homogenous Neumann problem∫Ω

curlt w ν curlt a+n2w ·νa dΩt =

∫w ·j dΩt (→ edge elements)

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

17

Dimensionality reduction for periodic magnetostatic fields

Comparison symmetric – oscillatory

Symmetric part 2D transversal equation ("Poisson")

curltνcurlta = j

Still singular (ungauged), can add gradtχ to a

Only describes Bz component, need also other equation

Oscillatory part 2D transversal equation ("Helmholtz")

curltνcurlta + n2ν a = j

Uniquely solvable

Describes full B solution using divB = divtb + inBz = 0

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

18

Dimensionality reduction for periodic magnetostatic fields

Some basics about curvilinear coordinates

Coordinates xk parametrize space: r(x1, x2, x3)→ inverse xk (r)

(Non-orthonormal) covariant and its dual (contravariant) basis

ek = ∂k r ek = grad xk

Representation of vectors in contra- and covariant components

A =∑

k

Ak ek =∑

k

Ak ek , Ak = A · ek , Ak = A · ek

Jacobian is the square-root of determinant of metric tensor

J =√

g, gij = ∂ir · ∂jr , Ak =∑

i

gik Ak

Differential operators (εijk =1: ijk=123,231,312 / -1: 321,213,132)

divA =1√

g

∑k

∂k√

gAk curlA = ei

∑j,k

εijk√

g∂jAk

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

19

Dimensionality reduction for periodic magnetostatic fields

Oscillatory part in 2D coordinate space

Careful with Fourier in curved coordinates! Assumptions:Orthogonal system (gij has only diagonal elements)

gij depends only on x1 and x2, not on x3

Expand covariant A and contravariant J components

Ak (x1, x2, x3) =∞∑

n=−∞Ak,n(x1, x2)einx3

, (19)

Jk (x1, x2, x3) =∞∑

n=−∞Jk

n (x1, x2)einx3, (20)

2D curl in coordinate space

curl2a :=∂a2

∂x1 −∂a1

∂x2 =√

gcurlta

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

20

Dimensionality reduction for periodic magnetostatic fields

Weak form in 2D coordinate space

Coordinate space volume element: dΩ2 := dx1dx2

Coordinate space line element: dΓ2 =√

(dx1)2 + (dx2)2

Weak form of Eq. (17) homogenous Neumann problem∫Ω

g33√gνcurl2w curl2a

+n2ν

(g22√

gw1a1 +

g11√g

w2a2

)dΩ2 =

∫Ω

w · j√

gdΩ2

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

21

Dimensionality reduction for periodic magnetostatic fields

Example: Cylindrical coordinates

R

Z Ω2 Γ2

ϕ

Ω

Γ

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

22

Dimensionality reduction for periodic magnetostatic fields

Example: Cylindrical coordinates

Coordinates (R, ϕ,Z ) symmetry coordinate: angle ϕ (ordering!)

Weak form of Eq. (17) homogenous Neumann problem∫Ω2

Rν curl2a curl2w +n2

Rν (wRaR+wZ aZ ) dRdZ =

∫Ω2

R w·j dRdZ

Weighting factor follows automatically from Jacobian√

g

Magnetic field

BR =inR

aR , BZ = − inR

aZ , Bϕ = −divtbin

, .

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

23

Dimensionality reduction for periodic magnetostatic fields

Example: Shielding by cylinder shell with µ > 1

ϕ

R

R

Z

Bn

Bn = B cosϕ er

1.0

0.4

1.0

0.5

µ = 50

µ = 1

µ = 1

0.60.8

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

24

Dimensionality reduction for periodic magnetostatic fields

FreeFEM++ implementation1 load "Element_Mixte"; // for 1st order edge elements2 real n = 1.0; // mode number34 mesh Th = square(50,50,[x+1e-31,y]); // cylinder cross-section56 fespace Hrot(Th,RT1Ortho); fespace Hdiv(Th,RT1); // 1st order78 Hrot [ax,ay], [wx,wy]; Hdiv [jr,jz];9

10 func real nu(real rp, real zp) // nu = 1/mu11 if((rp>0.4)&&(rp<0.5)&&(zp>0.2&&(zp<0.8))) return 1.0/50.0;12 return 1.0;13 1415 solve CurlCurl([ax,ay],[wx,wy],solver=UMFPACK) =16 int2d(Th)(nu(x,y)*(x*(dx(wy)-dy(wx))*(dx(ay)-dy(ax))17 + n^2*1.0/x*(wx*ax+wy*ay)))18 + on(1,ax=0.0,ay=0.0)19 + on(2,3,4,ax=0.0,ay=1.0*x);2021 plot([ax,ay],wait=true,value=true,ps="a_mu.eps");

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

25

Dimensionality reduction for periodic magnetostatic fields

a field: homogenous mag. field, µ = 1 everywhere

Vec Value00.05263430.1052690.1579030.2105370.2631720.3158060.368440.4210750.4737090.5263430.5789780.6316120.6842470.7368810.7895150.842150.8947840.9474181.00005

R

Z

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

26

Dimensionality reduction for periodic magnetostatic fields

b field: homogenous field, µ = 1 everywhere

Vec Value0.999950.999960.999970.999980.9999911.000011.000021.000031.000041.00005

R

Z

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

27

Dimensionality reduction for periodic magnetostatic fields

a field: shielding by cylinder shell with µ > 1

Vec Value00.135380.2707610.4061410.5415210.6769020.8122820.9476621.083041.218421.35381.489181.624561.759941.895322.030712.166092.301472.436852.57223

R

Z

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

28

Dimensionality reduction for periodic magnetostatic fields

b field: shielding by cylinder shell with µ > 1

Vec Value00.2716940.5433870.8150811.086771.358471.630161.901862.173552.445242.716942.988633.260323.532023.803714.07544.34714.618794.890485.16218

R

Z

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

29

Dimensionality reduction for periodic magnetostatic fields

A few technical issues

Careful with 1R terms near axis (1st order works "well enough")

0th order causes troubles

Complex numbers "emulated" now

Find best interface FreeFEM++↔ Fortran

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

30

Dimensionality reduction for periodic magnetostatic fields

Iterations for kinetic plasma equilibria

Formally, curl curl solver yields B = MJ with solution operator M

Monte Carlo kinetic code yields J = K (B0 + B) (noisy)

Equilibrium field: fixed point B = MK (B0 + B) or

(MK − I)B = −MK B0

Eigenvalues of MK > 1: relaxed iterations do not help

Trick: Arnoldi method, solve unstable part separately

Challenge: random noise from Monte Carlo method

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

31

Dimensionality reduction for periodic magnetostatic fields

ITER-like tokamak (Br , vacuum) [4]

R

Z

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

32

Dimensionality reduction for periodic magnetostatic fields

ITER-like tokamak (Br , kinetic equilibrium) [4]

R

Z

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016

33

Dimensionality reduction for periodic magnetostatic fields

Conclusion

Take-home messages:

Magnetostatics written as singular curl curl equation for A2D eqs. ungauged for symmetric, gauged for oscillatory

Co-/contravariant notation useful for easy generalisation

FreeFEM++ very useful for fast and easy solution

Outlook: Apply to eddy currents, fluid dynamics (Stokes), etc.References:[1] A Bossavit, IEEE Trans. Mag. 26, 702 (1990)[2] O Biro, Comput. Meth. Appl. Mech. Eng. 169, 391 (1999)[3] Z Belhachmi, C Bernardi, S Deparis, F Hecht,

Math. Models Methods Appl. Sci. 16, 233 (2006)[4] CG Albert, MF Heyn, SV Kasilov, W Kernbichler, AF Martitsch, AM Runov,

Joint Varenna-Lausanne International Workshop, P.01 (2016)

C.G. Albert, O. Biro, M.F. Heyn, W. Kernbichler, S.V. Kasilov, P. Lainer,8th FreeFEM++ workshop, Dec 8th 2016