Divergence Problem in MHD
Friedemann Kemm BTU Cottbus
kemm@math.tu-cottbus.de
0 0.05 0.1 0.15 0.2 0.25
0 20 40 60 80 100
central differences upwind differences transverse upwind differences
0 0.05 0.1 0.15 0.2 0.25
0 20 40 60 80 100
central differences upwind differences transverse upwind differences
The problem
Equations for the magnetic field:
Bt−∇ × (v × B) = 0
∇ · B = 0
⇒ No coupling of evolution and constraint!
The known solutions
Constrained Transport
• Apply special discretization
• Evans, Hawley, Balsara, Spicer, Torrilhon, Fey, Rossmanith, Kr¨oner, Besse . . .
• Discretized ∇ · B constant in time Divergence Cleaning
• Extend equations to control errors
• GLM-correction, Powell method, Transport correction
• With suitable chosen coefficients ∇ · B → 0 (t → ∞)
The surprise
Some schemes do not need any special technique:
• Zachary, Malagoli and Colella (1994), Upwind scheme
• Balbas and Tadmor (2006), Central scheme
Common to both schemes:
• No 1-d physics for inter-cell fluxes
Involutions
Conservation Law (F = (F1, F2, . . .))
qt + ∇ · F(q) = 0
with Involution (Mi matrices)
X
i
Mi qxi = 0
satisfied for every time whenever satisfied by initial condition Sufficient condition:
MiFj + MjFi = 0 i , j = 1,2, . . .
⇒ P
i Miqxi constant in time
Proof of Sufficiency
• Apply P
i Mi ∂x∂
i to the conservation law
• Constant matrices commute with derivatives
• Partial derivatives commute with each other
• Due to condition all terms including fluxes vanish Result:
∂
∂t
X
i
Mi qxi
= 0 Discrete Analogue?
Linear Schemes – Example
Discretized Conservation Law (2-d):
∂ˆ
∂tˆ q +
∂ˆ
∂xˆ F(q) +
∂ˆ
∂yˆ G(q) = 0 with constant coefficient vectors α, β, γ and
∂ˆ
∂tˆ hi ,jn := X
m
αm hn+mi ,j
∂ˆ
∂xˆ hi ,jn := X
k ,l
βk ,l hin+k ,j+l
∂ˆ
∂yˆ hi ,jn := X
k ,l
γk ,l hin+k ,j+l
Linear Schemes – Simple Calculations
∂ˆ2
∂xˆ ∂tˆ hi ,jn = X
k ,l
βk ,l X
m
αm hin+m+k ,j+l = X
k ,l ,m
βk ,l αm hin+m+k ,j+l
= X
m
αm X
k ,l
βk ,l hin+m+k ,j+l =
∂ˆ2
∂tˆ ∂xˆ hi ,jn
M
∂ˆ
∂tˆ hni ,j = X
m
αm M hn+mi ,j = X
m
αm (M h)n+mi ,j =
∂ˆ
∂tˆ (M h)ni ,j
Other (pairs of) partial derivatives analogue
Discrete Proof of Sufficiency
• Apply P
i Mi ˆ∂ˆ
∂xi to the discrete conservation law
• Constant matrices commute with discrete derivatives
• Linear discrete partial derivatives commute with each other
• Due to condition all terms including fluxes vanish Result:
∂ˆ
∂tˆ
X
i
Mi
∂ˆ
∂xˆ iq
= 0
Numerical example
Linearized induction equation (2d)
Bt − ∇ × (v × B) = 0 , v = (u, v)T ≡ constant , u, v > 0
• Standard upwind (DCU)
• Transverse upwind (CTU):
∂ˆ
∂xˆ h = (1 − cy)hi ,j − hi−1,j
∆x + cyhi ,j−1 − hi−1,j−1
∆x
∂ˆ
∂yˆ h = (1 − cx)hi ,j − hi ,j−1
∆y + cxhi−1,j − hi−1,j−1
∆y
• Forward Euler in time
Numerical Results
Initial condition
B1 = cos(2πx + πy) B2 = −2 cos(2πx + πy) L2-norm
0 0.05 0.1 0.15 0.2 0.25
0 20 40 60 80 100
central differences upwind differences transverse upwind differences
0 0.05 0.1 0.15 0.2 0.25
0 20 40 60 80 100
central differences upwind differences transverse upwind differences
Standard upwind Transverse upwind
Nonlinear Case
Finite differences for partial derivatives
∂ˆ
∂xˆ hj = (hx)j + O(∆xp)
∂ˆ
∂tˆ hj = 1
∆t
X
i∈I
αihj+i = (ht)j + O(∆tq) with bounded, not necessarily constant, in general matrix valued αj
∂ˆ
∂tˆ
∂ˆ
∂xˆ h
j = 1
∆t
X
i∈I
αi
(hx)j+i + O(∆xp)
=
∂ˆ
∂tˆ (hx)j + O ∆xp
∆t
= (hx t)j + O(∆tq) + O ∆xp
∆t
Commutators of finite differences
Space and time derivatives
∂ˆ
∂tˆ
∂ˆ
∂xˆ h
j − ∂ˆ
∂xˆ
∂ˆ
∂tˆ h
j = O ∆xp
∆t
+ O ∆tq
∆x
(1)
Space derivatives with each other
∂ˆ
∂yˆ
∂ˆ
∂xˆ h
j − ∂ˆ
∂xˆ
∂ˆ
∂yˆ h
j = O(∆xp−1) . (2)
Partial derivatives with matrices M
∂ˆ
∂tˆ (h)j − ∂ˆ
∂tˆ (Mh)j = O(∆tq) (3)
Discrete Nonlinear Proof of Sufficiency
• Use discrete differences of order O(∆xp) in space and O(∆tq) in time
• Apply P
i Mi ˆ∂ˆ
∂xi to the discrete conservation law
• Constant matrices commute with discrete derivatives with error of order O(∆tq) (time) or O(∆xp) (space)
• nonlinear discrete partial space derivatives commute with error according to (1) and (2)
• Due to condition all terms including fluxes vanish Result:
∂ˆ
∂tˆ
X
l
Ml
∂ˆ
∂xˆlqj
= O ∆xp
∆t
+ O ∆tq
∆x
+ O(∆xp−1)
Resonance
Weakly hyperbolic degeneracy for u = 0
B1t + vB1y = 0 (4)
B2t − vB1x = 0 (5)
Eq. (5) ODE for B2 ⇒ grows (for B1y = 0 linear) in time
∇ · B = B1x + B2y ⇒ B1x = −B2y + ∇ · B Inserted in (5):
B2t + v B2y = v(∇ · B)
• Advection in y-direction if divergence constrained fulfilled
• Otherwise, source, constant in time ⇒ Resonance
Resonance: Effects in Full MHD
• B grows by resonance
• Wave speeds depend on B
• Time step depends on leading wave speed
• Error estimate for the growth of ˆ∇ · B depends on ∆xp/∆t
Result: Error estimate for divergence worthless
Resonance – Numerical Example
0 5 10 15 20 25
-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1
B1 B2
0 5 10 15 20 25
-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1
B1 B2
0 5 10 15 20 25
-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1
B1 B2
Initial condition CIR-scheme Lax-Friedrichs
Consequences:
• Schemes resolving resonant waves fail
• Example System: all schemes taking care of wave-speeds coincide
Lax-Friedrichs Scheme
Starting point
qn+1i − qni
∆t + f (qni+1) − f (qni−1)
2∆x = 0
Unstable ⇒ Replace qni by average of neighboring values LF-scheme
qn+1i − 12(qni+1 + qni−1)
∆t + f (qni+1) − f (qni−1)
2∆x = 0
Consequence for ˆ∂ˆ
∂th = 0
hin+1 − 1
2(hin+1 + hni−1) = 0
⇔ hin+1 = hin + 1
2(hin+1 − 2hni + hin−1)
= hin + ∆t ∆x2 2∆t
hin+1 − 2hin + hin−1
∆x2
HLL-scheme
Numerical flux function
gHLL(qr, ql) = 1
2 f (qr) + f (ql)
− 1 2
SR + SL
SR − SL f (qr) − f (ql) + SRSL
SR − SL(qr − ql)
• Red term goes into time difference ⇒ central viscosity
• Vanishes if resonant wave exactly resolved (SL = 0 or SR = 0)
⇒ Impose lower bound on |SL/R| ⇒ lower bound on central viscosity Problem with 1d physics for inter-cell fluxes: No control on resonant wave
Shallow Water MHD
Evolution equations
ht + ∇ · [hv] = 0 (hv)t + ∇ · [hvvT−hBBT + gh2
2 I] = 0 (hB)t − ∇ × [v × (hB)] = 0
and the divergence constraint
∇ · (hB) = 0
Resonance e. g. for B k v
De Sterck Problem – Divergence for 1st Order
L∞-norm of divergence
0 0.5 1 1.5 2 2.5 3
0 50 100 150 200 250 300
with Harten fix without entropy fix
Resonant Example
LLF (Rusanov) 2nd order, 1-d physics for inter-cell fluxes
-1 -0.5
0 0.5
1 -1 -0.5
0 0.5
1 0.5
1 1.5 2 2.5
-1 -0.5
0 0.5
1 -1 -0.5
0 0.5
1 0
0.5 1 1.5 2 2.5
-1 -0.5
0 0.5
1 -1 -0.5
0 0.5
1 0
20 40 60 80 100
B1 after 4,5, and 6 time steps
De Sterck Problem (2nd order Roe with Harten entropy fix)
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Initial state t=0.8
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Distribution of Divergence
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
t=0.8 t=4.8
• No Divergence errors transported
• Computation survives even for long time
Outlook
0.001 0.01 0.1 1 10 100
100
Divergence error
Number of grid cells per direction Lax-Wendroff, dimensional splitting
CTU 2nd order
General criterion for ∂ˆˆ
∂t
P
l Ml ∂ˆˆ
∂xlqj
to be of the same order as the scheme itself?
Conclusions
• Divergence constraint prevents resonance
• Applying linear difference operators preserves discrete involution
• Approximate discrete involution for nonlinear systems
• Resonance can make the approximation worthless
• Stability by central viscosity on resonant wave
• 1-d physics for fluxes prevents control of viscosity on resonant wave
Problems with Initial Condition
Bl B∗l
B∗l
Br Br Br
B∗r B∗r
B∗r
Divergence in Upwind Differences:
(Marked cell)
• Vanishes if u · v > 0
• Else
∇ · B = α
∆x(B2r − B2l)
∆x space step size
α fraction of marked cell right of discontinuity
Numerical Example
B1 with different velocities
-2.5 -2 -1.5 -1 -0.5 0 0.5 1
0 50
100 150
200 250 300 0
10 20 30 40 50 60 70 80 90 100 -2.5
-2 -1.5 -1 -0.5 0 0.5 1
-2.5 -2 -1.5 -1 -0.5 0 0.5 1
0 50
100 150
200 250 300 0
10 20 30 40 50 60 70 80 90 100 -2.5
-2 -1.5 -1 -0.5 0 0.5 1
u, v > 0 u > 0, v < 0
Important Types of Involutions
Type I:
∂
∂t
X
i
Mi qxi
= 0 Type II:
tlim→∞
X
i
Mi qxi = 0 independent of initial condition
Examples:
MHD: ∇ · B Involution of Type I SMHD: ∇ · (hB) Involution of Type I GLM-MHD: ∇ · B Involution of Type II Powell-MHD: ∇ · B Involution of Type II
Resonance – Second Example (3d)
Pt + ∇(v · P) = 0 ∇ × P =: C Degeneracy for u = v = 0
Pt + w∇P3 = 0 Insert Curl of P
Pt + wPz = w
C2
−C1 0
• Resonance if ∇ × P 6= 0 and not parallel to v
• Otherwise linear Advection in z-direction
Relation to GLM-approach
System including numerical viscosity introduced by LF
Bt − ∇ × (v × B) = ∆x2
2∆t∇ · (∇B) Parabolic GLM
Bt − ∇ × (v × B) + ∇ψ = 0 1
κψ + ∇ · B = 0 results in
Bt − ∇ × (v × B) = κ∇(∇ · B)