PLUTO
define_problem.DefineProblem Class Reference
Inheritance diagram for define_problem.DefineProblem:
Collaboration diagram for define_problem.DefineProblem:

Public Member Functions

def __init__ (self, work_dir, pluto_dir, auto_update)
 
def ChkCompatiblity (self)
 
def GenerateOptionsList (self)
 
def AfterFlagLists (self)
 
def ReadOrBrowse
 
def ProcessHDModule (self)
 
def ProcessRHDModule (self)
 
def ProcessMHDModule (self)
 
def ProcessRMHDModule (self)
 
def ProcessUserDefPara (self)
 
def ProcessUserDefConst (self)
 
def NonUserFriendlyConst (self)
 
def AppendAdditionalFiles (self)
 
def AppendPlutoPathAndFlags (self)
 
def UpdatePlutoIni (self)
 
def WriteDefFileList (self)
 
def __init__ (self, work_dir, pluto_dir, auto_update)
 
def GenerateOptionsList (self)
 
def AfterFlagLists (self)
 
def ReadOrBrowse
 
def ProcessHDModule (self)
 
def ProcessRHDModule (self)
 
def ProcessMHDModule (self)
 
def ProcessRMHDModule (self)
 
def ProcessKROMEModule (self)
 
def ProcessUserDefPara (self)
 
def ProcessUserDefConst (self)
 
def NonUserFriendlyConst (self)
 
def AppendAdditionalFiles (self)
 
def AppendPlutoPathAndFlags (self)
 
def UpdatePlutoIni (self)
 
def WriteKromeOpts (self)
 
def WriteDefFileList (self)
 

Public Attributes

 work_dir
 
 pluto_dir
 
 auto_update
 
 def_fname
 
 additional_files
 
 header_files
 
 additional_flags
 
 pluto_path
 
 def_file_list
 
 entries
 
 default
 
 options
 
 entries_HD
 
 default_HD
 
 options_HD
 
 entries_RHD
 
 default_RHD
 
 options_RHD
 
 entries_MHD
 
 default_MHD
 
 options_MHD
 
 entries_RMHD
 
 default_RMHD
 
 options_RMHD
 
 udef_params
 
 phymodule
 
 mod_entries
 
 mod_default
 
 krome_dir
 
 entries_KROME
 
 default_KROME
 
 options_KROME
 
 non_usfr
 
 kromeoptstr
 

Static Public Attributes

tuple pf = pfIO.PlutoFiles(self.work_dir+'/definitions.h')
 
list tmplist1 = tmplist1+['CHAR_LIMITING', 'LIMITER']
 
list tmplist2 = tmplist2+['NO', 'DEFAULT']
 
list divb_mode = self.mod_default[self.mod_entries.index('DIVB_CONTROL')]
 
tuple longword = max(len(w) for w in tmplist1)
 
tuple cmset = set(['CHARACTERISTIC_TRACING', 'HANCOCK'])
 

Detailed Description

Definition at line 6 of file define_problem.py.

Constructor & Destructor Documentation

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.
9 
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.
14 
15  **Inputs**:
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.
19 
20  **Output**:
21  It generates a definitions.h file.
22 
23  """
24  #Some class attributes that will be used in various class methods.
25  self.work_dir = work_dir
26  self.pluto_dir = pluto_dir
27  self.auto_update = auto_update
28  self.def_fname = self.work_dir + '/definitions.h'
29  self.additional_files = []
30  self.header_files = []
31  self.additional_flags = []
32  self.pluto_path = []
33  self.def_file_list = []
34 
35  self.ChkCompatiblity() #To Replace Old Keywords with New Ones
36 
37  # defining the PLUTO entries and its default values in lists.
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',
42  'NO','LINEAR','RK2',
43  'NO', '0', '0']
44 
45  # Creating a dictionary of flags that are invoked by giving arguments.
46  flag_keys = ['WITH-CHOMBO', 'FULL', 'WITH-FD', 'WITH-SB', 'WITH-FARGO']
47  #self.flag_dict = {key: False for key in flag_keys} DOESNT WORK WITH PYTHON 2.6
def __init__(self, work_dir, pluto_dir, auto_update)

Here is the caller graph for this function:

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.
9 
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.
14 
15  **Inputs**:
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.
19 
20  **Output**:
21  It generates a definitions.h file.
22 
23  """
24  #Some class attributes that will be used in various class methods.
25  self.work_dir = work_dir
26  self.pluto_dir = pluto_dir
27  self.krome_dir = pluto_dir + 'Lib/krome/'
28  self.auto_update = auto_update
29  self.def_fname = self.work_dir + '/definitions.h'
30  self.additional_files = []
31  self.header_files = []
32  self.additional_flags = []
33  self.pluto_path = []
34  self.def_file_list = []
35 
36  # defining the PLUTO entries and its default values in lists.
37  self.entries = ['PHYSICS', 'DIMENSIONS', 'COMPONENTS', 'GEOMETRY',
38  'BODY_FORCE', 'COOLING', 'INTERPOLATION', 'TIME_STEPPING',
39  'DIMENSIONAL_SPLITTING', 'NTRACER', 'USER_DEF_PARAMETERS'
40  ]
41  self.default = ['HD', '1', '1', 'CARTESIAN','NO',
42  'NO','LINEAR','RK2',
43  'YES', '0', '0',
44  ]
45 
46  # Creating a dictionary of flags that are invoked by giving arguments.
47  flag_keys = ['WITH-CHOMBO', 'FULL', 'WITH-FD', 'WITH-SB', 'WITH-FARGO']
48  #self.flag_dict = {key: False for key in flag_keys} DOESNT WORK WITH PYTHON 2.6
def __init__(self, work_dir, pluto_dir, auto_update)

Here is the call graph for this function:

Member Function Documentation

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.

142  def AfterFlagLists(self):
143  """Modify options and default list based on command-line flags.
144 
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.
149  """
150  if self.flag_dict['FULL']:
151  self.options[self.entries.index('INTERPOLATION')] = ['FLAT','LINEAR','LimO3', 'WENO3','PARABOLIC', 'MP5']
152 
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'
160 
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'
167 
168 
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'
176 
177 
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'
187 
188 

Here is the call graph for this function:

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.

143  def AfterFlagLists(self):
144  """Modify options and default list based on command-line flags.
145 
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.
150  """
151  if self.flag_dict['FULL']:
152  self.options[self.entries.index('RECONSTRUCTION')] = ['FLAT','LINEAR','LimO3', 'WENO3','PARABOLIC', 'MP5']
153 
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'
161 
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'
168 
169 
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'
177 
178 
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'
188 
189 

Here is the caller graph for this function:

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.

392  """
393  Adds additional object files based on
394  modular defintions and requirements.
395  """
396  interp_mode = self.default[self.entries.index('INTERPOLATION')]
397 
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')

Here is the call graph for this function:

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.

421  """
422  Adds additional object files based on
423  modular defintions and requirements.
424  """
425  interp_mode = self.default[self.entries.index('RECONSTRUCTION')]
426 
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')

Here is the caller graph for this function:

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.

448  """
449  Adds additional C flags and path to 'makefile' based on
450  modular defintions and requirements.
451  """
452  self.pluto_path.append(self.phymodule+'/')
453 
454  dis_eff = ['Thermal_Conduction', 'Viscosity']
455  for de in dis_eff:
456  if de.upper() in self.mod_entries and self.mod_default[self.mod_entries.index(de.upper())] != 'NO':
457  self.pluto_path.append(de+'/')
458 
459  if self.phymodule == 'MHD' or self.phymodule == 'RMHD':
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/')
465  else:
466  pass
467 
468  if self.phymodule == 'MHD' and self.mod_default[self.mod_entries.index('RESISTIVE_MHD')] != 'NO':
469  self.pluto_path.append('MHD/Resistive/')
470 
471  if self.flag_dict['WITH-SB']:
472  self.pluto_path.append('MHD/ShearingBox/')
473  self.additional_flags.append(' -DSHEARINGBOX')
474 
475  if self.flag_dict['WITH-FARGO']:
476  self.pluto_path.append('Fargo/')
477  self.additional_flags.append(' -DFARGO')
478 
479  if self.flag_dict['WITH-FD']:
480  self.additional_flags.append(' -DFINITE_DIFFERENCE')
481 
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/')
488  else:
489  self.pluto_path.append('Cooling/'+ cool_mode +'/')
490 
491  if 'EOS' in self.mod_entries:
492  if 'PVTE_LAW' in self.mod_default:
493  tmp1 = 'PVTE'
494  else:
495  tmp1 = self.eos[0]+self.eos[1:].lower()
496  self.pluto_path.append('EOS/'+tmp1+'/')
497 

Here is the call graph for this function:

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.

479  """
480  Adds additional C flags and path to 'makefile' based on
481  modular defintions and requirements.
482  """
483  self.pluto_path.append(self.phymodule+'/')
484 
485  dis_eff = ['Dust','Thermal_Conduction', 'Viscosity']
486  for de in dis_eff:
487  if de.upper() in self.mod_entries and self.mod_default[self.mod_entries.index(de.upper())] != 'NO':
488  self.pluto_path.append(de+'/')
489 
490  if self.phymodule == 'MHD' or self.phymodule == 'RMHD':
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/')
496  else:
497  pass
498 
499  if self.phymodule == 'MHD' and self.mod_default[self.mod_entries.index('RESISTIVITY')] != 'NO':
500  self.pluto_path.append('MHD/Resistivity/')
501 
502  if self.flag_dict['WITH-SB']:
503  self.pluto_path.append('MHD/ShearingBox/')
504  self.additional_flags.append(' -DSHEARINGBOX')
505 
506  if self.flag_dict['WITH-FARGO']:
507  self.pluto_path.append('Fargo/')
508  self.additional_flags.append(' -DFARGO')
509 
510  if self.flag_dict['WITH-FD']:
511  self.additional_flags.append(' -DFINITE_DIFFERENCE')
512 
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/')
519  else:
520  self.pluto_path.append('Cooling/'+ cool_mode +'/')
521 
522  if 'EOS' in self.mod_entries:
523  if 'PVTE_LAW' in self.mod_default:
524  tmp1 = 'PVTE'
525  else:
526  tmp1 = self.eos[0]+self.eos[1:].lower()
527  self.pluto_path.append('EOS/'+tmp1+'/')
528 

