diff options
author | Robert C. Helling <helling@atdotde.de> | 2017-01-12 21:19:40 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-01-16 03:17:40 -0800 |
commit | 7725842383b66fba50c41dbf9f981be38a467135 (patch) | |
tree | 5bcbe960a3f23ce7895c56ffedef4fd1e79a402a /core/gas-model.c | |
parent | fedadc65dbf84164a079f1d9f402290c5e210537 (diff) | |
download | subsurface-7725842383b66fba50c41dbf9f981be38a467135.tar.gz |
Use real gas compressibility in planner
Modify formluas for gas use to take into account the
compressibility correction for real gases. This introduces
also the inverse formula to compute the pressure for a given
amount of gas.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/gas-model.c')
-rw-r--r-- | core/gas-model.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/gas-model.c b/core/gas-model.c index ad1160f3b..98139337c 100644 --- a/core/gas-model.c +++ b/core/gas-model.c @@ -62,3 +62,13 @@ double gas_compressibility_factor(struct gasmix *gas, double bar) */ return Z * 0.001 + 1.0; } + +/* Compute the new pressure when compressing (expanding) volome v1 at pressure p1 bar to volume v2 + * taking into account the compressebility (to first order) */ + +double isothermal_pressure(struct gasmix *gas, double p1, int volume1, int volume2) +{ + double p_ideal = p1 * volume1 / volume2 / gas_compressibility_factor(gas, p1); + + return p_ideal * gas_compressibility_factor(gas, p_ideal); +} |