mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Compute and display gas density
This appears to be critical for work of breathing so it might be worthwhile to compute. So far only in infobox. For background, see https://www.youtube.com/watch?v=QBajM3xmOtc Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
e6d884cf26
commit
bb6ceba4ac
5 changed files with 17 additions and 2 deletions
|
@ -9,6 +9,8 @@
|
|||
#define virial_m1(C, x1, x2, x3) (C[0]*x1+C[1]*x2+C[2]*x3)
|
||||
|
||||
/*
|
||||
* Z = pV/nRT
|
||||
*
|
||||
* Cubic virial least-square coefficients for O2/N2/He based on data from
|
||||
*
|
||||
* PERRY’S CHEMICAL ENGINEERS’ HANDBOOK SEVENTH EDITION
|
||||
|
@ -73,3 +75,9 @@ double isothermal_pressure(struct gasmix *gas, double p1, int volume1, int volum
|
|||
|
||||
return p_ideal * gas_compressibility_factor(gas, p_ideal);
|
||||
}
|
||||
|
||||
inline double gas_density(struct gasmix *gas, int pressure) {
|
||||
int density = gas->he.permille * HE_DENSITY + gas->o2.permille * O2_DENSITY + (1000 - gas->he.permille - gas->o2.permille) * N2_DENSITY;
|
||||
|
||||
return density * (double) pressure / gas_compressibility_factor(gas, pressure / 1000.0) / SURFACE_PRESSURE / 1000000.0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue