From 308d71ec39a33a276362d93c0ff534575b8c293c Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Mon, 25 Feb 2013 15:23:16 -0800 Subject: Take incompressibility of gas into account at higher pressures This creates a helper function called "gas_volume()" that takes the cylinder and a particular pressure, and returns the estimated volume of the gas at surface pressure, including proper approximation of the incompressibility of gas. It very much is an approximation, but it's closer to reality than assuming a pure ideal gas. See for example compressibility at http://en.wikipedia.org/wiki/Compressibility_factor Suggested-by: Jukka Lind Signed-off-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- dive.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'dive.h') diff --git a/dive.h b/dive.h index 201363153..f6677ab2c 100644 --- a/dive.h +++ b/dive.h @@ -203,10 +203,8 @@ static inline double bar_to_atm(double bar) return bar / SURFACE_PRESSURE * 1000; } -static inline double to_ATM(pressure_t pressure) -{ - return pressure.mbar / (double) SURFACE_PRESSURE; -} +/* Volume in mliter of a cylinder at pressure 'p' */ +extern int gas_volume(cylinder_t *cyl, pressure_t p); static inline int mbar_to_PSI(int mbar) { -- cgit v1.2.3-70-g09d2