cubic_parent.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:pythermophy 作者: j-jith 项目源码 文件源码
def get_Z(self, T, p):
        """
        Returns the compressibility factor of a real gas.

        :param T: temperature (K)
        :type T: float
        :param p: pressure (Pa)
        :type p: float

        :return: compressibility factor
        :rtype: float
        """
        # a = self.get_a(T)
        # coeffs = [
        #         1,
        #         (-self.R*T - self.b*p + self.c*p + self.d*p)/(self.R*T),
        #         (-self.R*T*self.d*p + a*p - self.b*self.d*p**2 + self.c*self.d*p**2 + self.e*p**2)/(self.R**2*T**2),
        #         (-self.R*T*self.e*p**2 - a*self.b*p**2 + a*self.c*p**2 - self.b*self.e*p**3 + self.c*self.e*p**3)/(self.R**3*T**3)
        # ]
        coeffs = [1, self.get_A(T, p), self.get_B(T, p), self.get_C(T, p)]
        #print(coeffs)

        roots = np.roots(coeffs)
        real_roots = roots[np.isreal(roots)].real

        if len(real_roots) == 1:
            real_roots = real_roots[0]

        return real_roots

    # Partial derivative of Z wrt T at constant p
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号