Here is the caller graph for this function:

def define_problem.DefineProblem.ChkCompatiblity (   self)

Definition at line 108 of file define_problem.py.

108  def ChkCompatiblity(self):
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])
115 
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.
117 
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.
122  """
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']
129  #parlist = ['NO','YES']
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)]
136 
137  self.options = [phylist, dimlist, comlist, geolist, bfolist,
138  coolist, intlist, tmslist,
139  dislist, ntrlist, udplist,
140  udclist]
141 

Here is the call graph for this function:

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.
118 
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.
123  """
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']
130  #parlist = ['NO','YES']
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)]
137 
138  self.options = [phylist, dimlist, comlist, geolist, bfolist,
139  coolist, intlist, tmslist,
140  dislist, ntrlist, udplist,
141  udclist]
142 

Here is the caller graph for this function:

def define_problem.DefineProblem.NonUserFriendlyConst (   self)
Sets the non-user friendly constants.

Definition at line 343 of file define_problem.without_userdef_constants.py.

344  """
345  Sets the non-user friendly constants.
346  """
347  tmplist1 = ['INITIAL_SMOOTHING', 'WARNING_MESSAGES', 'PRINT_TO_FILE', 'INTERNAL_BOUNDARY', 'SHOCK_FLATTENING']
348  tmplist2 = len(tmplist1)*['NO']
349 
350  if self.flag_dict['WITH-CHOMBO']:
351  tmplist1 += ['CHOMBO_EN_SWITCH','CHOMBO_REF_VAR','CHOMBO_LOGR']
352  tmplist2 += [ 'NO', 'ENG', 'NO']
353 
354  if not self.flag_dict['WITH-FD']:
355  tmplist1 = tmplist1 + ['ARTIFICIAL_VISCOSITY', 'CHAR_LIMITING', 'LIMITER']
356  tmplist2 = tmplist2 + ['NO', 'NO', 'DEFAULT']
357 
358  if 'MHD_FORMULATION' in self.mod_entries:
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']
363  else:
364  tmplist1 = tmplist1 + ['ASSIGN_VECTOR_POTENTIAL']
365  tmplist2 = tmplist2 + ['NO']
366 
367  if not self.flag_dict['WITH-CHOMBO']:
368  tmplist1 = tmplist1 + ['UPDATE_VECTOR_POTENTIAL']
369  tmplist2 = tmplist2 + ['NO']
370 
371  if 'HANCOCK' in self.default:
372  if (self.phymodule == 'RMHD'):
373  tmplist1 = tmplist1 + ['PRIMITIVE_HANCOCK']
374  tmplist2 = tmplist2 + ['NO']
375  else:
376  tmplist1 = tmplist1 + ['PRIMITIVE_HANCOCK']
377  tmplist2 = tmplist2 + ['YES']
378 
379  if 'SUPER_TIME_STEPPING' in self.mod_default:
380  tmplist1 = tmplist1 + ['STS_nu']
381  tmplist2 = tmplist2 + ['0.01']
382 
383  longword = max(len(w) for w in tmplist1)
384 
385  if (os.path.exists(self.work_dir+'/definitions.h')):
386  pf = pfIO.PlutoFiles(self.work_dir+'/definitions.h')
387  pf.UpdateListFromFile(tmplist1, tmplist2)
388 
389  self.non_usfr = ['#define '+tmplist1[i].ljust(longword+3)+tmplist2[i]+'\n' for i in range(len(tmplist1))]
390 
double max
Definition: analysis.c:5

Here is the call graph for this function:

def define_problem.DefineProblem.NonUserFriendlyConst (   self)
Sets the non-user friendly constants.

Definition at line 375 of file define_problem.py.

376  """
377  Sets the non-user friendly constants.
378  """
379  tmplist1 = ['INITIAL_SMOOTHING', 'WARNING_MESSAGES', 'PRINT_TO_FILE',
380  'INTERNAL_BOUNDARY', 'SHOCK_FLATTENING']
381  tmplist2 = len(tmplist1)*['NO']
382 

Here is the caller graph for this function:

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.

216  def ProcessHDModule(self):
217  """
218  Provides entries, options and defaults specific to Hydro Module.
219  Also updates them accordingly if required by flags.
220  """
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']]
225 
226  if self.flag_dict['WITH-CHOMBO']:
227  self.options_HD[2] = ['NO','EXPLICIT']
228  self.options_HD[3] = ['NO','EXPLICIT']
229 

Here is the call graph for this function:

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.

217  def ProcessHDModule(self):
218  """
219  Provides entries, options and defaults specific to Hydro Module.
220  Also updates them accordingly if required by flags.
221  """
222  self.entries_HD = ['EOS', 'ENTROPY_SWITCH',
223  'THERMAL_CONDUCTION',
224  'VISCOSITY',
225  'ROTATING_FRAME']
226  self.default_HD = ['IDEAL', 'NO',
227  'NO',
228  'NO',
229  'NO']
230  self.options_HD = [['IDEAL','PVTE_LAW','ISOTHERMAL'],
231 # ['NO','YES'],
232  ['NO','SELECTIVE','ALWAYS','CHOMBO_REGRID'],
233  ['NO','EXPLICIT','SUPER_TIME_STEPPING'],
234  ['NO','EXPLICIT','SUPER_TIME_STEPPING'],
235  ['NO','YES']]
236 
237  if self.flag_dict['WITH-CHOMBO']: # Chombo does not support STS at the
238  # moment. Only explicit allowed with Chombo
239  i = self.entries_HD.index('THERMAL_CONDUCTION')
240  self.options_HD[i] = ['NO','EXPLICIT']
241  i = self.entries_HD.index('VISCOSITY')
242  self.options_HD[i] = ['NO','EXPLICIT']
243 

Here is the caller graph for this function:

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.

279  """
280  Provides entries, options, and defaults for the KROME cooling module.
281  """
282  netwrkfiles = os.listdir(self.krome_dir+'/networks/')
283  self.entries_KROME = ['NETWORK_FILE', 'USE_N','COOLING_TYPE', 'HEATING_TYPE', 'GAMMA_TYPE']
284  self.default_KROME = [netwrkfiles[0], 'NO', 'NONE', 'NONE', 'DEFAULT']
285  self.options_KROME = [netwrkfiles, ['NO', 'YES'], [ 'NONE', 'H2', 'ATOMIC', 'Z'], ['NONE', 'COMPRESS', 'PHOTO', 'XRAY'], ['DEFAULT','FULL', 'ROT', 'VIB', 'EXACT', 'REDUCED']]
286 
287 
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.

239  def ProcessMHDModule(self):
240  """
241  Provides entries, options and defaults specific to Magneto-
242  Hydro Module.Also updates them accordingly if required by flags.
243  """
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']]
251 
252  if self.flag_dict['WITH-CHOMBO']:
253  self.options_MHD[2] = ['NONE','EIGHT_WAVES','DIV_CLEANING']
254  self.options_MHD[4] = ['NO','EXPLICIT']
255  self.options_MHD[5] = ['NO','EXPLICIT']
256  self.options_MHD[6] = ['NO','EXPLICIT']
257 
258  if self.flag_dict['WITH-FD']:
259  self.options_MHD[2] = ['NONE','EIGHT_WAVES','DIV_CLEANING']
260 
261  if self.flag_dict['WITH-SB'] or self.flag_dict['WITH-FARGO']:
262  self.options_MHD[2] = ['CONSTRAINED_TRANSPORT']
263  self.default_MHD[2] = 'CONSTRAINED_TRANSPORT'
264 

Here is the call graph for this function:

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.

