Definition at line 6 of file define_problem.py.
def define_problem.DefineProblem.__init__ |
( |
|
self, |
|
|
|
work_dir, |
|
|
|
pluto_dir, |
|
|
|
auto_update |
|
) |
| |
Defines the problem for the PLUTO code.
This class essentially creates the definitions.h file
based on the inputs given by the user from the PlutoSetup menu.
In case the header file is already present, this class will
read those default values to re-create the file.
**Inputs**:
1. work_dir = Path to PLUTO code working directory
2. pluto_dir = Path to PLUTO source directory
3. auto-update = Boolean that indicates auto-update of definitions.h file.
**Output**:
It generates a definitions.h file.
Definition at line 7 of file define_problem.py.
7 def __init__(self, work_dir, pluto_dir, auto_update):
8 """Defines the problem for the PLUTO code.
10 This class essentially creates the definitions.h file
11 based on the inputs given by the user from the PlutoSetup menu.
12 In case the header file is already present, this class will
13 read those default values to re-create the file.
16 1. work_dir = Path to PLUTO code working directory
17 2. pluto_dir = Path to PLUTO source directory
18 3. auto-update = Boolean that indicates auto-update of definitions.h file.
21 It generates a definitions.h file.
38 self.
entries = [
'PHYSICS',
'DIMENSIONS',
'COMPONENTS',
'GEOMETRY',
39 'BODY_FORCE',
'COOLING',
'RECONSTRUCTION',
'TIME_STEPPING',
40 'DIMENSIONAL_SPLITTING',
'NTRACER',
'USER_DEF_PARAMETERS']
41 self.
default = [
'HD',
'1',
'1',
'CARTESIAN',
'NO',
46 flag_keys = [
'WITH-CHOMBO',
'FULL',
'WITH-FD',
'WITH-SB',
'WITH-FARGO']
def __init__(self, work_dir, pluto_dir, auto_update)
def ChkCompatiblity(self)
def define_problem.DefineProblem.__init__ |
( |
|
self, |
|
|
|
work_dir, |
|
|
|
pluto_dir, |
|
|
|
auto_update |
|
) |
| |
Defines the problem for the PLUTO code.
This class essentially creates the definitions.h file
based on the inputs given by the user from the PlutoSetup menu.
In case the header file is already present, this class will
read those default values to re-create the file.
**Inputs**:
1. work_dir = Path to PLUTO code working directory
2. pluto_dir = Path to PLUTO source directory
3. auto-update = Boolean that indicates auto-update of definitions.h file.
**Output**:
It generates a definitions.h file.
Definition at line 7 of file define_problem.without_userdef_constants.py.
7 def __init__(self, work_dir, pluto_dir, auto_update):
8 """Defines the problem for the PLUTO code.
10 This class essentially creates the definitions.h file
11 based on the inputs given by the user from the PlutoSetup menu.
12 In case the header file is already present, this class will
13 read those default values to re-create the file.
16 1. work_dir = Path to PLUTO code working directory
17 2. pluto_dir = Path to PLUTO source directory
18 3. auto-update = Boolean that indicates auto-update of definitions.h file.
21 It generates a definitions.h file.
37 self.
entries = [
'PHYSICS',
'DIMENSIONS',
'COMPONENTS',
'GEOMETRY',
38 'BODY_FORCE',
'COOLING',
'INTERPOLATION',
'TIME_STEPPING',
39 'DIMENSIONAL_SPLITTING',
'NTRACER',
'USER_DEF_PARAMETERS'
41 self.
default = [
'HD',
'1',
'1',
'CARTESIAN',
'NO',
47 flag_keys = [
'WITH-CHOMBO',
'FULL',
'WITH-FD',
'WITH-SB',
'WITH-FARGO']
def __init__(self, work_dir, pluto_dir, auto_update)
def define_problem.DefineProblem.AfterFlagLists |
( |
|
self | ) |
|
Modify options and default list based on command-line flags.
This method is called after generation of default option list.
It modifies the members of the options list and if required
also the default list based on the conditions required by
the flags set using system arguments.
Definition at line 142 of file define_problem.without_userdef_constants.py.
143 """Modify options and default list based on command-line flags.
145 This method is called after generation of default option list.
146 It modifies the members of the options list and if required
147 also the default list based on the conditions required by
148 the flags set using system arguments.
150 if self.flag_dict[
'FULL']:
151 self.
options[self.entries.index(
'INTERPOLATION')] = [
'FLAT',
'LINEAR',
'LimO3',
'WENO3',
'PARABOLIC',
'MP5']
153 if self.flag_dict[
'WITH-CHOMBO']:
154 self.
options[self.entries.index(
'GEOMETRY')] = [
'CARTESIAN',
'CYLINDRICAL',
'POLAR',
'SPHERICAL']
155 self.
options[self.entries.index(
'INTERPOLATION')] = [
'FLAT',
'LINEAR',
'WENO3',
'PARABOLIC']
156 self.
options[self.entries.index(
'TIME_STEPPING')] = [
'EULER',
'HANCOCK',
'CHARACTERISTIC_TRACING',
'RK2']
157 self.
default[self.entries.index(
'TIME_STEPPING')] =
'HANCOCK'
158 self.
options[self.entries.index(
'DIMENSIONAL_SPLITTING')] = [
'NO']
159 self.
default[self.entries.index(
'DIMENSIONAL_SPLITTING')] =
'NO'
161 if self.flag_dict[
'WITH-FARGO']:
162 self.
options[self.entries.index(
'PHYSICS')] = [
'HD',
'MHD']
163 self.
options[self.entries.index(
'DIMENSIONS')] = [
'2',
'3']
164 self.
default[self.entries.index(
'DIMENSIONS')] =
'2'
165 self.
options[self.entries.index(
'DIMENSIONAL_SPLITTING')] = [
'NO']
166 self.
default[self.entries.index(
'DIMENSIONAL_SPLITTING')] =
'NO'
169 if self.flag_dict[
'WITH-FD']:
170 self.
options[self.entries.index(
'PHYSICS')] = [
'HD',
'MHD']
171 self.
options[self.entries.index(
'GEOMETRY')] = [
'CARTESIAN']
172 self.
options[self.entries.index(
'INTERPOLATION')] = [
'WENO3_FD',
'WENOZ_FD',
'MP5_FD',
'LIMO3_FD']
173 self.
default[self.entries.index(
'INTERPOLATION')] =
'WENOZ_FD'
174 self.
options[self.entries.index(
'TIME_STEPPING')] = [
'RK3']
175 self.
default[self.entries.index(
'TIME_STEPPING')] =
'RK3'
178 if self.flag_dict[
'WITH-SB']:
179 self.
options[self.entries.index(
'PHYSICS')] = [
'HD',
'MHD']
180 self.
default[self.entries.index(
'PHYSICS')] =
'MHD'
181 self.
options[self.entries.index(
'DIMENSIONS')] = [
'2',
'3']
182 self.
default[self.entries.index(
'DIMENSIONS')] =
'2'
183 self.
options[self.entries.index(
'COMPONENTS')] = [
'2',
'3']
184 self.
default[self.entries.index(
'COMPONENTS')] =
'2'
185 self.
options[self.entries.index(
'BODY_FORCE')] = [
'VECTOR',
'POTENTIAL',
'(VECTOR+POTENTIAL)']
186 self.
default[self.entries.index(
'BODY_FORCE')] =
'VECTOR'
def define_problem.DefineProblem.AfterFlagLists |
( |
|
self | ) |
|
Modify options and default list based on command-line flags.
This method is called after generation of default option list.
It modifies the members of the options list and if required
also the default list based on the conditions required by
the flags set using system arguments.
Definition at line 143 of file define_problem.py.
144 """Modify options and default list based on command-line flags.
146 This method is called after generation of default option list.
147 It modifies the members of the options list and if required
148 also the default list based on the conditions required by
149 the flags set using system arguments.
151 if self.flag_dict[
'FULL']:
152 self.
options[self.entries.index(
'RECONSTRUCTION')] = [
'FLAT',
'LINEAR',
'LimO3',
'WENO3',
'PARABOLIC',
'MP5']
154 if self.flag_dict[
'WITH-CHOMBO']:
155 self.
options[self.entries.index(
'GEOMETRY')] = [
'CARTESIAN',
'CYLINDRICAL',
'POLAR',
'SPHERICAL']
156 self.
options[self.entries.index(
'RECONSTRUCTION')] = [
'FLAT',
'LINEAR',
'WENO3',
'PARABOLIC']
157 self.
options[self.entries.index(
'TIME_STEPPING')] = [
'EULER',
'HANCOCK',
'CHARACTERISTIC_TRACING',
'RK2']
158 self.
default[self.entries.index(
'TIME_STEPPING')] =
'HANCOCK'
159 self.
options[self.entries.index(
'DIMENSIONAL_SPLITTING')] = [
'NO']
160 self.
default[self.entries.index(
'DIMENSIONAL_SPLITTING')] =
'NO'
162 if self.flag_dict[
'WITH-FARGO']:
163 self.
options[self.entries.index(
'PHYSICS')] = [
'HD',
'MHD']
164 self.
options[self.entries.index(
'DIMENSIONS')] = [
'2',
'3']
165 self.
default[self.entries.index(
'DIMENSIONS')] =
'2'
166 self.
options[self.entries.index(
'DIMENSIONAL_SPLITTING')] = [
'NO']
167 self.
default[self.entries.index(
'DIMENSIONAL_SPLITTING')] =
'NO'
170 if self.flag_dict[
'WITH-FD']:
171 self.
options[self.entries.index(
'PHYSICS')] = [
'HD',
'MHD']
172 self.
options[self.entries.index(
'GEOMETRY')] = [
'CARTESIAN']
173 self.
options[self.entries.index(
'RECONSTRUCTION')] = [
'WENO3_FD',
'WENOZ_FD',
'MP5_FD',
'LIMO3_FD']
174 self.
default[self.entries.index(
'RECONSTRUCTION')] =
'WENOZ_FD'
175 self.
options[self.entries.index(
'TIME_STEPPING')] = [
'RK3',
'SSP_RK4']
176 self.
default[self.entries.index(
'TIME_STEPPING')] =
'RK3'
179 if self.flag_dict[
'WITH-SB']:
180 self.
options[self.entries.index(
'PHYSICS')] = [
'HD',
'MHD']
181 self.
default[self.entries.index(
'PHYSICS')] =
'MHD'
182 self.
options[self.entries.index(
'DIMENSIONS')] = [
'2',
'3']
183 self.
default[self.entries.index(
'DIMENSIONS')] =
'2'
184 self.
options[self.entries.index(
'COMPONENTS')] = [
'2',
'3']
185 self.
default[self.entries.index(
'COMPONENTS')] =
'2'
186 self.
options[self.entries.index(
'BODY_FORCE')] = [
'VECTOR',
'POTENTIAL',
'(VECTOR+POTENTIAL)']
187 self.
default[self.entries.index(
'BODY_FORCE')] =
'VECTOR'
def define_problem.DefineProblem.AppendAdditionalFiles |
( |
|
self | ) |
|
Adds additional object files based on
modular defintions and requirements.
Definition at line 391 of file define_problem.without_userdef_constants.py.
393 Adds additional object files based on
394 modular defintions and requirements.
396 interp_mode = self.
default[self.entries.index(
'INTERPOLATION')]
398 if interp_mode ==
'LINEAR':
399 self.additional_files.append(
'plm_states.o')
400 elif interp_mode ==
'PARABOLIC':
401 self.additional_files.append(
'ppm_states.o')
402 self.additional_files.append(
'ppm_coeffs.o')
403 self.header_files.append(
'ppm_coeffs.h')
404 elif interp_mode
in [
'FLAT',
'LimO3',
'WENO3']:
405 self.additional_files.append(
'states_'+interp_mode.lower()+
'.o')
def AppendAdditionalFiles(self)
def define_problem.DefineProblem.AppendAdditionalFiles |
( |
|
self | ) |
|
Adds additional object files based on
modular defintions and requirements.
Definition at line 420 of file define_problem.py.
422 Adds additional object files based on
423 modular defintions and requirements.
425 interp_mode = self.
default[self.entries.index(
'RECONSTRUCTION')]
427 if interp_mode ==
'LINEAR':
428 self.additional_files.append(
'plm_states.o')
429 elif interp_mode ==
'PARABOLIC':
430 self.additional_files.append(
'ppm_states.o')
431 self.additional_files.append(
'ppm_coeffs.o')
432 self.header_files.append(
'ppm_coeffs.h')
433 elif interp_mode
in [
'FLAT',
'LimO3',
'WENO3']:
434 self.additional_files.append(interp_mode.lower()+
'_states.o')
def AppendAdditionalFiles(self)
def define_problem.DefineProblem.AppendPlutoPathAndFlags |
( |
|
self | ) |
|
Adds additional C flags and path to 'makefile' based on
modular defintions and requirements.
Definition at line 447 of file define_problem.without_userdef_constants.py.
449 Adds additional C flags and path to 'makefile' based on
450 modular defintions and requirements.
452 self.pluto_path.append(self.
phymodule+
'/')
454 dis_eff = [
'Thermal_Conduction',
'Viscosity']
457 self.pluto_path.append(de+
'/')
460 divb_mode = self.
mod_default[self.mod_entries.index(
'MHD_FORMULATION')]
461 if divb_mode ==
'CONSTRAINED_TRANSPORT':
462 self.pluto_path.append(
'MHD/CT/')
463 elif divb_mode ==
'DIV_CLEANING':
464 self.pluto_path.append(
'MHD/GLM/')
468 if self.
phymodule ==
'MHD' and self.
mod_default[self.mod_entries.index(
'RESISTIVE_MHD')] !=
'NO':
469 self.pluto_path.append(
'MHD/Resistive/')
471 if self.flag_dict[
'WITH-SB']:
472 self.pluto_path.append(
'MHD/ShearingBox/')
473 self.additional_flags.append(
' -DSHEARINGBOX')
475 if self.flag_dict[
'WITH-FARGO']:
476 self.pluto_path.append(
'Fargo/')
477 self.additional_flags.append(
' -DFARGO')
479 if self.flag_dict[
'WITH-FD']:
480 self.additional_flags.append(
' -DFINITE_DIFFERENCE')
482 cool_mode = self.
default[self.entries.index(
'COOLING')]
483 if cool_mode !=
'NO':
484 if cool_mode ==
'TABULATED':
485 self.pluto_path.append(
'Cooling/Tab/')
486 elif cool_mode ==
'POWER_LAW':
487 self.pluto_path.append(
'Cooling/Power_Law/')
489 self.pluto_path.append(
'Cooling/'+ cool_mode +
'/')
495 tmp1 = self.eos[0]+self.eos[1:].lower()
496 self.pluto_path.append(
'EOS/'+tmp1+
'/')
def AppendPlutoPathAndFlags(self)
def define_problem.DefineProblem.AppendPlutoPathAndFlags |
( |
|
self | ) |
|
Adds additional C flags and path to 'makefile' based on
modular defintions and requirements.
Definition at line 478 of file define_problem.py.
480 Adds additional C flags and path to 'makefile' based on
481 modular defintions and requirements.
483 self.pluto_path.append(self.
phymodule+
'/')
485 dis_eff = [
'Dust',
'Thermal_Conduction',
'Viscosity']
488 self.pluto_path.append(de+
'/')
491 divb_mode = self.
mod_default[self.mod_entries.index(
'DIVB_CONTROL')]
492 if divb_mode ==
'CONSTRAINED_TRANSPORT':
493 self.pluto_path.append(
'MHD/CT/')
494 elif divb_mode ==
'DIV_CLEANING':
495 self.pluto_path.append(
'MHD/GLM/')
500 self.pluto_path.append(
'MHD/Resistivity/')
502 if self.flag_dict[
'WITH-SB']:
503 self.pluto_path.append(
'MHD/ShearingBox/')
504 self.additional_flags.append(
' -DSHEARINGBOX')
506 if self.flag_dict[
'WITH-FARGO']:
507 self.pluto_path.append(
'Fargo/')
508 self.additional_flags.append(
' -DFARGO')
510 if self.flag_dict[
'WITH-FD']:
511 self.additional_flags.append(
' -DFINITE_DIFFERENCE')
513 cool_mode = self.
default[self.entries.index(
'COOLING')]
514 if cool_mode !=
'NO':
515 if cool_mode ==
'TABULATED':
516 self.pluto_path.append(
'Cooling/TABULATED/')
517 elif cool_mode ==
'POWER_LAW':
518 self.pluto_path.append(
'Cooling/Power_Law/')
520 self.pluto_path.append(
'Cooling/'+ cool_mode +
'/')
526 tmp1 = self.eos[0]+self.eos[1:].lower()
527 self.pluto_path.append(
'EOS/'+tmp1+
'/')
def AppendPlutoPathAndFlags(self)
def define_problem.DefineProblem.ChkCompatiblity |
( |
|
self | ) |
|
Definition at line 108 of file define_problem.py.
109 oldKeys_ = [
'INTERPOLATION',
'MHD_FORMULATION',
'RESISTIVE_MHD']
110 replaceKeys_ = [
'RECONSTRUCTION',
'DIVB_CONTROL',
'RESISTIVITY']
111 if (os.path.exists(self.
work_dir+
'/definitions.h')):
112 pf = pfIO.PlutoFiles(self.
work_dir+
'/definitions.h')
113 for i
in range(len(oldKeys_)):
114 pf.ReplaceWord(oldKeys_[i], replaceKeys_[i])
def ChkCompatiblity(self)
def define_problem.DefineProblem.GenerateOptionsList |
( |
|
self | ) |
|
Creates a default option list.
This method of class DefineProblem will create a
default valued options list for each entry in the
entries list. These are essentially the options
that will be browsed in the Pluto Setup Menu.
Definition at line 115 of file define_problem.without_userdef_constants.py.
116 """Creates a default option list.
118 This method of class DefineProblem will create a
119 default valued options list for each entry in the
120 entries list. These are essentially the options
121 that will be browsed in the Pluto Setup Menu.
123 phylist = [
'ADVECTION',
'HD',
'RHD',
'MHD',
'RMHD']
124 dimlist = [
'1',
'2',
'3']
125 comlist = [
'1',
'2',
'3']
126 geolist = [
'CARTESIAN',
'CYLINDRICAL',
'POLAR',
'SPHERICAL']
127 bfolist = [
'NO',
'VECTOR',
'POTENTIAL',
'(VECTOR+POTENTIAL)']
128 coolist = [
'NO',
'POWER_LAW',
'TABULATED',
'SNEq',
'MINEq',
'H2_COOL',
'KROME']
130 intlist = [
'FLAT',
'LINEAR',
'LimO3',
'WENO3',
'PARABOLIC']
131 tmslist = [
'EULER',
'RK2',
'RK3',
'HANCOCK',
'CHARACTERISTIC_TRACING']
132 dislist = [
'YES',
'NO']
133 ntrlist = [
'%d'%n
for n
in range(5)]
134 udplist = [
'%d'%n
for n
in range(32)]
135 udclist = [
'%d'%n
for n
in range(32)]
137 self.
options = [phylist, dimlist, comlist, geolist, bfolist,
138 coolist, intlist, tmslist,
139 dislist, ntrlist, udplist,
def GenerateOptionsList(self)
def define_problem.DefineProblem.GenerateOptionsList |
( |
|
self | ) |
|
Creates a default option list.
This method of class DefineProblem will create a
default valued options list for each entry in the
entries list. These are essentially the options
that will be browsed in the Pluto Setup Menu.
Definition at line 116 of file define_problem.py.
117 """Creates a default option list.
119 This method of class DefineProblem will create a
120 default valued options list for each entry in the
121 entries list. These are essentially the options
122 that will be browsed in the Pluto Setup Menu.
124 phylist = [
'ADVECTION',
'HD',
'RHD',
'MHD',
'RMHD']
125 dimlist = [
'1',
'2',
'3']
126 comlist = [
'1',
'2',
'3']
127 geolist = [
'CARTESIAN',
'CYLINDRICAL',
'POLAR',
'SPHERICAL']
128 bfolist = [
'NO',
'VECTOR',
'POTENTIAL',
'(VECTOR+POTENTIAL)']
129 coolist = [
'NO',
'POWER_LAW',
'TABULATED',
'SNEq',
'MINEq',
'H2_COOL']
131 intlist = [
'FLAT',
'LINEAR',
'LimO3',
'WENO3',
'PARABOLIC']
132 tmslist = [
'EULER',
'RK2',
'RK3',
'HANCOCK',
'CHARACTERISTIC_TRACING']
133 dislist = [
'YES',
'NO']
134 ntrlist = [
'%d'%n
for n
in range(9)]
135 udplist = [
'%d'%n
for n
in range(32)]
136 udclist = [
'%d'%n
for n
in range(32)]
138 self.
options = [phylist, dimlist, comlist, geolist, bfolist,
139 coolist, intlist, tmslist,
140 dislist, ntrlist, udplist,
def GenerateOptionsList(self)
def define_problem.DefineProblem.NonUserFriendlyConst |
( |
|
self | ) |
|
Sets the non-user friendly constants.
Definition at line 343 of file define_problem.without_userdef_constants.py.
345 Sets the non-user friendly constants.
347 tmplist1 = [
'INITIAL_SMOOTHING',
'WARNING_MESSAGES',
'PRINT_TO_FILE',
'INTERNAL_BOUNDARY',
'SHOCK_FLATTENING']
348 tmplist2 = len(tmplist1)*[
'NO']
350 if self.flag_dict[
'WITH-CHOMBO']:
351 tmplist1 += [
'CHOMBO_EN_SWITCH',
'CHOMBO_REF_VAR',
'CHOMBO_LOGR']
352 tmplist2 += [
'NO',
'ENG',
'NO']
354 if not self.flag_dict[
'WITH-FD']:
355 tmplist1 = tmplist1 + [
'ARTIFICIAL_VISCOSITY',
'CHAR_LIMITING',
'LIMITER']
356 tmplist2 = tmplist2 + [
'NO',
'NO',
'DEFAULT']
359 divb_mode = self.
mod_default[self.mod_entries.index(
'MHD_FORMULATION')]
360 if divb_mode ==
'CONSTRAINED_TRANSPORT':
361 tmplist1 = tmplist1 + [
'CT_EMF_AVERAGE',
'CT_EN_CORRECTION',
'ASSIGN_VECTOR_POTENTIAL']
362 tmplist2 = tmplist2 + [
'UCT_HLL',
'NO',
'YES']
364 tmplist1 = tmplist1 + [
'ASSIGN_VECTOR_POTENTIAL']
365 tmplist2 = tmplist2 + [
'NO']
367 if not self.flag_dict[
'WITH-CHOMBO']:
368 tmplist1 = tmplist1 + [
'UPDATE_VECTOR_POTENTIAL']
369 tmplist2 = tmplist2 + [
'NO']
373 tmplist1 = tmplist1 + [
'PRIMITIVE_HANCOCK']
374 tmplist2 = tmplist2 + [
'NO']
376 tmplist1 = tmplist1 + [
'PRIMITIVE_HANCOCK']
377 tmplist2 = tmplist2 + [
'YES']
380 tmplist1 = tmplist1 + [
'STS_nu']
381 tmplist2 = tmplist2 + [
'0.01']
383 longword =
max(len(w)
for w
in tmplist1)
385 if (os.path.exists(self.
work_dir+
'/definitions.h')):
386 pf = pfIO.PlutoFiles(self.
work_dir+
'/definitions.h')
387 pf.UpdateListFromFile(tmplist1, tmplist2)
389 self.
non_usfr = [
'#define '+tmplist1[i].ljust(longword+3)+tmplist2[i]+
'\n' for i
in range(len(tmplist1))]
def NonUserFriendlyConst(self)
def define_problem.DefineProblem.NonUserFriendlyConst |
( |
|
self | ) |
|
Sets the non-user friendly constants.
Definition at line 375 of file define_problem.py.
377 Sets the non-user friendly constants.
379 tmplist1 = [
'INITIAL_SMOOTHING',
'WARNING_MESSAGES',
'PRINT_TO_FILE',
380 'INTERNAL_BOUNDARY',
'SHOCK_FLATTENING']
381 tmplist2 = len(tmplist1)*[
'NO']
def NonUserFriendlyConst(self)
def define_problem.DefineProblem.ProcessHDModule |
( |
|
self | ) |
|
Provides entries, options and defaults specific to Hydro Module.
Also updates them accordingly if required by flags.
Definition at line 216 of file define_problem.without_userdef_constants.py.
218 Provides entries, options and defaults specific to Hydro Module.
219 Also updates them accordingly if required by flags.
221 self.
entries_HD = [
'EOS',
'ENTROPY_SWITCH',
'THERMAL_CONDUCTION',
'VISCOSITY',
'ROTATING_FRAME']
222 self.
default_HD = [
'IDEAL',
'NO',
'NO',
'NO',
'NO']
223 self.
options_HD = [[
'IDEAL',
'PVTE_LAW',
'ISOTHERMAL'], [
'NO',
'YES'], [
'NO',
'EXPLICIT',
'SUPER_TIME_STEPPING'],
224 [
'NO',
'EXPLICIT',
'SUPER_TIME_STEPPING'], [
'NO',
'YES']]
226 if self.flag_dict[
'WITH-CHOMBO']:
def ProcessHDModule(self)
def define_problem.DefineProblem.ProcessHDModule |
( |
|
self | ) |
|
Provides entries, options and defaults specific to Hydro Module.
Also updates them accordingly if required by flags.
Definition at line 217 of file define_problem.py.
219 Provides entries, options and defaults specific to Hydro Module.
220 Also updates them accordingly if required by flags.
223 'THERMAL_CONDUCTION',
232 [
'NO',
'SELECTIVE',
'ALWAYS',
'CHOMBO_REGRID'],
233 [
'NO',
'EXPLICIT',
'SUPER_TIME_STEPPING'],
234 [
'NO',
'EXPLICIT',
'SUPER_TIME_STEPPING'],
237 if self.flag_dict[
'WITH-CHOMBO']:
239 i = self.entries_HD.index(
'THERMAL_CONDUCTION')
241 i = self.entries_HD.index(
'VISCOSITY')
def ProcessHDModule(self)
def define_problem.DefineProblem.ProcessKROMEModule |
( |
|
self | ) |
|
Provides entries, options, and defaults for the KROME cooling module.
Definition at line 278 of file define_problem.without_userdef_constants.py.
280 Provides entries, options, and defaults for the KROME cooling module.
282 netwrkfiles = os.listdir(self.
krome_dir+
'/networks/')
283 self.
entries_KROME = [
'NETWORK_FILE',
'USE_N',
'COOLING_TYPE',
'HEATING_TYPE',
'GAMMA_TYPE']
285 self.
options_KROME = [netwrkfiles, [
'NO',
'YES'], [
'NONE',
'H2',
'ATOMIC',
'Z'], [
'NONE',
'COMPRESS',
'PHOTO',
'XRAY'], [
'DEFAULT',
'FULL',
'ROT',
'VIB',
'EXACT',
'REDUCED']]
def ProcessKROMEModule(self)
def define_problem.DefineProblem.ProcessMHDModule |
( |
|
self | ) |
|
Provides entries, options and defaults specific to Magneto-
Hydro Module.Also updates them accordingly if required by flags.
Definition at line 239 of file define_problem.without_userdef_constants.py.
241 Provides entries, options and defaults specific to Magneto-
242 Hydro Module.Also updates them accordingly if required by flags.
244 self.
entries_MHD = [
'EOS',
'ENTROPY_SWITCH',
'MHD_FORMULATION',
'BACKGROUND_FIELD',
245 'RESISTIVE_MHD',
'THERMAL_CONDUCTION',
'VISCOSITY',
'ROTATING_FRAME']
246 self.
default_MHD = [
'IDEAL',
'NO',
'EIGHT_WAVES',
'NO',
'NO',
'NO',
'NO',
'NO']
247 self.
options_MHD = [[
'IDEAL',
'PVTE_LAW',
'ISOTHERMAL'], [
'NO',
'YES'],
248 [
'NONE',
'EIGHT_WAVES',
'DIV_CLEANING',
'CONSTRAINED_TRANSPORT'],
249 [
'NO',
'YES'],[
'NO',
'EXPLICIT',
'SUPER_TIME_STEPPING'],
250 [
'NO',
'EXPLICIT',
'SUPER_TIME_STEPPING'],[
'NO',
'EXPLICIT',
'SUPER_TIME_STEPPING'],[
'NO',
'YES']]
252 if self.flag_dict[
'WITH-CHOMBO']:
253 self.
options_MHD[2] = [
'NONE',
'EIGHT_WAVES',
'DIV_CLEANING']
258 if self.flag_dict[
'WITH-FD']:
259 self.
options_MHD[2] = [
'NONE',
'EIGHT_WAVES',
'DIV_CLEANING']
261 if self.flag_dict[
'WITH-SB']
or self.flag_dict[
'WITH-FARGO']:
def ProcessMHDModule(self)
def define_problem.DefineProblem.ProcessMHDModule |
( |
|
self | ) |
|
Provides entries, options and defaults specific to Magneto-
Hydro Module.Also updates them accordingly if required by flags.
Definition at line 255 of file define_problem.py.
257 Provides entries, options and defaults specific to Magneto-
258 Hydro Module.Also updates them accordingly if required by flags.
260 self.
entries_MHD = [
'EOS',
'ENTROPY_SWITCH',
'DIVB_CONTROL',
'BACKGROUND_FIELD',
261 'RESISTIVITY',
'THERMAL_CONDUCTION',
'VISCOSITY',
'ROTATING_FRAME']
262 self.
default_MHD = [
'IDEAL',
'NO',
'EIGHT_WAVES',
'NO',
'NO',
'NO',
'NO',
'NO']
265 [
'NO',
'SELECTIVE',
'ALWAYS',
'CHOMBO_REGRID'],
266 [
'NO',
'EIGHT_WAVES',
'DIV_CLEANING',
'CONSTRAINED_TRANSPORT'],
267 [
'NO',
'YES'],[
'NO',
'EXPLICIT',
'SUPER_TIME_STEPPING'],
268 [
'NO',
'EXPLICIT',
'SUPER_TIME_STEPPING'],[
'NO',
'EXPLICIT',
'SUPER_TIME_STEPPING'],[
'NO',
'YES']]
270 if self.flag_dict[
'WITH-CHOMBO']:
271 indx_ = self.entries_MHD.index(
'DIVB_CONTROL')
272 self.
options_MHD[indx_] = [
'NO',
'EIGHT_WAVES',
'DIV_CLEANING']
273 indx_ = self.entries_MHD.index(
'RESISTIVITY')
275 indx_ = self.entries_MHD.index(
'THERMAL_CONDUCTION')
277 indx_ = self.entries_MHD.index(
'VISCOSITY')
280 if self.flag_dict[
'WITH-FD']:
281 indx_ = self.entries_MHD.index(
'DIVB_CONTROL')
282 self.
options_MHD[indx_] = [
'NO',
'EIGHT_WAVES',
'DIV_CLEANING']
284 if self.flag_dict[
'WITH-SB']
or self.flag_dict[
'WITH-FARGO']:
285 indx_ = self.entries_MHD.index(
'DIVB_CONTROL')
286 self.
options_MHD[indx_] = [
'CONSTRAINED_TRANSPORT']
def ProcessMHDModule(self)
def define_problem.DefineProblem.ProcessRHDModule |
( |
|
self | ) |
|
Provides entries, options and defaults specific to Relativistic
Hydro Module. Also updates them accordingly if required by flags.
Definition at line 230 of file define_problem.without_userdef_constants.py.
232 Provides entries, options and defaults specific to Relativistic
233 Hydro Module. Also updates them accordingly if required by flags.
235 self.
entries_RHD = [
'EOS',
'ENTROPY_SWITCH',
'USE_FOUR_VELOCITY']
237 self.
options_RHD = [[
'IDEAL',
'TAUB'], [
'NO',
'YES'], [
'NO',
'YES']]
def ProcessRHDModule(self)
def define_problem.DefineProblem.ProcessRHDModule |
( |
|
self | ) |
|
Provides entries, options and defaults specific to Relativistic
Hydro Module. Also updates them accordingly if required by flags.
Definition at line 244 of file define_problem.py.
246 Provides entries, options and defaults specific to Relativistic
247 Hydro Module. Also updates them accordingly if required by flags.
253 [
'NO',
'SELECTIVE',
'ALWAYS',
'CHOMBO_REGRID']]
def ProcessRHDModule(self)
def define_problem.DefineProblem.ProcessRMHDModule |
( |
|
self | ) |
|
Provides entries, options and defaults specific to Relativisitc
Magneto-Hydro Module.Also updates them accordingly if required by flags.
Definition at line 265 of file define_problem.without_userdef_constants.py.
267 Provides entries, options and defaults specific to Relativisitc
268 Magneto-Hydro Module.Also updates them accordingly if required by flags.
270 self.
entries_RMHD = [
'EOS',
'ENTROPY_SWITCH',
'MHD_FORMULATION' ]
273 [
'NONE',
'EIGHT_WAVES',
'DIV_CLEANING',
'CONSTRAINED_TRANSPORT']]
275 if self.flag_dict[
'WITH-CHOMBO']:
276 self.
options_RMHD[2] = [
'NONE',
'EIGHT_WAVES',
'DIV_CLEANING']
def ProcessRMHDModule(self)
def define_problem.DefineProblem.ProcessRMHDModule |
( |
|
self | ) |
|
Provides entries, options and defaults specific to Relativisitc
Magneto-Hydro Module.Also updates them accordingly if required by flags.
Definition at line 289 of file define_problem.py.
291 Provides entries, options and defaults specific to Relativisitc
292 Magneto-Hydro Module.Also updates them accordingly if required by flags.
298 [
'NO',
'SELECTIVE',
'ALWAYS',
'CHOMBO_REGRID'],
299 [
'NO',
'EIGHT_WAVES',
'DIV_CLEANING',
'CONSTRAINED_TRANSPORT']]
301 if self.flag_dict[
'WITH-CHOMBO']:
302 indx_ = self.entries_RMHD.index(
'DIVB_CONTROL')
303 self.
options_RMHD[indx_] = [
'NO',
'EIGHT_WAVES',
'DIV_CLEANING']
def ProcessRMHDModule(self)
def define_problem.DefineProblem.ProcessUserDefConst |
( |
|
self | ) |
|
Sets the Userdefined Constants.
Definition at line 315 of file define_problem.without_userdef_constants.py.
317 Sets the Userdefined Constants.
319 if (os.path.exists(self.
work_dir+
'/definitions.h')):
320 pf = pfIO.PlutoFiles(self.
work_dir+
'/definitions.h')
321 scrh_beg = pf.LocateString(
'User_Constants_Beg')
322 k_beg = scrh_beg[0][0]+1
323 scrh_end = pf.LocateString(
'User_Constants_End')
324 k_end = scrh_end[0][0]-1
325 const_lines = pf.ReadLines(k_beg, k_end)
327 for n
in range(len(const_lines)):
328 x = const_lines[n].split()
334 if (x[0] ==
'#define'):
335 self.udef_const.append(x[1])
336 self.udef_const_vals.append(x[2])
def ProcessUserDefConst(self)
def define_problem.DefineProblem.ProcessUserDefConst |
( |
|
self | ) |
|
Sets the Userdefined Constants.
Definition at line 336 of file define_problem.py.
338 Sets the Userdefined Constants.
340 if (os.path.exists(self.
work_dir+
'/definitions.h')):
341 pf = pfIO.PlutoFiles(self.
work_dir+
'/definitions.h')
342 old_beg_scrh = pf.LocateString(
'symbolic')
348 del_indx = pf.LocateString(
'USER_DEF_CONSTANTS')
349 pf.DeleteLines(del_indx[0][0], del_indx[0][0])
350 old_beg_scrh = pf.LocateString(
'symbolic')
351 pf.ReplaceLine(
'/* [Beg] user-defined constants (do not change this line) */', old_beg_scrh[0][0])
352 old_end_scrh = pf.LocateString(
'supplementary')
353 pf.InsertLine(
'/* [End] user-defined constants (do not change this line) */', old_end_scrh[0][0] - 1)
355 scrh_beg = pf.LocateString(
'[Beg]')
356 k_beg = scrh_beg[0][0]+1
357 scrh_end = pf.LocateString(
'[End]')
358 k_end = scrh_end[0][0]-1
359 const_lines = pf.ReadLines(k_beg, k_end)
361 for n
in range(len(const_lines)):
362 x = const_lines[n].split()
368 if (x[0] ==
'#define'):
369 self.udef_const.append(x[1])
370 self.udef_const_vals.append(x[2])
def ProcessUserDefConst(self)
def define_problem.DefineProblem.ProcessUserDefPara |
( |
|
self | ) |
|
Sets the Userdefined parameters
Definition at line 288 of file define_problem.without_userdef_constants.py.
290 Sets the Userdefined parameters
292 self.
udef_params = [
'USER_PAR_%.2d'%i
for i
in range(self.nparam)]
293 if (os.path.exists(self.
work_dir+
'/definitions.h')):
294 pf = pfIO.PlutoFiles(self.
work_dir+
'/definitions.h')
295 scrh = pf.LocateString(
'parameters')
297 par_lines = pf.ReadLines(k0, k0 + self.nparam)
298 for n
in range(self.nparam):
300 x = par_lines[n].split()
305 if (x[0] ==
"#define"):
311 menu.SetTitle (
"User-defined Parameters")
312 par_entries = [
'%d'%i
for i
in range(self.nparam)]
def ProcessUserDefPara(self)
def define_problem.DefineProblem.ProcessUserDefPara |
( |
|
self | ) |
|
Sets the Userdefined parameters
Definition at line 305 of file define_problem.py.
307 Sets the Userdefined parameters
309 self.
udef_params = [
'USER_PAR_%.2d'%i
for i
in range(self.nparam)]
310 if (os.path.exists(self.
work_dir+
'/definitions.h')):
311 pf = pfIO.PlutoFiles(self.
work_dir+
'/definitions.h')
312 scrh = pf.LocateString(
'parameters')
314 par_lines = pf.ReadLines(k0, k0 + self.nparam)
315 for n
in range(self.nparam):
317 x = par_lines[n].split()
322 if (x[0] ==
"#define"):
328 menu.SetTitle (
"User-defined Parameters")
329 par_entries = [
'%d'%i
for i
in range(self.nparam)]
def ProcessUserDefPara(self)
def define_problem.DefineProblem.ReadOrBrowse |
( |
|
self, |
|
|
|
Ents = None , |
|
|
|
Opts = None , |
|
|
|
Defs = None , |
|
|
|
MenuTitle = None |
|
) |
| |
Reads or Browses the entries, options and defaults to create header file.
This method either reads the already exsisting definitions.h file or browses
throught the three lists which are provided as inputs.
**Inputs**:
1. Ents = List of entries. [None]
2. Opts = List of options corresponding to each member in Ents [None]
3. Defs = List of default value from Opts corresponding to each member in Ents [None]
4. MenuTitle = Title for the Menu to be Browsed [None]
Definition at line 189 of file define_problem.without_userdef_constants.py.
189 def ReadOrBrowse(self, Ents=None, Opts=None, Defs=None, MenuTitle=None):
190 """Reads or Browses the entries, options and defaults to create header file.
192 This method either reads the already exsisting definitions.h file or browses
193 throught the three lists which are provided as inputs.
196 1. Ents = List of entries. [None]
197 2. Opts = List of options corresponding to each member in Ents [None]
198 3. Defs = List of default value from Opts corresponding to each member in Ents [None]
199 4. MenuTitle = Title for the Menu to be Browsed [None]
201 if (os.path.exists(self.
work_dir+
'/definitions.h')):
202 pf = pfIO.PlutoFiles(self.
work_dir+
'/definitions.h')
203 pf.UpdateListFromFile(Ents, Defs)
204 for i
in range(len(Ents)):
205 if Defs[i]
not in Opts[i]:
214 selection =
menu.Browse(Ents, default=Defs, options=Opts)
def define_problem.DefineProblem.ReadOrBrowse |
( |
|
self, |
|
|
|
Ents = None , |
|
|
|
Opts = None , |
|
|
|
Defs = None , |
|
|
|
MenuTitle = None |
|
) |
| |
Reads or Browses the entries, options and defaults to create header file.
This method either reads the already exsisting definitions.h file or browses
throught the three lists which are provided as inputs.
**Inputs**:
1. Ents = List of entries. [None]
2. Opts = List of options corresponding to each member in Ents [None]
3. Defs = List of default value from Opts corresponding to each member in Ents [None]
4. MenuTitle = Title for the Menu to be Browsed [None]
Definition at line 190 of file define_problem.py.
190 def ReadOrBrowse(self, Ents=None, Opts=None, Defs=None, MenuTitle=None):
191 """Reads or Browses the entries, options and defaults to create header file.
193 This method either reads the already exsisting definitions.h file or browses
194 throught the three lists which are provided as inputs.
197 1. Ents = List of entries. [None]
198 2. Opts = List of options corresponding to each member in Ents [None]
199 3. Defs = List of default value from Opts corresponding to each member in Ents [None]
200 4. MenuTitle = Title for the Menu to be Browsed [None]
202 if (os.path.exists(self.
work_dir+
'/definitions.h')):
203 pf = pfIO.PlutoFiles(self.
work_dir+
'/definitions.h')
204 pf.UpdateListFromFile(Ents, Defs)
205 for i
in range(len(Ents)):
206 if Defs[i]
not in Opts[i]:
215 selection =
menu.Browse(Ents, default=Defs, options=Opts)
def define_problem.DefineProblem.UpdatePlutoIni |
( |
|
self | ) |
|
Updates pluto.ini file with values of UserDefined Parameters
Definition at line 498 of file define_problem.without_userdef_constants.py.
500 Updates pluto.ini file with values of UserDefined Parameters
502 pf = pfIO.PlutoFiles(self.
work_dir+
'/pluto.ini')
503 scrh = pf.LocateString(
'[Parameters]')
507 print "Parameters keyword not found in pluto.ini"
512 ipos = scrh[0][0] + 2
513 tmplist1 = pf.ReadLines(ipos,100)
517 if (len(x.split()) == 0):
continue
518 paradict.update({x.split()[0]:x.split()[1]})
520 cmmval = x.split()[2]
525 if cmmval ==
'#' or cmmval.startswith(
'#'):
526 cmms.append(
' '.join(x.split()[2:]))
531 if x
in paradict.keys():
532 pf.InsertLine(x.ljust(21) + paradict[x] +
' '+cmms[self.udef_params.index(x)]+
'\n', ipos)
535 cmms[self.udef_params.index(x)]
537 pf.InsertLine(x.ljust(21) +
'0.0' +
'\n', ipos)
539 pf.InsertLine(x.ljust(21) +
'0.0'+
' '+cmms[self.udef_params.index(x)]+
'\n', ipos)
541 pf.DeleteLines(ipos,ipos+100)
def define_problem.DefineProblem.UpdatePlutoIni |
( |
|
self | ) |
|
Updates pluto.ini file with values of UserDefined Parameters
Definition at line 529 of file define_problem.py.
531 Updates pluto.ini file with values of UserDefined Parameters
533 pf = pfIO.PlutoFiles(self.
work_dir+
'/pluto.ini')
534 scrh = pf.LocateString(
'[Parameters]')
538 print "Parameters keyword not found in pluto.ini"
543 ipos = scrh[0][0] + 2
544 tmplist1 = pf.ReadLines(ipos,100)
548 if (len(x.split()) == 0):
continue
549 paradict.update({x.split()[0]:x.split()[1]})
551 cmmval = x.split()[2]
556 if cmmval ==
'#' or cmmval.startswith(
'#'):
557 cmms.append(
' '.join(x.split()[2:]))
562 if x
in paradict.keys():
563 pf.InsertLine(x.ljust(21) + paradict[x] +
' '+cmms[self.udef_params.index(x)]+
'\n', ipos)
566 cmms[self.udef_params.index(x)]
568 pf.InsertLine(x.ljust(21) +
'0.0' +
'\n', ipos)
570 pf.InsertLine(x.ljust(21) +
'0.0'+
' '+cmms[self.udef_params.index(x)]+
'\n', ipos)
572 pf.DeleteLines(ipos,ipos+100)
def define_problem.DefineProblem.WriteDefFileList |
( |
|
self | ) |
|
Writes all modular entries, options, defaults into a list.
Definition at line 557 of file define_problem.without_userdef_constants.py.
559 Writes all modular entries, options, defaults into a list.
562 self.def_file_list.append(
'#define '+x.ljust(21)+
' '+self.
default[self.entries.index(x)]+
'\n')
564 self.def_file_list.append(
'\n/* -- physics dependent declarations -- */\n\n')
571 self.def_file_list.append(
'#define '+x.ljust(21)+
' '+ self.
mod_default[self.mod_entries.index(x)]+
'\n')
578 self.def_file_list.append(
'\n/* -- user-defined parameters (labels) -- */\n\n')
580 self.def_file_list.append(
'#define '+x.ljust(21)+
' '+
'%d'%self.udef_params.index(x)+
'\n')
585 self.def_file_list.append(
'\n/* -- User_Constants_Beg -- DO NOT REMOVE THIS LINE*/\n\n')
586 for i
in range(len(self.udef_const)):
587 self.def_file_list.append(
'#define '+self.udef_const[i].ljust(21)+
' '+self.udef_const_vals[i]+
'\n')
588 self.def_file_list.append(
'\n/* -- User_Constants_End -- DO NOT REMOVE THIS LINE*/\n\n')
591 self.def_file_list.append(
'\n/* -- supplementary constants (user editable) -- */ \n\n')
594 self.def_file_list.append(x)
606 def WriteDefFileList(self)
def AppendPlutoPathAndFlags(self)
def AppendAdditionalFiles(self)
def NonUserFriendlyConst(self)
def define_problem.DefineProblem.WriteDefFileList |
( |
|
self | ) |
|
Writes all modular entries, options, defaults into a list.
Definition at line 574 of file define_problem.py.
576 Writes all modular entries, options, defaults into a list.
579 self.def_file_list.append(
'#define '+x.ljust(21)+
' '+self.
default[self.entries.index(x)]+
'\n')
581 self.def_file_list.append(
'\n/* -- physics dependent declarations -- */\n\n')
588 self.def_file_list.append(
'#define '+x.ljust(21)+
' '+ self.
mod_default[self.mod_entries.index(x)]+
'\n')
595 self.def_file_list.append(
'\n/* -- user-defined parameters (labels) -- */\n\n')
597 self.def_file_list.append(
'#define '+x.ljust(21)+
' '+
'%d'%self.udef_params.index(x)+
'\n')
602 self.def_file_list.append(
'\n/* [Beg] user-defined constants (do not change this line) */\n\n')
603 for i
in range(len(self.udef_const)):
604 self.def_file_list.append(
'#define '+self.udef_const[i].ljust(21)+
' '+self.udef_const_vals[i]+
'\n')
606 self.def_file_list.append(
'\n/* [End] user-defined constants (do not change this line) */\n')
608 self.def_file_list.append(
'\n/* -- supplementary constants (user editable) -- */ \n\n')
611 self.def_file_list.append(x)
615 def WriteDefFileList(self)
def AppendPlutoPathAndFlags(self)
def AppendAdditionalFiles(self)
def NonUserFriendlyConst(self)
def define_problem.DefineProblem.WriteKromeOpts |
( |
|
self | ) |
|
define_problem.DefineProblem.additional_files |
define_problem.DefineProblem.additional_flags |
define_problem.DefineProblem.auto_update |
define_problem.DefineProblem.def_file_list |
define_problem.DefineProblem.def_fname |
define_problem.DefineProblem.default |
define_problem.DefineProblem.default_HD |
define_problem.DefineProblem.default_KROME |
define_problem.DefineProblem.default_MHD |
define_problem.DefineProblem.default_RHD |
define_problem.DefineProblem.default_RMHD |
list define_problem.DefineProblem.divb_mode = self.mod_default[self.mod_entries.index('DIVB_CONTROL')] |
|
static |
define_problem.DefineProblem.entries |
define_problem.DefineProblem.entries_HD |
define_problem.DefineProblem.entries_KROME |
define_problem.DefineProblem.entries_MHD |
define_problem.DefineProblem.entries_RHD |
define_problem.DefineProblem.entries_RMHD |
define_problem.DefineProblem.header_files |
define_problem.DefineProblem.krome_dir |
define_problem.DefineProblem.kromeoptstr |
tuple define_problem.DefineProblem.longword = max(len(w) for w in tmplist1) |
|
static |
define_problem.DefineProblem.mod_default |
define_problem.DefineProblem.mod_entries |
define_problem.DefineProblem.non_usfr |
define_problem.DefineProblem.options |
define_problem.DefineProblem.options_HD |
define_problem.DefineProblem.options_KROME |
define_problem.DefineProblem.options_MHD |
define_problem.DefineProblem.options_RHD |
define_problem.DefineProblem.options_RMHD |
tuple define_problem.DefineProblem.pf = pfIO.PlutoFiles(self.work_dir+'/definitions.h') |
|
static |
define_problem.DefineProblem.phymodule |
define_problem.DefineProblem.pluto_dir |
define_problem.DefineProblem.pluto_path |
list define_problem.DefineProblem.tmplist2 = tmplist2+['NO', 'DEFAULT'] |
|
static |
define_problem.DefineProblem.udef_params |
define_problem.DefineProblem.work_dir |
The documentation for this class was generated from the following files: