def write_sk_inp(species_kept, dir_mech_de, dir_mech_sk, notes): species_kept = list(species_kept) n_sp = len(species_kept) print('total: ' + str(n_sp)) notes.append('! number of species = ' + str(n_sp)) skeletal(dir_mech_de, dir_mech_sk, species_kept, notes=notes) ck2cti(dir_mech_sk) f = open(os.path.join(dir_mech_sk, 'ns.txt'), 'w') f.write(str(n_sp)) f.close()
def set_soln(self, mech_name): dir_desk = os.path.join(self.wm.project['dir_public'],mech_name) dir_desk_mech = os.path.join(dir_desk,'mech') path_cti = os.path.join(dir_desk,'chem.cti') if not os.path.exists(path_cti): ctOK = ck2cti(dir_desk_mech) if ctOK not True: msg = 'errors in reading mech files, \nplease check output files' QMessageBox.information(QWidget(),'',msg) return None
def act_set(self): if self.read_path(): dir_desk = self.data['desk'] path_cti = os.path.join(dir_desk,'mech','chem.cti') if not os.path.exists(path_cti): dir_desk = self.data['desk'] dir_desk_mech = os.path.join(dir_desk,'mech') path_cti = os.path.join(dir_desk_mech,'chem.cti') if not os.path.exists(dir_desk_mech): os.makedirs(dir_desk_mech) shutil.copy(self.data['chem'],os.path.join(dir_desk_mech,'chem0.inp')) shutil.copy(self.data['therm'],os.path.join(dir_desk_mech,'therm0.dat')) fun_cleanck(dir_desk_mech) self.w.btn_save.setEnabled(False) self.w.btn_save.setText('setting...') self.parent.app.processEvents() if ck2cti(dir_desk_mech): self.no_set = False self.soln = ct.Solution(path_cti) self.soln_in = ct.Solution(path_cti) n_sp = self.soln.n_species f = open(os.path.join(dir_desk_mech,'ns.txt'),'w') f.write(str(n_sp)) f.close() self.act_ns() self.w.btn_save.setEnabled(True) self.w.btn_save.setText('save') self.parent.app.processEvents() return True else: return False