gauge pressure and absolute pressure calculations in C++
-
I need C++ source code for calculating gauge and absolute pressures at any height in water.
-
I need C++ source code for calculating gauge and absolute pressures at any height in water.
It's a straight calculation but you can only approximate it the formula is the same no matter what computer language you use. absolute pressure = gravity at surface * density of water * depth you are in the water (height of column of water above aka the weight you are holding up really) The second term varies by all the things that can make water density vary such as water temperature, salinity etc. So as any scuba diver knows the calibrations for fresh water is very different to the calibrations for ocean diving and dive computers exist for a reason. However if you are after the layman answer it's absolute pressure = 1atm * 1 * depth ... so its pretty uniform 9.8m adds 1g (1 atm) pressure to you and it's not hard to write that in C++ for anyone who can write a line of code pressure = 1 atm * depth
In vino veritas
-
I need C++ source code for calculating gauge and absolute pressures at any height in water.
Member 13100668 wrote:
any height
Don't get started on that, unless that's specifically the goal of this assignment. For example, with 100km of water you're already around 1GPa at the bottom, probably turning the water at the bottom into exotic ice (it depends on the temperature of course) with a density of about 1.3 times the normal density of water (so density varies significantly across the column, even more significantly than if you have layers with different temperatures/salinities which is already relevant enough that you have to care about if you're doing Serious Business). Also going that high in altitude makes g drop significantly for the higher layers of water.
-
I need C++ source code for calculating gauge and absolute pressures at any height in water.
There are mathematical formulas for these which can be simply implemented as C code. The gauge pressure formula should be provided by the manufacturer of the gauge because it contains gauge specific constants. Calculating pressure from depth is rather seldom in the oceanographic area. Depth sensors are measuring pressure and the pressure value itself is recorded in dbar (because 1 dbar corresponds to about 1 metre). To get the absolute pressure these sensors usually measure the offset (air pressure) before deployed and subtract this offset from all under water measurements. The advantage of this method is that this eliminates also offset drift errors. See the Unesco technical papers in marine Science 44: Algorithms for computation of fundamental properties of seawater (PDF)[^] for formulas. Some of them might be required for the gauge pressure calculation. It contains also a formula for calculating depth from pressure in seawater which is shown on his own also at Code10[^].
-
I need C++ source code for calculating gauge and absolute pressures at any height in water.
roh = mgh obviously. Now you need to know the thickness of the air at any point on the planets surface and adjust for air pressure.