Ir al contenido

fluids.water

La referencia de la API se publica en inglés en los dos idiomas: se genera a partir de los docstrings del código, que son su texto original.

Sea water: its speed of sound, and its density.

Four coexisting equations for the sound speed c as a function of temperature, salinity and depth or pressure, selectable through sound_speed_model:

  • "unesco": the UNESCO / Chen & Millero (1977) algorithm, the international standard, in the Wong & Zhu (1995) ITS-90 recalculation. Default.
  • "del_grosso": the Del Grosso (1974) equation (Wong & Zhu 1995 form), a high-accuracy alternative over a narrower domain.
  • "mackenzie": the Mackenzie (1981) nine-term depth-based equation.
  • "medwin": the Medwin (1975) six-term short formula.

Unlike air, sea water has four competing fits to one quantity rather than one model of a substance, which is why this constructor takes a model and air does not: those four are answers to the same question, while the air formulas scattered through the library are clauses of different measurement standards and must never be substitutable.

The density comes from Ainslie, Principles of Sonar Performance Modelling (Springer 2010), Equation (4.6) on printed folio 127, which the book attributes to Pierce (1989, p. 34). Its pressure argument is absolute, defined by Equation (4.4) as the atmosphere plus the water column above.

Sea water has no ratio of specific heats or thermal diffusivity here: no source in this library prints them, so a Fluid built from this module raises FluidPropertyUnavailableError for them rather than inventing a number.

Auto-generated from the source docstrings by scripts/generate_api_docs.py (make api-docs). Do not edit by hand.

depth_to_absolute_pressure_pa(
*,
depth_m: float,
latitude_deg: float = 45.0,
) -> float

Absolute static pressure at an ocean depth, in pascals.

Ainslie Equation (4.11), printed folio 128. Absolute, not gauge: Equation (4.4) defines the static pressure as the atmosphere plus the weight of the water above, so this returns one atmosphere at the surface rather than zero.

That is the pressure sea_water’s density wants. The sound speeds want the other one, from depth_to_gauge_pressure_mpa, and the two names say which is which because the difference is a factor of a million and an offset of an atmosphere.

Parameters

Name Description
depth_m Depth below the surface z, in metres (>= 0).
latitude_deg Latitude , in degrees (default 45).

Returns: Absolute static pressure, in pascals.

Raises

Exception When
ValueError If the depth is negative or non-finite.
TypeError if depth_m or latitude_deg is not a single number.
depth_to_gauge_pressure_mpa(
*,
depth_m: float,
latitude_deg: float = 45.0,
) -> float

Gauge pressure at an ocean depth (Leroy & Parthiot 1998), in MPa.

The standard-ocean formula, for an ideal medium of 0 degC and 35 ppt; no local corrections are applied. This is the pressure the UNESCO and Del Grosso sound speeds want, and it is gauge: zero at the surface.

Its companion depth_to_absolute_pressure_pa answers the other question, in the other unit and from the other datum, which is why both names carry theirs. Handing one to what wants the other is a factor of a million and an offset of an atmosphere.

Parameters

Name Description
depth_m Depth below the surface Z, in metres (>= 0).
latitude_deg Latitude , in degrees (default 45).

Returns: Gauge pressure, in megapascals.

Raises

Exception When
ValueError If the depth is negative or non-finite.
TypeError if depth_m or latitude_deg is not a single number.
sea_water(
*,
temperature_c: float,
salinity_psu: float = 35.0,
depth_m: float = 0.0,
latitude_deg: float = 45.0,
sound_speed_model: Literal['unesco', 'del_grosso', 'mackenzie', 'medwin'] = 'unesco',
) -> Fluid

Sea water at one point of the ocean.

Parameters

Name Description
temperature_c Temperature T, in degrees Celsius.
salinity_psu Practical salinity S, dimensionless (default 35, the salinity of the standard ocean).
depth_m Depth below the surface, in metres (default 0).
latitude_deg Latitude, in degrees, for the depth-to-pressure conversions (default 45).
sound_speed_model Which of the four fits to use; see the module docstring. One of "unesco", "del_grosso", "mackenzie" or "medwin".

Returns: The Fluid at that point.

Raises

Exception When
TypeError if sound_speed_model is not a text.

The density and the speed of sound come from different sources, which is why both are named in the result’s model. Neither source in this library prints a ratio of specific heats, a viscosity or a thermal diffusivity for sea water, so reading one raises rather than guessing.

sea_water_density(
*,
temperature_c: float,
salinity_psu: float,
static_pressure_pa: float,
) -> float

Density of sea water, in kilograms per cubic metre.

Ainslie Equation (4.6), printed folio 127, attributed there to Pierce (1989, p. 34):

The pressure is absolute, in pascals, as Equations (4.4) and (4.7) to (4.10) define it. Use depth_to_absolute_pressure_pa to get one from a depth.

Parameters

Name Description
temperature_c Temperature T, in degrees Celsius.
salinity_psu Practical salinity S, dimensionless.
static_pressure_pa Absolute static pressure P_w, in pascals.

Returns: Density rho, in kg/m3.

Raises

Exception When
ValueError For a temperature at or below absolute zero, a negative salinity, or a non-positive pressure.
TypeError if salinity_psu, static_pressure_pa or temperature_c is not a single number.
sea_water_sound_speed(
temperature_c: float | np.floating[Any] | np.integer[Any],
salinity_psu: float | np.floating[Any] | np.integer[Any],
depth_m: float | np.floating[Any] | np.integer[Any],
*,
model: Literal['unesco', 'del_grosso', 'mackenzie', 'medwin'] = 'unesco',
latitude_deg: float = 45.0,
) -> float
sea_water_sound_speed(
temperature_c: Sequence[float] | Sequence[np.floating[Any]] | Sequence[np.integer[Any]] | NDArray[np.bool_ | np.integer[Any] | np.floating[Any]],
salinity_psu: NumericArrayLike,
depth_m: NumericArrayLike,
*,
model: Literal['unesco', 'del_grosso', 'mackenzie', 'medwin'] = 'unesco',
latitude_deg: float = 45.0,
) -> NDArray[np.float64]
sea_water_sound_speed(
temperature_c: float | np.floating[Any] | np.integer[Any],
salinity_psu: Sequence[float] | Sequence[np.floating[Any]] | Sequence[np.integer[Any]] | NDArray[np.bool_ | np.integer[Any] | np.floating[Any]],
depth_m: NumericArrayLike,
*,
model: Literal['unesco', 'del_grosso', 'mackenzie', 'medwin'] = 'unesco',
latitude_deg: float = 45.0,
) -> NDArray[np.float64]
sea_water_sound_speed(
temperature_c: float | np.floating[Any] | np.integer[Any],
salinity_psu: float | np.floating[Any] | np.integer[Any],
depth_m: Sequence[float] | Sequence[np.floating[Any]] | Sequence[np.integer[Any]] | NDArray[np.bool_ | np.integer[Any] | np.floating[Any]],
*,
model: Literal['unesco', 'del_grosso', 'mackenzie', 'medwin'] = 'unesco',
latitude_deg: float = 45.0,
) -> NDArray[np.float64]
sea_water_sound_speed(
temperature_c: NumericArrayLike,
salinity_psu: NumericArrayLike,
depth_m: NumericArrayLike,
*,
model: Literal['unesco', 'del_grosso', 'mackenzie', 'medwin'] = 'unesco',
latitude_deg: float = 45.0,
) -> float | NDArray[np.float64]

Speed of sound in sea water, in metres per second.

Parameters

Name Description
temperature_c Temperature T, in degrees Celsius.
salinity_psu Salinity S, in parts per thousand (PSU).
depth_m Depth below the surface, in metres (>= 0).
model "unesco" (default), "del_grosso", "mackenzie" or "medwin".
latitude_deg Latitude for the depth→pressure conversion, in degrees (used by "unesco" and "del_grosso"; default 45°).

Returns: The sound speed c, in m/s; a float when temperature, salinity and depth are all numbers; an array of their broadcast shape when one is a sequence or an array, a zero-dimensional one included.

Raises

Exception When
ValueError If model is unknown or an input is non-finite.
TypeError if model is not a text, latitude_deg is not a single number, or depth_m, salinity_psu or temperature_c holds a text or a value that is not a real number.