11 use gsw_mod_toolbox,
only : gsw_sp_from_sr, gsw_pt_from_ct
12 use gsw_mod_toolbox,
only : gsw_rho, gsw_specvol
13 use gsw_mod_toolbox,
only : gsw_rho_first_derivatives, gsw_specvol_first_derivatives
14 use gsw_mod_toolbox,
only : gsw_rho_second_derivatives
17 implicit none ;
private
23 public gsw_sp_from_sr, gsw_pt_from_ct
51 real,
parameter ::
pa2db = 1.e-4
62 real,
intent(in) :: pressure
63 real,
intent(out) :: rho
64 real,
optional,
intent(in) :: rho_ref
67 real,
dimension(1) :: T0, S0, pressure0
68 real,
dimension(1) :: rho0
72 pressure0(1) = pressure
84 real,
dimension(:),
intent(in) :: T
85 real,
dimension(:),
intent(in) :: S
86 real,
dimension(:),
intent(in) :: pressure
87 real,
dimension(:),
intent(out) :: rho
88 integer,
intent(in) :: start
89 integer,
intent(in) :: npts
90 real,
optional,
intent(in) :: rho_ref
96 do j=start,start+npts-1
100 zp = pressure(j)*
pa2db
102 if (s(j) < -1.0e-10)
then
105 rho(j) = gsw_rho(zs,zt,zp)
107 if (
present(rho_ref)) rho(j) = rho(j) - rho_ref
116 real,
intent(in) :: T
117 real,
intent(in) :: S
118 real,
intent(in) :: pressure
119 real,
intent(out) :: specvol
120 real,
optional,
intent(in) :: spv_ref
123 real,
dimension(1) :: T0, S0, pressure0, spv0
125 t0(1) = t ; s0(1) = s ; pressure0(1) = pressure
137 real,
dimension(:),
intent(in) :: T
139 real,
dimension(:),
intent(in) :: S
140 real,
dimension(:),
intent(in) :: pressure
141 real,
dimension(:),
intent(out) :: specvol
142 integer,
intent(in) :: start
143 integer,
intent(in) :: npts
144 real,
optional,
intent(in) :: spv_ref
150 do j=start,start+npts-1
154 zp = pressure(j)*
pa2db
156 if (s(j) < -1.0e-10)
then
159 specvol(j) = gsw_specvol(zs,zt,zp)
161 if (
present(spv_ref)) specvol(j) = specvol(j) - spv_ref
169 real,
intent(in),
dimension(:) :: T
170 real,
intent(in),
dimension(:) :: S
171 real,
intent(in),
dimension(:) :: pressure
172 real,
intent(out),
dimension(:) :: drho_dT
174 real,
intent(out),
dimension(:) :: drho_dS
176 integer,
intent(in) :: start
177 integer,
intent(in) :: npts
183 do j=start,start+npts-1
187 zp = pressure(j)*
pa2db
188 if (s(j) < -1.0e-10)
then ;
189 drho_dt(j) = 0.0 ; drho_ds(j) = 0.0
191 call gsw_rho_first_derivatives(zs, zt, zp, drho_dsa=drho_ds(j), drho_dct=drho_dt(j))
200 real,
intent(in) :: T
201 real,
intent(in) :: S
202 real,
intent(in) :: pressure
203 real,
intent(out) :: drho_dT
205 real,
intent(out) :: drho_dS
214 if (s < -1.0e-10)
return
215 call gsw_rho_first_derivatives(zs, zt, zp, drho_dsa=drho_ds, drho_dct=drho_dt)
221 real,
intent(in),
dimension(:) :: t
222 real,
intent(in),
dimension(:) :: s
223 real,
intent(in),
dimension(:) :: pressure
224 real,
intent(out),
dimension(:) :: dsv_dt
226 real,
intent(out),
dimension(:) :: dsv_ds
228 integer,
intent(in) :: start
229 integer,
intent(in) :: npts
235 do j=start,start+npts-1
239 zp = pressure(j)*
pa2db
240 if (s(j) < -1.0e-10)
then ;
241 dsv_dt(j) = 0.0 ; dsv_ds(j) = 0.0
243 call gsw_specvol_first_derivatives(zs,zt,zp, v_sa=dsv_ds(j), v_ct=dsv_dt(j))
251 drho_dT_dT, drho_dS_dP, drho_dT_dP)
252 real,
intent(in) :: T
253 real,
intent(in) :: S
254 real,
intent(in) :: pressure
255 real,
intent(out) :: drho_dS_dS
256 real,
intent(out) :: drho_dS_dT
257 real,
intent(out) :: drho_dT_dT
258 real,
intent(out) :: drho_dS_dP
259 real,
intent(out) :: drho_dT_dP
268 if (s < -1.0e-10)
return
269 call gsw_rho_second_derivatives(zs, zt, zp, rho_sa_sa=drho_ds_ds, rho_sa_ct=drho_ds_dt, &
270 rho_ct_ct=drho_dt_dt, rho_sa_p=drho_ds_dp, rho_ct_p=drho_dt_dp)
276 drho_dT_dT, drho_dS_dP, drho_dT_dP, start, npts)
277 real,
dimension(:),
intent(in) :: T
278 real,
dimension(:),
intent(in) :: S
279 real,
dimension(:),
intent(in) :: pressure
280 real,
dimension(:),
intent(out) :: drho_dS_dS
281 real,
dimension(:),
intent(out) :: drho_dS_dT
282 real,
dimension(:),
intent(out) :: drho_dT_dT
283 real,
dimension(:),
intent(out) :: drho_dS_dP
284 real,
dimension(:),
intent(out) :: drho_dT_dP
285 integer,
intent(in) :: start
286 integer,
intent(in) :: npts
292 do j=start,start+npts-1
296 zp = pressure(j)*
pa2db
297 if (s(j) < -1.0e-10)
then ;
298 drho_ds_ds(j) = 0.0 ; drho_ds_dt(j) = 0.0 ; drho_dt_dt(j) = 0.0
299 drho_ds_dp(j) = 0.0 ; drho_dt_dp(j) = 0.0
301 call gsw_rho_second_derivatives(zs, zt, zp, rho_sa_sa=drho_ds_ds(j), rho_sa_ct=drho_ds_dt(j), &
302 rho_ct_ct=drho_dt_dt(j), rho_sa_p=drho_ds_dp(j), rho_ct_p=drho_dt_dp(j))
314 real,
intent(in),
dimension(:) :: t
315 real,
intent(in),
dimension(:) :: s
316 real,
intent(in),
dimension(:) :: pressure
317 real,
intent(out),
dimension(:) :: rho
318 real,
intent(out),
dimension(:) :: drho_dp
321 integer,
intent(in) :: start
322 integer,
intent(in) :: npts
328 do j=start,start+npts-1
332 zp = pressure(j)*
pa2db
333 if (s(j) < -1.0e-10)
then ;
334 rho(j) = 1000.0 ; drho_dp(j) = 0.0
336 rho(j) = gsw_rho(zs,zt,zp)
337 call gsw_rho_first_derivatives(zs,zt,zp, drho_dp=drho_dp(j))