Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. gauge pressure and absolute pressure calculations in C++

gauge pressure and absolute pressure calculations in C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 13068622
    wrote on last edited by
    #1

    I need C++ source code for calculating gauge and absolute pressures at any height in water.

    L L J M 4 Replies Last reply
    0
    • U User 13068622

      I need C++ source code for calculating gauge and absolute pressures at any height in water.

      L Offline
      L Offline
      leon de boer
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • U User 13068622

        I need C++ source code for calculating gauge and absolute pressures at any height in water.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • U User 13068622

          I need C++ source code for calculating gauge and absolute pressures at any height in water.

          J Offline
          J Offline
          Jochen Arndt
          wrote on last edited by
          #4

          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[^].

          1 Reply Last reply
          0
          • U User 13068622

            I need C++ source code for calculating gauge and absolute pressures at any height in water.

            M Offline
            M Offline
            Munchies_Matt
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups