Added freezing_point function
This commit is contained in:
parent
3783770460
commit
6386651a82
|
@ -138,3 +138,9 @@ double depth(double pressure, double latitude)
|
|||
|
||||
return depth / gr;
|
||||
}
|
||||
|
||||
double freezing_point(double salinity, double pressure)
|
||||
{
|
||||
return (-0.0575 + 1.710523e-3 * sqrt(fabs(salinity)) - 2.154996e-4 *
|
||||
salinity) * salinity - 7.53e-4 * pressure;
|
||||
}
|
||||
|
|
|
@ -6,5 +6,6 @@ double conductivity(double salinity, double temperature, double pressure);
|
|||
double specific_volume_anomaly(double salinity, double temperature,
|
||||
double pressure, double *sigma);
|
||||
double depth(double pressure, double latitude);
|
||||
double freezing_point(double salinity, double pressure);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -62,7 +62,15 @@ START_TEST(test_depth)
|
|||
{
|
||||
ck_assert(cmp_double(depth(500, 0), 496.652992));
|
||||
ck_assert(cmp_double(depth(10000, 30), 9712.653072));
|
||||
ck_assert_msg(cmp_double(depth(10000, 90), 9674.231441));
|
||||
ck_assert(cmp_double(depth(10000, 90), 9674.231441));
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_freezing_point)
|
||||
{
|
||||
ck_assert(cmp_double(freezing_point(5, 0), -0.273763));
|
||||
ck_assert(cmp_double(freezing_point(20, 300), -1.309106));
|
||||
ck_assert(cmp_double(freezing_point(40, 500), -2.588567));
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -75,6 +83,7 @@ Suite *oceanography_suite(void)
|
|||
tcase_add_test(tc_core, test_conductivity);
|
||||
tcase_add_test(tc_core, test_specific_volume_anomaly);
|
||||
tcase_add_test(tc_core, test_depth);
|
||||
tcase_add_test(tc_core, test_freezing_point);
|
||||
suite_add_tcase(s, tc_core);
|
||||
|
||||
return s;
|
||||
|
|
Loading…
Reference in New Issue