magnetic fields and mhd 17 february 2003 (snow permitting) astronomy g9001 - spring 2003 prof....

33
Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Upload: kassandra-bayley

Post on 15-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Magnetic Fields and MHD

17 February 2003 (snow permitting)

Astronomy G9001 - Spring 2003

Prof. Mordecai-Mark Mac Low

Page 2: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

MHD Approximation• Maxwell’s Equations in a gas

Mestel, Stellar Magnetism

4 0

1 4 1e

c t c c t

E B

B EE B J

The displacement current vanishes if electrons & ions move together

• This happens when thermal fluctuations can’t separate electrons, ions.

• Balance TE to electric PE (Debye length)

1/ 2 1/ 2

27 cm

4De e

kT T

n e n

Page 3: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Generalized Ohm’s Law

1

ec cn e

J v B

E J B

Hall term

• so long as ions are not very massive (eg dust grains) we may neglect the Hall term.

• If σ large, then E+(v/cB) = 0

Page 4: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Induction Equation

1

c t c

t

v BBE

Bv B

From Maxwell’s equations,

Page 5: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Lorentz Force

• Ampère’s law, in absence of displacement

current:4

c

B J

• The Lorentz force density: 1

4c

BJ B B

21 1 1

4 4 8B

B B B B

• so Lorentz force

• Remember vector identity: 21

2A A A A A

magnetic tension

magnetic pressure

net force always actsperpendicular to B

Page 6: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Magnetic Resistivity

• If σ finite, then we can use Ohm’s law and Maxwell’s equations:

1

4c c t

c

v BJ BE

J B

2

4

c

t

B

v B B

magnetic diffusivity λ

Magnetic Reynolds #:

m

vLR

Page 7: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Flux Conservation

• If σ , then magnetic flux through any parcel of gas remains constant:

• Gas remains tied to field lines

0

S S C

S C

S

D

Dt t

t

t

BB dS dS B v dS

BdS v B dS

Bv B dS

C

dS

Page 8: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Flux Conservation Consequences

• Flux cannot be created or destroyed without resistive effects (reconnection)

• So where did Galactic field come from?

• Flux carried with gas during collapse

• How come stars do not have same mass to flux ratio as interstellar gas?

Page 9: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

MHD Waves

• Linearize MHD equations:

Jackson, Ch. 10 Classical Electrodynamics

0 1 0 1

2 01

0

( , ) ,

, s

t t

Pt c

B B B x x

v v x

10 1

0 10 1 10 0

0

t

t

t

v

v

v

Page 10: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

210 1 0 1

10

4

1

4

sc

P

vv v

B

B B

vB

t

t

11 0tt

B

vv B BB

221 0

0 12

Taking a time derivative of the momentum eqn:

04sc

t t t

1v B B

2

21 00 0 1 1 02

04sc

t

v Bv v B

Page 11: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

2

21 0 01 12

0 0

04 4

sct

v B Bv v

0

0

1 1

introduce the Alfven velocity , and choose 4

plane waves exp .

A

i i t

Bv

v v k x

2 2 21 1s Ac v v k v k

1 1 1 0A A A A v k v k v v v k k v v

2 2

22 2 2 2

1 12

if then last term vanishes, leaving magnetosonic

waves with , while if :

1 0

A

s A A

sA A A

A

v c v

ck v k

v

k v

k v

v v v v

1 0

transverse Alfven

waves

A v v

Page 12: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

MHD waves

Robert McPherron, UCLA

Page 13: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

MHD Shocks

• If B v then shock jump conditions are

v1 v2

B1 B2

1 1 2 2

2 22 21 2

1 1 1 2 2 2

2 221 1

1 1 1 1 1 1 2

1 2 2

1

1

8 8

1 1... , u =

8 2 8 -1

v B v B

v v

B BP v P v

B B PP v u v v

Mestel, Stellar Magnetism

continuity of flux transport

Page 14: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

MHD shock

• perpendicular shock: 2 2 1

1 1 2

B vD

B v

2 2 21 1 1 1 1

21 1

1 1 2 21 1 1

1

is found from the positive root of

2 2- 2 1 2 1 0,

2where , .

8

1As ,

1

s

s A

D

D M D M

v P cM

c B v

M D

Page 15: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Oblique shocks

• Field at arbitrary angle to shock normal

• Parallel field must be conserved

• Momentum conservation in frame w/– no magnetic energy flow across shock

• Momentum conservation then gives

1 2x xB B1

1 11

yy x

x

B

v vB

2 2 2 22 21 1 2 2

1 1 1 2 2 2

1 1 2 21 1 1 2 2 2

8 4 8 4

4 4

x xx x

x y x yx y x y

B B B BP v P v

B B B Bv v v v

Page 16: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Oblique Shocks

• Three solutions (e.g. Mestel, p. 50):

v1

slowshock

fastshock

intermediate (Alfvèn)shock

Page 17: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Partially Neutral Gas• Only ions feel Lorentz force from B field

• Ions, neutrals couple through collisions, adding symmetric terms to momentum eqn

,

1,

4

where the collisional coupling constant

ii i i i

i n i n

i n n

nn n

i

i

i

n n n

n

P

m m

Pt

t

v vv

v v

B B

v

vv v

v v

Page 18: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

J-Shocks vs. C-Shocks• Classical shock is a

discontinuous jump or J-shock

• If vAi> vs>csn then ions see continuous compression by magnetic precursor

• Neutrals dragged by ions into continuous compression: C-shock (Mullan 1971, Draine 1980) Smith & Mac Low 1997

Page 19: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low
Page 20: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Nonlinear Development

Mac Low & Smith 1997

tim

e

Log ρ

Page 21: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Current Sheet Formation• Brandenburg & Zweibel (1994, 1995) showed

that nonlinear nature of field diffusion from ion-neutral drift produces sharp structures.

• Analogous to shock formation in strong sound waves: magnetic pressure higher in peaks, so waves spread and steepen.

• Zweibel & Brandenburg (1997) emphasized that current sheets form, driving reconnection.

• Seems to explain numerical results well.

i

i in

vt c

B BB

BB

Page 22: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Next week’s assignments

• Read Slavin & Cox (1993, ApJ, 417, 187) on the filling factor of hot gas with non-thermal pressures included

• Read Stone & Norman (1992b, ApJS, 80, 791) -- the MHD ZEUS paper

• Complete the blast exercise

Page 23: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Parallelization

• Additional issues:– How to coordinate multiple processors– How to minimize communications

• Common types of parallel machines– shared memory, single program

• eg SGI Origin 2000, dual or quad proc PCs

– multiple memory, multiple program• eg Beowulf Linux clusters, Cray T3E, ASCI systems

Page 24: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Shared Memory

• Multiple processors share same memory

• Only one processor can access memory location at a time

• Synchronization by controlling who reads, writes shared memory

U of Minn Supercomputing Inst.

Page 25: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Shared Memory• Advantages

– Easy for user

– Speed of memory access

• Disadvantages

– Memory bandwidth limited.

– Increase of processors without increase of bandwidth will cause severe bottlenecks

Page 26: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Distributed Memory

• Multiple processors with private memory • Data shared across network • User responsible for synchronization

U of Minn Supercomputing Inst.

Page 27: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Distributed Memory• Advantages

– Memory scalable with number of processors. More processors, more memory.

– Each processor can read its own memory quickly

• Disadvantages – Difficult to map data structure to memory

organization – User responsible for sending and receiving data

among processors

• To minimize overhead, data should be transferred early and in large chunks.

Page 28: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Methods

• Shared memory– data parallel

– loop level parallelization

• Implementation– OpenMP

– Fortran90

– High Performance Fortran (HPF)

• Examples– ZEUS-3D

• Distributed memory– block parallel

– tiled grids

• Implementation– Message Passing Interface (MPI)

– Parallel Virtual Machine (PVM)

• Examples– ZEUS-MP

– Flashcode

– GADGET

Page 29: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

OpenMP

• Designate inner loops that can be distributed across processors with DOACROSS command.

• Dependencies between loop instances prevent parallelization

• Execution of each loop usually depends on values from neighboring parts of grid.

• ZEUS-3D only parallelizes out to 8-10 processors with OpenMP

Page 30: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Cache Optimization

• Modern processors retrieve 64 bytes or more at a time from main memory– However it takes hundreds of cycles

• Cache is small amount of very fast memory on microprocessor chip– Retrievals from cache take only a few cycles.

• If successive operations can work on cached data, speed much higher– Fastest changing array index should be inner loop,

even if code rearrangement required

Page 31: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Parallel ZEUS-3D

• To run ZEUS-3D in parallel, set the variable iutask = 1 in setup block, recompile.– inserts DOACROSS directives– compiles with parallel flags turned on if OS

supports them.

• Set the number of processors for the job (usually with an environment variable)

• Run is otherwise similar to serial.

Page 32: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

Use of IDL

• Quick and dirty moviesfor i=1,30 do begin & $ a=sin(findgen(10000.)) & $ hdfrd,f=’zhd_’+string(i,form=’(i3.3)’)+’aa’,d=d,x=x & $ plot,x,d[4].dat & end

• Scaling, autoscaling, logscaling 2D arrays tvscl,alog(d) tv,bytscl(d,max=dmax,min=dmin)

• Array manipulation, resizing tvscl,rebin(d,nx,ny,/s) ; nx, ny multiple tvscl,rebin(reform(d[j,*,*]),nx,ny,/s)

pause

Page 33: Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low

More IDL

• plots, contours

plot,x,d[i,*,k],xtitle=’Title’,psym=-3 oplot,x,d[i+10,*,k]

contour,reform(d[i,*,*]),nlev=10

• slicer3D

dp = ptr_new(alog10(d))

slicer3D,dp

• Subroutines, functions