def eqfunc(self, x): """Calculate Phase Equilibrium""" # setting verbosity (True or False - default), if set to yes, in particular, when getters are called the returned values are displayed in a comprehensive way oc.setVerbosity(self.setverb) # tdb filepath tdbFile=self.pathname+self.db #print(tdbFile) # reading tdb oc.readtdb(tdbFile,self.comps) oc.setPhasesStatus((self.phasename[0],self.phasename[1]),phStat.Entered) #Equilibrium variable = oc.setElementMolarAmounts(self.x)+ [oc.setTemperature(self.T), oc.setPressure(self.P)] xs = [v.X(each) for each in self.comps if each != "VA"] xxs = [xs[i] for i in range(1, len(xs))] xxxs = xxs + [v.T, v.P] var = {xxxs[i]: variable[i] for i in range(len(variable))} eq_result = oc.calculateEquilibrium(self.db, self.comps, self.phasename, var) return eq_result
def readDatabase(self, pathname, db, comps): oc.readtdb(pathname + db, comps)
from pyOC import PhaseStatus as phStat from pyOC import GridMinimizerStatus as gmStat import math ###### # An example of Interfacil energy calculation ###### # oc setup ## setting verbosity (True or False - default), if set to yes, in particular, when getters are called the returned values are displayed in a comprehensive way oc.setVerbosity(False) ## tdb filepath tdbFile = os.environ.get('OCDATA') + '/feouzr.tdb' ## reading tdb elems = ('O', 'U', 'ZR') oc.readtdb(tdbFile, elems) ## suspend all phases except the liquid one oc.setPhasesStatus(('*', ), phStat.Suspended) oc.setPhasesStatus(('LIQUID', ), phStat.Entered) ## set pressure oc.setPressure(1E5) # mass density laws (from Barrachin2004) coriumMassDensityLaws = { 'U1': lambda T: 17270.0 - 1.358 * (T - 1408), 'ZR1': lambda T: 6844.51 - 0.609898 * T + 2.05008E-4 * T**2 - 4.47829E-8 * T**3 + 3.26469E-12 * T**4, 'O2U1': lambda T: 8860.0 - 9.285E-1 * (T - 3120),
def readDatabase(self): oc.readtdb(self.db, self.comps)
def initOC(cls, db, comps): cls.__db = db cls.__comps = comps # read database oc.readtdb(cls.__db, tuple([comp for comp in cls.__comps if comp != 'VA']))