Esempio n. 1
0
 def create_common_task_files(self, dir_name):
     '''
     creates files common for both solution methods
     changed ini file in dir_name
     batch scripts
     task identifier
     '''
     ini_file = self.window().output_dir + dir_name + SEPARATOR + dir_name + '_ini.ini'
     self.window().flow_ini.create_changed_copy(ini_file, Material = \
                                    self.window().flow_ini.dict_files['Material'])
     batch.create_launcher_scripts(ini_file, self.local_launcher, self.cluster_launcher)
     solver_utils.create_task_identifier('basic', self.window().output_dir + dir_name)
Esempio n. 2
0
 def save_monte_carlo_results(self):    
     '''
     save results from dict computed_conductivity_values if there are any
     '''
     
     if len(self.computed_conductivity_values) == 0:
         msg = "ERROR - nothing to save"           
         self.messenger(msg)
         return
     
     pocet = int(self.edit_monte_tasks.text())
     poc = len(str(pocet+1))
     
     local_launcher, cluster_launcher = self.window().get_launchers()
        
     for loop_nr in range(pocet):
         workcopy = copy.deepcopy(self.material)
         
         for mat in self.computed_conductivity_values.keys():
         
             workcopy[mat]['type_spec'] = []
             for direction_value in self.computed_conductivity_values[mat]:
                 
                 self.monte_logger.log_message(\
                       loop_nr, mat, workcopy[mat]['type_spec'], direction_value[loop_nr])
                 workcopy[mat]['type_spec'].append(direction_value[loop_nr])   
             
         
         for mat in self.computed_storativity_values.iterkeys():
             self.monte_logger.log_message(\
                   loop_nr, mat, workcopy[mat]['storativity'], self.computed_storativity_values[mat][loop_nr])
             workcopy[mat]['storativity'] = self.computed_storativity_values[mat][loop_nr]  
             
         for mat in self.computed_geometry_values.iterkeys():
             self.monte_logger.log_message(\
                   loop_nr, mat, workcopy[mat]['geometry_spec'], self.computed_geometry_values[mat][loop_nr])
             workcopy[mat]['geometry_spec'] = self.computed_geometry_values[mat][loop_nr]      
         
         for mat in self.computed_porosity_values.iterkeys():
             self.monte_logger.log_message(\
                   loop_nr, mat, workcopy[mat]['dualporosity'], self.computed_porosity_values[mat][loop_nr])
             workcopy[mat]['dualporosity'] = self.computed_porosity_values[mat][loop_nr]
             
         for mat in self.computed_sorption_values.iterkeys():
             for subst_nr in workcopy[mat]['sorption'].iterkeys():
                 workcopy[mat]['sorption'][subst_nr] = self.computed_sorption_values[mat][subst_nr][loop_nr]
         
         fdir = '{num:0{width}}'.format(num=loop_nr, width=poc+1)
         fname = self.window().output_dir + fdir + SEPARATOR +  self.window().flow_ini.dict_files['Material']
         
         workcopy.save_changes(fname)
         ffname = self.window().output_dir + fdir + SEPARATOR + fdir + '_ini.ini'
         self.window().flow_ini.create_changed_copy(ffname, Material = self.window().flow_ini.dict_files['Material'])
         
         batch.create_launcher_scripts(ffname, local_launcher, cluster_launcher)
         
         solver_utils.create_task_identifier('basic', self.window().output_dir + fdir)
         workcopy = {}  
     
     if self.window().centralWidget.tab_settings.launcher_check_hydra.isChecked():
         batch.create_cluster_batch(self.window().output_dir)
     
     #self.monte_logger.close()
     msg = "{} new tasks has been created".format(pocet)           
     self.messenger(msg)