8 'backstream':
'thermal',
11 delete = [
'fluxb',
'fluxe',
'populations_rholossvelboundary',
'rholossvelboundary',
'vole']
15 'rho':
'populations_vg_rho',
16 'rhov':
'populations_vg_v',
17 'blocks':
'populations_vg_blocks',
18 'ptensor':
'populations_vg_ptensor',
19 'rhobackstream':
'populations_vg_moments_nonthermal',
20 'rhononbackstream':
'populations_vg_moments_thermal',
21 'rhovbackstream':
'populations_vg_moments_nonthermal',
22 'rhovnonbackstream':
'populations_vg_moments_thermal',
23 'ptensorbackstream':
'populations_vg_moments_nonthermal',
24 'ptensornonbackstream':
'populations_vg_moments_thermal',
25 'accsubcycles':
'populations_vg_acceleration_subcycles',
26 'minvalue':
'populations_vg_effectivesparsitythreshold',
29 'fg_backgroundb':
'fg_b_background',
30 'backgroundb':
'fg_b_background',
31 'perturbedb':
'fg_b_perturbed',
32 'fg_perturbedb':
'fg_b_perturbed',
38 'populations_rho':
'populations_vg_rho',
39 'populations_v':
'populations_vg_v',
40 'populations_blocks':
'populations_vg_blocks',
41 'populations_ptensor':
'populations_vg_ptensor',
42 'populations_moments_nonbackstream':
'populations_vg_moments_thermal',
43 'populations_moments_thermal':
'populations_vg_moments_thermal',
44 'populations_moments_backstream':
'populations_vg_moments_nonthermal',
45 'populations_moments_nonthermal':
'populations_vg_moments_nonthermal',
46 'populations_minvalue':
'populations_vg_effectivesparsitythreshold',
47 'populations_effectivesparsitythreshold':
'populations_vg_effectivesparsitythreshold',
48 'populations_rholossadjust':
'populations_vg_rho_loss_adjust',
49 'populations_rhomlossadjust':
'populations_vg_rho_loss_adjust',
50 'populations_rho_loss_adjust':
'populations_vg_rho_loss_adjust',
51 'populations_energydensity':
'populations_vg_energydensity',
52 'populations_precipitationflux':
'populations_vg_precipitationdifferentialflux',
53 'populations_precipitationdifferentialflux':
'populations_vg_precipitationdifferentialflux',
54 'populations_maxvdt':
'populations_vg_maxdt_acceleration',
55 'populations_maxdt_acceleration':
'populations_vg_maxdt_acceleration',
56 'populations_maxrdt':
'populations_vg_maxdt_translation',
57 'populations_maxdt_translation':
'populations_vg_maxdt_translation',
58 'populations_accsubcycles':
'populations_vg_acceleration_subcycles',
59 'populations_acceleration_subcycles':
'populations_vg_acceleration_subcycles',
60 'velocitysubsteps':
'populations_vg_acceleration_subcycles',
62 'maxvdt':
'vg_maxdt_acceleration',
63 'maxrdt':
'vg_maxdt_translation',
64 'maxfieldsdt':
'fg_maxdt_fieldsolver',
65 'fg_maxfieldsdt':
'fg_maxdt_fieldsolver',
67 'fsgridrank':
'fg_rank',
68 'lbweight':
'vg_loadbalance_weight',
69 'vg_lbweight':
'vg_loadbalance_weight',
70 'vg_loadbalanceweight':
'vg_loadbalance_weight',
71 'boundarytype':
'vg_boundarytype',
72 'fsgridboundarytype':
'fg_boundarytype',
73 'boundarylayer':
'vg_boundarylayer',
74 'fsgridboundarylayer':
'fg_boundarylayer',
75 'gridcoordinates':
'vg_gridcoordinates',
76 'fsaved':
'vg_f_saved',
77 'vg_fsaved':
'vg_f_saved',
79 'fg_halle':
'fg_e_hall',
80 'gradpee':
'vg_e_gradpe',
81 'e_gradpe':
'vg_e_gradpe',
83 'vg_volb':
'vg_b_vol',
86 'vg_bvol':
'vg_b_vol',
87 'fg_volb':
'fg_b_vol',
88 'fg_bvol':
'fg_b_vol',
89 'backgroundvolb':
'vg_b_background_vol',
90 'perturbedvolb':
'vg_b_perturbed_vol',
91 'pressure':
'vg_pressure',
92 'bvolderivs':
'vg_b_vol_derivatives',
93 'derivs':
'vg_b_vol_derivatives',
94 'b_vol_derivs':
'vg_b_vol_derivatives',
95 'b_vol_derivatives':
'vg_b_vol_derivatives',
99 oldinfile = infile+
'_old'
100 outfile = infile+
'_new'
102 inf = open(infile,
'r')
103 outf = open(outfile,
'w')
107 columns = sline.split()
110 if ((columns[0] ==
'output')
or (columns[0] ==
'#output'))
and columns[1] ==
'=':
111 if columns[2].lower()
in replace:
112 genline = columns[0]+
' = '+replace[columns[2].lower()]+
'\n'
114 if verbose: print(
'Replaced '+line[:-1]+
"\n with "+genline[:-1])
116 elif columns[2].lower()
in delete:
117 if verbose: print(
'Removed '+line[:-1])
120 if verbose: print(
'Passed '+line[:-1])
122 elif ((columns[0] ==
'diagnostic')
or (columns[0] ==
'#diagnostic'))
and columns[1] ==
'=':
123 if columns[2].lower()
in replace:
124 genline = columns[0]+
' = '+replace[columns[2].lower()]+
'\n'
125 if verbose: print(
'Replaced '+line[:-1]+
"\n with "+genline[:-1])
128 elif columns[2].lower()
in delete:
129 if verbose: print(
'Removed '+line[:-1])
132 if verbose: print(
'Passed '+line[:-1])
135 elif len(columns)==1:
136 if columns[0][0]==
'[':
137 for category
in replacecategories:
138 lencat = len(category)
139 if category == columns[0][-1-lencat:-1]:
140 genline = columns[0][:-1-lencat]+replacecategories[category]+
']\n'
141 if verbose: print(
'Replaced '+line[:-1]+
"\n with "+genline[:-1])
153 shutil.copy2(infile,oldinfile)
154 shutil.move(outfile,infile)