255  def ProcessMHDModule(self):
256  """
257  Provides entries, options and defaults specific to Magneto-
258  Hydro Module.Also updates them accordingly if required by flags.
259  """
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']
263  self.options_MHD = [['IDEAL','PVTE_LAW','ISOTHERMAL'],
264 # ['NO','YES'],
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']]
269 
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')
274  self.options_MHD[indx_] = ['NO','EXPLICIT']
275  indx_ = self.entries_MHD.index('THERMAL_CONDUCTION')
276  self.options_MHD[indx_] = ['NO','EXPLICIT']
277  indx_ = self.entries_MHD.index('VISCOSITY')
278  self.options_MHD[indx_] = ['NO','EXPLICIT']
279 
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']
283 
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']
287  self.default_MHD[indx_] = 'CONSTRAINED_TRANSPORT'
288 

Here is the caller graph for this function:

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.

230  def ProcessRHDModule(self):
231  """
232  Provides entries, options and defaults specific to Relativistic
233  Hydro Module. Also updates them accordingly if required by flags.
234  """
235  self.entries_RHD = ['EOS', 'ENTROPY_SWITCH', 'USE_FOUR_VELOCITY']
236  self.default_RHD = ['IDEAL', 'NO', 'NO']
237  self.options_RHD = [['IDEAL','TAUB'], ['NO','YES'], ['NO','YES']]
238 

Here is the call graph for this function:

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.

244  def ProcessRHDModule(self):
245  """
246  Provides entries, options and defaults specific to Relativistic
247  Hydro Module. Also updates them accordingly if required by flags.
248  """
249  self.entries_RHD = ['EOS', 'ENTROPY_SWITCH']
250  self.default_RHD = ['IDEAL', 'NO', 'NO']
251  self.options_RHD = [['IDEAL','TAUB'],
252 # ['NO','YES']]
253  ['NO','SELECTIVE','ALWAYS','CHOMBO_REGRID']]
254 

Here is the caller graph for this function:

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.

265  def ProcessRMHDModule(self):
266  """
267  Provides entries, options and defaults specific to Relativisitc
268  Magneto-Hydro Module.Also updates them accordingly if required by flags.
269  """
270  self.entries_RMHD = ['EOS', 'ENTROPY_SWITCH','MHD_FORMULATION' ]
271  self.default_RMHD = ['IDEAL', 'NO', 'NONE']
272  self.options_RMHD = [['IDEAL', 'TAUB'], ['NO','YES'],
273  ['NONE','EIGHT_WAVES','DIV_CLEANING','CONSTRAINED_TRANSPORT']]
274 
275  if self.flag_dict['WITH-CHOMBO']:
276  self.options_RMHD[2] = ['NONE','EIGHT_WAVES','DIV_CLEANING']
277 

Here is the call graph for this function:

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.

289  def ProcessRMHDModule(self):
290  """
291  Provides entries, options and defaults specific to Relativisitc
292  Magneto-Hydro Module.Also updates them accordingly if required by flags.
293  """
294  self.entries_RMHD = ['EOS', 'ENTROPY_SWITCH','DIVB_CONTROL' ]
295  self.default_RMHD = ['IDEAL', 'NO', 'NO']
296  self.options_RMHD = [['IDEAL', 'TAUB'],
297 # ['NO','YES'],
298  ['NO','SELECTIVE','ALWAYS','CHOMBO_REGRID'],
299  ['NO','EIGHT_WAVES','DIV_CLEANING','CONSTRAINED_TRANSPORT']]
300 
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']
304 

Here is the caller graph for this function:

def define_problem.DefineProblem.ProcessUserDefConst (   self)
Sets the Userdefined Constants.

Definition at line 315 of file define_problem.without_userdef_constants.py.

316  """
317  Sets the Userdefined Constants.
318  """
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)
326  print const_lines
327  for n in range(len(const_lines)):
328  x = const_lines[n].split()
329  try:
330  x[0] == '#define'
331  except IndexError:
332  pass
333  else:
334  if (x[0] == '#define'):
335  self.udef_const.append(x[1])
336  self.udef_const_vals.append(x[2])
337  else:
338  continue
339 
340 
341 
342 

Here is the call graph for this function:

def define_problem.DefineProblem.ProcessUserDefConst (   self)
Sets the Userdefined Constants.

Definition at line 336 of file define_problem.py.

337  """
338  Sets the Userdefined Constants.
339  """
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')
343  try:
344  old_beg_scrh[0][0]
345  except IndexError:
346  pass
347  else:
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)
354 
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)
360  #print const_lines
361  for n in range(len(const_lines)):
362  x = const_lines[n].split()
363  try:
364  x[0] == '#define'
365  except IndexError:
366  pass
367  else:
368  if (x[0] == '#define'):
369  self.udef_const.append(x[1])
370  self.udef_const_vals.append(x[2])
371  else:
372  continue
373 
374 

Here is the caller graph for this function:

def define_problem.DefineProblem.ProcessUserDefPara (   self)
Sets the Userdefined parameters

Definition at line 288 of file define_problem.without_userdef_constants.py.

289  """
290  Sets the Userdefined parameters
291  """
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')
296  k0 = scrh[0][0] + 2
297  par_lines = pf.ReadLines(k0, k0 + self.nparam)
298  for n in range(self.nparam):
299  try:
300  x = par_lines[n].split()
301  x[0] == '#define'
302  except IndexError:
303  pass
304  else:
305  if (x[0] == "#define"):
306  self.udef_params[n] = x[1]
307  else:
308  break;
309 
310  if self.auto_update == 0:
311  menu.SetTitle ("User-defined Parameters")
312  par_entries = ['%d'%i for i in range(self.nparam)]
313  menu.Insert(par_entries,self.udef_params)
314 
def Insert(entries, default)
Similar to Browse, but allow the user to directly input the default values by a reading a string...
Definition: menu.py:227

Here is the call graph for this function:

def define_problem.DefineProblem.ProcessUserDefPara (   self)
Sets the Userdefined parameters

Definition at line 305 of file define_problem.py.

