Info Real gas - the real deal

Please register or login

Welcome to ScubaBoard, the world's largest scuba diving community. Registration is not required to read the forums, but we encourage you to join. Joining has its benefits and enables you to participate in the discussions.

Benefits of registering include

  • Ability to post and comment on topics and discussions.
  • A Free photo gallery to share your dive photos with the world.
  • You can make this box go away

Joining is quick and easy. Log in or Register now!

Hi,
Please take this comment as being constructive, but I question the overall advantages of using a EOS like GERG for diving applications.
As compared to one of the other MUCH SIMPLER EOS like VDW or virial equations.

There's a trade-off in whatever EOS you use that's governed by the accuracy you get vs the complexity. GERG is several orders of magnitude more complex than VDW or virial approaches.
Which means much greater risk of coding errors, amongst other things.

From an engineering point of view, one needs to decide what accuracy is needed, and try to follow KISS: Keep It Simple Stupid.

GERG (and the related NIST codes) were developed for COMPLETELY different reasons than the diving industry case.
GERG is intended to be used with a VERY complex "soup": often >20 hydrocarbon gases along with water and hydrogen.
The idea was to be able to accurately quantify natural gas mixtures that are being transfered by pipeline or LNG tank in VERY large quantities: in order to make the payments for it more accurate/consistent.

Air liquide or Lurgi might see advantages in using GERG at the high end of things: millions of tonnes of gas processed. But Joe Blender? I don't buy it.

Alan
 
As compared to one of the other MUCH SIMPLER EOS like VDW or virial equations.
I think I have advocated that using an ideal gas approximation was fine for most practical diving applications. It's not really a question of quantities of gas but of required accuracy of blends.

If you're going to use some other equation of state, I think I would argue for either GERG or an empirical interpolation like that used in subsurface. I think that GERG is more or less (obviously more) an extension of a virial approach. It should be straight forward to validate the output of a GERG based model for the limited cases of the few gases of interest to divers.

Van der Waals is much worse. Worse than ideal gas approximation in some regions of interest for diving. This is discussed here with a plot showing that z-1 has the wrong sign for Van der Waals for dry air at 200 bar! Obviously, you could object to the VDW coefficients I used for the plot. But if you are going to pick different coefficients to better fit to empirical data, rather than theoretical, you might as well have started from an empirical description. And since you would have to validate anyway, I don't see a major advantage over validating GERG over the limited phase space of interest here.
 
Hi Herr GoldFish,
Yes, I agree with you.

It's a case of "horses for courses" wrt to which Equation of State (EOS) you use for diving applications.

Van der Waals is still useful for teaching non-specialists about the limitiations of the ideal gas law, but for any actual use, as you say, you should use a cubic (3-component) virial EOS: for very little increased complexity, you get a big increase in accuracy.

My only point was that GERG 2004 (and its later variants) is indeed more accurate, but....the point is you pay for that (usually very slight accuracy improvement) with a lot of extra complexity. And it's in many cases, overkill, compared to using a 3-parameter virial cubic type.

It is not straightforward to use GERG 2004 in a DIY/Excel based set-up, as you can see by looking at the VBA Macro routine written for this Excel spreadsheet.

