ebook img

Shearingbox-implementation for the central-upwind, constraint-transport MHD-code NIRVANA PDF

0.25 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Shearingbox-implementation for the central-upwind, constraint-transport MHD-code NIRVANA

Shearingbox-implementation for the central-upwind, constraint-transport MHD-code NIRVANA O. Gressel, U. Ziegler 7 0 Astrophysikalisches Institut Potsdam, D-14482 Potsdam, Germany 0 2 n a Abstract J 1 We describe the implementation of the shearingbox approach into the Godunov- 3 type central-upwind/constraint-transport magnetohydrodynamics code NIRVANA. 1 This will allow for applications which require sheared-periodic boundary conditions v astypically usedinlocalCartesiansimulationsofdifferentially rotatingsystems.We 3 0 present the algorithm in detail and discuss necessary modifications in the numerical 9 fluxes in order to preserve conserved quantities and to fulfill other analytical con- 1 0 straints as good as seem feasible within the numerical scheme. We check the source 7 terms which come with the shearingbox formulation by investigating the conserva- 0 tion of the epicyclic mode energy. We also perform more realistic simulations of the / h magneto-rotational instability with initial zero-net-flux vertical magnetic field and p compare theobtained stresses and energetics with previous non-conservative results - o exploring the same parameter regime. r t s a Key words: Magnetohydrodynamics, Numerics: shearingbox : v i X r a 1 Introduction Simulations aiming to study the local behavior of (magneto-)hydrodynamic flows usually invoke periodic boundary conditions. This accounts for the un- boundedness of the flow and prevents the system from obtaining information about its surface. However, in the case of a shearing background flow period- icity is not strictly applicable. Typical scenarios for this include differentially rotating gaseous accretion disks, which are encountered in many astrophysical contexts. Such systems (if sufficiently ionized) are found to be unstable to the so-called magneto-rotational instability (MRI) and have been successfully modeled during the past decade (see [2,3] and references therein). Consider- able progress in the field has been made using the local shearingbox approach, a detailed description of which can be found e.g. in [1]. Preprint submitted to Elsevier 5 February 2008 The two key issues to be addressed in the design of shearingbox boundary conditions are (1) the time-dependent shifted-periodic mapping of the depen- dent variables of mass density, momentum, energy and, in case of magneto- hydrodynamic flows, the magnetic field and (2) the offset introduced in the velocity component parallel to the shearing background. The latter represents the global shear across the domain which is forced constant in time. Both of these features and the numerical treatment of the resulting source terms arising in the local approximation have profound implications on the accuracy properties of the shearingbox advection/induction scheme. Inthispaperwewilldealwiththeseimplicationsindetail.First,section2gives a compact recollection of basic facts about the MHD scheme in NIRVANA necessary for a understanding of the following shearingbox implementation which is then described in Section 3. Section 4 presents test cases to validate our approach. 2 Review of the MHD scheme Although the NIRVANA code can account for dissipative effects (viscosity, diffusion, thermal heat conduction), multi-scale phenomena (using adaptive mesh refinement, see Ziegler [12]) as well as self-gravity (multigrid-type Pois- son solver, see Ziegler [13]),we want to focus here onideal MHD in three space dimensions described by the following set of coupled equations ∂u ∂fx ∂fy ∂fz + + + =S(u), (1) ∂t ∂x ∂y ∂z ∂B +∇×E=0, (2) ∂t where u = (̺,m ,m ,m ,e)⊤. The source term S arises from non-inertial x y z forces in the local frame (rotating with Ω relative to the inertial frame) and will be discussed in detail in section 3.3. The flux functions fx, fy. fz are defined as: m x  m v +p+ 1B2 −B B  x x 2 x x fx= m v −B B  , (3)  y x y x     m v −B B   z x z x  (e+p+ 1B2)v −(v·B)B   2 x x   2 m y  m v −B B  x y x x fy= m v +p+ 1B2 −B B  , (4)  y y 2 y y     m v −B B   z y z y  (e+p+ 1B2)v −(v·B)B   2 y y   m z  m v −B B  x z x z fz= m v −B B  . (5)  y z y z   m v +p+ 1B2 −B B   z z 2 z z  (e+p+ 1B2)v −(v·B)B   2 z z   We adopt a notation where the magnetic permeability is set to unity. The equations are to be supplemented by the zero-divergence constraint ∇·B = 0 for the magnetic field B and an equation of state e = ǫ + 1̺v2 + 1B2 with 2 2 ǫ = p/(γ −1). Other symbols have their usual meaning with ̺ denoting the mass density, e the total energy density, ǫ the thermal energy density, p the pressure, v the velocity, m = ̺v the momentum, E = −v × B the electric field and γ the ratio of specific heats. The numerical methodused to solve the above system is a hybrid scheme com- bining the second-order version of the Godunov-type central-upwind scheme of Kurganov et al. [8] with the constraint transport (CT) technique for diver- gence free magnetic field evolution (see e.g. Evans & Hawley [5], T´oth [10]). The original description of this hybrid approach can be found in Ziegler [11]. Here,wecompactlysummarizetherelevantknowledgenecessaryforconstruct- ing the shearingbox-implementation. LetthecomputationaldomainbesubdividedinuniformCartesiancellsC = i,j,k [x ,x ]×[y ,y ]×[z ,z ] with center (x ,y ,z ) and spacings δx, 1 1 1 1 1 1 i j k i− i+ j− j+ k− k+ 2 2 2 2 2 2 δy and δz. Then, the scheme for Eq. (1) in semi-discrete form reads Fx (t)−Fx (t) Fy (t)−Fy (t) d i+1,j,k i−1,j,k i,j+1,k i,j−1,k u (t)=− 2 2 − 2 2 i,j,k dt δx δy Fz (t)−Fz (t) 1 1 i,j,k+ i,j,k− − 2 2 +S(u (t)) (6) i,j,k δz where the cell-centered u is an approximation to the volume-averaged state i,j,k u in cell C and the numerical fluxes are given by: i,j,k 3 a+fx(wE )−a−fx(wW ) a+a− uW −uE Fx = i,j,k i+1,j,k + i+1,j,k i,j,k , (7) i+1,j,k a+ −a− (cid:16)a+ −a− (cid:17) 2 b+fy(wN )−b−fy(wS ) b+b− uS −uN Fy = i,j,k i,j+1,k + i,j+1,k i,j,k , (8) i,j+1,k b+ −b− (cid:16) b+ −b− (cid:17) 2 c+fz(wT )−c−fz(wB ) c+c− uB −uT Fz = i,j,k i,j,k+1 + i,j,k+1 i,j,k (9) i,j,k+1 c+ −c− (cid:16) c+ −c− (cid:17) 2 with w=(u,B)⊤.We apply the third-order strong-stability-preserving Runge- Kutta scheme in [7] to integrate Eq. (6) in time (see also Eq. (19)). At any stage in the Runge-Kutta scheme the evaluation of the flux functions at cell faces requires point values for the variables left/right to a cell interface which are obtained by piecewise linear reconstruction from w applying the TVD i,j,k slope-limiter of van Leer [9]. These point values are characterized in the fol- lowing by superscripts W at cell interface x = x , E at x = x , S at 1 1 i− i+ 2 2 y = y , N at y = y , B at z = z and T at z = z , respectively. With 1 1 1 1 j− j+ k− k+ 2 2 2 2 such notation wW stands for the reconstructed value within cell C i+1,j,k i+1,j,k at x = x and wE for the value within cell C at the same position. i+1 i,j,k i,j,k 2 In contrast to the cell-centered u we use staggering for the magnetic field i,j,k i.e. the face-centered finite-volume approximations to the face-averaged com- ponents are B , B and B , respectively. It follows that in 1 1 1 x|i− ,j,k y|i,j− ,k z|i,j,k− 2 2 2 the reconstruction of B at E,W position the x-component is already properly located, i.e. (B )E,W = B , whereas other components are first recon- x i,j,k x|i±1,j,k 2 structed in x-direction and then spatially averaged in the transverse direction. Reconstruction of B at the other locations N,S,B,T is done in analogous fash- ion. The quantities a± in the flux formulae define the maximum (plus sign) respec- tive minimum (minus sign) wave-propagation-direction-sensitive speed at the interface x , i.e. 1 i+ 2 a+=max{(v +c )W , (v +c )E , 0}, x f i+1,j,k x f i,j,k a−=min{(v −c )W , (v −c )E , 0}, x f i+1,j,k x f i,j,k where c = (c2 + c2)1/2 is an upper limit for the fast magnetosonic speed f S A including the sound speed c = (γp/̺)1/2 and Alfv´en-speed c = (B2/̺)1/2. s A The corresponding speeds in the y(z)-direction are denoted by b± (c±). The above method can be formally applied to the induction equation (2). 4 Writing the curl of the electric field as divergence of an antisymmetric tensor 0 E −E z y −∇×E = ∇·−E 0 E  , z x  E −E 0   y x      and utilizing the abbreviations εx = (0,−E ,E )⊤, εy = (E ,0,−E )⊤, and z y z x εz = (−E ,E ,0)⊤, in analogy to Eqs. (7)–(9) one can derive electric field y x fluxes a+εx(wE )−a−εx(wW ) a+a− BW −BE Gx = i,j,k i+1,j,k + i+1,j,k i,j,k , (10) i+1,j,k a+ −a− (cid:16) a+ −a− (cid:17) 2 b+εy(wN )−b−εy(wS ) b+b− BS −BN Gy = i,j,k i,j+1,k + i,j+1,k i,j,k , (11) i,j+1,k b+ −b− (cid:16) b+ −b− (cid:17) 2 c+εz(wT )−c−εz(wB ) c+c− BB −BT Gz = i,j,k i,j,k+1 + i,j,k+1 i,j,k . (12) i,j,k+1 c+ −c− (cid:16) c+ −c− (cid:17) 2 These are, like the F-fluxes, defined at cell faces. As before, at any stage in the Runge-Kutta scheme, the electric field function εx (εy, εz) have to be evaluated at E,W (N,S,T,B) cell interfaces using reconstructed data, e.g., εx(wE ) = (−E )E = −(v )E (B )E + (v )E (B )E . Our CT scheme y i,j,k z i,j,k x i,j,k y i,j,k y i,j,k x i,j,k for the staggeredmagnetic field components finally reads insemi-discrete form E −E E −E d z|i−1,j+1,k z|i−1,j−1,k y|i−1,j,k+1 y|i−1,j,k−1 B =− 2 2 2 2 + 2 2 2 2 , (13) 1 dt x|i− ,j,k δy δz 2 E −E E −E d z|i+1,j−1,k z|i−1,j−1,k x|i,j−1,k+1 x|i,j−1,k−1 B =+ 2 2 2 2 − 2 2 2 2 , (14) 1 dt y|i,j− ,k δx δz 2 E −E E −E d y|i+1,j,k−1 y|i−1,j,k−1 x|i,j+1,k−1 x|i,j−1,k−1 B =− 2 2 2 2 + 2 2 2 2 (15) 1 dt z|i,j,k− δx δy 2 where E , E , E are edge-centered approximations to 1 1 1 1 1 1 x|i,j− ,k− y|i− ,j,k− z|i− ,j− ,k 2 2 2 2 2 2 the edge-averaged electric field components. These are computed by compo- sition of the electric field fluxes obtained from the Godunov-central scheme, i.e., 1 E = (−Gy −Gy +Gz +Gz ), (16) x|i,j−12,k−21 4 z|i,j−12,k z|i,j−21,k−1 y|i,j,k−21 y|i,j−1,k−21 5 1 E = (+Gx +Gx −Gz −Gz ), (17) 1 1 1 1 1 1 y|i− ,j,k− 4 z|i− ,j,k z|i− ,j,k−1 x|i,j,k− x|i−1,j,k− 2 2 2 2 2 2 1 E = (−Gx −Gx +Gy +Gy ). (18) z|i−21,j−21,k 4 y|i−21,j,k y|i−12,j−1,k x|i,j−21,k x|i−1,j−21,k It is now easy to show from (13)–(15) that B −B d d x|i+1,j,k x|i−1,j,k ∇·B = 2 2  dt i,j,k dt δx (cid:16) (cid:17)   B −B B −B 1 1 1 1 y|i,j+ ,k y|i,j− ,k z|i,j,k+ z|i,j,k− + 2 2 + 2 2 = 0.  δy δz   Thus, if (∇·B) = 0 initially, the system evolves divergence-free since this i,j,k condition is fulfilled after each stage in the multi-stage Runge-Kutta scheme. ThefullsystemofODEs(6),(13)–(15)includingthesourcetermissolvedwith the strong-stability-preserving third-order Runge-Kutta integration scheme given by (dropping cell indices and writing the rhs of Eq. 6 as L + S and F (13)–(15) compactely as dB = L ) dt E u(1)=un +δt(Ln +Sn) F B(1)=Bn +δtLn , E 3 1 1 u(2)= un + u(1) + δt(L(1) +S(1)) 4 4 4 F 3 1 1 B(2)= Bn + B(1) + δtL(1), 4 4 4 E 1 2 2 un+1= un + u(2) + δt(L(2) +S(2)) 3 3 3 F 1 2 2 Bn+1= Bn + B(2) + δtL(2) (19) 3 3 3 E with the time-step δt = tn+1 −tn restricted by the CFL condition. 3 Shearingbox implementation Let us now consider a magnetohydrodynamic flow with a background profile of the form v = (0,v = sx,0), with (linear) shear-parameter s. The compu- y tational domain is a Cartesian box with dimensions L , L , L and periodic x y z boundaries in y− and z−direction. To account for the background shear we 6 Fig. 1. Mapping of ghost zone values for a 2D shearingsheet. Reconstruction is indicated by highlighted cells. Arrows illustrate the need for a global velocity offset to match the velocity profile of the neighboring domain. introduce shearingbox boundary conditions in x−direction. These can be ex- pressed mathematically in the form1 (e.g. [1]): f(x,y,z) 7→ f(x±L ,y ∓wt,z), f ∈ {̺,m ,m ,ǫ} (20) x x z m (x,y,z) 7→ m (x±L ,y ∓wt,z) ∓̺w, (21) y y x where w = −sL represents the global velocity-offset across the box, as can be x seeninFigure1.BecauseNIRVANAbeingaconservativecodeevolvesthetotal energy (rather than the internal energy ǫ) we supplement the corresponding relation for the total energy density e(x,y,z) 7→ e(x±L ,y ∓wt,z) ∓m w + 1̺w2, (22) x y 2 which can be easily derived by separating the m2/(2̺) part from the total y energy and then using (21). As the y-coordinate of above mappings varies continously in time, there is some kind of interpolation necessary to map ghostzone values on a finite grid (see e.g. [1] for details). For our implementation, the same piecewise linear reconstruction is used as for the numerical scheme. Due to the shifted periodicity and the additional interpolation, ghost cells on opposing sides of the domain along with their adjoint regular zones are not re- 1 Position arguments are being suppressed for extra variables in eqs. (21), (22). 7 dundant in the same sense as for strictly periodic boundary conditions. Let us elucidate on that: In the case of regular periodicity every pair of cell and ghost cell (separated by the domain boundary) has an identical counterpart at the opposite boundary. Therefore the total flux across the interface is conserved to machine accuracy. For shifted periodicity at a given time t this does no longer hold. Thus the ad- ditionaltruncationerrorconnectedtotheinterpolationcanleadtothebuildup of considerable deviations in conserved quantities, as is shown in section 4.1. In the following we want to suggest a method to correct for this. Since strict conservation only applies as long as there is no source on the rhs of (1), in the local shearingbox approach with source term (33)/(34) only the total z- momentum and mass are exactly conserved. We note that it is nevertheless desirable to preserve all variables as good as possible under advection. 3.1 Conservation of hydrodynamic variables As the numerical fluxes are nonlinear functions of the conserved quantities any form of interpolation for the ghost cells will lead to some small inconsis- tency in the fluxes. This can be avoided by matching the computed x-fluxes at the sheared domain boundaries. It is straightforward to map fluxes not containing m . The quantities related to those fluxes, i.e. mass density, x- y and z-momentum are then conserved to machine precision with respect to advection. For the y-momentum flux and total energy flux, applying the map- pings(21)/(22) tothethirdandfifthcomponent oftheflux function(3) yields: fx(m ) 7→ fx(m )∓fx(̺)w , (23) y y fx(e) 7→ fx(e)∓fx(m )w+ 1fx(̺)w2 , (24) y 2 in nice analogy to the originalmappings. We want to point out that these rela- tions consistently include the magnetic part of the fluxes due to the Lorentz- force, although this is not directly visible in the above notation. Also, the modifications to the fluxes can be solely expressed in terms of fluxes and the velocity offset w. The recipe can then directly be carried over to the numerical fluxes (7): while the first term is just a linear combination of the flux-function (evaluated at the adequate positions) one has to apply (21)/(22) once again for the second term, which then gives: Fx (m ) = Fx (m ) ∓ Fx (̺)w , (25) 1 y 1 y 1 i+ ,j,k ˜ı+ ,˜,k ˜ı+ ,˜,k 2 2 2 b b 8 Fx (e) = Fx (e) ∓ Fx (m )w + 1Fx (̺)w2 , (26) i+1,j,k ˜ı+1,˜,k ˜ı+1,˜,k y 2 ˜ı+1,˜,k 2 2 2 2 b b b where the hat stands for the piecewise linear interpolation procedure used, and tilde marks the corresponding indices of the zones to map from. Relation (24) expresses the fact that the total energy within the shearingbox is not conserved but can be altered by angular momentum transport through the radial boundaries. In integral formulation this corresponds to Eq. (8) (cast into our notation) of Hawley et al. [1]: ∂Γ = w dydz(̺v δv −B B ) (27) x y x y ∂t Z ∂X where Γ is the volume integral of total energy and δv = v +sx expresses the y y perturbed velocity.2 When correcting the energy- and momentum-fluxes ac- cording to Eqs. (23), (24) one can satisfy this property more accurately which allows to trace the detailed evolution of energetics, e.g. in MRI-simulations. 3.2 Conservation of magnetic flux Applying Gauß’ theorem to the integral form of the induction equation, one can show that the azimuthal field (due to the shear) grows linearly with the net radial magnetic field-flux through the radial boundaries: ∂hBi w = − yˆ dydzB . (28) x ∂t V Z ∂X For zero net radial field the mean magnetic flux through the shearingbox is conserved. Our implementation satisfies this condition to machine accuracy for the x- and z-component of the magnetic field and to truncation error for they-component(seesection4.1).This correspondstotheamountofprecision reported by [1,6]. The seminal paper of Hawley et. al [1] discusses this topic rather briefly, men- tioning that mapping the electromotive forces at the sheared interfaces con- serves the vertical field to roundoff error. Furthermore, the authors state that the spurious vertical field, that arises otherwise, is negligible as the associ- ated MRI growth rates are unresolved. Considering the differences between MRI-simulations with and without zero net vertical field (see e.g. [6]) leaves 2 Expanding δv yields the additional w2 term in (24). y 9 this somewhat questionable in the sense that a spurious field might lead to an overestimation of magnetic stresses in the latter case. One might further investigate this by a series of MRI-simulations with initial vertical field of the form B = B sin(2πx/L ) + B , where |B | ≪ |B |, i.e., with a controlled z 0 x 1 1 0 ”spurious” field. Although from the physical point of view an exactly vanish- ing vertical flux is rather a question of academic nature, the issue of enhanced turbulent transport for net vertical field is still standing. In our implementation we apply additional boundaryconditions to theelectric field fluxes G to assure conservation of mean magnetic fields. Due to the different staggering of magnetic field components, which are face-centered, the method has to be applied for the fluxes in all three directions. The velocity offset w enters the fluxes via the electromotive force: E(x,y,z) 7→ E(x±L ,y ∓wt,z) ±w yˆ ×B (29) x For the x(z)-direction only the x(z)-component of the magnetic field is needed to evaluate the additional second term. As the staggering of the normal field component coincides with that of the fluxes no reconstruction is needed in this case. Employing BE = BW (respectively BT = BB ) the x|i,j,k x|i+1,j,k z|i,j,k z|i,j,k+1 characteristic velocities cancel out and we yield Gx =Gx ∓ w yˆB (30) 1 1 1 i+ ,j,k ˜ı+ ,˜,k x|˜ı+ ,˜,k 2 2 2 Gz =Gcz ∓ w yˆB (31) 1 1 1 i,j,k+ ˜ı,˜,k+ z|˜ı,˜,k+ 2 2 2 c for the numerical electric fluxes in x/z-direction. For the remaining direction matters are a bit more complicated and we need the full reconstruction to be consistent with the underlying numerical scheme: b+(B xˆ +B zˆ)N −b−(B xˆ +B ˆz)S Gy = Gy ±w x z ˜ı,˜,k x z ˜ı,˜,k (32) i,j+1,k ˜ı,˜+1,k b+ −b− 2 2 c To conclude the discussion of the boundary conditions we want to remark that the reconstruction of the magnetic field at the sheared interfaces preserves the ∇·B = 0 constraint to roundoff error (see section 4.1). The actual code is pub- licly available on the internet at www.aip.de/~gressel/index.php?id=code and can be embedded into the original NIRVANA package. The current implementation supports distributed memory parallelism in the formofblockwisedomaindecompositionalongthez-coordinate.Inthiscaseall the information needed to reconstruct the boundary values is available locally, i.e., without MPI communications. Additional block distribution along the x- 10

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.