306  """
307  Sets the Userdefined parameters
308  """
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')
313  k0 = scrh[0][0] + 2
314  par_lines = pf.ReadLines(k0, k0 + self.nparam)
315  for n in range(self.nparam):
316  try:
317  x = par_lines[n].split()
318  x[0] == '#define'
319  except IndexError:
320  pass
321  else:
322  if (x[0] == "#define"):
323  self.udef_params[n] = x[1]
324  else:
325  break;
326 
327  if self.auto_update == 0:
328  menu.SetTitle ("User-defined Parameters")
329  par_entries = ['%d'%i for i in range(self.nparam)]
330  menu.Insert(par_entries,self.udef_params)
331 
332 
333 
334 
335 
def Insert(entries, default)
Similar to Browse, but allow the user to directly input the default values by a reading a string...
Definition: menu.py:227

Here is the caller graph for this function:

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.
191 
192  This method either reads the already exsisting definitions.h file or browses
193  throught the three lists which are provided as inputs.
194 
195  **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]
200  """
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]:
206  Defs[i] = Opts[i][0]
207  else:
208  pass
209 
210  # Provides Browsing options using the menu file in case of no automatic update flag.
211  if self.auto_update == 0:
212  selection = ''
213  menu.SetTitle(MenuTitle)
214  selection = menu.Browse(Ents, default=Defs, options=Opts)
215 
def SetTitle
Definition: menu.py:50
def Browse
Browse a menu with entries (1st column) and default (2nd column, optional) Note: with Python > 2...
Definition: menu.py:181

Here is the call graph for this function:

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.
192 
193  This method either reads the already exsisting definitions.h file or browses
194  throught the three lists which are provided as inputs.
195 
196  **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]
201  """
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]:
207  Defs[i] = Opts[i][0]
208  else:
209  pass
210 
211  # Provides Browsing options using the menu file in case of no automatic update flag.
212  if self.auto_update == 0:
213  selection = ''
214  menu.SetTitle(MenuTitle)
215  selection = menu.Browse(Ents, default=Defs, options=Opts)
216 
def SetTitle
Definition: menu.py:50
def Browse
Browse a menu with entries (1st column) and default (2nd column, optional) Note: with Python > 2...
Definition: menu.py:181

Here is the call graph for this function:

Here is the caller graph for this function:

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.

498  def UpdatePlutoIni(self):
499  """
500  Updates pluto.ini file with values of UserDefined Parameters
501  """
502  pf = pfIO.PlutoFiles(self.work_dir+'/pluto.ini')
503  scrh = pf.LocateString('[Parameters]')
504  try:
505  scrh[0]
506  except IndexError:
507  print "Parameters keyword not found in pluto.ini"
508  sys.exit()
509  else:
510  pass
511 
512  ipos = scrh[0][0] + 2
513  tmplist1 = pf.ReadLines(ipos,100)
514  paradict = {}
515  cmms = []
516  for x in tmplist1:
517  if (len(x.split()) == 0): continue # skip blank lines
518  paradict.update({x.split()[0]:x.split()[1]})
519  try:
520  cmmval = x.split()[2]
521  except IndexError:
522  cmms.append('')
523  continue
524  else:
525  if cmmval == '#' or cmmval.startswith('#'):
526  cmms.append(' '.join(x.split()[2:]))
527  else:
528  cmms.append('')
529 
530  for x in self.udef_params:
531  if x in paradict.keys():
532  pf.InsertLine(x.ljust(21) + paradict[x] +' '+cmms[self.udef_params.index(x)]+'\n', ipos)
533  else:
534  try:
535  cmms[self.udef_params.index(x)]
536  except IndexError:
537  pf.InsertLine(x.ljust(21) + '0.0' + '\n', ipos)
538  else:
539  pf.InsertLine(x.ljust(21) + '0.0'+' '+cmms[self.udef_params.index(x)]+ '\n', ipos)
540  ipos = ipos + 1
541  pf.DeleteLines(ipos,ipos+100)
542 

Here is the call graph for this function:

def define_problem.DefineProblem.UpdatePlutoIni (   self)
Updates pluto.ini file with values of UserDefined Parameters

Definition at line 529 of file define_problem.py.

529  def UpdatePlutoIni(self):
530  """
531  Updates pluto.ini file with values of UserDefined Parameters
532  """
533  pf = pfIO.PlutoFiles(self.work_dir+'/pluto.ini')
534  scrh = pf.LocateString('[Parameters]')
535  try:
536  scrh[0]
537  except IndexError:
538  print "Parameters keyword not found in pluto.ini"
539  sys.exit()
540  else:
541  pass
542 
543  ipos = scrh[0][0] + 2
544  tmplist1 = pf.ReadLines(ipos,100)
545  paradict = {}
546  cmms = []
547  for x in tmplist1:
548  if (len(x.split()) == 0): continue # skip blank lines
549  paradict.update({x.split()[0]:x.split()[1]})
550  try:
551  cmmval = x.split()[2]
552  except IndexError:
553  cmms.append('')
554  continue
555  else:
556  if cmmval == '#' or cmmval.startswith('#'):
557  cmms.append(' '.join(x.split()[2:]))
558  else:
559  cmms.append('')
560 
561  for x in self.udef_params:
562  if x in paradict.keys():
563  pf.InsertLine(x.ljust(21) + paradict[x] +' '+cmms[self.udef_params.index(x)]+'\n', ipos)
564  else:
565  try:
566  cmms[self.udef_params.index(x)]
567  except IndexError:
568  pf.InsertLine(x.ljust(21) + '0.0' + '\n', ipos)
569  else:
570  pf.InsertLine(x.ljust(21) + '0.0'+' '+cmms[self.udef_params.index(x)]+ '\n', ipos)
571  ipos = ipos + 1
572  pf.DeleteLines(ipos,ipos+100)
573 

