Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Peng Robinson EOS

Status
Not open for further replies.

valves4life

Industrial
Feb 15, 2012
16
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,




 
Replies continue below

Recommended for you

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
 
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!
 
@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. :(
 
valves4life said:
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
 
Do you have access to a simulator? Aspen Plus, HYSYS, etc.

Good Luck,
Latexman
Pats' Pub's Proprietor
 
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... :)
 
Untitled_ff2m7f.png



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.
 
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
 
You may want to get:
Capture_pxk7am.jpg


Good Luck,
Latexman
Pats' Pub's Proprietor
 
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
 
This may help:
3294D48E-D0B2-464E-962E-79A938FBE6F1_j58ua5.jpg


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

Good Luck,
Latexman
Pats' Pub's Proprietor
 
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!

 
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! faq731-376 forum1529 Entire Forum list
 
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.
 
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:

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...
 
Yes, Vm is molar volume

Molar density [&rho;] = 1/Vm

Watch your units. "R=8.314413" is in (Joules)(gram-mols)/(Kelvin) or (m[sup]3[/sup]) (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
 
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.
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor