## Using Peng Robinson EOS

## Using Peng Robinson EOS

(OP)

Hi Everyone, I am very grateful for any answers here, as this is something I've been struggling with for a VERY long time. I've tried over and over to find a solution on my own without any avail.

I'm currently trying to get a calculated bulk modulus of substances in order to do a speed of sound calculation.

I've tried using Peng Robinson, but I'm running into an issue. I have MathCad and attempt to solve for V, but am having issues there as well, not finding a solution, probably due to my erroneous MathCad skills. I have Pc, Tc, and w (accentric factor), as well as input pressure and temp. In theory, I should be able to run this calculation and get a volume output, and then just calculate another point, and then I'd solve in the bulk modulus equation with those values?

I'm bashing my head against the keyboard here trying to find a solution and am not finding one. Keep in mind any iterative calculations will be difficult since I'm trying to write a quick javascript file to output this for me, so doing a "guess and check" is not a good option for me. As I said I've been struggling for a long time and in the past I've just ignored any effects of pressure on liquids, but in the last few weeks I've decided to solve this once and for all...

I'm sorry to ask this, but I've ordered books, scoured everything I can find on the internet for what feels like weeks now (it's been at least 2).

Can someone please help??

Thanks,

I'm currently trying to get a calculated bulk modulus of substances in order to do a speed of sound calculation.

I've tried using Peng Robinson, but I'm running into an issue. I have MathCad and attempt to solve for V, but am having issues there as well, not finding a solution, probably due to my erroneous MathCad skills. I have Pc, Tc, and w (accentric factor), as well as input pressure and temp. In theory, I should be able to run this calculation and get a volume output, and then just calculate another point, and then I'd solve in the bulk modulus equation with those values?

I'm bashing my head against the keyboard here trying to find a solution and am not finding one. Keep in mind any iterative calculations will be difficult since I'm trying to write a quick javascript file to output this for me, so doing a "guess and check" is not a good option for me. As I said I've been struggling for a long time and in the past I've just ignored any effects of pressure on liquids, but in the last few weeks I've decided to solve this once and for all...

I'm sorry to ask this, but I've ordered books, scoured everything I can find on the internet for what feels like weeks now (it's been at least 2).

Can someone please help??

Thanks,

## RE: Using Peng Robinson EOS

Also, please do not double or cross post.

Good Luck,

Latexman

Pats' Pub's Proprietor

## RE: Using Peng Robinson EOS

TTFN (ta ta for now)

I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg

FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

## RE: Using Peng Robinson EOS

Let's just give an example, let's say I've got Benzene at 300K and 10bar. mol mass = 78.114, Pc=48.95, Tc=562.05, w=0.210

I want to solve for (eventually) speed of sound in this fluid, but in order to do so, I need bulk modulus, for that, I need compressed volume (or density)

So how do I go about that? You say it's iterative, but how do I get an original value to use in the iterative process?

Thanks again and sorry about the crosspost!

## RE: Using Peng Robinson EOS

I've realized I was using the wrong equals when doing the mathcad, I found the proper one, and Mathcad refuses to solve PR EOS for V when I do that. :(

## RE: Using Peng Robinson EOS

That is correct. Solve PR EOS twice, once for each condition or pressure, then calculate the bulk modulus.

Still no info.

Good Luck,

Latexman

Pats' Pub's Proprietor

## RE: Using Peng Robinson EOS

Good Luck,

Latexman

Pats' Pub's Proprietor

## RE: Using Peng Robinson EOS

However, you're seeing that I'm not giving a ton of info, and that's really just because I'm trying to learn HOW to solve this, instead of just saying "here solve this for me!"

I think I get it now. When I start the iteration, I'll start out with the volume of the substance at that point assuming infinite bulk modulus (ie unaffected by pressure entirely), and move downward from there, in small increments, until I reach the pressure I am solving at. I think I understand.

OK last question, when it comes to solving what state a substance is in, exactly how does the EOS tell us that? What I mean is when getting the volume, and therefore subsequent density, how do we know if that is a liquid or a gas? Or do we care, since we have the density? The reason I ask is because I'm using this to calculate control valve sizing (Cv, noise, etc) and sizing for liquids is very different than sizing for gasses.

Also, on that front, would a supercritical fluid be considered compressible? I believe it'll be treated as a gas (per IEC 60534-8-4) when it comes to the equations for noise and Cv... You don't have to answer this one if you don't know it, I'm just stabbing in the dark. I'm embarrassed to admit I'm on the ISA committee for control valve noise, but truthfully these thing we're discussing are NEVER part of the things taken into account, they always just say "well that's close enough" and I don't feel good about that.

I'm attempting to find a better way to look at these equations from a more quantitative level. Sure, the argument can be made that often times the customer doesn't know the process within .0001psi so why should we worry about the bulk modulus effect on liquid water, but to be honest, it bothers me knowing the calculation can be better, and we're not taking advantage of that. Sorry I went off on a tangent there... :)

## RE: Using Peng Robinson EOS

PS here's the PR EOS i'm using... for ease I substituted alpha as p, and P = Pressure, T is obv temp...

PPS Mathcad didn't like that equation I tried to solve for V. haha.

## RE: Using Peng Robinson EOS

Start with a guess, or use the density of water at thiose conditions. Anything close until it iterates to convergence.

I do it in Excel and use the Solver Add-in.

Good Luck,

Latexman

Pats' Pub's Proprietor

## RE: Using Peng Robinson EOS

Good Luck,

Latexman

Pats' Pub's Proprietor

## RE: Using Peng Robinson EOS

PR EOS

On determining whether it is gas or liquid, I think there are ways to do it analytically, but I just eyeball it. Is it close to the density of air or water? If air, gas. If water, liquid.

Good Luck,

Latexman

Pats' Pub's Proprietor

## RE: Using Peng Robinson EOS

10 more pages after this.

Elementary Principles of Chemical Processesby Felder and Rousseau.Good Luck,

Latexman

Pats' Pub's Proprietor

## RE: Using Peng Robinson EOS

This should be the last question(s),

the volume is the molar volume, right?? So I can take 1/density * molar mass and use that as a basis for my starting point?

now, here's the biggie, what are the units? I've been using R=8.314413, and pressure in Pa, density in kg/m3, and temp in K.

I ask because I'm getting some pretty wackado answers here when I try to run it this way.

Thanks for the recommendation on the book. I have that, but for some reason they don't really go very deep into the more basic point because of that it's causing me to not be able to fully utilize this book's true value. It has been an enormous help thus far though...

you've been extremely helpful thank you so much kind sir!

## RE: Using Peng Robinson EOS

> numeric

> synbolic, which is what is shown in your snippet, by virtue of the <ctrl>. operator at the end, instead of the normal "=" sign.

The symbolic engine attempts to find closed-form solutions, which for the PR EOS equations, there is none, otherwise they would be published.

The numeric engine has a numerical solver, which is probably what you want, anyway, but it is a Newton-Raphson solver, which does iterations internally in Mathcad.

Again, posting your Mathcad file might still be helpful

TTFN (ta ta for now)

I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg

FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

## RE: Using Peng Robinson EOS

it was a shot in the dark, I know.

## RE: Using Peng Robinson EOS

## CODE --> javascript

to be clear you don't have to analyze my code line by line, but for example the attached is giving me a required pressure of 137030Pa, which can't be correct since it's pretty much water at STP...

I really am sorry to do this. I'm reaching out for help after exhausting all my possible options, short of paying someone to consult for me on this. (Which isn't out of the question, mind you folks) I'm not sure if that is against the rules here so I'll leave it there. If it is, please disregard, if it's not, please let me know if anyone is interested. Also Mods, if this is against rules feel free to clip this whole section...

## RE: Using Peng Robinson EOS

Molar density ρ = 1/Vm

Watch your units."R=8.314413" is in (Joules)(gram-mols)/(Kelvin) or (m^{3}) (Pascals)/((gram-mols)(Kelvin))Always "mol" (SI) or "mole" (US units)= gram-mol(e)s. kg-mol(e)s will be spelled out.

Good Luck,

Latexman

Pats' Pub's Proprietor

## RE: Using Peng Robinson EOS

OK last question, when it comes to solving what state a substance is in, exactly how does the EOS tell us that? What I mean is when getting the volume, and therefore subsequent density, how do we know if that is a liquid or a gas? Or do we care, since we have the density? The reason I ask is because I'm using this to calculate control valve sizing (Cv, noise, etc) and sizing for liquids is very different than sizing for gasses.You basically need to do a thermodynamic stability test (a method for this is called tangent distance plan analysis) which will tell you if you are in single homogeneous gas phase, liquid phase or liquid-vapor mixture. One step further is to do a flash calculation (VLE equilibrium) which will tell you the liquid and gas phase compositions.

There is a reference on EOS based on speed of sound property that you can find in the book "Characterization and properties of petroleum fractions", M.R. Riazi, section 6.9, page 284.

Leaving supercritical case apart, the properties will be very much different if you are in gas or liquid region as there is 1st order loss of continuity of thermodynamic properties. If you calculate thermodynamic properties (including speed of sound) in liquid region via the use of a density root incorrectly selected (e.g. vapor root), you will get totally misleading results. It will even be different if you are in mixture phase and you calculate thermodynamic properties in reference to liquid or gas phase. If you evaluating pure compounds, I suppose the thermodynamic test would be of lesser complication.

If you plan an escape, you must succeed as if you fail, you will be punished for trying. Never say or write down your plan. Heart is the only place where secrecy is granted.

## RE: Using Peng Robinson EOS

I also frequent ChEResources forum. Here is a promising thread over there - PR EOS Workbook. There is a free, down-loadable Excel spreadsheet.

Good Luck,

Latexman

Pats' Pub's Proprietor

## RE: Using Peng Robinson EOS

My experience with cubic equation of state (PR or other EOS) is to write them in terms of Z and solve them using Newton Raphson's method or Halley's method for a faster convergence.

2 equations : EOS and PV=ZRT . Let you substitute V = ZRT/P in the EOS

solve F(Z) =0 ; Zn+1=Zn -F(Z)/F'(Z) with initial guess : Z=1 , Z gas being the bigger root.

It works fine .

Pierre

## RE: Using Peng Robinson EOS

with proposed procedures you solve molar volume (liquid and vapor phase) *NOT* the bulk modulus which is a derivative

bulk modulus = -V dP/dV

in the same way, if you wish to calculate the speed of sound you need additional derivatives and, for two phase conditions, the solutions is not easy

for MathCad, Excel or open source alternatives as LibreOffice, OpenOffice etc. you can consider to link a thermodynamic library as for example Prode Properties,

with Prode you can obtain all the desired properties (including bulk modulus) plus derivatives directly in MathCad or Excel or ...