Browse Source

Added cpsw alias function

master
Daniele Tricoli 10 years ago
parent
commit
87d06a8655
  1. 8
      docs/function_reference.rst
  2. 2
      src/oceanography.h
  3. 3
      tests/test_oceanography.c

8
docs/function_reference.rst

@ -6,6 +6,7 @@ Function reference
#. adiabatic_temperature_gradient
#. atg
#. conductivity
#. cpsw
#. depth
#. freezing_point
#. potential_temperature
@ -57,6 +58,11 @@ Units::
temperature -- degrees Celsius
pressure -- decibars
cpsw
----
Alias for :ref:`ref_specific_heat`.
depth
-----
@ -143,6 +149,8 @@ Units::
Returns sound speed in meters/second.
.. _ref_specific_heat:
specific_heat
-------------

2
src/oceanography.h

@ -53,6 +53,8 @@ double sound_speed(double salinity, double temperature, double pressure);
#define theta(salinity, temperature, pressure, reference_pressure) \
potential_temperature(salinity, temperature, pressure, \
reference_pressure)
#define cpsw(salinity, temperature, pressure) \
specific_heat(salinity, temperature, pressure)
#ifdef __cplusplus
}

3
tests/test_oceanography.c

@ -105,6 +105,9 @@ START_TEST(test_specific_heat)
ck_assert(cmp_double(specific_heat(25, 0, 0), 4048.440412));
ck_assert(cmp_double(specific_heat(35, 20, 5000), 3894.992770));
ck_assert(cmp_double(specific_heat(40, 40, 10000), 3849.499481));
/* Test again the first case using the function alias cpsw. */
ck_assert(cmp_double(cpsw(25, 0, 0), 4048.440412));
}
END_TEST

Loading…
Cancel
Save