JaiaBot  1.20.0
JaiaBot micro-AUV software
dissolved_oxygen_compensation.h File Reference
#include <cmath>
Include dependency graph for dissolved_oxygen_compensation.h:

Go to the source code of this file.

Functions

double pressure_correction (double pressure_mmhg=760.0)
 Approximates the effect of barometric pressure on dissolved oxygen (DO) solubility. More...
 
double salinity_correction (double temperature_k, double salinity_ppt)
 Computes the salinity correction factor for dissolved oxygen solubility. More...
 
double calculate_do_saturation_fresh (double temperature_k)
 Calculates the saturation concentration of dissolved oxygen in freshwater at 1 atm and 0 ppt salinity. More...
 
double calculate_dissolved_oxygen_solubility (double temperature_celsius, double salinity_ppt, double pressure_mmhg=760.0)
 Calculates the dissolved oxygen (DO) solubility in mg/L, corrected for temperature, salinity, and pressure. More...
 
double calculate_do_saturation_percent (double do_raw, double do_max)
 Calculates dissolved oxygen (DO) percent saturation. More...
 

Function Documentation

◆ calculate_dissolved_oxygen_solubility()

double calculate_dissolved_oxygen_solubility ( double  temperature_celsius,
double  salinity_ppt,
double  pressure_mmhg = 760.0 
)

Calculates the dissolved oxygen (DO) solubility in mg/L, corrected for temperature, salinity, and pressure.

This function estimates the maximum amount of oxygen that water can hold under the given conditions. It uses the Weiss (1970) equation for DO saturation at 0 ppt salinity and 1 atm pressure, then applies salinity and pressure correction factors to reflect real-world conditions.

The result represents oxygen solubility at equilibrium with the atmosphere — useful for calculating % saturation or comparing measured DO values to environmental capacity.

Parameters
temperature_celsiusWater temperature in degrees Celsius.
salinity_pptSalinity in parts per thousand (ppt).
pressure_mmhgBarometric pressure in mmHg (default is standard: 760 mmHg).
Returns
DO solubility in mg/L under the specified conditions.

References:

Definition at line 98 of file dissolved_oxygen_compensation.h.

◆ calculate_do_saturation_fresh()

double calculate_do_saturation_fresh ( double  temperature_k)

Calculates the saturation concentration of dissolved oxygen in freshwater at 1 atm and 0 ppt salinity.

This is based on the Benson & Krause (1984) equation recommended by USGS for high-accuracy DO solubility estimates. It returns the maximum possible DO (mg/L) at a given temperature in °C.

Parameters
temperature_kWater temperature in degrees Kelvin.
Returns
DO saturation in mg/L at standard atmospheric pressure and zero salinity.

Reference:

Definition at line 60 of file dissolved_oxygen_compensation.h.

◆ calculate_do_saturation_percent()

double calculate_do_saturation_percent ( double  do_raw,
double  do_max 
)

Calculates dissolved oxygen (DO) percent saturation.

This function expresses the measured DO concentration as a percentage of the theoretical maximum solubility under current temperature, salinity, and pressure conditions.

Percent saturation >100% indicates supersaturation (e.g., from photosynthesis), while <100% indicates undersaturation (e.g., from respiration or pollution).

Parameters
do_rawMeasured dissolved oxygen concentration in mg/L.
do_maxDO solubility in mg/L under current environmental conditions.
Returns
Percent saturation (%).

Definition at line 124 of file dissolved_oxygen_compensation.h.

◆ pressure_correction()

double pressure_correction ( double  pressure_mmhg = 760.0)

Approximates the effect of barometric pressure on dissolved oxygen (DO) solubility.

This function applies a simple linear scaling based on the ratio of the measured pressure to standard sea-level pressure (760 mmHg). It is suitable for most field applications where high-precision correction is not required.

For more precise calculations, especially at high elevations or in scientific contexts, a more complex model accounting for non-ideal gas behavior, water vapor pressure, and oxygen mole fraction is available in equations (9)–(11) of the USGS WQ.2011.03 memo.

Parameters
pressure_mmhgBarometric pressure in mmHg (default: 760 mmHg).
Returns
Approximate correction factor to scale DO solubility for pressure deviations.

Reference:

Definition at line 20 of file dissolved_oxygen_compensation.h.

◆ salinity_correction()

double salinity_correction ( double  temperature_k,
double  salinity_ppt 
)

Computes the salinity correction factor for dissolved oxygen solubility.

This factor adjusts the oxygen solubility downward based on increased salinity.

Parameters
temperature_kWater temperature in Kelvin.
salinity_pptSalinity in parts per thousand (ppt).
Returns
Salinity correction factor (unitless).

Reference: Garcia & Gordon (1992), also adopted by USGS:

Definition at line 34 of file dissolved_oxygen_compensation.h.