FV3 Bundle
gsw_sstar_from_sa.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental function gsw_sstar_from_sa (sa, p, long, lat)
3 !==========================================================================
4 !
5 ! Calculates Preformed Salinity, Sstar, from Absolute Salinity, SA.
6 !
7 ! sa : Absolute Salinity [g/kg]
8 ! p : sea pressure [dbar]
9 ! long : longitude [deg E]
10 ! lat : latitude [deg N]
11 !
12 ! gsw_sstar_from_sa : Preformed Salinity [g/kg]
13 !--------------------------------------------------------------------------
14 
15 use gsw_mod_toolbox, only : gsw_saar
16 
18 
19 use gsw_mod_kinds
20 
21 implicit none
22 
23 real (r8), intent(in) :: sa, p, long, lat
24 
25 real (r8) :: gsw_sstar_from_sa
26 
27 real (r8) :: saar
28 
29 character (*), parameter :: func_name = "gsw_sstar_from_sa"
30 
31 ! In the Baltic Sea, Sstar = sa, and note that gsw_saar returns zero
32 ! for saar in the Baltic.
33 
34 saar = gsw_saar(p,long,lat)
35 
36 if (saar.gt.gsw_error_limit) then
37  gsw_sstar_from_sa = gsw_error_code(1,func_name,saar)
38 else
39  gsw_sstar_from_sa = sa*(1.0_r8 - 0.35_r8*saar)/(1.0_r8 + saar)
40 end if
41 
42 return
43 end function
44 
45 !--------------------------------------------------------------------------
integer, parameter, public long
Definition: Type_Kinds.f90:76
real(r8), parameter, public gsw_error_limit
elemental real(r8) function gsw_sstar_from_sa(sa, p, long, lat)
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)