diff --git a/interfaces/cython/cantera/mixmaster/CompositionFrame.py b/interfaces/cython/cantera/mixmaster/CompositionFrame.py index b3fbdc3b0..b2db479f7 100644 --- a/interfaces/cython/cantera/mixmaster/CompositionFrame.py +++ b/interfaces/cython/cantera/mixmaster/CompositionFrame.py @@ -5,7 +5,8 @@ if sys.version_info.major == 3: else: from Tkinter import * -from Cantera import * +from cantera import * +import numpy as np from .SpeciesInfo import SpeciesInfo #from KineticsFrame import KineticsFrame @@ -94,12 +95,12 @@ class CompFrame(Frame): elif c == 2: mf.var.set("Concentration") - mf.comp = mix.concentrations() + mf.comp = g.concentrations #mf.data = spdict(mix,mix,mf.comp) for s in mf.variable.keys(): try: - k = g.speciesIndex(s) + k = g.species_index(s) if mf.comp[k] > _CUTOFF: mf.variable[s].set(mf.comp[k]) else: @@ -129,7 +130,7 @@ class MixtureFrame(Frame): #self.scroll.grid(column=0,row=1) self.var = StringVar() self.var.set("Moles") - self.comp = array(self.top.mix.moles()) + self.comp = np.array(self.top.mix.moles()) self.names = self.top.mix.speciesNames() self.nsp = len(self.names) #self.data = self.top.mix.moleDict() @@ -149,7 +150,7 @@ class MixtureFrame(Frame): def update(self): self.newcomp = 0 for s in self.variable.keys(): - k = self.g.speciesIndex(s) + k = self.g.species_index(s) current = self.comp[k] val = self.variable[s].get() dv = abs(val - current) diff --git a/interfaces/cython/cantera/mixmaster/DataFrame.py b/interfaces/cython/cantera/mixmaster/DataFrame.py index 1dbfd8c19..a51cf3bcd 100644 --- a/interfaces/cython/cantera/mixmaster/DataFrame.py +++ b/interfaces/cython/cantera/mixmaster/DataFrame.py @@ -7,9 +7,8 @@ else: from Tkinter import * from tkFileDialog import askopenfilename -from Cantera import * -from Cantera.num import * -from Cantera import num +from cantera import * +import numpy as num from .GraphFrame import Graph from .DataGraph import DataGraph, plotLimits from .ControlPanel import make_menu diff --git a/interfaces/cython/cantera/mixmaster/DataGraph.py b/interfaces/cython/cantera/mixmaster/DataGraph.py index ba098cd09..0e314c9bc 100644 --- a/interfaces/cython/cantera/mixmaster/DataGraph.py +++ b/interfaces/cython/cantera/mixmaster/DataGraph.py @@ -6,7 +6,7 @@ else: from Tkinter import * import math -from Cantera.num import * +from numpy import * def plotLimits(ypts, f=0.0, ndiv=5, logscale=0): """Return plot limits that""" diff --git a/interfaces/cython/cantera/mixmaster/Edit.py b/interfaces/cython/cantera/mixmaster/Edit.py index 205856fa6..c56bc3af2 100644 --- a/interfaces/cython/cantera/mixmaster/Edit.py +++ b/interfaces/cython/cantera/mixmaster/Edit.py @@ -8,7 +8,7 @@ else: from .ElementFrame import getElements from .utilities import handleError -from Cantera import * +from cantera import * from .config import * from .SpeciesFrame import getSpecies diff --git a/interfaces/cython/cantera/mixmaster/ElementFrame.py b/interfaces/cython/cantera/mixmaster/ElementFrame.py index 9678c1598..1025f3e71 100644 --- a/interfaces/cython/cantera/mixmaster/ElementFrame.py +++ b/interfaces/cython/cantera/mixmaster/ElementFrame.py @@ -12,7 +12,7 @@ else: from types import * import string -from Cantera import * +from cantera import * # (row,column) positions in the periodic table _pos = {'H':(1,1), 'He':(1,18), diff --git a/interfaces/cython/cantera/mixmaster/ImportFrame.py b/interfaces/cython/cantera/mixmaster/ImportFrame.py index 904508705..3a8d1fdeb 100644 --- a/interfaces/cython/cantera/mixmaster/ImportFrame.py +++ b/interfaces/cython/cantera/mixmaster/ImportFrame.py @@ -7,7 +7,7 @@ else: from Tkinter import * from tkFileDialog import askopenfilename -from Cantera import * +from cantera import * #from Cantera.ck2ctml import ck2ctml class ImportFrame(Frame): diff --git a/interfaces/cython/cantera/mixmaster/KineticsFrame.py b/interfaces/cython/cantera/mixmaster/KineticsFrame.py index 40a777426..aadbc7a24 100644 --- a/interfaces/cython/cantera/mixmaster/KineticsFrame.py +++ b/interfaces/cython/cantera/mixmaster/KineticsFrame.py @@ -7,10 +7,9 @@ if sys.version_info.major == 3: else: from Tkinter import * -from Cantera import * +from cantera import * from .SpeciesInfo import SpeciesInfo -from Cantera import rxnpath import webbrowser _CUTOFF = 1.e-15 @@ -65,21 +64,21 @@ class KineticsFrame(Frame): if c == 0: mf.var.set("Creation Rates") #mf.data = spdict(mix.g, mix.moles()) - mf.comp = g.creationRates() + mf.comp = g.creation_rates elif c == 1: mf.var.set("Destruction Rates") #mf.data = spdict(mix.g,mix.mass()) - mf.comp = g.destructionRates() + mf.comp = g.destruction_rates elif c == 2: mf.var.set("Net Production Rates") - mf.comp = g.netProductionRates() + mf.comp = g.net_production_rates #mf.data = spdict(mix,mix,mf.comp) for s in mf.variable.keys(): try: - k = g.speciesIndex(s) + k = g.species_index(s) if mf.comp[k] > _CUTOFF or -mf.comp[k] > _CUTOFF: mf.variable[s].set(mf.comp[k]) else: @@ -191,7 +190,7 @@ class ReactionKineticsFrame(Frame): self.config(relief=GROOVE, bd=4) self.top = top self.g = self.top.mix.g - nr = self.g.nReactions() + nr = self.g.n_reactions self.eqs=Text(self,width=40,height=30) self.data = [] self.start = DoubleVar() @@ -204,7 +203,7 @@ class ReactionKineticsFrame(Frame): self.data.append(Text(self,width=15,height=30)) for n in range(nr): - s = self.g.reactionEqn(n) + s = self.g.reaction_equation(n) self.eqs.insert(END,s+'\n') self.eqs.grid(column=0,row=1,sticky=W+E+N) for i in range(4): @@ -254,10 +253,10 @@ class ReactionKineticsFrame(Frame): # return self.master.deiconify() - nr = self.g.nReactions() - frop = self.g.fwdRatesOfProgress() - rrop = self.g.revRatesOfProgress() - kp = self.g.equilibriumConstants() + nr = self.g.n_reactions + frop = self.g.forward_rates_of_progress + rrop = self.g.reverse_rates_of_progress + kp = self.g.equilibrium_constants self.data[0].delete(1.0,END) self.data[1].delete(1.0,END) self.data[2].delete(1.0,END) @@ -276,7 +275,7 @@ class ReactionKineticsFrame(Frame): self.data[2].insert(END,s) s = '%12.5e \n' % (kp[n],) self.data[3].insert(END,s) - self.eqs.insert(END, self.g.reactionEqn(n)+'\n') + self.eqs.insert(END, self.g.reaction_equation(n)+'\n') class ReactionPathFrame(Frame): @@ -302,7 +301,7 @@ class ReactionPathFrame(Frame): self.sc.bind('',self.show) scframe.grid(row=3,column=0,columnspan=10) - enames = self.g.elementNames() + enames = self.g.element_names self.nel = len(enames) i = 1 @@ -329,7 +328,7 @@ class ReactionPathFrame(Frame): sp.grid(column=2,row=1) sp.bind('',self.show) - self.b = rxnpath.PathBuilder(self.g) + self.fmt = StringVar() self.fmt.set('svg') @@ -371,27 +370,25 @@ class ReactionPathFrame(Frame): def show(self,e=None): self.master.deiconify() - el = self.g.elementName(self.el.get()) - det = 'false' - if self.detailed.get() == 1: det = 'true' - flow = 'one_way' - if self.net.get() == 1: flow = 'net' - self.d = rxnpath.PathDiagram(arrow_width=-2, - flow_type=flow, - detailed = det, - threshold=math.pow(10.0, - self.thresh.get())) + el = self.g.element_name(self.el.get()) + det = False + if self.detailed.get() == 1: det = True + flow = 'OneWayFlow' + if self.net.get() == 1: flow = 'NetFlow' + + self.d = ReactionPathDiagram(self.g, el) + self.d.arrow_width = -2 + self.d.flow_type = flow + self.d.show_details = det + self.d.threshold = math.pow(10.0, self.thresh.get()) node = self.local.get() try: - k = self.g.speciesIndex(node) - self.d.displayOnly(k) + k = self.g.species_index(node) + self.d.display_only(k) except: - self.d.displayOnly() + self.d.display_only(-1) - self.b.build(element = el, diagram = self.d, - dotfile = 'rxnpath.dot', format = 'dot') - #self.b.build(element = el, diagram = self.d, - # dotfile = 'rxnpath.txt', format = 'plain') + self.d.write_dot('rxnpath.dot') if self.browser.get() == 1: fmt = self.fmt.get() diff --git a/interfaces/cython/cantera/mixmaster/MechManager.py b/interfaces/cython/cantera/mixmaster/MechManager.py index 9e0135100..cf16632a4 100644 --- a/interfaces/cython/cantera/mixmaster/MechManager.py +++ b/interfaces/cython/cantera/mixmaster/MechManager.py @@ -1,4 +1,4 @@ -from Cantera import * +from cantera import * import sys if sys.version_info.major == 3: diff --git a/interfaces/cython/cantera/mixmaster/Mix.py b/interfaces/cython/cantera/mixmaster/Mix.py index 0d6ee9aaa..192035455 100644 --- a/interfaces/cython/cantera/mixmaster/Mix.py +++ b/interfaces/cython/cantera/mixmaster/Mix.py @@ -1,5 +1,5 @@ -from Cantera import GasConstant, OneAtm -from Cantera.num import zeros, ones +from cantera import gas_constant +from numpy import zeros, ones from .utilities import handleError def spdict(phase, x): @@ -12,21 +12,21 @@ def spdict(phase, x): class Species: def __init__(self,g,name): self.g = g - t = g.temperature() - p = g.pressure() - x = g.moleFractions() + t = g.T + p = g.P + x = g.X self.name = name self.symbol = name - self.index = g.speciesIndex(name) - self.minTemp = g.minTemp(self.index) - self.maxTemp = g.maxTemp(self.index) - self.molecularWeight = g.molecularWeights()[self.index] + self.index = g.species_index(name) + #self.minTemp = g.minTemp(self.index) + #self.maxTemp = g.maxTemp(self.index) + self.molecularWeight = g.molecular_weights[self.index] self.c = [] - self.e = g.elementNames() - self.hf0 = self.enthalpy_RT(298.15)*GasConstant*298.15 - g.setState_TPX(t,p,x) + self.e = g.element_names + self.hf0 = self.enthalpy_RT(298.15)*gas_constant*298.15 + g.TPX = t,p,x for n in range(len(self.e)): - na = g.nAtoms(self.index, n) + na = g.n_atoms(self.index, n) if na > 0: self.c.append((self.e[n],na)) @@ -34,8 +34,8 @@ class Species: return self.c def enthalpy_RT(self,t): - self.g.setTemperature(t) - return self.g.enthalpies_RT()[self.index] + self.g.TP = t, None + return self.g.partial_molar_enthalpies[self.index] / (gas_constant*t) def cp_R(self,t): self.g.setTemperature(t) @@ -49,13 +49,13 @@ class Mix: def __init__(self,g): self.g = g self._mech = g - self.nsp = g.nSpecies() + self.nsp = g.n_species self._moles = zeros(self.nsp,'d') - self.wt = g.molecularWeights() + self.wt = g.molecular_weights def setMoles(self, m): self._moles = m - self.g.setMoleFractions(self._moles) + self.g.X = self._moles def moles(self): return self._moles @@ -74,7 +74,7 @@ class Mix: def moleDict(self): d = {} - nm = self.g.speciesNames() + nm = self.g.species_names for e in range(self.nsp): d[nm[e]] = self._moles[e] return d @@ -86,11 +86,11 @@ class Mix: return self.wt*self._moles def speciesNames(self): - return self.g.speciesNames() + return self.g.species_names def massDict(self): d = {} - nm = self.g.speciesNames() + nm = self.g.species_names for e in range(self.nsp): d[nm[e]] = self._moles[e]*self.wt[e] return d @@ -101,32 +101,32 @@ class Mix: total_mass = self.totalMass() if temperature and pressure: - self.g.setState_TP(temperature, pressure) + self.g.TP = temperature, pressure if equil: self.g.equilibrate('TP',solver=0) elif temperature and density: - self.g.setState_TR(temperature, density) + self.g.TD = temperature, density if equil: self.g.equilibrate('TV',solver=0) elif pressure and enthalpy: - self.g.setState_HP(enthalpy, pressure) + self.g.HP = enthalpy, pressure if equil: self.g.equilibrate('HP',solver=0) elif pressure and entropy: - self.g.setState_SP(entropy, pressure) + self.g.SP = entropy, pressure if equil: self.g.equilibrate('SP',solver=0) elif density and entropy: - self.g.setState_SV(entropy, 1.0/density) + self.g.SV = entropy, 1.0/density if equil: self.g.equilibrate('SV',solver=0) elif density and intEnergy: - self.g.setState_UV(intEnergy, 1.0/density) + self.g.UV = intEnergy, 1.0/density if equil: self.g.equilibrate('UV',solver=0) @@ -134,5 +134,5 @@ class Mix: # handleError('unsupported property pair', warning=1) - total_moles = total_mass/self.g.meanMolecularWeight() - self._moles = self.g.moleFractions()*total_moles + total_moles = total_mass/self.g.mean_molecular_weight + self._moles = self.g.X*total_moles diff --git a/interfaces/cython/cantera/mixmaster/NewFlowFrame.py b/interfaces/cython/cantera/mixmaster/NewFlowFrame.py index 7c14c06b2..33099bd2c 100644 --- a/interfaces/cython/cantera/mixmaster/NewFlowFrame.py +++ b/interfaces/cython/cantera/mixmaster/NewFlowFrame.py @@ -1,4 +1,4 @@ -from Cantera import * +from cantera import * import sys if sys.version_info.major == 3: diff --git a/interfaces/cython/cantera/mixmaster/SpeciesFrame.py b/interfaces/cython/cantera/mixmaster/SpeciesFrame.py index b514617c2..dcae00e0b 100644 --- a/interfaces/cython/cantera/mixmaster/SpeciesFrame.py +++ b/interfaces/cython/cantera/mixmaster/SpeciesFrame.py @@ -10,7 +10,7 @@ else: from Tkinter import * from types import * -from Cantera import * +from cantera import * class SpeciesFrame(Frame): diff --git a/interfaces/cython/cantera/mixmaster/SpeciesInfo.py b/interfaces/cython/cantera/mixmaster/SpeciesInfo.py index 92668036f..1f0b850f6 100644 --- a/interfaces/cython/cantera/mixmaster/SpeciesInfo.py +++ b/interfaces/cython/cantera/mixmaster/SpeciesInfo.py @@ -5,7 +5,7 @@ else: from Tkinter import * import re, math -from Cantera import * +from cantera import * from .Units import temperature, specificEnergy, specificEntropy from .UnitChooser import UnitVar from .GraphFrame import Graph diff --git a/interfaces/cython/cantera/mixmaster/ThermoFrame.py b/interfaces/cython/cantera/mixmaster/ThermoFrame.py index f4170b747..6b5f9c96a 100644 --- a/interfaces/cython/cantera/mixmaster/ThermoFrame.py +++ b/interfaces/cython/cantera/mixmaster/ThermoFrame.py @@ -1,6 +1,6 @@ -from Cantera import * +from cantera import * import sys if sys.version_info.major == 3: @@ -93,12 +93,12 @@ class ThermoFrame(Frame): self.prop[1].check() def showState(self): - self.prop[_TEMPERATURE].set(self.mix.g.temperature()) - self.prop[_PRESSURE].set(self.mix.g.pressure()) - self.prop[_DENSITY].set(self.mix.g.density()) - self.prop[_INTENERGY].set(self.mix.g.intEnergy_mass()) - self.prop[_ENTHALPY].set(self.mix.g.enthalpy_mass()) - self.prop[_ENTROPY].set(self.mix.g.entropy_mass()) + self.prop[_TEMPERATURE].set(self.mix.g.T) + self.prop[_PRESSURE].set(self.mix.g.P) + self.prop[_DENSITY].set(self.mix.g.density) + self.prop[_INTENERGY].set(self.mix.g.int_energy_mass) + self.prop[_ENTHALPY].set(self.mix.g.enthalpy_mass) + self.prop[_ENTROPY].set(self.mix.g.entropy_mass) def setState(self,event=None): if event: diff --git a/interfaces/cython/cantera/mixmaster/Units/area.py b/interfaces/cython/cantera/mixmaster/Units/area.py index a03759935..27449720e 100644 --- a/interfaces/cython/cantera/mixmaster/Units/area.py +++ b/interfaces/cython/cantera/mixmaster/Units/area.py @@ -1,4 +1,4 @@ -from length import meter, centimeter, inch, foot, mile +from .length import meter, centimeter, inch, foot, mile # # Definitions of common area units diff --git a/interfaces/cython/cantera/mixmaster/config.py b/interfaces/cython/cantera/mixmaster/config.py index c004001d5..a707b85cb 100644 --- a/interfaces/cython/cantera/mixmaster/config.py +++ b/interfaces/cython/cantera/mixmaster/config.py @@ -1,5 +1,5 @@ -from Cantera import * +from .cantera import * # thermo parametrizations #from Cantera.Species.Thermo.NasaPolynomial import NasaPolynomial diff --git a/interfaces/cython/cantera/mixmaster/main.py b/interfaces/cython/cantera/mixmaster/main.py index f1f3e61ee..7aa4f5144 100644 --- a/interfaces/cython/cantera/mixmaster/main.py +++ b/interfaces/cython/cantera/mixmaster/main.py @@ -23,9 +23,8 @@ else: import sys, os, string # Cantera imports -from Cantera import * -from Cantera.num import zeros -from Cantera.gases import IdealGasMix +from cantera import * +from numpy import zeros from . import utilities # local imports @@ -66,7 +65,7 @@ class MixMaster: ff = os.path.splitext(self.fname) try: - self.mech = IdealGasMix(pathname) + self.mech = Solution(pathname) self.mechname = ff[0] except: @@ -121,17 +120,17 @@ class MixMaster: def makeMix(self): self.mix = Mix(self.mech) - nsp = self.mech.nSpecies() + nsp = self.mech.n_species self.species = [] - nm = self.mech.speciesNames() + nm = self.mech.species_names for k in range(nsp): self.species.append(Species(self.mech, nm[k])) - x = self.mech.moleFractions() + x = self.mech.X self.mix.setMoles(x) - self.mix.set(temperature = self.mech.temperature(), - pressure = self.mech.pressure()) + self.mix.set(temperature = self.mech.T, + pressure = self.mech.P) diff --git a/interfaces/cython/cantera/mixmaster/newflow.py b/interfaces/cython/cantera/mixmaster/newflow.py index 78defa2ad..754999f33 100644 --- a/interfaces/cython/cantera/mixmaster/newflow.py +++ b/interfaces/cython/cantera/mixmaster/newflow.py @@ -11,8 +11,7 @@ else: -from Cantera.gases import IdealGasMix -from Cantera import * +from cantera import * class NewFlowDialog: