def ok(self): p = self.p.get() try: infile = self.infile.get() spfile = self.spfile.get() trfile = self.trfile.get() if spfile and trfile: self.gas = IdealGasMix(import_file = infile, thermo_db = spfile, transport_db = trfile) elif spfile: self.gas = IdealGasMix(import_file = infile, thermo_db = spfile) else: self.gas = IdealGasMix(import_file = infile) except: tkMessageBox.showerror('Create Gas', 'Error reading file %s. See log file for more information.' % infile) #self.flow = Flow1D(flow_type = ftype, flow_geom = fgeom, # pressure = p, grid = gr, gas = g) self.top.destroy()
def loadmech(self, mechname, pathname, mw=1): p = os.path.normpath(os.path.dirname(pathname)) self.fname = os.path.basename(pathname) ff = os.path.splitext(self.fname) try: self.mech = IdealGasMix(pathname) self.mechname = ff[0] except: utilities.handleError('could not create gas mixture object: ' +ff[0]+'\n') self.mechname = 'Error' return self.makeMix() if not mechname: mechname = self.mechname self.mechframe.addMechanism(mechname, self.mech) if mw==1: self.makeWindows()
def readMechanism(infile, thermo=""): """Read in a mechanism file.""" g = IdealGasMix(infile, thermo) __data.g = g __data.nsp = g.nSpecies()