FV3 Bundle
gsw_t_freezing_poly.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental function gsw_t_freezing_poly (sa, p, saturation_fraction, polynomial)
3 !==========================================================================
4 !
5 ! Calculates the in-situ temperature at which seawater freezes from a
6 ! computationally efficient polynomial.
7 !
8 ! SA = Absolute Salinity [ g/kg ]
9 ! p = sea pressure [ dbar ]
10 ! ( i.e. absolute pressure - 10.1325 dbar )
11 ! saturation_fraction = the saturation fraction of dissolved air in
12 ! seawater
13 !
14 ! t_freezing = in-situ temperature at which seawater freezes. [ deg C ]
15 ! (ITS-90)
16 !--------------------------------------------------------------------------
17 
19 
21 
23 
24 use gsw_mod_kinds
25 
26 implicit none
27 
28 real (r8), intent(in) :: sa, p
29 real (r8), intent(in), optional :: saturation_fraction
30 logical, intent(in), optional :: polynomial
31 
32 real (r8) :: gsw_t_freezing_poly
33 
34 real (r8) :: p_r, sa_r, x, ctf, sfrac
35 logical :: direct_poly
36 
37 if (present(polynomial)) then
38  direct_poly = polynomial
39 else
40  direct_poly = .false.
41 end if
42 
43 if (.not. direct_poly) then
44 
45  if (present(saturation_fraction)) then
46  sfrac = saturation_fraction
47  else
48  sfrac = 1.0_r8
49  end if
50 
51  ctf = gsw_ct_freezing_poly(sa,p,sfrac)
53 
54 else
55 
56  ! Alternative calculation ...
57  sa_r = sa*1e-2_r8
58  x = sqrt(sa_r)
59  p_r = p*1e-4_r8
60 
62  + sa_r*(t1 + x*(t2 + x*(t3 + x*(t4 + x*(t5 + t6*x))))) &
63  + p_r*(t7 + p_r*(t8 + t9*p_r)) &
64  + sa_r*p_r*(t10 + p_r*(t12 + p_r*(t15 + t21*sa_r)) &
65  + sa_r*(t13 + t17*p_r + t19*sa_r) &
66  + x*(t11 + p_r*(t14 + t18*p_r) + sa_r*(t16 + t20*p_r + t22*sa_r)))
67 
68  if (.not. present(saturation_fraction)) return
69 
70  ! Adjust for the effects of dissolved air
72  saturation_fraction*(1e-3_r8)*(2.4_r8 - sa/(2.0_r8*gsw_sso))
73 end if
74 
75 return
76 end function
77 
78 !--------------------------------------------------------------------------
elemental real(r8) function gsw_t_freezing_poly(sa, p, saturation_fraction, polynomial)