{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Forming the Phase Envelope"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Overview"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The analysis in this section follows the methodologies proposed in the GERG 2004 monograph published in 2007\n",
      "\n",
      "System of Equations"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Our residual vector $\\mathbf{F}$ is equal to \n",
      "\n",
      "$$F_i = \\ln\\phi(T,p,\\mathbf{y})-\\ln \\phi(T,p,\\mathbf{x})+\\ln K_i=0,  i=1,2,3... N$$\n",
      "\n",
      "$$F_{N+1} = \\sum_{i=1}^{N}(y_i-x_i)=0$$\n",
      "    \n",
      "where\n",
      "\n",
      "$$x_i = \\frac{z_i}{1-\\beta+\\beta K_i}$$\n",
      "    \n",
      "and \n",
      "\n",
      "$$y_i = \\frac{K_iz_i}{1-\\beta+\\beta K_i}$$\n",
      "    \n",
      "DO NOT NORMALIZE $x$ and $y$ !!!!\n",
      "\n",
      "$$F_{N+2} = X_s - S = 0$$\n",
      "    \n",
      "and the system to be solved is equal to\n",
      "\n",
      "$$\\mathbf{J}\\mathbf{\\Delta X}= -\\mathbf{F}$$\n",
      "    "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Building the Jacobian matrix"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "This is the trickiest part of this method.  There are a lot of derivatives to implement, and we want to implement all of them analytically.\n",
      "\n",
      "$$\\frac{\\partial F_i}{\\partial \\ln T} = T\\left[ \\left(\\frac{\\partial \\ln \\phi_i}{\\partial T}\\right)''_{p,\\mathbf{n}} -\\left(\\frac{\\partial \\ln \\phi_i}{\\partial T}\\right)'_{p,\\mathbf{n}}\\right]$$\n",
      "    \n",
      "$$\\frac{\\partial F_i}{\\partial \\ln p} = p\\left[ \\left(\\frac{\\partial \\ln \\phi_i}{\\partial p}\\right)''_{T,\\mathbf{n}} -\\left(\\frac{\\partial \\ln \\phi_i}{\\partial p}\\right)'_{T,\\mathbf{n}}\\right]$$\n",
      "    \n",
      "$$ \\frac{\\partial F_i}{\\partial \\ln K_j} = \\frac{K_jz_j}{(1-\\beta+\\beta K_j)^2}[(1-\\beta)\\phi_{ij}''+\\beta\\phi_{ij}']+\\zeta $$\n",
      "\n",
      "$\\zeta$ is the Kronecker delta or $\\zeta = 0$ for $i\\neq j$ , and  $\\zeta = 0$ for $i=j$.  Also\n",
      "\n",
      "$$\\phi_{ij} = n\\left( \\frac{\\partial \\ln \\phi_i}{\\partial n_j}\\right)_{T,p}$$\n",
      "\n",
      "For the $F_{N+1}$ term,\n",
      "\n",
      "$$\\frac{\\partial F_{N+1}}{\\partial \\ln K_j}=\\frac{K_jz_j}{(1-\\beta+\\beta K_j)^2}$$\n",
      "\n",
      "and all other partials of $F_{N+1}$ in the Jacobian are zero.  For the specified term\n",
      "\n",
      "$$\\frac{\\partial F_{N+2}}{X_s}=1$$\n",
      "    \n",
      "and all other partials of $F_{N+2}$ in the Jacobian are zero.\n",
      "\n",
      "From GERG 2004 Monograph, Eqn 7.27:\n",
      "\n",
      "\n",
      "$$\\ln \\phi_i  = \\left( \\frac{\\partial n\\alpha^r}{\\partial n_i}\\right)_{T,V,n_j}-\\ln Z$$\n",
      "        \n",
      "and (Kunz, 2012, Table B4)\n",
      "\n",
      "$$\\left( \\frac{\\partial n\\alpha^r}{\\partial n_i}\\right)_{T,V,n_j} = \\alpha^r + n\\left( \\frac{\\partial \\alpha^r}{\\partial n_i}\\right)_{T,V,n_j}$$\n",
      "        \n",
      "so\n",
      "\n",
      "$$\\ln \\phi_i  = \\alpha^r + n\\left( \\frac{\\partial \\alpha^r}{\\partial n_i}\\right)_{T,V,n_j}-\\ln Z$$"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Density marching phase envelope construction(T,P)"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Another two alternatives have been proposed in A DENSITY MARCHING METHOD FOR CALCULATING PHASE ENVELOPES\n",
      "Gadhiraju Venkatarathnam, I&ECR, 2014\n",
      "\n",
      "In this paper, density marching methods are proposed rather than methods that march in temperature, pressure, or K-factor.\n",
      "\n",
      "The system of equations to be solved is similar to that of the GERG 2004 formulation, where the unknowns are $\\ln(T)$, $\\ln(p)$, and $\\ln(K_i)$\n",
      "\n",
      "(A1) - OK\n",
      "$$F_i = \\ln K_i+\\ln\\phi(T,p,\\mathbf{y})-\\ln \\phi(T,p,\\mathbf{x})=0,  i=1,2,3... N$$\n",
      "\n",
      "(A2) - OK\n",
      "$$F_{N+1} = \\sum_{i=1}^{N}\\frac{z_i(K_i-1)}{1-\\beta+\\beta K_i}=0$$\n",
      "    \n",
      "(A3) - TYPO, should be $\\ln(\\rho)$ rather than $\\rho$, and should be all on left-hand-side\n",
      "$$F_{N+2} = \\ln \\rho ''-\\ln\\rho''_{S} = 0$$\n",
      "\n",
      "(A6) - TYPO, missing an n to multiply the terms $\\left( \\frac{\\partial \\ln \\phi_i}{\\partial n_j}\\right)_{T,p}$\n",
      "$$ \\frac{\\partial F_i}{\\partial \\ln K_j} = \\frac{K_jz_j}{(1-\\beta+\\beta K_j)^2}[(1-\\beta)\\phi_{ij}''+\\beta\\phi_{ij}']+\\zeta $$\n",
      "\n",
      "$\\zeta$ is the Kronecker delta or $\\zeta = 0$ for $i\\neq j$ , and  $\\zeta = 0$ for $i=j$.\n",
      "\n",
      "(A7) - OK\n",
      "$$\\frac{\\partial F_i}{\\partial \\ln T} = T\\left[ \\left(\\frac{\\partial \\ln \\phi_i}{\\partial T}\\right)''_{p,\\mathbf{n}} -\\left(\\frac{\\partial \\ln \\phi_i}{\\partial T}\\right)'_{p,\\mathbf{n}}\\right]$$\n",
      "\n",
      "(A8) - OK\n",
      "$$\\frac{\\partial F_i}{\\partial \\ln p} = p\\left[ \\left(\\frac{\\partial \\ln \\phi_i}{\\partial p}\\right)''_{T,\\mathbf{n}} -\\left(\\frac{\\partial \\ln \\phi_i}{\\partial p}\\right)'_{T,\\mathbf{n}}\\right]$$\n",
      "    \n",
      "(A9) - OK\n",
      "$$\\frac{\\partial F_{N+1}}{\\partial \\ln K_j}=\\frac{K_jz_j}{(1-\\beta+\\beta K_j)^2}$$\n",
      "\n",
      "(A11) - OK\n",
      "$$ \\frac{\\partial F_{N+2}}{\\partial \\ln K_j} = \\frac{K_jz_j(1-\\beta)\\beta}{(1-\\beta+\\beta K_j)^2}\\left(n\\left(\\frac{\\partial \\rho}{\\partial n_j}\\right)''_{T,p}\\right)\\left(\\frac{1}{\\rho''_{S}}\\right)$$\n",
      "\n",
      "(A12) - OK\n",
      "$$\\frac{\\partial F_{N+2}}{\\partial \\ln T}=\\left(\\frac{\\partial \\rho}{\\partial T}\\right)''_{p,n}\\frac{T}{\\rho''_{S}}$$\n",
      "\n",
      "(A13) - OK\n",
      "$$\\frac{\\partial F_{N+2}}{\\partial \\ln p}=\\left(\\frac{\\partial \\rho}{\\partial p}\\right)''_{T,n}\\frac{p}{\\rho''_{S}}$$\n"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Density marching phase envelope construction (density)"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Another two alternatives have been proposed in A DENSITY MARCHING METHOD FOR CALCULATING PHASE ENVELOPES\n",
      "Gadhiraju Venkatarathnam, I&ECR, 2014\n",
      "\n",
      "In this paper, density marching methods are proposed rather than methods that march in temperature, pressure, or K-factor.\n",
      "\n",
      "The system of equations to be solved is similar to that of the GERG 2004 formulation, where the unknowns are $\\ln(T)$, $\\ln(p)$, and $\\ln(K_i)$\n",
      "\n",
      "(A14) - OK\n",
      "$$F_i = \\ln K_i+\\ln\\phi(T,\\rho'',\\mathbf{y})-\\ln \\phi(T,\\rho',\\mathbf{x})=0,  i=1,2,3... N$$\n",
      "\n",
      "(A15) - OK\n",
      "$$F_{N+1} = \\sum_{i=1}^{N}\\frac{z_i(K_i-1)}{1-\\beta+\\beta K_i}=0$$\n",
      "    \n",
      "(A16) - OK\n",
      "$$F_{N+2} = p(T,\\rho',\\mathbf{y})-p(T,\\rho'',\\mathbf{x}) = 0$$\n",
      "\n",
      "(A17) - TYPO, missing an n to multiply the terms $\\left( \\frac{\\partial \\ln \\phi_i}{\\partial n_j}\\right)_{T,p}$\n",
      "$$ \\frac{\\partial F_i}{\\partial \\ln K_j} = \\frac{K_jz_j}{(1-\\beta+\\beta K_j)^2}[(1-\\beta)\\phi_{ij}''+\\beta\\phi_{ij}']+\\zeta $$\n",
      "\n",
      "$\\zeta$ is the Kronecker delta or $\\zeta = 0$ for $i\\neq j$ , and  $\\zeta = 0$ for $i=j$.\n",
      "\n",
      "(A18) - OK\n",
      "$$\\frac{\\partial F_i}{\\partial \\ln T} = T\\left[ \\left(\\frac{\\partial \\ln \\phi_i}{\\partial T}\\right)''_{p,\\mathbf{n}} -\\left(\\frac{\\partial \\ln \\phi_i}{\\partial T}\\right)'_{p,\\mathbf{n}}\\right]$$\n",
      "\n",
      "(A19) - OK\n",
      "$$\\frac{\\partial F_i}{\\partial \\ln \\rho'} = -\\rho'\\left(\\frac{\\partial \\ln \\phi_i}{\\partial \\rho}\\right)'_{T,n}$$\n",
      "    \n",
      "(A20) - OK\n",
      "$$\\frac{\\partial F_{N+1}}{\\partial \\ln K_j}=\\frac{K_jz_j}{(1-\\beta+\\beta K_j)^2}$$\n",
      "\n",
      "(A22) - TYPO Second derivative of ln(phi) with respect to rho' needs constraints, first needs to have the constraints in the right place\n",
      "$$ \\frac{\\partial F_{N+2}}{\\partial \\ln K_j} = \\frac{RTK_jz_j}{(1-\\beta+\\beta K_j)^2}\\left[(1-\\beta)\\left(\\frac{\\partial \\ln \\phi_i}{\\partial \\rho}\\right)''_{T,n}+\\beta\\left(\\frac{\\partial \\ln \\phi_i}{\\partial \\rho}\\right)'_{T,n}\\right]$$\n",
      "\n",
      "(A23) - TYPO Should be A23\n",
      "$$\\frac{\\partial F_{N+2}}{\\partial \\ln T}=T\\left[\\left(\\frac{\\partial p}{\\partial T}\\right)'_{\\rho',n}-\\left(\\frac{\\partial p}{\\partial T}\\right)''_{\\rho'',n} \\right]$$\n",
      "\n",
      "(A24) - TYPO Should be A24\n",
      "$$\\frac{\\partial F_{N+2}}{\\partial \\ln p'}=\\rho'\\left(\\frac{\\partial p}{\\partial \\rho}\\right)'_{T,n}$$\n"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Other analytic derivatives"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Three analyic derivatives are not provided in GERG and need to be rederived:\n",
      "\n",
      "$$\\left(\\frac{\\partial \\ln \\phi_i}{\\partial \\rho}\\right)_{T,n}$$\n",
      "\n",
      "$$\\left(\\frac{\\partial \\ln \\phi_i}{\\partial T}\\right)_{\\rho,n}$$\n",
      "\n",
      "$$n\\left(\\frac{\\partial \\rho}{\\partial n_j}\\right)_{T,p}$$\n",
      "The last is for T,p marching, the first two are for density marching."
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Derivations"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "For $n\\left( \\frac{\\partial \\rho}{\\partial n_i}\\right)_{T,p,n_j}$\n",
      "-----------------------------------------------------------------\n",
      "\n",
      "GERG 2007 Monograph Equation 7.32 gives\n",
      "\n",
      "$$\\left( \\frac{\\partial V}{\\partial n_i}\\right)_{T,p,n_j} = \\dfrac{-\\left(\\dfrac{\\partial p}{\\partial n_i}\\right)_{T,V,n_j}}{\\left(\\dfrac{\\partial p}{\\partial V}\\right)_{T,n}}$$\n",
      "\n",
      "expand the left hand side with \n",
      "\n",
      "$V = vn = \\dfrac{n}{\\rho}$\n",
      "\n",
      "n held constant in derivative, so get\n",
      "\n",
      "$$\\left( \\frac{\\partial V}{\\partial n_i}\\right)_{T,p,n_j} = n\\left( \\frac{\\partial (1/\\rho)}{\\partial n_i}\\right)_{T,p,n_j} = -\\frac{n}{\\rho^2}\\left( \\frac{\\partial \\rho}{\\partial n_i}\\right)_{T,p,n_j}$$\n",
      "\n",
      "so\n",
      "\n",
      "$$ n\\left( \\frac{\\partial \\rho}{\\partial n_i}\\right)_{T,p,n_j} = -\\rho^2\\left( \\frac{\\partial V}{\\partial n_i}\\right)_{T,p,n_j} $$\n",
      "\n",
      "For $\\left(\\frac{\\partial \\ln \\phi_i}{\\partial \\rho}\\right)_{T,n}$ and $\\left(\\frac{\\partial \\ln \\phi_i}{\\partial T}\\right)_{\\rho,n}$\n",
      "--------------------------------------------------------------------------------------------------------------------------------------------\n",
      "\n",
      "GERG 2007 Monograph 7.27\n",
      "$$\\ln \\phi_i  = \\left(\\frac{\\partial n \\alpha^r}{\\partial n_i} \\right)_{T,V,n_j} - \\ln Z $$\n",
      "\n",
      "GERG 2007 Monograph 7.34\n",
      "$$\\ln \\left(\\frac{f_i}{n_i}\\right) = \\ln\\left(\\frac{RT}{V}\\right)+\\left(\\frac{\\partial n\\alpha^r}{\\partial n_i} \\right)_{T,V,n_j}$$\n",
      "\n",
      "and $Z = (pV)/(nRT)$, thus\n",
      "\n",
      "$$\\ln \\phi_i = \\ln \\left(\\frac{f_i}{n_i}\\right) - \\ln\\left(\\frac{RT}{V}\\right)  - \\ln \\left(\\frac{pV}{nRT}\\right) ?=  \\ln \\left(\\frac{f_i}{n_i}\\right) -\\ln\\left(\\frac{p}{n}\\right)$$\n",
      "\n",
      "$$\\frac{\\partial \\left[\\ln\\left(\\frac{p}{n}\\right)\\right]}{\\partial T} = \\frac{1}{pn}\\left(\\frac{\\partial p}{\\partial T}\\right)_{\\rho,n}$$\n"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Equivalent fugacities for the $i$-th component\n",
      "\n",
      "$$ F_k^A = \\ln f_i(T,p,\\mathbf{x})-\\ln f_i(T,p,\\mathbf{y}) = 0\\mbox{ for } k = i = 1...N $$\n",
      "\n",
      "Material balance\n",
      "\n",
      "$$ F_k^B = \\frac{z_i-x_i}{y_i-x_i}-\\frac{z_{N-1}-x_{N-1}}{y_{N-1}-x_{N-1}}\\mbox{  for  }i=1..N-2; k = i+N; k = N+1..2N-2$$\n",
      "\n",
      "The independent variables to be obtained are\n",
      "\n",
      "$$ \n"
     ]
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Conversion of derivatives"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "To convert partial with $T$, $V$, $x_k$ held constant to one with $\\tau$, $\\delta$, $x_k$ held constant, use Gernert 3.118, or\n",
      "\n",
      "$$ \\frac{\\partial}{\\partial x_j} [Y]_{T,V,x_k} = \\frac{\\partial}{\\partial x_j} [Y]_{\\tau,\\delta,x_k}+\\left(\\frac{\\partial\\delta}{\\partial x_j}\\right)_{T,V,x_k}\\left.\\frac{\\partial Y}{\\partial\\delta}\\right|_{\\tau,\\bar x}+\\left(\\frac{\\partial\\tau}{\\partial x_j}\\right)_{T,V,x_k}\\left.\\frac{\\partial Y}{\\partial\\tau}\\right|_{\\delta,\\bar x} $$\n",
      "\n",
      "To convert pressure,\n",
      "\n",
      "$$ p=\\rho R T(1+\\delta \\alpha_\\delta) $$\n",
      "\n",
      "convert $\\rho$ and $T$ to reduced variables\n",
      "\n",
      "$$ p=\\rho_r(\\bar x)\\delta R \\frac{T_r(\\bar x)}{\\tau}(1+\\delta \\alpha_\\delta) = \\rho_r(\\bar x)R \\frac{T_r(\\bar x)}{\\tau}\\delta (1+\\delta \\alpha_\\delta)$$\n",
      "\n",
      "All the derivatives\n",
      "\n",
      "$$ \\frac{dp}{d\\tau}\\times\\frac{d\\tau}{dx_j} = -\\rho_r(\\bar x)\\delta R \\frac{T_r(\\bar x)}{\\tau^2}(1+\\delta \\alpha_\\delta) \\times \\frac{1}{T}\\frac{\\partial T_r}{\\partial x_j}|_{T,V,x_k}$$\n",
      "\n",
      "$$ \\frac{dp}{d\\delta}\\times\\frac{d\\delta}{dx_j} = \\rho_r(\\bar x) R \\frac{T_r(\\bar x)}{\\tau}[ (1+\\delta \\alpha_\\delta)+ \\delta(\\alpha_\\delta+\\delta \\alpha_{\\delta\\delta})] \\times \\frac{-\\delta}{\\rho_r}\\frac{\\partial \\rho_r}{\\partial x_j}|_{T,V,x_k}$$\n",
      "\n",
      "$$ \\frac{\\partial p}{\\partial x_j}|_{\\tau,\\delta,x_k} = \\frac{\\delta R}{\\tau}\\left[\\rho_r(\\bar x)T_r(\\bar x)(\\delta \\frac{\\partial}{\\partial x_j}[\\alpha_\\delta]_{\\tau, \\delta, x_k})+(1+\\delta \\alpha_\\delta)\\left(\\rho_r \\frac{\\partial T_r}{\\partial x_j}+T_r \\frac{\\partial \\rho_r}{\\partial x_j}\\right)\\right]$$\n",
      "\n",
      "with $\\delta$ factored out"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Turn back into normal variables\n",
      "$$ \\frac{dp}{d\\tau}\\times\\frac{d\\tau}{dx_j} = -\\frac{\\rho R}{\\tau}(1+\\delta \\alpha_\\delta)\\frac{\\partial T_r}{\\partial x_j}|_{T,V,x_k}$$\n",
      "\n",
      "$$ \\frac{dp}{d\\delta}\\times\\frac{d\\delta}{dx_j} = - R T[ (1+\\delta \\alpha_\\delta)+ \\delta(\\alpha_\\delta+\\delta \\alpha_{\\delta\\delta})]\\delta\\frac{\\partial \\rho_r}{\\partial x_j}|_{T,V,x_k}$$\n",
      "\n",
      "$$ \\frac{\\partial p}{\\partial x_j}|_{\\tau,\\delta,x_k} = R\\left[\\rho T (\\delta \\frac{\\partial}{\\partial x_j}[\\alpha_\\delta]_{\\tau, \\delta, x_k})+(1+\\delta \\alpha_\\delta)\\left(\\frac{\\rho}{\\tau} \\frac{\\partial T_r}{\\partial x_j}+\\delta T \\frac{\\partial \\rho_r}{\\partial x_j}\\right)\\right]$$"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "First term cancels with a term in the third one, yielding\n",
      "\n",
      "$$ \\frac{dp}{d\\delta}\\times\\frac{d\\delta}{dx_j} = -\\delta R T[ (1+\\delta \\alpha_\\delta)+ \\delta(\\alpha_\\delta+\\delta \\alpha_{\\delta\\delta})]\\frac{\\partial \\rho_r}{\\partial x_j}|_{T,V,x_k}$$\n",
      "\n",
      "$$ \\frac{\\partial p}{\\partial x_j}|_{\\tau,\\delta,x_k} = \\rho R T (\\delta \\frac{\\partial}{\\partial x_j}[\\alpha_\\delta]_{\\tau, \\delta, x_k})+(1+\\delta \\alpha_\\delta)\\delta R T \\frac{\\partial \\rho_r}{\\partial x_j}$$"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "First term in first line cancels with term at end of second line, yielding\n",
      "\n",
      "$$ \\frac{dp}{d\\delta}\\times\\frac{d\\delta}{dx_j} = -\\delta R T[ \\delta(\\alpha_\\delta+\\delta \\alpha_{\\delta\\delta})]\\frac{\\partial \\rho_r}{\\partial x_j}|_{T,V,x_k}$$\n",
      "\n",
      "$$ \\frac{\\partial p}{\\partial x_j}|_{\\tau,\\delta,x_k} = \\rho R T (\\delta \\frac{\\partial}{\\partial x_j}[\\alpha_\\delta]_{\\tau, \\delta, x_k})$$"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Total equation is\n",
      "\n",
      "$$ \\frac{\\partial p}{\\partial x_j}|_{T,V,x_k} = \\rho R T \\left(\\delta \\frac{\\partial}{\\partial x_j}[\\alpha_\\delta]_{\\tau, \\delta, x_k}-\\frac{\\delta}{\\rho_r}(\\alpha_\\delta+\\delta \\alpha_{\\delta\\delta})\\frac{\\partial \\rho_r}{\\partial x_j}|_{T,V,x_k}\\right)$$"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "$$ p=\\rho R T(1+\\delta \\alpha_\\delta) $$\n",
      "\n",
      "$$ p=\\rho R T(1+\\frac{\\rho}{\\rho_r} \\alpha_\\delta) $$"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "$$ \\frac{\\partial p}{\\partial x_j}|_{T,V,x_k} = \\rho R T \\left(\\rho\\frac{-1}{\\rho_r^2}\\left(\\frac{\\partial \\rho_r}{\\partial x_j}\\right)_{x_{k\\neq j}}\\alpha_\\delta + \\frac{\\rho}{\\rho_r}\\left(\\frac{\\partial}{\\partial x_j}\\left(\\frac{\\partial \\alpha_r}{\\partial \\delta}_{\\tau,\\bar x}\\right)\\right)_{T,V,x_{k\\neq j}}\\right)$$\n",
      "\n",
      "$$ \\frac{\\partial p}{\\partial x_j}|_{T,V,x_k} = \\delta\\rho R T \\left(\\frac{-1}{\\rho_r}\\left(\\frac{\\partial \\rho_r}{\\partial x_j}\\right)_{x_{k\\neq j}}\\alpha_\\delta + \\left(\\frac{\\partial}{\\partial x_j}\\left(\\frac{\\partial \\alpha_r}{\\partial \\delta}_{\\tau,\\bar x}\\right)\\right)_{T,V,x_{k\\neq j}}\\right)$$"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "import matplotlib.pyplot as plt\n",
      "import CoolProp.CoolProp as CP\n",
      "%matplotlib inline"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "p = np.linspace(1000, 12000, 100)\n",
      "mix = 'REFPROP-MIX:Water[0.7]&Ethanol[0.3]'\n",
      "rhoL = CP.Props('D','P',p,'Q',0,mix)\n",
      "rhoV = CP.Props('D','P',p,'Q',1,mix)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 2
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "plt.plot(rhoL,p,rhoV,p)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 3,
       "text": [
        "[<matplotlib.lines.Line2D at 0x5d5e350>,\n",
        " <matplotlib.lines.Line2D at 0x5d5e530>]"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEACAYAAACpoOGTAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8VOW9x/FPIESWQGIUAwEkYRPwssumoEEUAStQby3Q\nqyhiq6CAtopQvZXaVytaq3UDaqkV7QXqVhaFiCABLZusBjBAAgkkSEACoSoaAnP/eE7MGANJJjPz\nnJn5vl+vec2ZZ87MfBNlfnmWcw6IiIiIiIiIiIiIiIiIiIiIiIiIiIiEnFeAAiDDq+2PwGfAduAd\nIM7ruWnAXiATGOTV3sN5j73Ac17tFwD/dNrXAy39G19ERAKlP9CN7xeI64FazvYM5wbQEdgG1AGS\ngSwgynluI9DL2V4KDHa2JwAzne2RwAK/phcRkYBK5vsFwtuPgX8429OAh72eSwP6AE0xPY5So4DZ\nXvv0drajgaM1jysiIv5Qq/JdzutOTI8AIAnI83ouD2hWQXu+045zf9DZLgGKgIQaZhIRET+oSYF4\nBCgG5vkpi4iIuEi0j6+7AxgKDPRqywdaeD1ujuk55Dvb5dtLX3MpcMjJEgcUlv+w1q1be7Kzs32M\nKiISsbKBNr6+2JcexGDgIWA48I1X+2LM/EIMkAK0xUxOHwZOYuYaooDbgEVer7nd2f4JsLKiD8zO\nzsbj8bj+9thjj1W6zw2v38CCjAWuz+mGm3LayZiX5+HCCz2cPOnunKHy+7R5A1r78B3/ncoKxHxg\nLXAZZq7gTuAFIBb4ANhK2SqkXcAbzv0yzAolj/PcBGAOZjlrFmZyGuBvwEVO+/3A1Jr8MG5XeKqQ\ntQfXcmO7G21HETmnZs3g2mvh9ddtJxHbKhtiGl1B2yvn2f8Pzq28zUCnCtq/BX5aSYaw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nK2B+zF/CCZh/s3fWkEOn3O6vUDkY8b+SrXg+xXQtgJMFw6gKeaLBH6Yu7nT\nFix1MMXhdcwQE7g3K5hJwPeAHrgv55XAMMzwzXzgWszv1W05wYyVg/kr/V+Y85y5KWeec/vEefwW\nplAcdlFGb0OAzZjfJ7jrdwlwBbAWOAaUAO9ghuXd+vv0O7cdRJfMDyepS8f0pvLDyaAYTLc6m+Ad\ntR4FvIYZFvHmtqwXU7a6oh6wBhjowpzerqFsDsJtOesDDZ3tBsC/MePnbsu5BmjnbE938rktY6kF\nmEnfUm7L2QWzUrGe83lzMT1Ht+UMKLccRDcfM85XjJkXGYuZJFpBxcvJfo3JnAncEMSc/TBDN9so\nW6Y32IVZO2HGobdhlmY+5LS7Lae3ayhbxeS2nCmY3+U2zJdG6b8Vt+XsgulBbMf8xRvnwoxgiuwX\nlBVdcGfOKZQtc52LGT1wY04REREREREREREREREREREREREREREREREREZHg+3+dbWZKGhzUjgAA\nAABJRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0x37ea9f0>"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "K_i=\\frac{y_i}{x_i}"
     ]
    }
   ],
   "metadata": {}
  }
 ]
}