محاسبات فلش با استفاده از معادله حالت Soave-Redlich-Kwong در Mathematica

پیرجو

مدیر ارشد
مدیر کل سایت
مدیر ارشد
محاسبات فلش با استفاده از معادله حالت Soave-Redlich-Kwong در Mathematica
کد:
(*CacheID: 232*)


(*NotebookFileLineBreakTest
NotebookFileLineBreakTest*)
(*NotebookOptionsPosition[     10777,        321]*)
(*NotebookOutlinePosition[     11421,        343]*)
(*  CellTagsIndexPosition[     11377,        339]*)
(*WindowFrame->Normal*)



Notebook[{

Cell[CellGroupData[{
Cell[TextData[{
  StyleBox["Flash Calculations using the Soave-Redlich-Kwong Equation of \
State", "Subsubtitle",
    FontSize->18,
    FontVariations->{"CompatibilityType"->0}],
  StyleBox["\n",
    FontWeight->"Plain",
    FontVariations->{"CompatibilityType"->0}],
  StyleBox["Authors' Data",
    FontSize->14,
    FontWeight->"Bold"],
  StyleBox[": Zakia Nasri",
    FontSize->14],
  StyleBox[" and",
    TextAlignment->Center,
    FontSize->13,
    Background->RGBColor[0.605478, 0.996109, 0.605478]],
  StyleBox[" Housam Binous",
    FontSize->14],
  StyleBox["\n",
    TextAlignment->Center,
    FontFamily->"MS Shell Dlg",
    FontSize->8.5,
    Background->RGBColor[0.605478, 0.996109, 0.605478]],
  StyleBox["Department of Chemical Engineering\nNational Institute of Applied \
Sciences and Technology\nTunis, TUNISIA\nEmail: binoushousam@yahoo.com ",
    FontSize->14,
    FontWeight->"Plain"]
}], "Title",
  TextAlignment->Center,
  Background->RGBColor[0.605478, 0.996109, 0.605478]],

Cell[TextData[{
  StyleBox["Acknowledgement :",
    FontWeight->"Bold"],
  "\nThis problem was presented in the Master's report of R. Privat under the \
direction of J-P Corriou."
}], "Subsubtitle",
  Background->RGBColor[0.773449, 0.996109, 0.996109]],

Cell[BoxData[
    \(Off[General::"\<spell1\>"]\)], "Input"],

Cell[CellGroupData[{

Cell["Reduced Pressure and Temperature", "Subsubtitle",
  Background->RGBColor[1, 1, 0.658824]],

Cell[BoxData[
    \(Tre[i_] := T/Tc[i]\)], "Input"],

Cell[BoxData[
    \(Pre[i_] := P/Pc[i]\)], "Input"]
}, Closed]],

Cell[CellGroupData[{

Cell[TextData[StyleBox["Equilibrium constants using the \[Phi]-\[Phi] methode \
and the Soave-Redlich-Kwong Equation of State", "Subsubtitle",
  FontSize->18,
  FontVariations->{"CompatibilityType"->0}]], "Subsubtitle",
  Background->RGBColor[1, 1, 0.658824]],

Cell[BoxData[
    \(Ap[i_] := 0.42747\ a[i]\ Pre[i]/Tre[i]^2\)], "Input"],

Cell[BoxData[
    \(Bp[i_] := 0.08664\ Pre[i]/Tre[i]\)], "Input"],

Cell[BoxData[
    \(\[Phi]\_v[i_] := 
      Exp[\((Z\_v - 1)\)\ Bp[i]/B\_v - Log[Z\_v - B\_v] - 
          A\_v/B\_v\ \((2\ Ap[i]^0.5/A\_v^0.5 - 
                Bp[i]/B\_v)\)\ Log[\((Z\_v + B\_v)\)/Z\_v]]\)], "Input"],

Cell[BoxData[
    \(\[Phi]\_l[i_] := 
      Exp[\((Z\_l - 1)\)\ Bp[i]/B\_l - Log[Z\_l - B\_l] - 
          A\_l/B\_l\ \((2\ Ap[i]^0.5/A\_l^0.5 - 
                Bp[i]/B\_l)\)\ Log[\((Z\_l + B\_l)\)/Z\_l]]\)], "Input"],

Cell[BoxData[
    \(a[i_] := \((1 + m[i]\ \((1 - Tre[i]^0.5)\))\)^2\)], "Input"],

Cell[BoxData[
    \(m[i_] := 0.480 + 1.574\ \[Omega][i] - 0.176\ \[Omega][i]^2\)], "Input"],


*)
 

پیرجو

مدیر ارشد
مدیر کل سایت
مدیر ارشد
ادامه

ادامه

کد:
Cell[BoxData[
    \(\(A\_v = \[Sum]\+\(i = 1\)\%4\(\[Sum]\+\(j = 1\)\%4 y[i]\ y[j]\ Ab[i, 
                j]\);\)\)], "Input"],

Cell[BoxData[
    \(\(Ab[i_, j_] = \((Ap[i]\ Ap[j])\)^0.5;\)\)], "Input"],

Cell[BoxData[
    \(\(B\_v = \[Sum]\+\(i = 1\)\%4 y[i]\ Bp[i];\)\)], "Input"],

Cell[BoxData[
    \(\(A\_l = \[Sum]\+\(i = 1\)\%4\(\[Sum]\+\(j = 1\)\%4 x[i]\ x[j]\ Ab[i, 
                j]\);\)\)], "Input"],

Cell[BoxData[
    \(\(B\_l = \[Sum]\+\(i = 1\)\%4 x[i]\ Bp[i];\)\)], "Input"],

Cell[BoxData[
    \(\(K[i_] := \[Phi]\_l[i]/\[Phi]\_v[i];\)\)], "Input"]
}, Closed]],

Cell[CellGroupData[{

Cell["\<\
Critical Pressure and Temperature and acentric factor for Ethane, Propane, \
n-Butane and n-Pentane\
\>", "Subsubtitle",
  Background->RGBColor[1, 1, 0.658824]],

Cell[BoxData[
    \(Pc[1] = 709.8; Tc[1] = 550.0; \[Omega][1] = 0.1064;\)], "Input"],

Cell[BoxData[
    \(Pc[2] = 617.4; Tc[2] = 665.9; \[Omega][2] = 0.1538;\)], "Input"],

Cell[BoxData[
    \(Pc[3] = 550.7; Tc[3] = 765.3; \[Omega][3] = 0.1954;\)], "Input"],

Cell[BoxData[
    \(Pc[4] = 489.5; Tc[4] = 845.6; \[Omega][4] = 0.2387;\)], "Input"]
}, Closed]],

Cell[CellGroupData[{

Cell["\<\
Flash Pressure and Temperature are 197.33 \[Degree]F and 20 atm. Feed is \
composed of 2.5% Ethane, 35% Propane, 60% n-Butane and 2.5% n-Pentane.\
\>", "Subsubtitle",
  Background->RGBColor[1, 1, 0.658824]],

Cell[BoxData[
    \(\(T = 197.33 + 459.67;\)\)], "Input"],

Cell[BoxData[
    \(\(P = 20\ 14.696;\)\)], "Input"],

Cell[BoxData[
    \(z[1] := 0.025; z[2] = 0.35; z[3] = 0.60; z[4] = 0.025;\)], "Input"]
}, Closed]],

Cell[CellGroupData[{

Cell["Rachford and Rice Equation and Flash Calculations.", "Subsubtitle",
  Background->RGBColor[1, 1, 0.658824]],

Cell[BoxData[
    \(Eq[i_] := y[i] \[Equal] \ K[i]\ x[i]\)], "Input"],

Cell[BoxData[
    \(V = \[Phi]\_vap\ F; L = \((1 - \[Phi]\_vap)\)\ F;\)], "Input"],

Cell[BoxData[
    \(\(EQ[i_] := 
        x[i] \[Equal] \ 
          z[i]/\((1 + \[Phi]\_vap\ \((K[i] - 1)\))\);\)\)], "Input"],

Cell[CellGroupData[{

Cell[BoxData[
    \(FindRoot[{Eq[1], Eq[2], Eq[3], \[Sum]\+\(i = 1\)\%4 y[i] \[Equal] 1, 
          EQ[1], EQ[2], 
          EQ[3], \[Sum]\+\(i = 1\)\%4 x[i] \[Equal] 
            1, \[Sum]\+\(i = 1\)\%4\( z[i]\ \((K[i] - 1)\)\)\/\(1 + \
\[Phi]\_vap\ \((K[i] - 1)\)\) \[Equal] 0, 
          Z\_l^3 - Z\_l^2 + Z\_l\ \((A\_l - B\_l - B\_l^2)\) - 
              A\_l\ B\_l \[Equal] 0, 
          Z\_v^3 - Z\_v^2 + Z\_v\ \((A\_v - B\_v - B\_v^2)\) - 
              A\_v\ B\_v \[Equal] 0}, {x[1], 0.01, 0.05}, {x[2], 0.3, 
          0.4}, {x[3], 0.6, 0.7}, {x[4], 0.05, 0.1}, {\[Phi]\_vap, 0.001, 
          0.9}, {y[1], 0.01, 0.05}, {y[2], 0.4, 0.5}, {y[3], 0.5, 
          0.6}, {y[4], 0.01, 0.05}, {Z\_l, 0.07, 0.09}, {Z\_v, 0.65, 0.85}, 
        MaxIterations \[Rule] 100000] // Chop\)], "Input"],

Cell[BoxData[
    \({x[1] \[Rule] 0.014846943480635307`, x[2] \[Rule] 0.2978126273101035`, 
      x[3] \[Rule] 0.6555198908083132`, 
      x[4] \[Rule] 0.03182053840094799`, \[Phi]\_vap \[Rule] 
        0.3623602788991743`, y[1] \[Rule] 0.04286617367926499`, 
      y[2] \[Rule] 0.44183330175453345`, y[3] \[Rule] 0.5023025141019329`, 
      y[4] \[Rule] 0.012998010464268588`, Z\_l \[Rule] 0.09130463908706844`, 
      Z\_v \[Rule] 0.7137064763654182`}\)], "Output"]
}, Open  ]],
 

پیرجو

مدیر ارشد
مدیر کل سایت
مدیر ارشد
ادامه

ادامه

کد:
Cell[CellGroupData[{

Cell[BoxData[
    \(FindRoot[{Eq[1], Eq[2], Eq[3], \[Sum]\+\(i = 1\)\%4 y[i] \[Equal] 1, 
          EQ[1], EQ[2], 
          EQ[3], \[Sum]\+\(i = 1\)\%4 x[i] \[Equal] 
            1, \[Sum]\+\(i = 1\)\%4\( z[i]\ \((K[i] - 1)\)\)\/\(1 + \
\[Phi]\_vap\ \((K[i] - 1)\)\) \[Equal] 0, 
          Z\_l^3 - Z\_l^2 + Z\_l\ \((A\_l - B\_l - B\_l^2)\) - 
              A\_l\ B\_l \[Equal] 0, 
          Z\_v^3 - Z\_v^2 + Z\_v\ \((A\_v - B\_v - B\_v^2)\) - 
              A\_v\ B\_v \[Equal] 0}, {x[1], 0.01}, {x[2], 0.3}, {x[3], 
          0.6}, {x[4], 0.05}, {\[Phi]\_vap, 0.5}, {y[1], 0.01}, {y[2], 
          0.4}, {y[3], 0.5}, {y[4], 0.01}, {Z\_l, 0.07}, {Z\_v, 0.65}, 
        MaxIterations \[Rule] 1000000] // Chop\)], "Input"],

Cell[BoxData[
    \({x[1] \[Rule] 0.014846943676298163`, x[2] \[Rule] 0.2978126275508644`, 
      x[3] \[Rule] 0.6555198921621438`, 
      x[4] \[Rule] 0.0318205366106936`, \[Phi]\_vap \[Rule] 
        0.3623602834313944`, y[1] \[Rule] 0.04286617422650309`, 
      y[2] \[Rule] 0.4418333020987036`, y[3] \[Rule] 0.5023025151461126`, 
      y[4] \[Rule] 0.012998008528680813`, Z\_l \[Rule] 0.09130463912381659`, 
      Z\_v \[Rule] 0.7137064770771142`}\)], "Output"]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{

Cell[TextData[{
  "True Vapor Pressure (TVP) Computation using the ",
  StyleBox["Soave-Redlich-Kwong Equation of State", "Subsubtitle",
    FontVariations->{"CompatibilityType"->0}],
  ". We find TVP=109.074 psia. "
}], "Subsubtitle",
  Background->RGBColor[1, 1, 0.658824]],

Cell[BoxData[
    \(P =. \)], "Input"],

Cell[BoxData[
    \(\(\[Phi]\_vap = 0;\)\)], "Input"],

Cell[BoxData[
    \(\(T = 100 + 459.67;\)\)], "Input"],

Cell[CellGroupData[{

Cell[BoxData[
    \(FindRoot[{Eq[1], Eq[2], Eq[3], \[Sum]\+\(i = 1\)\%4 y[i] \[Equal] 1, 
          EQ[1], EQ[2], 
          EQ[3], \[Sum]\+\(i = 1\)\%4 x[i] \[Equal] 
            1, \[Sum]\+\(i = 1\)\%4\( z[i]\ \((K[i] - 1)\)\)\/\(1 + \
\[Phi]\_vap\ \((K[i] - 1)\)\) \[Equal] 0, 
          Z\_l^3 - Z\_l^2 + Z\_l\ \((A\_l - B\_l - B\_l^2)\) - 
              A\_l\ B\_l \[Equal] 0, 
          Z\_v^3 - Z\_v^2 + Z\_v\ \((A\_v - B\_v - B\_v^2)\) - 
              A\_v\ B\_v \[Equal] 0}, {x[1], 0.01}, {x[2], 0.3}, {x[3], 
          0.6}, {x[4], 0.05}, {P, 100}, {y[1], 0.1}, {y[2], 0.5}, {y[3], 
          0.3}, {y[4], 0.01}, {Z\_l, 0.07}, {Z\_v, 0.85}, 
        MaxIterations \[Rule] 1000000] // Chop\)], "Input"],

Cell[BoxData[
    \({x[1] \[Rule] 0.025`, x[2] \[Rule] 0.35`, x[3] \[Rule] 0.6`, 
      x[4] \[Rule] 0.025000000000000043`, P \[Rule] 109.07410772249145`, 
      y[1] \[Rule] 0.11828678935620147`, y[2] \[Rule] 0.5546896884211652`, 
      y[3] \[Rule] 0.3222304627418087`, y[4] \[Rule] 0.004793059480824634`, 
      Z\_l \[Rule] 0.03150166713476441`, 
      Z\_v \[Rule] 0.8713987365131364`}\)], "Output"]
}, Open  ]]
}, Closed]],

Cell[TextData[StyleBox["Conclusion: Both flash and TVP calculations are in \
agreement with results of Privat and HYSYS 3.2.",
  FontSize->18]], "Subsubtitle",
  Background->RGBColor[1, 0.717647, 1]]
}, Open  ]]
},
FrontEndVersion->"5.2 for Microsoft Windows",
ScreenRectangle->{{0, 800}, {0, 517}},
WindowSize->{495, 359},
WindowMargins->{{63, Automatic}, {47, Automatic}}
]

(*******************************************************************
Cached data follows.  If you edit this Notebook file directly, not
using Mathematica, you must remove the line containing CacheID at
the top of  the file.  The cache data will then be recreated when
you save this file from within Mathematica.
 

پیرجو

مدیر ارشد
مدیر کل سایت
مدیر ارشد
ادامه

ادامه

کد:
*******************************************************************)

(*CellTagsOutline
CellTagsIndex->{}
*)

(*CellTagsIndex
CellTagsIndex->{}
*)

(*NotebookFileOutline
Notebook[{

Cell[CellGroupData[{
Cell[1776, 53, 995, 30, 262, "Title"],
Cell[2774, 85, 252, 6, 87, "Subsubtitle"],
Cell[3029, 93, 59, 1, 30, "Input"],

Cell[CellGroupData[{
Cell[3113, 98, 95, 1, 46, "Subsubtitle"],
Cell[3211, 101, 51, 1, 30, "Input"],
Cell[3265, 104, 51, 1, 30, "Input"]
}, Closed]],

Cell[CellGroupData[{
Cell[3353, 110, 259, 4, 74, "Subsubtitle"],
Cell[3615, 116, 73, 1, 30, "Input"],
Cell[3691, 119, 65, 1, 30, "Input"],
Cell[3759, 122, 218, 4, 90, "Input"],
Cell[3980, 128, 218, 4, 90, "Input"],
Cell[4201, 134, 80, 1, 30, "Input"],
Cell[4284, 137, 91, 1, 30, "Input"],
Cell[4378, 140, 127, 2, 53, "Input"],
Cell[4508, 144, 73, 1, 30, "Input"],
Cell[4584, 147, 77, 1, 51, "Input"],
Cell[4664, 150, 127, 2, 53, "Input"],
Cell[4794, 154, 77, 1, 51, "Input"],
Cell[4874, 157, 72, 1, 30, "Input"]
}, Closed]],

Cell[CellGroupData[{
Cell[4983, 163, 170, 4, 68, "Subsubtitle"],
Cell[5156, 169, 84, 1, 30, "Input"],
Cell[5243, 172, 84, 1, 30, "Input"],
Cell[5330, 175, 84, 1, 30, "Input"],
Cell[5417, 178, 84, 1, 30, "Input"]
}, Closed]],

Cell[CellGroupData[{
Cell[5538, 184, 216, 4, 88, "Subsubtitle"],
Cell[5757, 190, 57, 1, 30, "Input"],
Cell[5817, 193, 52, 1, 30, "Input"],
Cell[5872, 196, 87, 1, 50, "Input"]
}, Closed]],

Cell[CellGroupData[{
Cell[5996, 202, 113, 1, 48, "Subsubtitle"],
Cell[6112, 205, 69, 1, 30, "Input"],
Cell[6184, 208, 82, 1, 30, "Input"],
Cell[6269, 211, 126, 3, 30, "Input"],

Cell[CellGroupData[{
Cell[6420, 218, 795, 13, 294, "Input"],
Cell[7218, 233, 467, 7, 87, "Output"]
}, Open  ]],

Cell[CellGroupData[{
Cell[7722, 245, 723, 12, 234, "Input"],
Cell[8448, 259, 465, 7, 87, "Output"]
}, Open  ]]
}, Closed]],

Cell[CellGroupData[{
Cell[8962, 272, 275, 6, 88, "Subsubtitle"],
Cell[9240, 280, 38, 1, 30, "Input"],
Cell[9281, 283, 53, 1, 30, "Input"],
Cell[9337, 286, 54, 1, 30, "Input"],

Cell[CellGroupData[{
Cell[9416, 291, 712, 12, 234, "Input"],
Cell[10131, 305, 404, 6, 86, "Output"]
}, Open  ]]
}, Closed]],
Cell[10562, 315, 199, 3, 74, "Subsubtitle"]
}, Open  ]]
}
]
 
بالا