PROBLEM 1: MOLECULAR THERMODYNAMICS OF PURE FLUIDS Recall from CBE40C: The behavior of most pure fluids can be described by cubic equations of state. When one such equation of state is used...

1 answer below »
Help me solve these two questions with Matlab code and a pdf file!


PROBLEM 1: MOLECULAR THERMODYNAMICS OF PURE FLUIDS Recall from CBE40C: The behavior of most pure fluids can be described by cubic equations of state. When one such equation of state is used to plot isotherms on a P-v diagram (v is the molar volume in this problem, denoted as V in other literature), for T < tc,="" a="" van="" der="" waals="" loop="" is="" observed="" (see="" figure="" 1,="" which="" is="" reproduced="" from="" figure="" 7.3-1="" in="" chemical,="" biochemical,="" and="" engineering="" thermodynamics="" by="" stanley="" sandler,="" 4th="" edition).="" these="" are="" regions="" of="" the="" phase="" diagram="" that="" a="" vapor="" phase="" and="" a="" liquid="" phase="" can="" coexist.="" however,="" as="" you="" also="" know="" from="" cbe40c,="" for="" each="" temperature="" t="">< tc="" there="" is="" only="" one="" unique="" pressure,="" psat,="" at="" which="" a="" gas-="" liquid="" coexistence="" is="" possible.="" at="" this="" temperature="" and="" pressure,="" the="" fugacities="" of="" the="" vapor="" and="" liquid="" are="" going="" to="" be="" equal="" to="" one="" another,="" and="" this="" is="" the="" criterion="" that="" is="" used="" for="" finding="" psat="" for="" a="" given="" t="" (or="" tsat="" for="" a="" given="" p).="" the="" purpose="" of="" this="" problem="" is="" to="" use="" this="" criterion="" to="" find="" out="" what="" the="" psat="" of="" nh3="" is="" for="" a="" number="" of="" different="" temperatures,="" using="" two="" different="" equations="" of="" state.="" recall="" that="" cubic="" equations="" of="" state="" can="" be="" generalized="" in="" terms="" of="" the="" compressibility="" factor,="" z,="" as:="" for="" the="" entire="" range="" of="" temperatures="" and="" pressures="" corresponding="" to="" the="" van="" der="" waals="" loop,="" the="" cubic="" equation="" of="" state="" predicts="" three="" distinct,="" real="" roots.="" as="" you="" know,="" the="" middle="" root="" corresponds="" to="" the="" middle="" part="" of="" the="" loop,="" which="" is="" a="" physically="" unrealistic="" region="" (it="" predicts="" that="" pressurizing="" a="" fluid="" increases="" its="" molar="" volume),="" so="" that="" root="" is="" discarded.="" of="" the="" two="" roots="" remaining,="" the="" small="" one="" is="" the="" liquid="" compressibility,="" zl,="" and="" the="" large="" one="" is="" the="" vapor="" compressibility,="" zv.="" those="" roots="" can="" then="" be="" used="" to="" calculate="" the="" fugacities="" corresponding="" to="" the="" predicted="" vapor="" and="" liquid="" phases,="" fv="" and="" fl,="" respectively.="" if="" those="" two="" fugacities="" are="" equal,="" the="" temperature="" and="" pressure="" that="" were="" used="" in="" the="" calculations="" correspond="" to="" the="" correct="" [t,="" psat]="" pair="" (in="" other="" words,="" for="" any="" given="" t,="" the="" p="" that="" gives="" equal="" fugacities="" for="" the="" vapor="" and="" the="" liquid="" phases="" is="" the="" correct="" psat).="" z="" 3="" +αz="" 2="" +="" βz="" +="" γ="0" figure="" 1.="" van="" der="" waals="" loops="" on="" a="" p-v="" diagram="" (only="" observed="" for="" the="" three="" isotherms="" that="" have="" t="">< tc) figure 2. cleaning up the van der waals loop after psat is found. once the correct psat is found, the van der waals loop can be cleaned up as shown in figure 2 (previous page), which is reproduced from figures 7.3-2 and 7.3-3 in chemical, biochemical, and engineering thermodynamics by stanley sandler, 4th edition. now, how do we go about using this information to find psat for a given t using a cubic equation of state? in principle, you can keep guessing different values of p, calculating fv and fl, and comparing them, until you find a p for which fv = fl. but this is not a very efficient method. instead, figure 7.5-1 in chemical, biochemical, and engineering thermodynamics by stanley sandler, 4th edition, which is reproduced in figure 3, gives a clever algorithm for finding psat. it basically says that after the calculation of fv and fl, if they are not equal to each other to within a certain tolerance that you desire, then multiply your current guess of p by fl/fv and repeat the calculations iteratively. in this problem, you want to create a function file that takes in a fugacity equation corresponding to an equation of state with its parameters for a given fluid, a value of t, and a value of p as an initial guess, and then goes through this clever algorithm to find the correct psat for the given t. you then want to use this function file to find psat for nh3 for a number of different temperatures, using two different cubic equations of state. the temperatures that we want to find psat for are t1 = 375 k, t2 = 382 k, t3 = 391 k, t4 = 400 k. we want to use the peng-robinson equation of state, and the van der waals equation of state. let us go through those two equations of state now: 1) van der waals: the parameters for ammonia are a = 0.4253 pa.m6/mol2, b = 3.737 ´ 10–5 m3/mol if represented in terms of the compressibility factor: the parameters are given as: , , p = rt v − b − a v2 z 3 +αz 2 + βz + γ = 0 α = −1− b β = a γ = −ab figure 3. a clever algorithm to find psat where z=pv/rt is the compressibility factor, and the parameters a and b are given by: the fugacity of the vapor and the liquid phase can be calculated by: here, zl and zv correspond to the liquid (low) and vapor (high) roots of the cubic equation of state, respectively. 2) peng-robinson the relevant parameters are related to the fluid’s critical properties: if represented in terms of the compressibility factor: the parameters are given as: , , where z=pv/rt is the compressibility factor, and the parameters a and b are given by: the fugacity of the vapor and the liquid phase can be calculated by: a = ap rt( )2 , b = bp rt ln f v p = zv −1( )− ln zv − b( )− azv ln f l p = z l −1( )− ln z l − b( )− az l p = rt v − b − a t ( ) v v + b( ) + b v − b( ) a t( ) = 0.45724 r 2tc 2 pc α t( ) b = 0.07780 rtc pc α t( ) = 1+κ 1− t tc ⎛ ⎝⎜ ⎞ ⎠⎟ ⎡ ⎣ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ 2 κ = 0.37464 +1.54226ω − 0.26992ω 2 z 3 +αz 2 + βz + γ = 0 α = −1+ b β = a− 3b 2 − 2b γ = −ab + b 2 + b3 a = ap rt( )2 , b = bp rt here, zl and zv correspond to the liquid (low) and vapor (high) roots of the cubic equation of state, respectively. the critical properties of ammonia can be found from thermodynamic tables: tc = 405.6 k, pc = 11.28 mpa, w = 0.250 a) develop a function file that takes in as input a function file for the fugacity calculation corresponding to any equation of state with any parameters needed in the fugacity equation, a value of t, and a p0 as an initial guess, and implements the clever algorithm shown in figure 3 to find the correct psat for the given t (with the tolerance as specified in figure 3). so the inputs to your function file should be a function handle referencing a function file for the fugacity equation with any parameters needed, and t and p0. the output from the function should be psat. call this function file psatfinder. note that psatfinder should be set up in a general way, so that it can work with both p-r and vdw equations of state (in fact, it will work with any cubic eos as long as the fugacity equation is also known for that eos). b) using the peng-robinson eos, produce a log-log p-v diagram (v on the logarithmic x- and p on the logarithmic y-axis) for nh3 for temperatures t1 = 375 k, t2 = 382 k, t3 = 391 k, t4 = 400 k, t5 = 405.6 k, t6 = 408 k (all on one graph). rescale your axes to 3 ´ 10–5 m3/mol £ v £ 1 ´ 10–3 m3/mol, and 1 ´ 106 pa £ p £ 1 ´ 108 pa. this plot should give you some guidance on how to guess your pressures in the next step. c) write a script file that sends the fugacity function file for the van der waals eos to psatfinder with the four different values of temperature t1, t2, t3, and t4 specified earlier, to find the corresponding psat for each value (for nh3). the entire script file should run with one command called psatvdw, printing a column of the four t values and their corresponding psat values at once. note: you should find psat for the temperatures given one by one, using a loop. d) write a script file that sends the fugacity function file for the peng-robinson eos to psatfinder with the four different values of temperature t1, t2, t3, and t4 specified earlier, to find the corresponding psat for each value (for nh3). the entire script file should run with one command called psatpr, printing a column of the four t values and their corresponding psat values at once. note: you should find psat for the temperatures given one by one, using a loop. e) bonus question (10% extra on problem): using the information you found in part d, create a cleaned-up version of the p-v diagram that you had plotted in part b. note: in matlab, the command “isreal(a)” is a logical statement (true/false, or 1/0), regarding whether a number tc)="" figure="" 2.="" cleaning="" up="" the="" van="" der="" waals="" loop="" after="" psat="" is="" found.="" once="" the="" correct="" psat="" is="" found,="" the="" van="" der="" waals="" loop="" can="" be="" cleaned="" up="" as="" shown="" in="" figure="" 2="" (previous="" page),="" which="" is="" reproduced="" from="" figures="" 7.3-2="" and="" 7.3-3="" in="" chemical,="" biochemical,="" and="" engineering="" thermodynamics="" by="" stanley="" sandler,="" 4th="" edition.="" now,="" how="" do="" we="" go="" about="" using="" this="" information="" to="" find="" psat="" for="" a="" given="" t="" using="" a="" cubic="" equation="" of="" state?="" in="" principle,="" you="" can="" keep="" guessing="" different="" values="" of="" p,="" calculating="" fv="" and="" fl,="" and="" comparing="" them,="" until="" you="" find="" a="" p="" for="" which="" fv="fL." but="" this="" is="" not="" a="" very="" efficient="" method.="" instead,="" figure="" 7.5-1="" in="" chemical,="" biochemical,="" and="" engineering="" thermodynamics="" by="" stanley="" sandler,="" 4th="" edition,="" which="" is="" reproduced="" in="" figure="" 3,="" gives="" a="" clever="" algorithm="" for="" finding="" psat.="" it="" basically="" says="" that="" after="" the="" calculation="" of="" fv="" and="" fl,="" if="" they="" are="" not="" equal="" to="" each="" other="" to="" within="" a="" certain="" tolerance="" that="" you="" desire,="" then="" multiply="" your="" current="" guess="" of="" p="" by="" fl/fv="" and="" repeat="" the="" calculations="" iteratively.="" in="" this="" problem,="" you="" want="" to="" create="" a="" function="" file="" that="" takes="" in="" a="" fugacity="" equation="" corresponding="" to="" an="" equation="" of="" state="" with="" its="" parameters="" for="" a="" given="" fluid,="" a="" value="" of="" t,="" and="" a="" value="" of="" p="" as="" an="" initial="" guess,="" and="" then="" goes="" through="" this="" clever="" algorithm="" to="" find="" the="" correct="" psat="" for="" the="" given="" t.="" you="" then="" want="" to="" use="" this="" function="" file="" to="" find="" psat="" for="" nh3="" for="" a="" number="" of="" different="" temperatures,="" using="" two="" different="" cubic="" equations="" of="" state.="" the="" temperatures="" that="" we="" want="" to="" find="" psat="" for="" are="" t1="375" k,="" t2="382" k,="" t3="391" k,="" t4="400" k.="" we="" want="" to="" use="" the="" peng-robinson="" equation="" of="" state,="" and="" the="" van="" der="" waals="" equation="" of="" state.="" let="" us="" go="" through="" those="" two="" equations="" of="" state="" now:="" 1)="" van="" der="" waals:="" the="" parameters="" for="" ammonia="" are="" a="0.4253" pa.m6/mol2,="" b="3.737" ´="" 10–5="" m3/mol="" if="" represented="" in="" terms="" of="" the="" compressibility="" factor:="" the="" parameters="" are="" given="" as:="" ,="" ,="" p="RT" v="" −="" b="" −="" a="" v2="" z="" 3="" +αz="" 2="" +="" βz="" +="" γ="0" α="−1−" b="" β="A" γ="−AB" figure="" 3.="" a="" clever="" algorithm="" to="" find="" psat="" where="" z="Pv/RT" is="" the="" compressibility="" factor,="" and="" the="" parameters="" a="" and="" b="" are="" given="" by:="" the="" fugacity="" of="" the="" vapor="" and="" the="" liquid="" phase="" can="" be="" calculated="" by:="" here,="" zl="" and="" zv="" correspond="" to="" the="" liquid="" (low)="" and="" vapor="" (high)="" roots="" of="" the="" cubic="" equation="" of="" state,="" respectively.="" 2)="" peng-robinson="" the="" relevant="" parameters="" are="" related="" to="" the="" fluid’s="" critical="" properties:="" if="" represented="" in="" terms="" of="" the="" compressibility="" factor:="" the="" parameters="" are="" given="" as:="" ,="" ,="" where="" z="Pv/RT" is="" the="" compressibility="" factor,="" and="" the="" parameters="" a="" and="" b="" are="" given="" by:="" the="" fugacity="" of="" the="" vapor="" and="" the="" liquid="" phase="" can="" be="" calculated="" by:="" a="aP" rt(="" )2="" ,="" b="bP" rt="" ln="" f="" v="" p="ZV" −1(="" )−="" ln="" zv="" −="" b(="" )−="" azv="" ln="" f="" l="" p="Z" l="" −1(="" )−="" ln="" z="" l="" −="" b(="" )−="" az="" l="" p="RT" v="" −="" b="" −="" a="" t="" (="" )="" v="" v="" +="" b(="" )="" +="" b="" v="" −="" b(="" )="" a="" t(="" )="0.45724" r="" 2tc="" 2="" pc="" α="" t(="" )="" b="0.07780" rtc="" pc="" α="" t(="" )="1+κ" 1−="" t="" tc="" ⎛="" ⎝⎜="" ⎞="" ⎠⎟="" ⎡="" ⎣="" ⎢="" ⎢="" ⎤="" ⎦="" ⎥="" ⎥="" 2="" κ="0.37464" +1.54226ω="" −="" 0.26992ω="" 2="" z="" 3="" +αz="" 2="" +="" βz="" +="" γ="0" α="−1+" b="" β="A−" 3b="" 2="" −="" 2b="" γ="−AB" +="" b="" 2="" +="" b3="" a="aP" rt(="" )2="" ,="" b="bP" rt="" here,="" zl="" and="" zv="" correspond="" to="" the="" liquid="" (low)="" and="" vapor="" (high)="" roots="" of="" the="" cubic="" equation="" of="" state,="" respectively.="" the="" critical="" properties="" of="" ammonia="" can="" be="" found="" from="" thermodynamic="" tables:="" tc="405.6" k,="" pc="11.28" mpa,="" w="0.250" a)="" develop="" a="" function="" file="" that="" takes="" in="" as="" input="" a="" function="" file="" for="" the="" fugacity="" calculation="" corresponding="" to="" any="" equation="" of="" state="" with="" any="" parameters="" needed="" in="" the="" fugacity="" equation,="" a="" value="" of="" t,="" and="" a="" p0="" as="" an="" initial="" guess,="" and="" implements="" the="" clever="" algorithm="" shown="" in="" figure="" 3="" to="" find="" the="" correct="" psat="" for="" the="" given="" t="" (with="" the="" tolerance="" as="" specified="" in="" figure="" 3).="" so="" the="" inputs="" to="" your="" function="" file="" should="" be="" a="" function="" handle="" referencing="" a="" function="" file="" for="" the="" fugacity="" equation="" with="" any="" parameters="" needed,="" and="" t="" and="" p0.="" the="" output="" from="" the="" function="" should="" be="" psat.="" call="" this="" function="" file="" psatfinder.="" note="" that="" psatfinder="" should="" be="" set="" up="" in="" a="" general="" way,="" so="" that="" it="" can="" work="" with="" both="" p-r="" and="" vdw="" equations="" of="" state="" (in="" fact,="" it="" will="" work="" with="" any="" cubic="" eos="" as="" long="" as="" the="" fugacity="" equation="" is="" also="" known="" for="" that="" eos).="" b)="" using="" the="" peng-robinson="" eos,="" produce="" a="" log-log="" p-v="" diagram="" (v="" on="" the="" logarithmic="" x-="" and="" p="" on="" the="" logarithmic="" y-axis)="" for="" nh3="" for="" temperatures="" t1="375" k,="" t2="382" k,="" t3="391" k,="" t4="400" k,="" t5="405.6" k,="" t6="408" k="" (all="" on="" one="" graph).="" rescale="" your="" axes="" to="" 3="" ´="" 10–5="" m3/mol="" £="" v="" £="" 1="" ´="" 10–3="" m3/mol,="" and="" 1="" ´="" 106="" pa="" £="" p="" £="" 1="" ´="" 108="" pa.="" this="" plot="" should="" give="" you="" some="" guidance="" on="" how="" to="" guess="" your="" pressures="" in="" the="" next="" step.="" c)="" write="" a="" script="" file="" that="" sends="" the="" fugacity="" function="" file="" for="" the="" van="" der="" waals="" eos="" to="" psatfinder="" with="" the="" four="" different="" values="" of="" temperature="" t1,="" t2,="" t3,="" and="" t4="" specified="" earlier,="" to="" find="" the="" corresponding="" psat="" for="" each="" value="" (for="" nh3).="" the="" entire="" script="" file="" should="" run="" with="" one="" command="" called="" psatvdw,="" printing="" a="" column="" of="" the="" four="" t="" values="" and="" their="" corresponding="" psat="" values="" at="" once.="" note:="" you="" should="" find="" psat="" for="" the="" temperatures="" given="" one="" by="" one,="" using="" a="" loop.="" d)="" write="" a="" script="" file="" that="" sends="" the="" fugacity="" function="" file="" for="" the="" peng-robinson="" eos="" to="" psatfinder="" with="" the="" four="" different="" values="" of="" temperature="" t1,="" t2,="" t3,="" and="" t4="" specified="" earlier,="" to="" find="" the="" corresponding="" psat="" for="" each="" value="" (for="" nh3).="" the="" entire="" script="" file="" should="" run="" with="" one="" command="" called="" psatpr,="" printing="" a="" column="" of="" the="" four="" t="" values="" and="" their="" corresponding="" psat="" values="" at="" once.="" note:="" you="" should="" find="" psat="" for="" the="" temperatures="" given="" one="" by="" one,="" using="" a="" loop.="" e)="" bonus="" question="" (10%="" extra="" on="" problem):="" using="" the="" information="" you="" found="" in="" part="" d,="" create="" a="" cleaned-up="" version="" of="" the="" p-v="" diagram="" that="" you="" had="" plotted="" in="" part="" b.="" note:="" in="" matlab,="" the="" command="" “isreal(a)”="" is="" a="" logical="" statement="" (true/false,="" or="" 1/0),="" regarding="" whether="" a="">
Answered 1 days AfterOct 23, 2022

Answer To: PROBLEM 1: MOLECULAR THERMODYNAMICS OF PURE FLUIDS Recall from CBE40C: The behavior of most...

Rachakonda answered on Oct 24 2022
46 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here