×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Using Peng Robinson EOS

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,




RE: Using Peng Robinson EOS

Many of us ChE's have experience solving PR EOS. I think it would help if you could attach your work or hand calcs showing where you run into difficulty. Your question doesn't really give us much information on your problem. Solving for V is an iterative, non-linear calculation. Is that the problem?

Also, please do not double or cross post.

Good Luck,
Latexman
Pats' Pub's Proprietor

RE: Using Peng Robinson EOS

(OP)
Ahh. OK sorry about the crosspost. I didn't know what to do with it, so I placed it in both spots.


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

(OP)
@IRstuff

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

Quote (valves4life)

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?

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

Do you have access to a simulator? Aspen Plus, HYSYS, etc.

Good Luck,
Latexman
Pats' Pub's Proprietor

RE: Using Peng Robinson EOS

(OP)
I do not have access to a simulator..

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

(OP)



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

Try P - f(V,T) = 0 and iterate until it meets your tolerance criteria like 1/1,000,000.

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

You may want to get:

Good Luck,
Latexman
Pats' Pub's Proprietor

RE: Using Peng Robinson EOS

Or check out Wikipedia:

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

This may help:


10 more pages after this. Elementary Principles of Chemical Processes by Felder and Rousseau.

Good Luck,
Latexman
Pats' Pub's Proprietor

RE: Using Peng Robinson EOS

(OP)
Wow you've been very helpful!

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

Mathcad has two types of processing
> 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

(OP)
Oh I don't really have a MathCad file. I'm doing most of this in javascript, I just used MathCad to try to give me a symbolically solved answer for the V value. I figured it may be able to find one, even though it'll be really complex, I figured there could be a chance, but stepping back and looking at the algebra behind solving that, I realize that isn't possible...

it was a shot in the dark, I know.

RE: Using Peng Robinson EOS

(OP)
I'm so close, I just seem to be off by a bit. Perhaps a kind sir can please tell me where I'm blowing this:

CODE --> javascript

let fluid = {};
fluid.critical_pressure=22064000;
fluid.critical_temperature=647.14;
fluid.omega=0.344;
fluid.temperature = 295;
fluid.pressure = 101325;
fluid.molecular_weight = 18.01528;
fluid.density = 1029;


const r = 8.314413;
const ac = 0.45724*((Math.pow(r,2)*Math.pow(fluid.critical_temperature,2))/fluid.critical_pressure);
const b = 0.07780*((r*fluid.critical_temperature)/fluid.critical_pressure);
let m;
if (fluid.omega < 0.490000001) {
    m= 0.37464 + 1.54226*fluid.omega-0.26992*Math.pow(fluid.omega,2);
} else if (fluid.omega>0.49) {
    m=0.379642+1.485030*fluid.omega-0.164423*Math.pow(fluid.omega,2)+0.016666*Math.pow(fluid.omega,3);
}
const alpha = Math.pow(1+m*(1-Math.pow((fluid.temperature/fluid.critical_temperature),0.5)),2);

const pressure = async (volume) => {
   const EOS = await (((r*fluid.temperature)/(volume-b))-((ac*alpha)/(Math.pow(volume,2)+(2*b*volume)-Math.pow(b,2))));
    return EOS;
};
let volume = (fluid.molecular_weight/fluid.density);

pressure(volume).then(function (pressure) {
    console.log(pressure);
}); 



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

Yes, Vm is molar volume

Molar density ρ = 1/Vm

Watch your units. "R=8.314413" is in (Joules)(gram-mols)/(Kelvin) or (m3) (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

This is a cubic EOS and PR handling is similar to SRK. You can solve for compressibility as an option; the equation should be of the form AxZ^3+ BxZ^2+CxZ+D=0 ; the coefficients A,B,C and D are determined based on binary interaction coefficients, eccentricity factors etc. Details can be found in API Technical Databook 8D1.1 assuming the case is for mixtures. You need a cubic equation solver that will return the roots and their type (imaginery, real). Other option, which is preferred, is to solve for density. As density solver, I suggest a regula falsi type of solver.

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

Google peng robinson vba (or spreadsheet) and preos.xls, there seems to be many Excel solutions already available to download free of charge.

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

Hi,
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

Hi valves4life,
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 ...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close