FV3 Bundle
gsw_hill_ratio_at_sp2.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental function gsw_hill_ratio_at_sp2 (t)
3 !==========================================================================
4 !
5 ! Calculates the Hill ratio, which is the adjustment needed to apply for
6 ! Practical Salinities smaller than 2. This ratio is defined at a
7 ! Practical Salinity = 2 and in-situ temperature, t using PSS-78. The Hill
8 ! ratio is the ratio of 2 to the output of the Hill et al. (1986) formula
9 ! for Practical Salinity at the conductivity ratio, Rt, at which Practical
10 ! Salinity on the PSS-78 scale is exactly 2.
11 !--------------------------------------------------------------------------
12 
14 
15 use gsw_mod_kinds
16 
17 implicit none
18 
19 real (r8), intent(in) :: t
20 
21 real (r8) :: gsw_hill_ratio_at_sp2
22 
23 real (r8), parameter :: g0 = 2.641463563366498e-1_r8
24 real (r8), parameter :: g1 = 2.007883247811176e-4_r8
25 real (r8), parameter :: g2 = -4.107694432853053e-6_r8
26 real (r8), parameter :: g3 = 8.401670882091225e-8_r8
27 real (r8), parameter :: g4 = -1.711392021989210e-9_r8
28 real (r8), parameter :: g5 = 3.374193893377380e-11_r8
29 real (r8), parameter :: g6 = -5.923731174730784e-13_r8
30 real (r8), parameter :: g7 = 8.057771569962299e-15_r8
31 real (r8), parameter :: g8 = -7.054313817447962e-17_r8
32 real (r8), parameter :: g9 = 2.859992717347235e-19_r8
33 real (r8), parameter :: sp2 = 2.0_r8
34 
35 real (r8) :: t68, ft68, rtx0, dsp_drtx, sp_est, rtx, rtxm, x, part1, part2
36 real (r8) :: sqrty, sp_hill_raw_at_sp2
37 
38 t68 = t*1.00024_r8
39 ft68 = (t68 - 15.0_r8)/(1.0_r8 + k*(t68 - 15.0_r8))
40 
41 !--------------------------------------------------------------------------
42 ! Find the initial estimates of Rtx (Rtx0) and of the derivative dSP_dRtx
43 ! at SP = 2.
44 !--------------------------------------------------------------------------
45 rtx0 = g0 + t68*(g1 + t68*(g2 + t68*(g3 + t68*(g4 + t68*(g5 &
46  + t68*(g6 + t68*(g7 + t68*(g8 + t68*g9))))))))
47 
48 dsp_drtx = a1 + (2.0_r8*a2 + (3.0_r8*a3 + (4.0_r8*a4 + 5.0_r8*a5*rtx0)*rtx0)* &
49  rtx0)*rtx0 + &
50  ft68*(b1 + (2.0_r8*b2 + (3.0_r8*b3 + (4.0_r8*b4 + 5.0_r8*b5*rtx0)*rtx0)* &
51  rtx0)*rtx0)
52 
53 !--------------------------------------------------------------------------
54 ! Begin a single modified Newton-Raphson iteration to find Rt at SP = 2.
55 !--------------------------------------------------------------------------
56 sp_est = a0 + (a1 + (a2 + (a3 + (a4 + a5*rtx0)*rtx0)*rtx0)*rtx0)*rtx0 &
57  + ft68*(b0 + (b1 + (b2 + (b3 + (b4 + b5*rtx0)*rtx0)*rtx0)*rtx0)*rtx0)
58 rtx = rtx0 - (sp_est - sp2)/dsp_drtx
59 rtxm = 0.5_r8*(rtx + rtx0)
60 dsp_drtx = a1 + (2.0_r8*a2 + (3.0_r8*a3 + (4.0_r8*a4 + 5.0_r8*a5*rtxm)*rtxm)* &
61  rtxm)*rtxm &
62  + ft68*(b1 + (2.0_r8*b2 + (3.0_r8*b3 + (4.0_r8*b4 + 5.0_r8*b5*rtxm)*rtxm)* &
63  rtxm)*rtxm)
64 rtx = rtx0 - (sp_est - sp2)/dsp_drtx
65 
66 ! This is the end of one full iteration of the modified Newton-Raphson
67 ! iterative equation solver. The error in Rtx at this point is equivalent
68 ! to an error in SP of 9e-16 psu.
69 
70 x = 400.0_r8*rtx*rtx
71 sqrty = 10.0_r8*rtx
72 part1 = 1.0_r8 + x*(1.5_r8 + x)
73 part2 = 1.0_r8 + sqrty*(1.0_r8 + sqrty*(1.0_r8 + sqrty))
74 sp_hill_raw_at_sp2 = sp2 - a0/part1 - b0*ft68/part2
75 
76 gsw_hill_ratio_at_sp2 = 2.0_r8/sp_hill_raw_at_sp2
77 
78 return
79 end function
80 
81 !--------------------------------------------------------------------------
elemental real(r8) function gsw_hill_ratio_at_sp2(t)