If you program a GERG-2004 based model for 3 components (O2, N2 & He: without water vapour) you need a LOT of constants in multiple functions that need to be called properly in whatever iterative search routine you use to solve with (it's not a direct solution like vDW etc):
- Common: 18 constants
- O2 and He: each gas needs 12 constants each
- N2: needs 24 constants
So that's 66 constants (for only THREE components).
Lots of places to screw up.

If someone wants to use davidem's Excel/VBA macro as a "black box" to calculated compressibility factors there's no real danger. But modifying it to do other things is not straightforward: you really need to be very careful.

GERG-2004 is based on a thermodynamic semi-rigorous approach. It uses the Helmholtz energy to do some very accurate combinations of very accurate correlations to experimental data for the gases it models: in particular for complex MIXTURES of non-ideal type gases used in natural gas mixes.

To quote from Oliver Kunz's PhD thesis (the developer of GERG-2004):
"These models use equations of state in the form of fundamental equations for each mixture component along with further correlation equations to take into account the residual mixture behaviour.
The equations are explicit in the Helmholtz free energy. The basic principles for the development of these mixture models are strongly related to the development of empirical equations of state for pure substances. The models enable the accurate description of the thermodynamic properties of mixtures in the extended fluid region for wide ranges of temperature, pressure, and composition"

The real advantage of using a Helmholtz Energy (GERG-2004 etc) based approach is it means you can derive many other properties important to pipeline use: viscosity, density, thermal properties etc.
 
Interesting thread. Has anyone tried computing/recomputing Z-factors by using REFPROP models? It seems that REFPROP model results differ significantly from simplified models, as seen on DGX. E.g., DGX states that air Z is > 1. REFPROP suggests Z < 1.


1754358299097.png
 
DGX states that air Z is > 1. REFPROP suggests Z < 1.
No idea why the disagreement, but Z_air @ 3000 psi is definitely > 1. That's why an AL80 (11.11L water volume) only holds 77ish cuft of gas when expanded to 1 atm. The ideal capacity is 80.06 cuft.
 
No idea why the disagreement, but Z_air @ 3000 psi is definitely > 1. That's why an AL80 (11.11L water volume) only holds 77ish cuft of gas when expanded to 1 atm. The ideal capacity is 80.06 cuft.
How did you compute the z-factor? What model did you use for the calculation? What package (Python, etc.?) GERG-2008 will give you 1.036 but other models will produce a different z-factor.
 
I didn't compute Z, but the 77.x cuft spec for an AL80 is ubiquitous. That means Z > 1 and pretty close to 1.03. GERG gives that, DGX is similar, and even Wikipedia gives 1.03ish. The 0.88 value seems way off.
 
I didn't compute Z, but the 77.x cuft spec for an AL80 is ubiquitous. That means Z > 1 and pretty close to 1.03. GERG gives that, DGX is similar, and even Wikipedia gives 1.03ish. The 0.88 value seems way off.
It depends on the model. We use GERG because it is probably the most conservative and thus suitable for diving. But REFPROP is deemed to be accurate, too, with Z ~ 0.88. There are other models with lower Zs, and you're looking at close to 13% deviation.

I am not debating whether to use 1.03 even more conservative (there are calculations that put Z close to 1.1 for air). However, it'd be nice if someone who knows the models intimately could chime in and describe the differences. Unfortunately, I rely on publicly available software libraries to test things, so I don't crunch numbers by hand.
 
I suspect there was a user error when using REFPROP. It has a plethora of settings and fluid selections, which is probably where the misstep happened.
REFPROP gives a compressibility factor (Z) of 1.0313 for air at the values you specified (70 °F and 3000 psi), and 1.0363 at 300 K and 3000 psi.

If I had to make a wild guess, I’d say whoever calculated the Z-factor likely selected the wrong fluid in REFPROP. Methane, for example, would come close to the incorrect value of 0.881. It has a Z-factor of 0.83172 at 300 K and 3000 psi. REFPROP also has a free version available, called MINI-REFPROP. It has at least air as a pseudo pure fluid.

I love COOLPROP and surprised it isn’t more widely adopted in the gas industry. It also hasn’t seen any real recognition in the SCUBA world yet, which is odd. It’s an open-source library for calculating various fluid properties, and it can be used easily by anyone with basic Python skills.

I got tired of writing Python scripts manually, so I built a small app to run a local server.

The app launches a Flask server that can be accessed via a local browser, no internet required and the app certainly doesn't connect to anything outside your local server. It’s not the neatest solution, but it was the quickest approach I could think of that didn’t involve writing a full standalone program. It was intended for personal use, so I didn’t pay much attention to which licenses to include. I sincerely apologize if I forgot to add a license and will do so when someone points it out (It's been a while and I can't recall all the dependencies). None of the heavy lifting in the app is my own. I just pulled everything together into a usable package. All I did was write the HTML and PHP front-end.
Maybe that’s of use to someone like me that likes to play around with the physics.

For what it’s worth, COOLPROP also returns a Z of 1.0313 at 3000 psi and 70 °F.
 

Attachments

Back
Top Bottom