コード例 #1
0
ファイル: PRLinDuan.py プロジェクト: gonmolina/pychemqt
    def _volumeCorrection(self):
        """Apply volume correction to the rhoL property"""

        c = 0
        for cmp, x in zip(self.componente, self.xi):
            if cmp.id in dat:
                b, g = dat[cmp.id]
            else:
                # Generalized correlation
                b = -2.8431 * exp(-64.2184 *
                                  (0.3074 - self.Zc)) + 0.1735  # Eq 12
                g = -99.2558 + 301.6201 * self.Zc  # Eq 13

            Tr = self.T / cmp.Tc
            f = b + (1 - b) * exp(g * abs(1 - Tr))  # Eq 10

            cc = (0.3074 - cmp.Zc) * R * cmp.Tc / cmp.Pc  # Eq 9
            c += cc * f  # Eq 8

        if self.rhoL:
            v = self.Vl.m3mol - c
            self.rhoL = unidades.MolarDensity(1 / v, "molm3")
            self.Vl = unidades.MolarVolume(v, "m3mol")
        if self.rhoG:
            v = self.Vg.m3mol - c
            self.rhoG = unidades.MolarDensity(1 / v, "molm3")
            self.Vg = unidades.MolarVolume(v, "m3mol")
コード例 #2
0
ファイル: cubic.py プロジェクト: spacejun/pychemqt
    def __init__(self, T, P, mezcla, **kwargs):
        EoS.__init__(self, T, P, mezcla, **kwargs)

        self._cubicDefinition()

        self.x, self.Zl, self.Zg, self.xi, self.yi, self.Ki = self._Flash()
        # print("q = ", self.x)
        # print("x = ", self.xi)
        # print("y = ", self.yi)
        # print("K = ", self.Ki)

        if self.Zl:
            self.Vl = unidades.MolarVolume(self.Zl * R * T / P,
                                           "m3mol")  # l/mol
            self.rhoL = unidades.MolarDensity(self.P / self.Zl / R / self.T,
                                              "molm3")
        else:
            self.Vl = None
            self.rhoL = None

        if self.Zg:
            self.Vg = unidades.MolarVolume(self.Zg * R * T / P,
                                           "m3mol")  # l/mol
            self.rhoG = unidades.MolarDensity(self.P / self.Zg / R / self.T,
                                              "molm3")
        else:
            self.Vg = None
            self.rhoG = None
コード例 #3
0
    def __init__(self, T, P, mezcla):
        P_atm = P/101325
        self.T = unidades.Temperature(T)
        self.P = unidades.Pressure(P)
        self.mezcla = mezcla
        self.componente = mezcla.componente
        self.zi = mezcla.fraccion

        self.B = self.b*P/R/T
        self.Tita = self.tita*P/(R*T)**2

        delta = self.delta*P/R/T
        epsilon = self.epsilon*(P/R/T)**2

        # δ1, δ2 calculated from polynomial factorization
        self.delta1 = ((self.delta**2-4*self.epsilon)**0.5-self.delta)/2/self.b
        self.delta2 = ((self.delta**2-4*self.epsilon)**0.5+self.delta)/2/self.b

        # Eq 4-6.3 in [1]_
        coeff = [1, delta-self.B-1, self.Tita+epsilon-delta*(self.B+1),
                 -epsilon*(self.B+1)-self.Tita*self.B]
        Z = roots(coeff)
        # print("Z", Z)
        # TODO: use the anallycal solution, Span, pag 50

        # Set the minimum and maximum root values as liquid and gas Z values
        self.Z = r_[Z[0].real, Z[2].real]
        self.Zl = min(Z).real
        self.Zg = max(Z).real

        self.V = self.Z*R_atml*T/P_atm  # l/mol
        self.rho = 1/self.V
        self.Vl = unidades.MolarVolume(self.Zl*R*T/P, "m3mol")   # l/mol
        self.Vg = unidades.MolarVolume(self.Zg*R*T/P, "m3mol")  # l/mol
コード例 #4
0
    def _volumeCorrection(self):
        """Apply volume correction to the rhoL property"""
        c = 0
        for cmp, x in zip(self.componente, self.xi):
            c += 0.40768 * R * cmp.Tc / cmp.Pc * (0.29441 - cmp.rackett
                                                  )  # Eq 8

        if self.rhoL:
            v = self.Vl.m3mol - c
            self.rhoL = unidades.MolarDensity(1 / v, "molm3")
            self.Vl = unidades.MolarVolume(v, "m3mol")
        if self.rhoG:
            v = self.Vg.m3mol - c
            self.rhoG = unidades.MolarDensity(1 / v, "molm3")
            self.Vg = unidades.MolarVolume(v, "m3mol")