FV3 Bundle
gsw_sound_speed_t_exact.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental function gsw_sound_speed_t_exact (sa, t, p)
3 !==========================================================================
4 !
5 ! Calculates the sound speed of seawater
6 !
7 ! sa : Absolute Salinity [g/kg]
8 ! t : in-situ temperature [deg C]
9 ! p : sea pressure [dbar]
10 !
11 ! gsw_sound_speed_t_exact : sound speed [m/s]
12 !--------------------------------------------------------------------------
13 
14 use gsw_mod_toolbox, only : gsw_gibbs
15 
16 use gsw_mod_kinds
17 
18 implicit none
19 
20 real (r8), intent(in) :: sa, t, p
21 
22 real (r8) :: gsw_sound_speed_t_exact
23 
24 real (r8) :: g_tt, g_tp
25 
26 integer, parameter :: n0=0, n1=1, n2=2
27 
28 g_tt = gsw_gibbs(n0,n2,n0,sa,t,p)
29 g_tp = gsw_gibbs(n0,n1,n1,sa,t,p)
30 
31 gsw_sound_speed_t_exact = gsw_gibbs(n0,n0,n1,sa,t,p) * &
32  sqrt(g_tt/(g_tp*g_tp - g_tt*gsw_gibbs(n0,n0,n2,sa,t,p)))
33 
34 return
35 end function
36 
37 !--------------------------------------------------------------------------
elemental real(r8) function gsw_sound_speed_t_exact(sa, t, p)