Changes between Version 23 and Version 24 of AstroBearProjects/resistiveMHD


Ignore:
Timestamp:
01/27/13 23:52:36 (12 years ago)
Author:
Shule Li
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • AstroBearProjects/resistiveMHD

    v23 v24  
    1 = ======================================= =
    2 = The 2.5-D Magnetized Cloud with Resistivity =
    3 = ======================================= =
     1'''Resistivity''' [[BR]][[BR]]
     2
     3The resistive equation can be written as:[[BR]]
     4
     5[[latex(\frac{\partial \textbf{B}}{\partial t}=\nabla \times (\eta \nabla \times \textbf{B}))]]
     6
     7The magnetic diffusivity eta is a function of temperature as we all know. [[BR]]
     8
     9Now for the first equation, what if we want to include the temperature dependence into the code? From the next section, you can see that when a field configuration in equilibrium is subject to strong diffusion, usually heating would occur and surppress the local resistivity and thus the diffusivity. By expanding the first equation, we have the form:[[BR]]
     10
     11[[latex(\frac{\partial \textbf{B}}{\partial t}=\eta \nabla^2 \textbf{B} + \nabla \eta \times (\nabla \times \textbf{B}))]]
     12
     13Now the second term depends on all of the three components of B. So we end up with equations in which the time variance of Bx, By and Bz depend on each other.[[BR]]
     14
     15So the coefficient array is thus no longer a tri-diagonal matrix. For cases where resistive speed is slow (which is usually the case), we can use explicit solver to treat the problem instead.[[BR]]
     16
     17One may wonder if it is possible to throw away the second term on the right hand side of the diffusion equation to just let the diffusivity to vary with position but ignore its own spacial variation. This would give us a form of resistive MHD similar to that of the thermal diffusion case but with temperature dependence built in. [[BR]]
     18
     19[[latex(\frac{\partial \textbf{B}}{\partial t}=\eta (T) \nabla^2 \textbf{B})]]
     20
     21Unfortunately, this does not work because the diffusion equation itself has to be divergence free. Our roughest approximation, treating the resistivity as a constant satisfies the requirement as long as the divergence and the Laplacian are commutable. If we try to do the same thing to the above equation, we end up getting:[[BR]]
     22
     23[[latex(\frac{\partial \textbf{B}}{\partial t}=\eta \nabla^2 (\nabla \cdot \textbf{B}) + (\nabla \eta \cdot \nabla)\textbf{B})]]
     24
     25The first term on the right hand side is zero but the second term is not, especially at sharp temperature fronts where grad(T) is large.[[BR]]
     26So this approximation only works under '''slowly varying temperature''' situation.[[BR]]
     27
     28Upon a closer look at the simulations conducted below, we can observe that the energy inside the domain does not conserve. There is a small increase of total energy during the evolution, especially for the force-free field case. This phenomenon is explained below. [[BR]]
     29
     30In AstoBEAR, we explicitly calculate the resistivity induced current on the cell edges, following equation: [[BR]]
     31[[latex(\textbf{J} = \eta \nabla \times \textbf{B})]] [[BR]]
     32The magnetic field is represented by the aux field, which is centered on the cell faces. Its curl therefore reside on the cell edges. Here is an example on calculating the diffusive current on the x direction, notice that the red arrow is where we are calculating the diffusive current, the green arrows are where the magnetic field originally resides: [[BR]]
     33
     34<< figure. [[BR]]
    435
    536
    6 The 2.5-D magnetized cloud with resistivity is explored with the following simple configuration:[[BR]]
    7 The Bz field is centralized inside a cylinder-shaped cavity. The density inside the cavity is 10 times smaller than that of the ambient, and the temperature is uniformly distributed.[[BR]]
    8 This configuration can maintain the balanced state for a long time although the field is not force-free. [[BR]]
    9 When there is resistivity, the Bz field will drift away from the center of the cylinder and carry flow away. Here, there are two competing effects on the fluid parcels:[[BR]]
    10 (1)the fluid parcels are carried away by the field depending on the field strength and the resistivity. In the perfect conducting case, the fluid will move along when the field is drifting because of the "frozen in" phenomenon. [[BR]]
    11 (2)when the field is leaving the cavity, it will create pressure imbalance between the cavity and the ambient medium. The pressure gradient will thus drive the flow inward towards the cavity.[[BR]]
    12 (3)the drifting away of the field provides heating which drives up the cavity temperature. This increase in temperature along with the inflow of material will drive the cavity pressure to be higher than the ambient thus drive the flow backwards (outflow).[[BR]]
     37The actual code looks like: [[BR]]
    1338
    14 We use vr, va and cs to identify the speed of the resistive speed, Alfven speed and sound speed respectively. In the discussion we will see that the relative greatness of the three speeds can sometimes define very different evolution behaviors. For sound speed, we have:[[BR]]
     39<< code. [[BR]]
    1540
    16 [[Image(http://www.pas.rochester.edu/~shuleli/mceq8.png, 6%)]][[BR]]
    17 [[Image(http://www.pas.rochester.edu/~shuleli/mceq9.png, 10%)]][[BR]]
     41After calculating and storing jx, jy and jz of the given grid, the change of magnetic field due to diffusion can be calculated as: [[BR]]
    1842
    19 and for the resistive speed which characterize how fast the field is drifting away from its center, we have: [[BR]]
     43[[latex(\frac{\partial \textbf{B}}{\partial t}=\nabla \times \textbf{J})]] [[BR]]
    2044
    21 [[Image(http://www.pas.rochester.edu/~shuleli/mceq10.png, 6%)]]
     45In the case of AMR, we need to store the emf using function storefixupfluxes. In case of resistivity, it is simply the diffusive current. The code looks like: [[BR]]
     46
     47<< code. [[BR]]
     48
     49In the case of resistive MHD, the energy can be dissipated in the form of Joule heat, comparing to the infinite conductivity case, where the voltage inside the fluid is everywhere zero, and no heat is generated by the current. [[BR]]
     50If we dot the resistive induction equation with the magnetic field B, we obtain the time evolution equation for magnetic energy:[[BR]][[BR]]
     51[[latex(\partial (B^2)/\partial t  +  \nabla \cdot \textbf{S} =  - \textbf{J}\cdot\textbf{E} = -j^2/\eta)]][[BR]][[BR]]
     52where [[latex(\textbf{S}=\textbf{J} \times \textbf{B})]] is the magnetic energy flux caused by resistive diffusion and [[latex(j=|\textbf{J}|)]] is the magnitude of the diffusive current.[[BR]][[BR]]
     53In this equation, the S term accounts for the redistribution of magnetic energy (and thus the redistribution of total energy), and the [[latex(j^2/\eta)]] term accounts for the loss of magnetic energy due to reconnection.[[BR]]
     54The total energy change for the resistive step is therefore:[[BR]][[BR]]
     55[[latex(\partial \epsilon/\partial t  +  \nabla \cdot \textbf{S} = 0)]][[BR]][[BR]]
     56Here the [[latex(j^2/\eta)]] dissipation term is absent because the dissipation of magnetic energy does not change the total energy: the loss of magnetic energy is converted into thermal energy. [[BR]]
     57In the code, the energy flux as a result of magnetic diffusion needs to be calculated explicitly using: [[BR]]
     58
     59[[latex(\textbf{S}=\textbf{J} \times \textbf{B})]] [[BR]]
     60
     61The energy fluxes reside on the cell faces while the diffusive current reside on the cell edges. We therefore need to compute a face average of the diffusive current as well as the magnetic field components which are not normal to the face using the surrounding edges. In the last diagram, the blue arrows connected by dashed lines are what used to compute the energy flux. [[BR]]
     62The magnetic field can be updated from the diffusive currents by: [[BR]]
     63
     64[[latex(\frac{\partial \textbf{B}}{\partial t}=\nabla \times \textbf{J})]] [[BR]]
     65
     66The updating of magnetic field and the calculation of the energy fluxes can be done at the same time, as in the code: [[BR]]
     67
     68<< code. [[BR]]
     69
     70We then call storefixupfluxes for the three energy flux components (as xflux, yflux and zflux in the code).[[BR]]
     71Finally, the energy is updated using the divergence of the energy fluxes. This finishes the diffusive process.[[BR]]
     72[[BR]]
     73
     74The resistive time scale is explicitly calculated by: [[BR]]
     75
     76[[latex(dt_{resistive} = \frac{c dx}{\eta})]] [[BR]]
     77
     78where c is the cfl number (set to be 0.5 in the code). To change the cfl number, the following line of code can be modified: [[BR]]
     79
     80where 2d0 can be replaced by any value above 1 (for example, putting this number to 5d0 will reduce the cfl to 0.2).
     81
     82[[BR]][[BR]]
     83
     84'''Resistivity Test Problems'''[[BR]][[BR]]
    2285
    2386
    24 where eta is the constant resistivity as defined in the previous section, l is the length scale of field variation. In the discussion, we will take l as the clump or cavity radius.[[BR]]
     87'''Sweet-Parker Problem'''[[BR]]
    2588
    26 To illustrate the above effects, we have the following set of simulation results corresponding to the density, temperature, field strength and velocity vector on each row. [[BR]]
    27 This simulation is done with beta = 0.5 inside the cavity. The relationship between vr, va and cs is '''vr > va > cs'''. [[BR]]
    28 The field strength shows no surprise that the field drifts away from where it is concentrating, and the material flow in due to the push of pressure imbalance from the ambient (see the velocity plot, row 4, column 2). It is interesting that the fall-in velocity seems to always track the front of the field strength, when comparing row 1 and row 3. [[BR]]
    29 Next let us look at the density. The shape of the density distribution roughly stays the same throughout the simulation, although we can see a material deposition inside the cavity which makes sense. The deposition rate is about 0.1241 at t = 2.0. The temperature rise up shortly after the simulation starts, and stays relatively stable throughout the simulation. In the long run, it is the inflow of material that makes up for the pressure drop.[[BR]]
     89To investigate the Sweet-Parker problem, we introduce the following magnetic field configuration called "sheer pinch": [[BR]]
     90[[latex(B_y(x) = b_0 tanh(x/a))]][[BR]][[BR]]
    3091
    31 [[Image(http://www.pas.rochester.edu/~shuleli/resclump1.png, 80%)]]
     92where in computational units we choose [[latex(b_0 = 1)]] and [[latex(a = 0.5)]].[[BR]]
     93The density profile is chosen so that the pressure equilibrium can be maintained with constant temperature.[[BR]][[BR]]
     94[[latex(\rho(x) = \rho_0/cosh^2(x/a)+\rho_c)]][[BR]][[BR]]
     95where [[latex(\rho_0 = 1)]] and [[latex(a = 0.5)]]. The temperature is set to be constant as 0.5. [[BR]]
     96The domain is set to be -6.4 < x < 6.4 and -12.8< y < 12.8, with fixed resolution 480 * 960. The boundaries are all open. The initial profile is plotted below: [[BR]]
     97[[Image(http://www.pas.rochester.edu/~shuleli/hhc_plot.png, 30%)]][[BR]][[BR]]
     98The initial state is in pressure equilibrium though unstable. There are two ways to generate instabilities. The first way is to artificially increase the resistivity at the center of the domain. This increase will result in a higher reconnectivity, which will eventually bend magnetic field. This creates an X point where field lines continue to come in and annihilate because of the lower field pressure at the center. The reconnection heat will drive outflows out of the X point, parallel to the direction of the sheer pinch. The box surrounding the X point where the outflows (Petschek shock) come out of is called the "Sweet-Parker Box". The following diagrams show how increased resistivity at the center of a sheer pinch drives Petschek shock.[[BR]]
     99[[Image(http://www.pas.rochester.edu/~shuleli/multi_test/resistive_instab.png,30%)]][[BR]][[BR]]
     100The flow pattern for our setup is shown in the following plot:[[BR]][[BR]]
     101[[Image(http://www.pas.rochester.edu/~shuleli/hhc_flowpattern.png, 30%)]][[BR]][[BR]]
     102The 2-D mach number plot is shown below:[[BR]][[BR]]
     103[[Image(http://www.pas.rochester.edu/~shuleli/hhc_mach.png, 30%)]][[BR]][[BR]]
    32104
    33 As we stated before, the above run is done with beta = 0.5, in other words, the field is supporting the cavity initially. Next let us look at a run with high beta: beta = 100. The relation between vr, va and cs is  '''vr > cs >> va'''. We compare the high beta run with the first run in terms of the density deposition and field diffusion. [[BR]]
    34 As seen in the following picture, the field diffusion occurs at roughly the same rate since we are keeping vr in the two runs. But the mass deposition is much slower, almost unrecognizable in the high beta case, which makes sense: the energy carried away by the field only takes a tiny potion of the total energy. The heating is not plotted here but the same thing happens: the heating is negligible in the high beta case. This result supports our assumption that the '''heating of the cavity is triggered by the energy carried away by the field diffusion'''.[[BR]]
     105To test Sweet-Parker problem in AstroBEAR, we . [[BR]][[BR]]
    35106
    36 [[Image(http://www.pas.rochester.edu/~shuleli/resclump2.png, 50%)]]
     107The following figure shows the Petschek shock from a reconnection spot at the center. Colored variable is the kinetic energy in log scale, magnetic field is illustrated by white lines. [[BR]]
     108[[Image(http://www.pas.rochester.edu/~shuleli/multi_test/sp1_0020.png, 30%)]]
     109[[BR]]
     110A movie with 2-level AMR:[[BR]]
     111[[http://www.pas.rochester.edu/~shuleli/multi_test/spmovie.gif open movie]] [[BR]][[BR]]
    37112
    38 One of our intuition is that the mass deposition observed inside the cavity is caused by the pushing from the ambient material. The simulation under weak conduction case, can give us some insight on this topic. In the following simulation, we compare the case with resistivity ten times greater comparing to figure 1. This situation can be called '''vr > > cs > va'''. The following graph shows the comparison between field strength, density, and density at different time, for each row. The first row is comparing the field diffusion speed, which does not need more description than that the greater the resistivity, the faster the spreading of the field. The second row compares mass deposition into the cavity at the same time t = 0.1. As we see from the scale, the right plot has a greater deposition rate and more blurred edge. So the weak conduction does help material to deposit into the cavity. So how fast it is? By comparing the third row, we find that the mass deposited into the blue region of the cavity for weak conduction at t = 0.2, is almost identical to the one for strong conduction at t = 2.0. '''The deposited density does show how resistive the material is.''' And it seems to scale to the resistivity.
     113The second way to perturb the sheer pinch is to put in a sinusoidal perturabtion on magnetic field: [[BR]][[BR]]
     114[[latex(B_x = B_p sin(kx)cos(ky))]][[BR]]
     115[[latex(B_y = -B_p cos(kx)sin(ky))]][[BR]][[BR]]
     116where Bp is the perturbation amplitude and the wave number:[[BR]]
     117[[latex(k = 2\pi/L_y)]].[[BR]]
     118This perturbation creates periodical X points and O points, which leads to bright and dark spots of magnetic pressure. Material flow into the dark spots as a result of pressure imbalance, which creates periodical dense "islands".
     119The growth rate and the size of the "islands" depend on resistivity and the strength of the perturbation.[[BR]][[BR]]
    39120
    40 [[Image(http://www.pas.rochester.edu/~shuleli/resclump3.png, 50%)]]
     121[[Image(http://www.pas.rochester.edu/~shuleli/multi_test/mihr_0180.png,40%)]][[BR]][[BR]]
    41122
    42 Another assumption one can make is that by looking at the velocity plot, we may think that rotation may happen due to the Lorentz force at the edge of the field front where the field is pointing at z direction and the speed is radial. The initial setup is not force-free so at the edge of the field front, the Lorentz force which is pointing on the azimuthal direction may not be negligible. So the real inflow might have a shape of spiral inward to the center of the cavity instead of straight fall-in. However the tangential velocity is small so the vector plot on figure 1 row 4 looks like mostly radial. [[BR]]
     123To watch a full movie, [http://www.pas.rochester.edu/~shuleli/multi_test/mihr.gif click here][[BR]][[BR]]
    43124
    44 In the next section we examine a more complicated scenario: the force-free configuration.[[BR]][[BR]][[BR]]
    45 
    46 = =================================== =
    47 = The Force Free Field Subject to Resistivity =
    48 = =================================== =
    49 
    50 We still use the 2.5-D model for the force-free field, where the field has a B_z, B_phi component that only depends on Bessel functions of r. The following vector graph shows how the field looks like initially.[[BR]]
    51 
    52 [[Image(http://www.pas.rochester.edu/~shuleli/3dfield/mcfieldvector.png, 40%)]]
    53 
    54 In the infinite conduction case where the field is frozen in, the force-free field configuration can sit literally forever because the Lorentz force is self-canceling everywhere. Now with the the resistivity, we would expect the field to drift and break the force-free status. We conduct simulation with strong resistivity and high beta to let the field diffusion play a prominent role in the evolution. The setup has a beta of beta = 0.2 and with '''vr > va > cs'''. One could say that this setup resembles figure 1, the major differences are that (1) the field is force-free; (2) there is no cavity initially. The density and temperature is uniform distributed. The following graph shows the field strength, velocity, density, temperature and the B_x component, respectively on each row.[[BR]]
    55 
    56 [[Image(http://www.pas.rochester.edu/~shuleli/resff1.png, 80%)]]
    57 
    58 Let us look at the field diffusion first. One of the drastic difference between the FF and non-FF case is that in the FF case although the field dissipates and reduce in strength, it does not spread in space very much. One of the reasons is that in the FF configuration, the field strength at the edge are largely composed by the B_x and B_y field because they are first order Bessel comparing to B_z which is zero order. B_z contributes mostly to the central area around r = 0. The B_phi field is reconnecting itself during the diffusion so that it reduces the strength in a way that it does not have to spread over. Let us look at row 4 for B_x evolution. The blue and red lobes in the B_x field correspond to opposite directions they point to. And the field diffusion happens so that the positive lobe would spread into the negative lobe's territory and vice versa. If the positive field and the negative field move into one zone, they inevitably cancel each other which at the macroscopic level, appears as field reconnection. The reconnection rate thus connects to how fast the colored lobes expand which in turn relates to how strong the resistivity is. The B_x evolution on row 4 shows that the positive and negative lobes are diminishing due to the reconnection and the zone with green (denotes zero field) increases. This dissipation happens without significant expansion since it happens at the inside and edge regions at the same rate, which is slightly different from traditional diffusion where edge always diffuse faster because it has a larger gradient. [[BR]]
    59 
    60 From the density plot, we see a dense ring is formed at the edge of the total field strength plot, where the pressure gradient is the greatest. And the material flow is the fastest at the ring. [[BR]]
    61 The material flow is interesting in itself that it reverts its direction during the evolution: during early phase of the evolution, the material is flowing into the strong field region, which is identical to figure 1: the inflow is there to compensate the pressure loss. Then, however, at time t = 0.1, it reverts its direction to point outwards. The material flow in this situation is subtle since it depends on which region is losing pressure faster. In the force-free configuration, the field cancellation caused by the reconnection is happening not just inside the strong field region but also at the edge. The reversed flow may indicate that the region outside the ring is losing pressure faster comparing to the region inside the ring at time t = 0.1. The temperature plot has no surprise that we also get heating where field pressure is dropping.[[BR]]
    62 
    63 We next compare the former case to a weak field case: beta = 0.2 and beta = 20. In the beta = 20 situation, the velocity relation is '''vr > cs > va'''. The following plot shows comparison of field distribution, temperature and density respectively. Obviously the high beta case does not have a dense ring and the density does not redistribute much during the evolution. Another difference is that the central heating is not obvious in the high beta case, which is similar to the comparison we did before: the pressure loss in the high beta case is not significant enough to trigger the heating. [[BR]]
    64 
    65 [[Image(http://www.pas.rochester.edu/~shuleli/resff2.png, 50%)]]
    66 
    67 Finally we compare the first simulation to a case where the sound speed is comparable to the diffusion speed: '''vr = cs > va'''. This is achieved by raising the uniform temperature initially but keep everything else the same. The following graph shows the result. We can see that there is little difference between the hot case and the high beta case in terms of ring formation and central heating: both cases does not have ring formation and significant central heating. But in the hot case, the field is dissipating faster comparing to the original situation (See row 1). [[BR]]
    68 
    69 [[Image(http://www.pas.rochester.edu/~shuleli/resff3.png, 50%)]]
    70 
    71 [[BR]][[BR]][[BR]][[BR]]
    72 = =================================== =
    73 = 3-D Tangled Field Cloud Evolution =
    74 = =================================== =
    75 
    76 In the 3-D tangled field case, the field will exert force on the cloud material because it is not force-free, and at the same time, it will diminish due to magnetic reconnection as a result of field diffusion. [[BR]]
    77 [[Image(http://www.pas.rochester.edu/~shuleli/clumpfieldlines.png, 50%)]][[BR]][[BR]][[BR]][[BR]]
    78 
    79 = =================================== =
    80 = Viscosity in AstroBEAR =
    81 = =================================== =
    82 
    83 The viscosity term in the Navier-Stokes Equation can be separated as:[[BR]][[BR]]
    84 [[latex($dv/dt = \nabla \cdot T$)]][[BR]]
    85 For the applications we are considering, the fluid is isotropic. Under this assumption, the tensor can be expressed as the following combination of two scalar dynamic viscosities [[latex($\mu$)]] and [[latex($\mu'$)]]:[[BR]][[BR]]
    86 [[latex($T = 2 \mu \nabla v + \mu' \nabla \cdot v I$)]][[BR]][[BR]]
    87 where I is the unit tensor.[[BR]]
    88 It can be proven that the stress tensor should have zero trace, which leads to the following relation between [[latex($\mu$)]] and [[latex($\mu'$)]]:[[BR]][[BR]]
    89 [[latex($\mu' = -2/3\mu$)]][[BR]][[BR]]
    90 Combining these relations, we can write down the final form of the separated viscous equation:[[BR]][[BR]]
    91 [[latex($dv/dt=\nabla \cdot (2 \mu \nabla v) - 2/3 \nabla (\mu \nabla \cdot v)$)]][[BR]][[BR]]
    92 Notice that this equation already counts the effect of all the elements in a viscosity tensor, assuming the fluid itself is isotropic.[[BR]]
    93 [[BR]][[BR]]
    94 
    95 = =================================== =
    96 = Viscosity Implementation =
    97 = =================================== =
    98 The viscous source term is calculated rigorously by first finding the tensor elements at the surrounding face centers of a cell center considered:
    99 The [[latex($\mu$)]] sources [[latex($2\mu \nabla v$)]] are naturally located at the cell centers, the [[latex($\mu'$)]] sources however needs an averaging to obtain the cell centered velocity divergence.[[BR]]
    100 Therefore the scheme requires a 20 point stencil in 3-D configuration, which makes the implicit scheme a bit complicated. The following graph shows such a stencil in 2-D setting:[[BR]][[BR]]
    101 [[Image(http://www.pas.rochester.edu/~shuleli/vis_stencil.png, 35%)]][[BR]][[BR]]
    102 Using this stencil setting, one can get face centered velocity divergence for the cell considered, and then calculate the gradient components located at the cell center.[[BR]]
    103 In the viscous plasma context, the physical viscosity can be calculated rigorously. The plasma viscosity is proportional to the product of ion mean free path and the ion thermal energy:[[BR]][[BR]]
    104 [[latex($\mu \sim \lambda_{ifp}v_{thermal}$)]][[BR]][[BR]]
    105 In our code, we offer the option to calculate the realistic viscosity using the following equation:[[BR]][[BR]]
    106 [[latex($\mu = \frac{m_{i}}{3 \sqrt{2} \pi d_{i}^2} (\frac{8kT}{\pi m_{i}})^{\frac{1}{2}}$)]][[BR]][[BR]]
    107 The ion mass and local temperature should be readily available, but a good estimate of ion diameter [[latex($d_{i}$)]] usually requires look up a ionic radius table. [[BR]]
    108 As an estimate, one can use that of hydrogen, about 0.1~0.2 nm.[[BR]]
    109 One can see that the viscosity itself is anisotropic and depends on the local temperature. [[BR]]
    110 That is why we have both the [[latex($\mu$)]] and [[latex($\mu'$)]] terms in our viscosity equation, and have to calculate face centered source terms before applying the final divergence.[[BR]][[BR]]
    111 The viscosity interface is as follows:[[BR]]
    112 The viscosity source term can be turned on in astrobear by putting the viscosity flag to true:[[BR]]
    113 '''lViscous = .true.'''[[BR]]
    114 The second parameter '''VisType''' determines which type of viscosity one requires: 1 for constant viscosity; 2 for real physical viscosity.[[BR]]
    115 The third parameter '''viscosity''' is the user defined constant viscosity.[[BR]]
    116 The viscosity module is tested to be working compatibly with implicit thermal conduction module and uniform gravity module.[[BR]][[BR]]
    117 
    118 = ======================= =
    119 = Code Tests =
    120 = ======================= =
    121 The 2-D Harris current sheet test can be set up as follows:[[BR]][[BR]]
    122 [[latex($B_y(x) = b_0 tanh(x/a)$)]][[BR]][[BR]]
    123 where in computational units we choose [[latex($b_0 = 1$)]] and [[latex($a = 0.5$)]].[[BR]]
    124 The density profile is chosen so that the pressure equilibrium can be maintained with constant temperature.[[BR]][[BR]]
    125 [[latex($\rho(x) = \rho_0/cosh^2(x/a)+\rho_c$)]][[BR]][[BR]]
    126 where [[latex($\rho_0 = 1$)]] and [[latex($a = 0.5$)]]. The temperature is set to be constant as 0.5. [[BR]]
    127 The domain is set to be -6.4 < x < 6.4 and -12.8< y < 12.8, with fixed resolution 480 * 960. The boundaries are all open.[[BR]]
    128 The initial state is in pressure equilibrium though unstable. We put in a perturbation: [[BR]][[BR]]
    129 [[latex($B_x = B_p sin(kx)cos(ky)$)]][[BR]]
    130 [[latex($B_y = -B_p cos(kx)sin(ky)$)]][[BR]][[BR]]
    131 where [[latex($\B_p$)]] is the perturbation amplitude and [[latex($k = 2\pi/L_y$)]].
    132 The magnetic field and the density profiles are plotted below:[[BR]][[BR]]
    133 [[Image(http://www.pas.rochester.edu/~shuleli/hhc_plot.png, 50%)]][[BR]][[BR]]
    134 The magnetic energy is diminished at the X point which will convert to bulk ram pressure that drives the y direction outflow around the x = 0 line. [[BR]]
    135 For the outflow pattern, the leading edge is bounded by intermediate shocks and the trailing edge is bounded by slow shocks(Petschek-type). There are totally four slow mode shocks stemming from the Sweet-Parker region, as shown in the following figure.[[BR]][[BR]]
    136 [[Image(http://www.pas.rochester.edu/~shuleli/petschek_diagram.png, 50%)]][[BR]][[BR]]
    137 The time evolution model can be given by the Semenov solution, which is obtained by assuming a large resistivity box at the stagnation point. See the following figure.[[BR]][[BR]]
    138 [[Image(http://www.pas.rochester.edu/~shuleli/semenov_evolution.png, 50%)]][[BR]][[BR]]
    139 The flow pattern for our setup is shown in the following plot:[[BR]][[BR]]
    140 [[Image(http://www.pas.rochester.edu/~shuleli/hhc_flowpattern.png, 50%)]][[BR]][[BR]]
    141 The 2-D mach number plot is shown below:[[BR]][[BR]]
    142 [[Image(http://www.pas.rochester.edu/~shuleli/hhc_mach.png, 50%)]][[BR]][[BR]]
    143 
    144 The following plots show the AstroBEAR test of various settings in the current sheet outflow problem. [[BR]][[BR]]
    145 [[Image(http://www.pas.rochester.edu/~shuleli/cs_outflow.png, 50%)]][[BR]][[BR]]
    146 The Workman setting has central symmetry while the reconnection sites locate at the two edges. The positive radius of curvature of field lines at the reconnection site results in an inflow to the X point.[[BR]]
    147 The first panel shows its kinetic energy distribution. [[BR]]
    148 The Semenov setting is achieved by applying a resistivity function that varies with position. This resistivity gradient results in bending of magnetic field lines with negative radius of curvature. A vertical outflow from the X point is thus created. The resulted Sweet-Parker region is expanding throughout the simulation till the flow speed at its boundary reaches the Alfven speed. Panels 2 and 3 shows the kinetic energy and vertical flow momentum. Panel 4 shows the kinetic energy of Semenov outflow with an enhanced resistivity contrary. [[BR]]
    149 
    150 
    151 Other possible tests:[[BR]]
    152 [[BR]][[BR]]
    153 (1) Flux Explusion Problem (Analytic 2D, resistivity only) [[BR]]
    154 [[Image(http://www.pas.rochester.edu/~shuleli/rmhd_test1.png, 50%)]][[BR]][[BR]]
    155 This problem studies the field redistribution when there is a rotating rigid cylinder with finite conductivity is placed in the flow. Can be found in text books.
    156 
    157 (2) Hartman Flow (Analytic 2D, involves viscosity and resistivity) [[BR]]
    158 [[Image(http://www.pas.rochester.edu/~shuleli/rmhd_test2.png, 50%)]][[BR]][[BR]]
    159 This problem solves the state of a stationary flow of viscose and resistive fluid between two plates with superimposed transverse magnetic field. Can be found in many MHD text books and papers.
    160 See for instance:
    161 [[https://www.pas.rochester.edu/~shuleli/hartmann_apj08.pdf]][[BR]][[BR]]
    162 
    163 
    164 (3) Hydromagnetic Rayleigh-Bernard Convection (2D or 3D. Involves thermal diffusion, viscosity, resistivity) [[BR]]
    165 [[Image(http://www.pas.rochester.edu/~shuleli/rmhd_test3.png, 50%)]][[BR]][[BR]]
    166 The stabilizing effect of vertical magnetic field on a classical Rayleigh-Bernard convection problem. This problem involves find the critical Chandrasekhar number with a given Rayleigh number. For a thermal convecting flow at fixed Rayleigh number, the applied vertical non-dimensional magnetic field exceeds the critical Chandrasekhar number. For details, see for instance, Chandrasekhar's 1961 book.
    167 Also experiments. see for instance:
    168 [[https://www.pas.rochester.edu/~shuleli/RB_pre00.pdf]][[BR]][[BR]]
    169 
    170 The following LLNL journal contains useful tests on resistive MHD solver: [[BR]][[BR]]
    171 [[https://e-reports-ext.llnl.gov/pdf/374198.pdf]][[BR]][[BR]]
    172 
    173 Tests
    174 The stabilization effect of RT by constant viscosity and constant thermal conduction.[[BR]][[BR]]
    175 [[Image(http://www.pas.rochester.edu/~shuleli/rt_graph.png, 50%)]][[BR]][[BR]]
    176 
    177 The Harris Sheet Test Simulation:[[BR]][[BR]]
    178 Click the following links for animations of kinetic energy and magnetic mach.[[BR]]
    179 [http://www.pas.rochester.edu/~shuleli/currentsheet/csheet_kin.gif GIF:Kinetic Energy][http://www.pas.rochester.edu/~shuleli/currentsheet/csheet_mach.gif GIF:Magnetic Mach][[BR]]
    180 [[Image(http://www.pas.rochester.edu/~shuleli/currentsheet/csheet_test.png, 40%)]][[BR]][[BR]]
    181 
    182 
     125Notice that in our island formation problem, the perturbation is anti-symmetric about the center. So the density pattern is also anti-symmetric. It is trivial to use a symmetric perturbation in order to obtain a symmetric island pattern. [[BR]]