예제 #1
0
    path = sys.argv[3]
    if len(sys.argv) > 4:
      tstart = float(sys.argv[4])
    if len(sys.argv) > 5:
      tend = float(sys.argv[5])
  else:
    debug = False
    movie_type = sys.argv[1]
    path = sys.argv[2]
    if len(sys.argv) > 3:
      tstart = float(sys.argv[3])
    if len(sys.argv) > 4:
      tend = float(sys.argv[4])
  
  # LOAD FILES
  files = io.get_dumps_list(path)
  if len(files) == 0:
      util.warn("INVALID PATH TO DUMP FOLDER")
      sys.exit(1)

  frame_dir = "frames_"+movie_type
  util.make_dir(frame_dir)

  hdr = io.load_hdr(files[0])
  geom = io.load_geom(hdr, path)

  jmin, jmax = get_j_vals(geom)
  #print("jmin: {} jmax: {}".format(jmin, jmax))

  if diag_post:
    # Load fluxes from post-analysis: more flexible
예제 #2
0
import os, sys
import numpy as np
import matplotlib.pyplot as plt

RES = [32, 64, 128, 256]

NVAR = 8

L1 = np.zeros(len(RES))

# RUN PROBLEM FOR EACH RESOLUTION AND ANALYZE RESULT
for m in range(len(RES)):
    os.chdir('../dumps_' + str(RES[m]))

    dfiles = io.get_dumps_list(".")
    hdr, geom, dump0 = io.load_all(dfiles[0])
    dump1 = io.load_dump(dfiles[-1], hdr, geom)

    r = geom['r'][:, hdr['n2'] // 2, 0]

    #   print("r_eh is {}".format(hdr['r_eh']))

    imin = 0
    while r[imin] < hdr['r_eh']:
        imin += 1

    rho0 = np.mean(dump0['RHO'][imin:, :, 0], axis=1)
    rho1 = np.mean(dump1['RHO'][imin:, :, 0], axis=1)

    L1[m] = np.mean(np.fabs(rho1 - rho0))
예제 #3
0
from __future__ import print_function, division

import hdf5_to_dict as io

import sys
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from pylab import *

COMPARE = False

dump_dir = sys.argv[1]
init_file = io.get_dumps_list(dump_dir)[0]
hdr, geom, dump = io.load_all(init_file, extras=False)

N2 = hdr['n2']
r = geom['r'][:, N2 // 2, 0]
rho = dump['RHO'][:, N2 // 2, 0]
uu = dump['UU'][:, N2 // 2, 0]
p = (hdr['gam'] - 1) * uu
b2 = dump['bsq'][:, N2 // 2, 0]
beta = dump['beta'][:, N2 // 2, 0]
gamma = dump['gamma'][:, N2 // 2, 0]

figname = 'initial-cuts.pdf'

if COMPARE:
    tablename = 'initial-cuts.csv'
예제 #4
0
    if MODES[n] == 3:  # FAST
        dvar[0] = 0.481846076323
        dvar[1] = 0.642461435098
        dvar[2] = -0.0832240462505
        dvar[3] = -0.224080007379
        dvar[4] = -0.224080007379
        dvar[5] = 0.406380545676
        dvar[6] = -0.203190272838
        dvar[7] = -0.203190272838
    dvar *= amp

    # USE DUMPS IN FOLDERS OF GIVEN FORMAT
    for m in range(len(RES)):
        os.chdir('../dumps_' + str(RES[m]) + '_' + str(MODES[n]))

        dfile = io.get_dumps_list(".")[-1]

        hdr, geom, dump = io.load_all(dfile)

        X1 = geom['x']
        X2 = geom['y']
        X3 = geom['z']

        dvar_code = []
        dvar_code.append(dump['RHO'] - var0[0])
        dvar_code.append(dump['UU'] - var0[1])
        dvar_code.append(dump['U1'] - var0[2])
        dvar_code.append(dump['U2'] - var0[3])
        dvar_code.append(dump['U3'] - var0[4])
        dvar_code.append(dump['B1'] - var0[5])
        dvar_code.append(dump['B2'] - var0[6])
예제 #5
0
    if len(sys.argv) > 5:
      tstart = float(sys.argv[5])
    if len(sys.argv) > 6:
      tend = float(sys.argv[6])
  else:
    debug = False
    movie_type = sys.argv[1]
    path1 = sys.argv[2]
    path2 = sys.argv[3]
    if len(sys.argv) > 4:
      tstart = float(sys.argv[4])
    if len(sys.argv) > 5:
      tend = float(sys.argv[5])
  
  # LOAD FILES
  files1 = io.get_dumps_list(path1)
  files2 = io.get_dumps_list(path2)
  
  if len(files1) == 0 or len(files2) == 0:
      util.warn("INVALID PATH TO DUMP FOLDER")
      sys.exit(1)

  frame_dir = "frames_compare_"+movie_type
  util.make_dir(frame_dir)

  hdr1 = io.load_hdr(files1[0])
  hdr2 = io.load_hdr(files2[0])
  geom1 = io.load_geom(hdr1, path1)
  geom2 = io.load_geom(hdr2, path2)
  # TODO diags from post?
  # Load diagnostics from HARM itself