-
Notifications
You must be signed in to change notification settings - Fork 0
/
HYM_SILO.py
executable file
·101 lines (83 loc) · 4.13 KB
/
HYM_SILO.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
"""
Clayton Myers
HYM_SILO.py
Created: 07 July 2009
Modified: 14 January 2010
Modified: 30 August 2012 by Jack Hare: added command to read $HOME and $SCRATCH from shell environment
This file is a wrapper script for the HYM-to-SILO conversion utility
(HYM_SILO.exe) and the probe data extraction utility (Probe_SILO.exe).
User parameters:
(1) Utility Flags (boolean):
(a) Convert_Run_To_SILO -- Request HYM-to-SILO conversion.
(b) Extract_Probe_Data -- Request probe data extraction.
(2) Paths (strings with leading and trailing slashes):
(a) code_path -- Path to the HYM code directory (used for moving
data files from a new run to data_path if needed).
(b) run_path -- Path to the parent run storage directory.
(3) cycle_arg (integer):
-- An integer that determines which cycles will be converted by the
conversion utilities.
-- The term cycle refers to the sequential value of a given output
frame. The number of cycles Ncyc corresponds to the integer value
of "i3dbout" in the "hstat.d" run output file.
-- If the cycle argument cycle_arg is between [1,Ncyc], then the
data will be converted for only that cycle value.
-- If the cycle argument cycle_arg is zero (0), then all available
cycles in the range [1,Ncyc] will be converted.
(4) data_flags (string of 1's and 0's):
-- A string of 1's and 0's that determines which variables will be
written to the silo databases (e.g., 10110).
-- The present data_flags string has five entries corresponding to:
#1 = p (pressure)
#2 = n (density)
#3 = B (magnetic field)
#4 = v (fluid velocity)
#5 = J (current density)
(5) phi_rot (float):
-- Command line argument sent to Probe_SILO.exe that rotates the
synthesized probe array by phi_rot (in degrees).
"""
#==============================================================================#
#==============================================================================#
import os
# User input variables:
Convert_To_SILO = True
Extract_Probe_Data = False
# Convert_To_SILO = False
# Extract_Probe_Data = True
# code_path = "./HYM_CoH/"
# run_path = "./RunData_CoH/2009_07_21_co1/"
# code_path = "../scratch2/HYM_CounterH/"
# run_path = "../scratch2/RunData_CounterH/2010_01_11_ct1/"
#run_str = "CounterH"
# run_num = 12
# runID = "2011_02_01_ct%d" % run_num
run_str = "CoH"
run_ID = "2012_09_13_1303"
home_path = os.environ["HOME"] #read environment variable
scratch_path = os.environ["SCRATCH"]+"/hym_coh/"
# code_path = scratch_path + "HYM_%s_HR/" % run_str
code_path =scratch_path + run_ID+"/"
# code_path = scratch_path + "HYM_%s_%02d/" % (run_str,run_num)
run_path = scratch_path + "RunData_%s/%s/" % (run_str,run_ID)
cycle_arg = 0 # 0
data_flags = "11111" # "10111"
phi_rot = 0.0
#==============================================================================#
################################################################################
################################################################################
#==============================================================================#
# Construct the derived paths and argument variables:
data_path = run_path + "HYM_Data/"
silo_path = run_path + "SILO/"
probe_path = run_path + "Probe_Data/"
flags = [Convert_To_SILO,Extract_Probe_Data]
paths = [code_path,run_path,data_path,silo_path,probe_path]
args = [cycle_arg,data_flags,phi_rot]
# Execute the script functionality:
import HYM_PyPack as HPP
HPP.Convert_to_SILO(flags,paths,args)
#==============================================================================#
################################################################################
################################################################################
#==============================================================================#