-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathgswteos-10.h
326 lines (316 loc) · 19.4 KB
/
gswteos-10.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
/*
** $Id: gswteos-10.h,v 045882f2da27 2015/09/13 23:47:38 fdelahoyde $
** $Version: 3.05.0-2 $
**
** GSW TEOS-10 V3.05 definitions and prototypes.
*/
#ifndef GSWTEOS_10_H
#define GSWTEOS_10_H
#ifdef __cplusplus
# include <complex>
#else
# include <complex.h>
#endif
#ifdef _WIN32
# define DECLSPEC __declspec(dllexport)
#else
# define DECLSPEC
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <errno.h>
#define GSW_INVALID_VALUE 9e15 /* error return from gsw_saar et al. */
#define GSW_ERROR_LIMIT 1e10
#define INTERP_METHOD_LINEAR 1
#define INTERP_METHOD_PCHIP 2
#define INTERP_METHOD_MRST 3
/*
** Prototypes:
*/
DECLSPEC extern void gsw_add_barrier(double *input_data, double lon, double lat,
double long_grid, double lat_grid, double dlong_grid,
double dlat_grid, double *output_data);
DECLSPEC extern void gsw_add_mean(double *data_in, double *data_out);
DECLSPEC extern int gsw_infunnel(double sa, double ct, double p);
DECLSPEC extern double gsw_adiabatic_lapse_rate_from_ct(double sa, double ct, double p);
DECLSPEC extern double gsw_adiabatic_lapse_rate_ice(double t, double p);
DECLSPEC extern double gsw_alpha(double sa, double ct, double p);
DECLSPEC extern double gsw_alpha_on_beta(double sa, double ct, double p);
DECLSPEC extern double gsw_alpha_wrt_t_exact(double sa, double t, double p);
DECLSPEC extern double gsw_alpha_wrt_t_ice(double t, double p);
DECLSPEC extern double gsw_beta_const_t_exact(double sa, double t, double p);
DECLSPEC extern double gsw_beta(double sa, double ct, double p);
DECLSPEC extern double gsw_cabbeling(double sa, double ct, double p);
DECLSPEC extern double gsw_c_from_sp(double sp, double t, double p);
DECLSPEC extern double gsw_chem_potential_water_ice(double t, double p);
DECLSPEC extern double gsw_chem_potential_water_t_exact(double sa, double t, double p);
DECLSPEC extern double gsw_cp_ice(double t, double p);
DECLSPEC extern double gsw_cp_t_exact(double sa, double t, double p);
DECLSPEC extern void gsw_ct_first_derivatives (double sa, double pt, double *ct_sa,
double *ct_pt);
DECLSPEC extern void gsw_ct_first_derivatives_wrt_t_exact(double sa, double t,
double p, double *ct_sa_wrt_t, double *ct_t_wrt_t,
double *ct_p_wrt_t);
DECLSPEC extern double gsw_ct_freezing(double sa, double p, double saturation_fraction);
DECLSPEC extern void gsw_ct_freezing_first_derivatives(double sa, double p,
double saturation_fraction, double *ctfreezing_sa,
double *ctfreezing_p);
DECLSPEC extern void gsw_ct_freezing_first_derivatives_poly(double sa, double p,
double saturation_fraction, double *ctfreezing_sa,
double *ctfreezing_p);
DECLSPEC extern double gsw_ct_freezing_poly(double sa, double p,
double saturation_fraction);
DECLSPEC extern double gsw_ct_from_enthalpy(double sa, double h, double p);
DECLSPEC extern double gsw_ct_from_enthalpy_exact(double sa, double h, double p);
DECLSPEC extern double gsw_ct_from_entropy(double sa, double entropy);
DECLSPEC extern double gsw_ct_from_pt(double sa, double pt);
DECLSPEC extern void gsw_ct_from_rho(double rho, double sa, double p, double *ct,
double *ct_multiple);
DECLSPEC extern double gsw_ct_from_t(double sa, double t, double p);
DECLSPEC extern double gsw_ct_maxdensity(double sa, double p);
DECLSPEC extern void gsw_ct_second_derivatives(double sa, double pt, double *ct_sa_sa,
double *ct_sa_pt, double *ct_pt_pt);
DECLSPEC extern double gsw_deltasa_atlas(double p, double lon, double lat);
DECLSPEC extern double gsw_deltasa_from_sp(double sp, double p, double lon, double lat);
DECLSPEC extern double gsw_dilution_coefficient_t_exact(double sa, double t, double p);
DECLSPEC extern double gsw_dynamic_enthalpy(double sa, double ct, double p);
DECLSPEC extern double gsw_enthalpy_ct_exact(double sa, double ct, double p);
DECLSPEC extern double gsw_enthalpy_diff(double sa, double ct, double p_shallow,
double p_deep);
DECLSPEC extern double gsw_enthalpy(double sa, double ct, double p);
DECLSPEC extern void gsw_enthalpy_first_derivatives_ct_exact(double sa, double ct,
double p, double *h_sa, double *h_ct);
DECLSPEC extern void gsw_enthalpy_first_derivatives(double sa, double ct, double p,
double *h_sa, double *h_ct);
DECLSPEC extern double gsw_enthalpy_ice(double t, double p);
DECLSPEC extern void gsw_enthalpy_second_derivatives_ct_exact(double sa, double ct,
double p, double *h_sa_sa, double *h_sa_ct, double *h_ct_ct);
DECLSPEC extern void gsw_enthalpy_second_derivatives(double sa, double ct, double p,
double *h_sa_sa, double *h_sa_ct, double *h_ct_ct);
DECLSPEC extern double gsw_enthalpy_sso_0(double p);
DECLSPEC extern double gsw_enthalpy_t_exact(double sa, double t, double p);
DECLSPEC extern void gsw_entropy_first_derivatives(double sa, double ct,
double *eta_sa, double *eta_ct);
DECLSPEC extern double gsw_entropy_from_ct(double sa, double ct);
DECLSPEC extern double gsw_entropy_from_pt(double sa, double pt);
DECLSPEC extern double gsw_entropy_from_t(double sa, double t, double p);
DECLSPEC extern double gsw_entropy_ice(double t, double p);
DECLSPEC extern double gsw_entropy_part(double sa, double t, double p);
DECLSPEC extern double gsw_entropy_part_zerop(double sa, double pt0);
DECLSPEC extern void gsw_entropy_second_derivatives(double sa, double ct,
double *eta_sa_sa, double *eta_sa_ct, double *eta_ct_ct);
DECLSPEC extern double gsw_fdelta(double p, double lon, double lat);
DECLSPEC extern void gsw_frazil_properties(double sa_bulk, double h_bulk, double p,
double *sa_final, double *ct_final, double *w_ih_final);
DECLSPEC extern void gsw_frazil_properties_potential(double sa_bulk, double h_pot_bulk,
double p, double *sa_final, double *ct_final,
double *w_ih_final);
DECLSPEC extern void gsw_frazil_properties_potential_poly(double sa_bulk,
double h_pot_bulk, double p, double *sa_final, double *ct_final,
double *w_ih_final);
DECLSPEC extern void gsw_frazil_ratios_adiabatic(double sa, double p, double w_ih,
double *dsa_dct_frazil, double *dsa_dp_frazil,
double *dct_dp_frazil);
DECLSPEC extern void gsw_frazil_ratios_adiabatic_poly(double sa, double p,
double w_ih, double *dsa_dct_frazil, double *dsa_dp_frazil,
double *dct_dp_frazil);
DECLSPEC extern double *gsw_geo_strf_dyn_height(double *sa, double *ct, double *p,
double p_ref, int n_levels, double *dyn_height);
DECLSPEC extern int gsw_geo_strf_dyn_height_1(double *sa, double *ct, double *p,
double p_ref, int n_levels, double *dyn_height,
double max_dp_i, int interp_method);
DECLSPEC extern double *gsw_geo_strf_dyn_height_pc(double *sa, double *ct,
double *delta_p, int n_levels, double *geo_strf_dyn_height_pc,
double *p_mid);
DECLSPEC extern double gsw_gibbs_ice (int nt, int np, double t, double p);
DECLSPEC extern double gsw_gibbs_ice_part_t(double t, double p);
DECLSPEC extern double gsw_gibbs_ice_pt0(double pt0);
DECLSPEC extern double gsw_gibbs_ice_pt0_pt0(double pt0);
DECLSPEC extern double gsw_gibbs(int ns, int nt, int np, double sa, double t, double p);
DECLSPEC extern double gsw_gibbs_pt0_pt0(double sa, double pt0);
DECLSPEC extern double gsw_grav(double lat, double p);
DECLSPEC extern double gsw_helmholtz_energy_ice(double t, double p);
DECLSPEC extern double gsw_hill_ratio_at_sp2(double t);
DECLSPEC extern void gsw_ice_fraction_to_freeze_seawater(double sa, double ct,
double p, double t_ih, double *sa_freeze, double *ct_freeze,
double *w_ih);
DECLSPEC extern double gsw_internal_energy(double sa, double ct, double p);
DECLSPEC extern double gsw_internal_energy_ice(double t, double p);
DECLSPEC extern void gsw_ipv_vs_fnsquared_ratio(double *sa, double *ct, double *p,
double p_ref, int nz, double *ipv_vs_fnsquared_ratio,
double *p_mid);
DECLSPEC extern double gsw_kappa_const_t_ice(double t, double p);
DECLSPEC extern double gsw_kappa(double sa, double ct, double p);
DECLSPEC extern double gsw_kappa_ice(double t, double p);
DECLSPEC extern double gsw_kappa_t_exact(double sa, double t, double p);
DECLSPEC extern double gsw_latentheat_evap_ct(double sa, double ct);
DECLSPEC extern double gsw_latentheat_evap_t(double sa, double t);
DECLSPEC extern double gsw_latentheat_melting(double sa, double p);
DECLSPEC extern void gsw_linear_interp_sa_ct(double *sa, double *ct, double *p, int np,
double *p_i, int npi, double *sa_i, double *ct_i);
DECLSPEC extern double gsw_melting_ice_equilibrium_sa_ct_ratio(double sa, double p);
DECLSPEC extern double gsw_melting_ice_equilibrium_sa_ct_ratio_poly(double sa, double p);
DECLSPEC extern void gsw_melting_ice_into_seawater(double sa, double ct, double p,
double w_ih, double t_ih, double *sa_final, double *ct_final,
double *w_ih_final);
DECLSPEC extern double gsw_melting_ice_sa_ct_ratio(double sa, double ct, double p,
double t_ih);
DECLSPEC extern double gsw_melting_ice_sa_ct_ratio_poly(double sa, double ct, double p,
double t_ih);
DECLSPEC extern double gsw_melting_seaice_equilibrium_sa_ct_ratio(double sa, double p);
DECLSPEC extern double gsw_melting_seaice_equilibrium_sa_ct_ratio_poly(double sa,
double p);
DECLSPEC extern void gsw_melting_seaice_into_seawater(double sa, double ct, double p,
double w_seaice, double sa_seaice, double t_seaice,
double *sa_final, double *ct_final);
DECLSPEC extern double gsw_melting_seaice_sa_ct_ratio(double sa, double ct, double p,
double sa_seaice, double t_seaice);
DECLSPEC extern double gsw_melting_seaice_sa_ct_ratio_poly(double sa, double ct,
double p, double sa_seaice, double t_seaice);
DECLSPEC extern void gsw_nsquared(double *sa, double *ct, double *p, double *lat,
int nz, double *n2, double *p_mid);
DECLSPEC extern double gsw_o2sol(double sa, double ct, double p, double lon, double lat);
DECLSPEC extern double gsw_o2sol_sp_pt(double sp, double pt);
DECLSPEC extern double gsw_pot_enthalpy_from_pt_ice(double pt0_ice);
DECLSPEC extern double gsw_pot_enthalpy_from_pt_ice_poly(double pt0_ice);
DECLSPEC extern double gsw_pot_enthalpy_ice_freezing(double sa, double p);
DECLSPEC extern void gsw_pot_enthalpy_ice_freezing_first_derivatives(double sa,
double p, double *pot_enthalpy_ice_freezing_sa,
double *pot_enthalpy_ice_freezing_p);
DECLSPEC extern void gsw_pot_enthalpy_ice_freezing_first_derivatives_poly(double sa,
double p, double *pot_enthalpy_ice_freezing_sa,
double *pot_enthalpy_ice_freezing_p);
DECLSPEC extern double gsw_pot_enthalpy_ice_freezing_poly(double sa, double p);
DECLSPEC extern double gsw_pot_rho_t_exact(double sa, double t, double p, double p_ref);
DECLSPEC extern double gsw_pressure_coefficient_ice(double t, double p);
DECLSPEC extern double gsw_pressure_freezing_ct(double sa, double ct,
double saturation_fraction);
DECLSPEC extern double gsw_pt0_cold_ice_poly(double pot_enthalpy_ice);
DECLSPEC extern double gsw_pt0_from_t(double sa, double t, double p);
DECLSPEC extern double gsw_pt0_from_t_ice(double t, double p);
DECLSPEC extern void gsw_pt_first_derivatives (double sa, double ct, double *pt_sa,
double *pt_ct);
DECLSPEC extern double gsw_pt_from_ct(double sa, double ct);
DECLSPEC extern double gsw_pt_from_entropy(double sa, double entropy);
DECLSPEC extern double gsw_pt_from_pot_enthalpy_ice(double pot_enthalpy_ice);
DECLSPEC extern double gsw_pt_from_pot_enthalpy_ice_poly_dh(double pot_enthalpy_ice);
DECLSPEC extern double gsw_pt_from_pot_enthalpy_ice_poly(double pot_enthalpy_ice);
DECLSPEC extern double gsw_pt_from_t(double sa, double t, double p, double p_ref);
DECLSPEC extern double gsw_pt_from_t_ice(double t, double p, double p_ref);
DECLSPEC extern void gsw_pt_second_derivatives (double sa, double ct, double *pt_sa_sa,
double *pt_sa_ct, double *pt_ct_ct);
DECLSPEC extern void gsw_rho_alpha_beta (double sa, double ct, double p, double *rho,
double *alpha, double *beta);
DECLSPEC extern double gsw_rho(double sa, double ct, double p);
DECLSPEC extern void gsw_rho_first_derivatives(double sa, double ct, double p,
double *drho_dsa, double *drho_dct, double *drho_dp);
DECLSPEC extern void gsw_rho_first_derivatives_wrt_enthalpy (double sa, double ct,
double p, double *rho_sa, double *rho_h);
DECLSPEC extern double gsw_rho_ice(double t, double p);
DECLSPEC extern void gsw_rho_second_derivatives(double sa, double ct, double p,
double *rho_sa_sa, double *rho_sa_ct, double *rho_ct_ct,
double *rho_sa_p, double *rho_ct_p);
DECLSPEC extern void gsw_rho_second_derivatives_wrt_enthalpy(double sa, double ct,
double p, double *rho_sa_sa, double *rho_sa_h, double *rho_h_h);
DECLSPEC extern double gsw_rho_t_exact(double sa, double t, double p);
DECLSPEC extern void gsw_rr68_interp_sa_ct(double *sa, double *ct, double *p, int mp,
double *p_i, int mp_i, double *sa_i, double *ct_i);
DECLSPEC extern double gsw_saar(double p, double lon, double lat);
DECLSPEC extern int gsw_sa_ct_interp(double *sa, double *ct, double *p,
int m, double *p_i, int m_i, double *sa_i, double *ct_i);
DECLSPEC extern double gsw_sa_freezing_estimate(double p, double saturation_fraction,
double *ct, double *t);
DECLSPEC extern double gsw_sa_freezing_from_ct(double ct, double p,
double saturation_fraction);
DECLSPEC extern double gsw_sa_freezing_from_ct_poly(double ct, double p,
double saturation_fraction);
DECLSPEC extern double gsw_sa_freezing_from_t(double t, double p,
double saturation_fraction);
DECLSPEC extern double gsw_sa_freezing_from_t_poly(double t, double p,
double saturation_fraction);
DECLSPEC extern double gsw_sa_from_rho(double rho, double ct, double p);
DECLSPEC extern double gsw_sa_from_sp_baltic(double sp, double lon, double lat);
DECLSPEC extern double gsw_sa_from_sp(double sp, double p, double lon, double lat);
DECLSPEC extern double gsw_sa_from_sstar(double sstar, double p,double lon,double lat);
DECLSPEC extern int gsw_sa_p_inrange(double sa, double p);
DECLSPEC extern void gsw_seaice_fraction_to_freeze_seawater(double sa, double ct,
double p, double sa_seaice, double t_seaice, double *sa_freeze,
double *ct_freeze, double *w_seaice);
DECLSPEC extern double gsw_sigma0(double sa, double ct);
DECLSPEC extern double gsw_sigma1(double sa, double ct);
DECLSPEC extern double gsw_sigma2(double sa, double ct);
DECLSPEC extern double gsw_sigma3(double sa, double ct);
DECLSPEC extern double gsw_sigma4(double sa, double ct);
DECLSPEC extern double gsw_sound_speed(double sa, double ct, double p);
DECLSPEC extern double gsw_sound_speed_ice(double t, double p);
DECLSPEC extern double gsw_sound_speed_t_exact(double sa, double t, double p);
DECLSPEC extern void gsw_specvol_alpha_beta(double sa, double ct, double p,
double *specvol, double *alpha, double *beta);
DECLSPEC extern double gsw_specvol_anom_standard(double sa, double ct, double p);
DECLSPEC extern double gsw_specvol(double sa, double ct, double p);
DECLSPEC extern void gsw_specvol_first_derivatives(double sa, double ct, double p,
double *v_sa, double *v_ct, double *v_p);
DECLSPEC extern void gsw_specvol_first_derivatives_wrt_enthalpy(double sa, double ct,
double p, double *v_sa, double *v_h);
DECLSPEC extern double gsw_specvol_ice(double t, double p);
DECLSPEC extern void gsw_specvol_second_derivatives (double sa, double ct, double p,
double *v_sa_sa, double *v_sa_ct, double *v_ct_ct,
double *v_sa_p, double *v_ct_p);
DECLSPEC extern void gsw_specvol_second_derivatives_wrt_enthalpy(double sa, double ct,
double p, double *v_sa_sa, double *v_sa_h, double *v_h_h);
DECLSPEC extern double gsw_specvol_sso_0(double p);
DECLSPEC extern double gsw_specvol_t_exact(double sa, double t, double p);
DECLSPEC extern double gsw_sp_from_c(double c, double t, double p);
DECLSPEC extern double gsw_sp_from_sa_baltic(double sa, double lon, double lat);
DECLSPEC extern double gsw_sp_from_sa(double sa, double p, double lon, double lat);
DECLSPEC extern double gsw_sp_from_sk(double sk);
DECLSPEC extern double gsw_sp_from_sr(double sr);
DECLSPEC extern double gsw_sp_from_sstar(double sstar, double p,double lon,double lat);
DECLSPEC extern double gsw_sp_salinometer(double rt, double t);
DECLSPEC extern double gsw_spiciness0(double sa, double ct);
DECLSPEC extern double gsw_spiciness1(double sa, double ct);
DECLSPEC extern double gsw_spiciness2(double sa, double ct);
DECLSPEC extern double gsw_sr_from_sp(double sp);
DECLSPEC extern double gsw_sstar_from_sa(double sa, double p, double lon, double lat);
DECLSPEC extern double gsw_sstar_from_sp(double sp, double p, double lon, double lat);
DECLSPEC extern double gsw_t_deriv_chem_potential_water_t_exact(double sa, double t,
double p);
DECLSPEC extern double gsw_t_freezing(double sa, double p, double saturation_fraction);
DECLSPEC extern void gsw_t_freezing_first_derivatives_poly(double sa, double p,
double saturation_fraction, double *tfreezing_sa,
double *tfreezing_p);
DECLSPEC extern void gsw_t_freezing_first_derivatives(double sa, double p,
double saturation_fraction, double *tfreezing_sa,
double *tfreezing_p);
DECLSPEC extern double gsw_t_freezing_poly(double sa, double p,
double saturation_fraction);
DECLSPEC extern double gsw_t_from_ct(double sa, double ct, double p);
DECLSPEC extern double gsw_t_from_pt0_ice(double pt0_ice, double p);
DECLSPEC extern double gsw_thermobaric(double sa, double ct, double p);
DECLSPEC extern int gsw_tracer_ct_interp(double *tracer, double *ct, double *p,
int m, double *p_i, int m_i, double factor, double *sa_i, double *ct_i);
DECLSPEC extern void gsw_turner_rsubrho(double *sa, double *ct, double *p, int nz,
double *tu, double *rsubrho, double *p_mid);
DECLSPEC extern int gsw_util_indx(double *x, int n, double z);
DECLSPEC extern double *gsw_util_interp1q_int(int nx, double *x, int *iy, int nxi,
double *x_i, double *y_i);
DECLSPEC extern int gsw_util_intersect(double *x, int nx, double *y, int ny, int *ix, int *iy);
DECLSPEC extern double *gsw_util_linear_interp(int nx, double *x, int ny, double *y,
int nxi, double *x_i, double *y_i);
DECLSPEC extern void gsw_util_sort_real(double *rarray, int nx, int *iarray);
DECLSPEC extern double gsw_util_xinterp1(double *x, double *y, int n, double x0);
DECLSPEC extern int gsw_util_pchip_interp(double *x, double *y, int n,
double *xi, double *yi, int ni);
DECLSPEC extern double gsw_z_from_p(double p, double lat, double geo_strf_dyn_height,
double sea_surface_geopotential);
DECLSPEC extern double gsw_p_from_z(double z, double lat, double geo_strf_dyn_height,
double sea_surface_geopotential);
#ifdef __cplusplus
}
#endif
#endif /* GSWTEOS_10_H */