Here is the caller graph for this function:

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.

557  def WriteDefFileList(self):
558  """
559  Writes all modular entries, options, defaults into a list.
560  """
561  for x in self.entries:
562  self.def_file_list.append('#define '+x.ljust(21)+' '+self.default[self.entries.index(x)]+'\n')
563 
564  self.def_file_list.append('\n/* -- physics dependent declarations -- */\n\n')
565  self.phymodule = self.default[self.entries.index('PHYSICS')]
566  tmp1 = ['entries_%s'%self.phymodule, 'default_%s'%self.phymodule]
567  self.mod_entries = self.__getattribute__(tmp1[0])
568  self.mod_default = self.__getattribute__(tmp1[1])
569 
570  for x in self.mod_entries:
571  self.def_file_list.append('#define '+x.ljust(21)+' '+ self.mod_default[self.mod_entries.index(x)]+'\n')
572 
573  self.AppendAdditionalFiles()
575 
576  # always insert user-defined paramters and constants sections
577 
578  self.def_file_list.append('\n/* -- user-defined parameters (labels) -- */\n\n')
579  for x in self.udef_params:
580  self.def_file_list.append('#define '+x.ljust(21)+' '+'%d'%self.udef_params.index(x)+'\n')
581 
582  self.UpdatePlutoIni()
583 
584 
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')
589 
590 
591  self.def_file_list.append('\n/* -- supplementary constants (user editable) -- */ \n\n')
592  self.NonUserFriendlyConst()
593  for x in self.non_usfr:
594  self.def_file_list.append(x)
595 
596 
597 
598 
599 
600 
601 
602 
603 
604 
605 

Here is the call graph for this function:

def define_problem.DefineProblem.WriteDefFileList (   self)
Writes all modular entries, options, defaults into a list.

Definition at line 574 of file define_problem.py.

574  def WriteDefFileList(self):
575  """
576  Writes all modular entries, options, defaults into a list.
577  """
578  for x in self.entries:
579  self.def_file_list.append('#define '+x.ljust(21)+' '+self.default[self.entries.index(x)]+'\n')
580 
581  self.def_file_list.append('\n/* -- physics dependent declarations -- */\n\n')
582  self.phymodule = self.default[self.entries.index('PHYSICS')]
583  tmp1 = ['entries_%s'%self.phymodule, 'default_%s'%self.phymodule]
584  self.mod_entries = self.__getattribute__(tmp1[0])
585  self.mod_default = self.__getattribute__(tmp1[1])
586 
587  for x in self.mod_entries:
588  self.def_file_list.append('#define '+x.ljust(21)+' '+ self.mod_default[self.mod_entries.index(x)]+'\n')
589 
590  self.AppendAdditionalFiles()
592 
593  # always insert user-defined paramters and constants sections
594 
595  self.def_file_list.append('\n/* -- user-defined parameters (labels) -- */\n\n')
596  for x in self.udef_params:
597  self.def_file_list.append('#define '+x.ljust(21)+' '+'%d'%self.udef_params.index(x)+'\n')
598 
599  self.UpdatePlutoIni()
600 
601 
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')
605 
606  self.def_file_list.append('\n/* [End] user-defined constants (do not change this line) */\n')
607 
608  self.def_file_list.append('\n/* -- supplementary constants (user editable) -- */ \n\n')
609  self.NonUserFriendlyConst()
610  for x in self.non_usfr:
611  self.def_file_list.append(x)
612 
613 
614 

Here is the caller graph for this function:

def define_problem.DefineProblem.WriteKromeOpts (   self)

Definition at line 543 of file define_problem.without_userdef_constants.py.

