0% found this document useful (0 votes)
81 views12 pages

Phase Separator

phase separator simulation

Uploaded by

Naufal Hadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
81 views12 pages

Phase Separator

phase separator simulation

Uploaded by

Naufal Hadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 12
Programming Series be Material Balance Simulation of Binary Mixture in Two Phase Separator - © Just using python! ® Naufal Hadi Overview Two-phase separators (also known as flash separator, flashing vessel/tank, and knock-out drum ) are one of the most common types of process equipment used in the industry including oil refineries, chemical plants, refrigeration systems, natural gas and petrochemical processing plants. Two phase separators handles two-phase fluids. One is gaseous phase and the other is liquid phase. As its name suggests, it is used for separating gas and liquid in wet gas stream, or more generally the gas/liquid stream. Material balance on two phase separator can be achieved by applying thermodynamic. It’s including equation of state and vapor liquid equilibrium. This calculation are easily solved using process simulation software. But in this case I will perform the calculation only using python, a multi purpose programming language. So let’s take a look a problem. Horizontal two phase separator The Problem >>> ® Naufal Hadi The Problems Astream at 1000 kmol/h consisting mixture of benzene and toluene are separated using two phase separator. The stream contains 0.75 (mole fraction) of benzene (z:). The separator operating condition is 87 °C and atmospheric pressure (1.01 bar). Using thermodynamic properties of both component and Peng-Robinson as equation of state, define : a. molar fraction of both component in vapor phase (y: and ys) b. molar fraction of both component in liquid phase (x: and x2) c. vapor flows at top separator (V) d. liquid flows at bottom separator (L) F = 1000 kmol/h 2 = 0.75 benzene 22 = 0.25 toluene Solution >>> ® Naufal Hadi WARNING ! Freeze at this page and try to solve on your own Just kidding, © let’s slide to next page ) Naufal Hadi 3 Solution The solution are done by deriving material balance and combining with vapor liquid equilibrium. from material balance : Pa=LtV = tL=F-V for i component gives : Fy=Ly+Wy, because L= F-V: Fu,=Fx-Vx + W, solving for yi: _Fa+Vx,—Fx, Vv F E E JEG AHF Ne and 7-9 a From vapor liquid equilibrium : and: Exj=2y=1 => = Ex Ey=0 now divide equation (I) with x; respectively gives : rearranging : a1 Ka1-te2h oxo o=(1-K}+(Z-1)5 ) Naufal Hadi multiply both side with » gives : 0=(1-K,)9+(2—1) Xi rearranging and apply K,= z —K=1+9(K,-1) y solving for yi: 2K, YT @(K-1) by dividing both side with K, gives x:: z, x, = =! merce ie with =z recalling : x,-Zy,=0 yield : 2) The equation (2) also called as Rachford-Rice Equation and used to solve material balance with gives good convergence stability. Now we are going to solve this equation by python code using it’s library. The library are called phasepy, which is python package for calculation of physical properties of phases at thermodynamic equilibrium. For installation and documentation you can visit their website. The Code >>> ® Naufal Hadi The Code To easily understand how the code are working, I suggest using Jupyter Notebook, a scientific python editor. It has friendly interface which return every line of codes that we write. Now launch Jupyter Notebook. Import package [1]: [# import necessary library ‘import nunpy as np fron phasepy import component, mixture, preos fron phasepy.equilibriun inport flash Now set given data, operating condition, and thermodynamic properties of components [2]: (# given data F = 1000 # nolar flow. knol/h T = 87. + 273.15 # vessel temperature, converted to K P = 1.01 # vessel pressure, bar 2 = np.array([0.75, 9.25]) # overall molar fraction component [3]: # define component thermodynamical properties benzene = component(nane='benzene’, Tc=562.2, Pc=48.98, Zc=0.271, Ve=259.9, 210, 13.7819, 2726.81, 217.572], GC={"CH=C':6}) toluene = conponent(nane="toluene’, Tc=591.8, Pe= W=0.262, Ant=[13.9320, 3056.96, -217.625], GC={"CH=C'z6, 'CH3:1}) +06, Zc=0.264, Ve=316, Define equation of state and mixing rules for mixture [4]: # setting up eos mix = mixture(benzene, toluene) #mix given component mix.unifac() # using dortnund modified unifac mixing rule eos = preos(mix, ‘mhv_unifac') # peng robinson equation of state ) Naufal Hadi Now our initial setting are complete, let’s set random value for initial guess [5]: # initial guess x0 = np.array({0.4, 9.6]) # Liquid molar fraction to guess yO = np.array([@.2, 0.8]) # vapor molar fraction to guess And start calculation using flash command [6]: |# start calculation sep = flash(x®, y@, 'VL', Z, T, P, eos) # solver for flash calculation [7]: sep Sep stand for separation, which is new variable to store calculation result. The flash command will return array that contains molar vapor fraction (y, and y2), liquid vapor fraction (x, and X2) and overall liquid fraction (x). Now let’s check the results. [7]: (array([0.81063167, 0.18936833]), array([0.64528823, 0.35471177]), ©.3667014050359152) Jn order to facilitate further calculations, we must separate one by one to independent variable. To do that we just index the array [8]: y1 = (sep[o])[0] # benzene vapor fraction, indexing fron tuple y2 = (sep[6])[1] # toluene vapor fraction, indexing from tuple x1 = (sep[1])[0] # benzene liquid fraction, indexing from tuple x2 = (sep[1])[1] # benzene liquid fraction, indexing from tuple [9]: yt y2, xd, 32 [9]: (0.8106316699864328, 0, 18936833001356734, 9.6452882348270927, 9.35471176517290726) Now Yi, V2, Yo X2, are independent variable that contains molar fraction in liquid and vapor phase for both component. Next we have calculate the flow of vapor phase at top separator and liquid phase at bottom separator. This is done by simply applying linear algebra solve dt using matrix. ® Naufal Hadi from material balance of each component gives : Fz; = Lx + Wi Faz = Lx + Wp we can rearrange it in matrix form : x BI (ZI - (Fe x Yo} \V] ~ \Fa,| Matrix generation in jupyter notebook [10]: # compute vapor flow and liquid flow using matrix ‘import scipy.linalg # import new library A= np.array (Cyt, xt],{y2, x21]) B = np.array ([F*Z[0], F*z[1]]) [41]: print (a) print (8) [19]: [[e.81063167 0.64528823] [e.18936833 0.3547117]] (750. 250.] (benzene component) (oluene component) In order to solve this matrix, we have to import another package that handle linear algebra system [12]: # now solve the matrix € = scipy.linalg.solve(A,B) # solver for linear algebra And final results that contains vapor and liquid flow [43]: print (C) [13]: [633.29859496 366. 70140504) ) Naufal Hadi Complete Code peed eee) ese ee eee ory Pee iseet eth) Bee Rotary 1000 arr) en p-array((@.75, 0.251) Co eee nae Paice eC eee 7 a es =(13.7819, 2726.81, 217.572], oer Oy Peo ena eee eee ee Ce er Ant=[13.9320, 3056.96, -217.625], ee 6, 1}) ieee cece) mix.unifac() Coes ream Omer Tas) cone en oN) ere ieee) eat (sep[2]) (0) en aUpes) (sep[1]) (0) (sept) (1) Se MURS EDD ere m Grace arden} eeect men ere tC a) esas asus rests esas print print print Posty This code are available in my github page. You can download or pull the code for free. To run the code just simply type in terminal : python separator. py Then we get : Vapor Flow (V) : 122.04308131931882 kmol/h benzene fraction in vapor (y1) _: 0.8642111622668507 toluene fraction in vapor (y2) _: 0.13578883773314926 Liquid Flow (L) : 877.9569186806812 kmol/h benzene fraction in liquid (x1): 0.7341237287758344 toluene fraction in liquid (x2): 0.2658762712241656 ® Naufal Hadi 10 Thanks for your time ! Enjoy this post and feel free to like and comment. End ® Naufal Hadi

You might also like