Commits

Ji-hoon Kim committed e1a43aa

Completed SedovBlast-MHD-2D-Gardiner test. Added notes and scripts. Had to fix hard-coded
parameters in Grid_MHD2DTestInitializeGrid.C. (I think I might have already fixed this
in week-of-code, after 52weeks-of-code branched out, though.)

Comments (0)

Files changed (5)

run/Hydro/Hydro-2D/SedovBlast-MHD-2D-Gardiner/SedovBlast-MHD-2D-Gardiner.enzo

 #
 #  set I/O and stop/start parameters
 #
-StopTime = 0.05
+StopTime = 0.02
 #StopCycle = 5
 dtDataDump             = 0.0025
 DataDumpName           = data

run/Hydro/Hydro-2D/SedovBlast-MHD-2D-Gardiner/notes.txt

+BrioWu-MHD-1D
+=============
+From
+ Gardiner, T. A., & Stone, J. M. 2005, J. Comput. Phys., 205, 509
+ Wang, P., & Abel, T. 2009, Astrophysical Journal, 696:96-109
+
+Run: Ji-hoon Kim, July 2010
+
+Test Description
+================
+
+This test sets up a two-dimensional blast wave problem for MHD, and has become a useful 
+standard test for any MHD solver.  While the initial condition  essentially describes 
+a circular overpressurized region in a low-pressure magnetized medium, more detailed 
+description of the initial set up can be found in the papers above.  This test problem 
+is new for enzo2.0.  It uses the new Stanford hydro_rk solver.  
+
+Unfortunately for some users, most of the key parameters are hard-coded in 
+Grid_MHD2DTestInitializeGrid.C.  With zero B-field, this test should be a pure Sedov 
+blast wave problem.    
+
+This test runs to completion while generating 10 outputs, and scripts.py will 
+produce the plots for Density, x-velocity, By, Internal Energy for the 10th snapshot 
+(t=0.02).  This 10th snapshot should be compared to Figure 13 of Gardiner & Stone (2005)
+or Figure 16 of Wang & Abel (2009)
+
+Success in test_gardiner.py is determined by nearly exact match (3e-5) in Density, 
+Pressure, Bx, and By. 
+

run/Hydro/Hydro-2D/SedovBlast-MHD-2D-Gardiner/scripts.py

+from matplotlib import use; use('Agg')
+from yt.mods import *
+import pylab as plt
+
+### define problem name
+problem_name = 'SedovBlast-MHD-2D-Gardiner'
+
+### define simulation output directory and filename base
+output_dir_base = 'DD'
+datafile_base = 'data'
+
+### define output to be plotted
+dumpid = '0009'
+
+### construct input filename
+filename = './' + output_dir_base + dumpid + '/' + datafile_base + dumpid
+print "Plotting output file %s\n" % filename
+
+### some more filenames
+png_filename = './' + problem_name
+
+### load data
+pf = load(filename)
+
+### define InternalEnergy field
+def _InternalEnergy(field, data):
+    return data['TotalEnergy'] - 0.5*data['x-velocity']*data['x-velocity']
+
+add_field('InternalEnergy', function=_InternalEnergy, units=r'\rm{erg}/\rm{g}')
+
+### define Pressure field
+def _Pressure(field, data):
+    return (data.pf['Gamma'] - 1.0) * data['Density'] * data['InternalEnergy']
+
+add_field('Pressure', function=_Pressure, units=r'\rm{dyne}/\rm{cm}^{2}')
+
+
+
+### define fields vector
+fields = ('Density', 'Pressure', 'Bx', 'By')
+pc = PlotCollection(pf, center=[0.5,0.5,0.5])
+
+for f in fields:
+    pc.add_slice(f, 2)
+
+pc.save(png_filename)

run/Hydro/Hydro-2D/SedovBlast-MHD-2D-Gardiner/test_gardiner.py

+from yt.mods import *
+from yt.extensions.enzo_test import YTStaticOutputTest
+from yt.extensions.enzo_test.output_tests import create_test
+import pylab
+class TestGardinerImage(YTStaticOutputTest):
+    field = None
+
+    def run(self):
+        # self.pf already exists
+        sl = self.pf.h.slice(2, 0.5)
+        frb = FixedResolutionBuffer(sl, (0.0, 1.0, 0.0, 1.0), (200,200))
+        self.result = frb[self.field]
+
+    def compare(self, old_result):
+        current_buffer = self.result
+        old_buffer = old_result
+
+        # We want our arrays to agree to some delta
+        self.compare_array_delta(current_buffer, old_buffer, 3e-5)
+
+    def plot(self):
+        pylab.clf()
+        pylab.imshow(self.result,
+            interpolation='nearest', origin='lower')
+        fn = "%s_%s_projection.png" % (self.pf, self.field)
+        pylab.savefig(fn)
+        return [fn]
+for field in ['Density','Pressure','Bx','By']:
+    create_test(TestGardinerImage,'test_gardiner_%s'%field,field=field)

src/enzo/hydro_rk/Grid_MHD2DTestInitializeGrid.C

 
   /* MHD2DProblemType 7: Cylindrical Sedov-Taylor Blast Wave 
    * Reference: Fryxell et al, 2000, ApJS, 131, 273
+   * (I don't think this could be used in 2D test - comments by
+   *  Ji-hoon Kim, Apr.2010)
+   * (Some parameters fixed - comments by Ji-hoon Kim, Jul.2010)
    */
 
   if (MHD2DProblemType == 7) {