543  def WriteKromeOpts(self):
544  self.kromeoptstr = 'python '+self.krome_dir+'krome -n='+self.krome_dir+'networks/'+ self.default_KROME[self.entries_KROME.index('NETWORK_FILE')]
545  if self.default_KROME[self.entries_KROME.index('USE_N')]:
546  self.kromeoptstr += ' -useN'
547 
548  if self.default_KROME[self.entries_KROME.index('COOLING_TYPE')] != 'NONE':
549  self.kromeoptstr += ' -cooling='+ self.default_KROME[self.entries_KROME.index('COOLING_TYPE')]
550 
551  if self.default_KROME[self.entries_KROME.index('HEATING_TYPE')] != 'NONE':
552  self.kromeoptstr += ' -heating='+ self.default_KROME[self.entries_KROME.index('HEATING_TYPE')]
553 
554  if self.default_KROME[self.entries_KROME.index('GAMMA_TYPE')] != 'DEFAULT':
555  self.kromeoptstr += ' -gamma='+ self.default_KROME[self.entries_KROME.index('GAMMA_TYPE')]
556 

Member Data Documentation

define_problem.DefineProblem.additional_files

Definition at line 29 of file define_problem.py.

define_problem.DefineProblem.additional_flags

Definition at line 31 of file define_problem.py.

define_problem.DefineProblem.auto_update

Definition at line 27 of file define_problem.py.

tuple define_problem.DefineProblem.cmset = set(['CHARACTERISTIC_TRACING', 'HANCOCK'])
static

Definition at line 456 of file define_problem.py.

define_problem.DefineProblem.def_file_list

Definition at line 33 of file define_problem.py.

define_problem.DefineProblem.def_fname

Definition at line 28 of file define_problem.py.

define_problem.DefineProblem.default

Definition at line 41 of file define_problem.py.

define_problem.DefineProblem.default_HD

Definition at line 226 of file define_problem.py.

define_problem.DefineProblem.default_KROME

Definition at line 284 of file define_problem.without_userdef_constants.py.

define_problem.DefineProblem.default_MHD

Definition at line 262 of file define_problem.py.

define_problem.DefineProblem.default_RHD

Definition at line 250 of file define_problem.py.

define_problem.DefineProblem.default_RMHD

Definition at line 295 of file define_problem.py.

list define_problem.DefineProblem.divb_mode = self.mod_default[self.mod_entries.index('DIVB_CONTROL')]
static

Definition at line 392 of file define_problem.py.

define_problem.DefineProblem.entries

Definition at line 38 of file define_problem.py.

define_problem.DefineProblem.entries_HD

Definition at line 222 of file define_problem.py.

define_problem.DefineProblem.entries_KROME

Definition at line 283 of file define_problem.without_userdef_constants.py.

define_problem.DefineProblem.entries_MHD

Definition at line 260 of file define_problem.py.

define_problem.DefineProblem.entries_RHD

Definition at line 249 of file define_problem.py.

define_problem.DefineProblem.entries_RMHD

Definition at line 294 of file define_problem.py.

define_problem.DefineProblem.header_files

Definition at line 30 of file define_problem.py.

define_problem.DefineProblem.krome_dir

Definition at line 27 of file define_problem.without_userdef_constants.py.

define_problem.DefineProblem.kromeoptstr

Definition at line 544 of file define_problem.without_userdef_constants.py.

tuple define_problem.DefineProblem.longword = max(len(w) for w in tmplist1)
static

Definition at line 412 of file define_problem.py.

define_problem.DefineProblem.mod_default

Definition at line 585 of file define_problem.py.

define_problem.DefineProblem.mod_entries

Definition at line 584 of file define_problem.py.

define_problem.DefineProblem.non_usfr

Definition at line 389 of file define_problem.without_userdef_constants.py.

define_problem.DefineProblem.options

Definition at line 138 of file define_problem.py.

define_problem.DefineProblem.options_HD

Definition at line 230 of file define_problem.py.

define_problem.DefineProblem.options_KROME

Definition at line 285 of file define_problem.without_userdef_constants.py.

define_problem.DefineProblem.options_MHD

Definition at line 263 of file define_problem.py.

define_problem.DefineProblem.options_RHD

Definition at line 251 of file define_problem.py.

define_problem.DefineProblem.options_RMHD

Definition at line 296 of file define_problem.py.

tuple define_problem.DefineProblem.pf = pfIO.PlutoFiles(self.work_dir+'/definitions.h')
static

Definition at line 104 of file define_problem.py.

define_problem.DefineProblem.phymodule

Definition at line 490 of file define_problem.py.

define_problem.DefineProblem.pluto_dir

Definition at line 26 of file define_problem.py.

define_problem.DefineProblem.pluto_path

Definition at line 32 of file define_problem.py.

list define_problem.DefineProblem.tmplist1 = tmplist1+['CHAR_LIMITING', 'LIMITER']
static

Definition at line 388 of file define_problem.py.

list define_problem.DefineProblem.tmplist2 = tmplist2+['NO', 'DEFAULT']
static

Definition at line 389 of file define_problem.py.

define_problem.DefineProblem.udef_params

Definition at line 309 of file define_problem.py.

define_problem.DefineProblem.work_dir

Definition at line 25 of file define_problem.py.


The documentation for this class was generated from the following files: