Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Force between magnets wikipedia , lookup
Immunity-aware programming wikipedia , lookup
Scanning SQUID microscope wikipedia , lookup
Multiferroics wikipedia , lookup
Electromagnetism wikipedia , lookup
Lorentz force wikipedia , lookup
Faraday paradox wikipedia , lookup
Magnetic Fields and MHD 17 February 2003 (snow permitting) Astronomy G9001 - Spring 2003 Prof. Mordecai-Mark Mac Low Mestel, Stellar Magnetism MHD Approximation • Maxwell’s Equations in a gas E 4e B 0 1 B 4 1 E E B J c t c c t • This happens when thermal fluctuations can’t separate electrons, ions. • Balance TE to electric PE (Debye length) The displacement 1/ 2 kT D 2 4 nee 1/ 2 T 7 cm ne current vanishes if electrons & ions move together Generalized Ohm’s Law vB 1 E J B c cnee J 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 Induction Equation From Maxwell’s equations, v B 1 B E c t c B v B t Lorentz Force • Ampère’s law, in absence of displacement 4 current: B J c 1 B • The Lorentz force density: J B B c 4 • Remember vector identity: • so Lorentz force 1 A A A A A2 2 1 1 1 2 B B B B B 4 4 8 net force always acts perpendicular to B magnetic tension magnetic pressure Magnetic Resistivity • If σ finite, then we can use Ohm’s law and Maxwell’s equations: E J v B 1 B 4 c c t c J B B c v B B t 4 magnetic diffusivity λ 2 Magnetic Reynolds #: Rm vL Flux Conservation • If σ , then magnetic flux through any parcel of gas remains constant: D B B dS dS B v dS Dt S S t C B dS S t v B dS C B v B dS 0 S t • Gas remains tied to field lines dS C 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? Jackson, Ch. 10 Classical Electrodynamics MHD Waves • Linearize MHD equations: B B0 B1 (x, t ) 0 1 x, t v v1 x, t P0 c 0 2 s 0 1 v 0 0 1 v1 0 t t 1 0 v1 0 t v 1 v v P B B t 4 v1 1 2 0 cs 1 B 0 B1 0 t 4 B B1 v B v1 B 0 t t Taking a time derivative of the momentum eqn: v1 B1 B0 2 0 2 cs 1 0 t t t 4 2 v1 B0 2 0 2 cs 0 v1 v1 B0 0 t 4 2 v1 B B 2 0 0 c v v 0 s 1 1 2 t 40 4 0 2 B0 introduce the Alfven velocity v A , and choose 40 plane waves v1 v1 exp ik x it . v1 c v 2 2 s 2 A k v k 1 v A k v A k v1 v A v1 k k v1 v A 0 if k v A then last term vanishes, leaving magnetosonic waves with v c v , while if k v A : 2 s 2 A v A v1 0 transverse Alfven waves 2 2 cs 2 2 2 k vA v1 v 2 1 k v A v1 v A 0 A MHD waves Robert McPherron, UCLA B1 v1 B2 v2 Mestel, Stellar Magnetism MHD Shocks • If B v then shock jump conditions are 1v1 2v2 2 1 2 2 B B 2 P1 v P2 2v2 8 8 2 B12 1 B 1 P 2 1 P1 v1 1u1 1v1 v1 ...2 , u = 8 2 8 -1 2 1 1 v1B1 v2 B2 continuity of flux transport MHD shock B2 2 v1 • perpendicular shock: D B1 1 v2 D is found from the positive root of 2 2- D 2 1 1 1M 2 D 1 1M 0, 2 2 1 v1 P1 2 cs2 where M 1 , 1 2 2. cs1 B1 8 v A 1 1 As M 1 , D 1 2 1 Oblique shocks • Field at arbitrary angle to shock normal • Parallel field must be conserved B1x B2 x B1 y • Momentum conservation in frame w/ v1 y v1x B1x – no magnetic energy flow across shock • Momentum conservation then gives 2 2 2 2 B1 B1x B2 B2 x 2 2 P1 1v1x P2 2v2 x 8 4 8 4 B1x B1 y B2 x B2 y 1v1x v1 y 2v2 x v2 y 4 4 Oblique Shocks • Three solutions (e.g. Mestel, p. 50): slow shock intermediate (Alfvèn) shock fast shock v1 Partially Neutral Gas • Only ions feel Lorentz force from B field • Ions, neutrals couple through collisions, adding symmetric terms to momentum eqn v n n n v n v n Pn i n vi v n , t v i i i v i v i Pi t 1 B B i n v n vi , 4 v where the collisional coupling constant mi mn 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: Cshock (Mullan 1971, Draine 1980) Smith & Mac Low 1997 Nonlinear Development time Log ρ Mac Low & Smith 1997 Current Sheet Formation • Brandenburg & Zweibel (1994, 1995) showed that nonlinear nature of field diffusion from ion-neutral drift produces sharp structures. B B B B vi B t i in c • 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. Next week’s assignments • Read Slavin & Cox (1993, ApJ, 417, 187) on the filling factor of hot gas with nonthermal pressures included • Read Stone & Norman (1992b, ApJS, 80, 791) -- the MHD ZEUS paper • Complete the blast exercise 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 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. 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 Distributed Memory • Multiple processors with private memory • Data shared across network • User responsible for synchronization U of Minn Supercomputing Inst. 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. 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 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 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 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. Use of IDL • Quick and dirty movies pause for 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) 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