3 h_pot_bulk, p, sa_final, ct_final, w_ih_final)
61 real (r8),
intent(in) :: sa_bulk, h_pot_bulk, p
62 real (r8),
intent(out) :: sa_final, ct_final, w_ih_final
64 integer :: iterations, max_iterations
66 real (r8) :: ctf_sa, ctf, dfunc_dw_ih, dfunc_dw_ih_mean_poly, dpot_h_ihf_dsa
67 real (r8) :: func, func0, h_pot_ihf, sa, w_ih_old, w_ih, x, xa, y, z
69 real (r8),
parameter :: f01 = -9.041191886754806e-1_r8
70 real (r8),
parameter :: f02 = 4.169608567309818e-2_r8
71 real (r8),
parameter :: f03 = -9.325971761333677e-3_r8
72 real (r8),
parameter :: f04 = 4.699055851002199e-2_r8
73 real (r8),
parameter :: f05 = -3.086923404061666e-2_r8
74 real (r8),
parameter :: f06 = 1.057761186019000e-2_r8
75 real (r8),
parameter :: f07 = -7.349302346007727e-2_r8
76 real (r8),
parameter :: f08 = 1.444842576424337e-1_r8
77 real (r8),
parameter :: f09 = -1.408425967872030e-1_r8
78 real (r8),
parameter :: f10 = 1.070981398567760e-1_r8
79 real (r8),
parameter :: f11 = -1.768451760854797e-2_r8
80 real (r8),
parameter :: f12 = -4.013688314067293e-1_r8
81 real (r8),
parameter :: f13 = 7.209753205388577e-1_r8
82 real (r8),
parameter :: f14 = -1.807444462285120e-1_r8
83 real (r8),
parameter :: f15 = 1.362305015808993e-1_r8
84 real (r8),
parameter :: f16 = -9.500974920072897e-1_r8
85 real (r8),
parameter :: f17 = 1.192134856624248_r8
86 real (r8),
parameter :: f18 = -9.191161283559850e-2_r8
87 real (r8),
parameter :: f19 = -1.008594411490973_r8
88 real (r8),
parameter :: f20 = 8.020279271484482e-1_r8
89 real (r8),
parameter :: f21 = -3.930534388853466e-1_r8
90 real (r8),
parameter :: f22 = -2.026853316399942e-2_r8
91 real (r8),
parameter :: f23 = -2.722731069001690e-2_r8
92 real (r8),
parameter :: f24 = 5.032098120548072e-2_r8
93 real (r8),
parameter :: f25 = -2.354888890484222e-2_r8
94 real (r8),
parameter :: f26 = -2.454090179215001e-2_r8
95 real (r8),
parameter :: f27 = 4.125987229048937e-2_r8
96 real (r8),
parameter :: f28 = -3.533404753585094e-2_r8
97 real (r8),
parameter :: f29 = 3.766063025852511e-2_r8
98 real (r8),
parameter :: f30 = -3.358409746243470e-2_r8
99 real (r8),
parameter :: f31 = -2.242158862056258e-2_r8
100 real (r8),
parameter :: f32 = 2.102254738058931e-2_r8
101 real (r8),
parameter :: f33 = -3.048635435546108e-2_r8
102 real (r8),
parameter :: f34 = -1.996293091714222e-2_r8
103 real (r8),
parameter :: f35 = 2.577703068234217e-2_r8
104 real (r8),
parameter :: f36 = -1.292053030649309e-2_r8
106 real (r8),
parameter :: g01 = 3.332286683867741e5_r8
107 real (r8),
parameter :: g02 = 1.416532517833479e4_r8
108 real (r8),
parameter :: g03 = -1.021129089258645e4_r8
109 real (r8),
parameter :: g04 = 2.356370992641009e4_r8
110 real (r8),
parameter :: g05 = -8.483432350173174e3_r8
111 real (r8),
parameter :: g06 = 2.279927781684362e4_r8
112 real (r8),
parameter :: g07 = 1.506238790315354e4_r8
113 real (r8),
parameter :: g08 = 4.194030718568807e3_r8
114 real (r8),
parameter :: g09 = -3.146939594885272e5_r8
115 real (r8),
parameter :: g10 = -7.549939721380912e4_r8
116 real (r8),
parameter :: g11 = 2.790535212869292e6_r8
117 real (r8),
parameter :: g12 = 1.078851928118102e5_r8
118 real (r8),
parameter :: g13 = -1.062493860205067e7_r8
119 real (r8),
parameter :: g14 = 2.082909703458225e7_r8
120 real (r8),
parameter :: g15 = -2.046810820868635e7_r8
121 real (r8),
parameter :: g16 = 8.039606992745191e6_r8
122 real (r8),
parameter :: g17 = -2.023984705844567e4_r8
123 real (r8),
parameter :: g18 = 2.871769638352535e4_r8
124 real (r8),
parameter :: g19 = -1.444841553038544e4_r8
125 real (r8),
parameter :: g20 = 2.261532522236573e4_r8
126 real (r8),
parameter :: g21 = -2.090579366221046e4_r8
127 real (r8),
parameter :: g22 = -1.128417003723530e4_r8
128 real (r8),
parameter :: g23 = 3.222965226084112e3_r8
129 real (r8),
parameter :: g24 = -1.226388046175992e4_r8
130 real (r8),
parameter :: g25 = 1.506847628109789e4_r8
131 real (r8),
parameter :: g26 = -4.584670946447444e4_r8
132 real (r8),
parameter :: g27 = 1.596119496322347e4_r8
133 real (r8),
parameter :: g28 = -6.338852410446789e4_r8
134 real (r8),
parameter :: g29 = 8.951570926106525e4_r8
136 real (r8),
parameter :: saturation_fraction = 0.0_r8
138 character (*),
parameter :: func_name =
"gsw_frazil_properties_potential" 144 func0 = h_pot_bulk - &
150 if (func0 >= 0.0_r8)
then 172 w_ih = y*(f01 + x*(f02 + x*(f03 + x*(f04 + x*(f05 + f06*x)))) &
173 + y*(f07 + x*(f08 + x*(f09 + x*(f10 + f11*x))) + y*(f12 + x*(f13 &
174 + x*(f14 + f15*x)) + y*(f16 + x*(f17 + f18*x) + y*(f19 + f20*x &
175 + f21*y)))) + z*(f22 + x*(f23 + x*(f24 + f25*x)) + y*(x*(f26 + f27*x) &
176 + y*(f28 + f29*x + f30*y)) + z*(f31 + x*(f32 + f33*x) + y*(f34 &
179 if (w_ih .gt. 0.9_r8)
then 183 w_ih_final = sa_final
188 sa = sa_bulk/(1.0_r8 - w_ih)
196 func = h_pot_bulk - (1.0_r8 - w_ih)*
gsw_cp0*ctf - w_ih*h_pot_ihf
200 dfunc_dw_ih_mean_poly = g01 + xa*(g02 + xa*(g03 + xa*(g04 + g05*xa))) &
201 + w_ih*(xa*(g06 + xa*(g07 + g08*xa)) + w_ih*(xa*(g09 + g10*xa) &
202 + w_ih*xa*(g11 + g12*xa + w_ih*(g13 + w_ih*(g14 + w_ih*(g15 &
203 + g16*w_ih)))))) + z*(g17 + xa*(g18 + g19*xa) + w_ih*(g20 &
204 + w_ih*(g21 + g22*w_ih) + xa*(g23 + g24*xa*w_ih)) &
205 + z*(g25 + xa*(g26 + g27*xa) + w_ih*(g28 + g29*w_ih)))
208 w_ih = w_ih_old - func/dfunc_dw_ih_mean_poly
210 sa = sa_bulk/(1.0_r8 - w_ih)
223 dfunc_dw_ih =
gsw_cp0*ctf - h_pot_ihf - &
224 sa*(
gsw_cp0*ctf_sa + w_ih*dpot_h_ihf_dsa/(1.0_r8 - w_ih))
226 if (w_ih .ge. 0.0_r8 .and. w_ih .le. 0.20_r8 .and. sa .gt. 15.0_r8 &
227 .and. sa .lt. 60.0_r8 .and. p .le. 3000.0_r8)
then 229 else if (w_ih .ge. 0.0_r8 .and. w_ih .le. 0.85_r8 .and. sa .gt. 0.0_r8 &
230 .and. sa .lt. 120.0_r8 .and. p .le. 3500.0_r8)
then 236 do iterations = 1, max_iterations
238 if (iterations .gt. 1)
then 245 func = h_pot_bulk - (1.0_r8 - w_ih)*
gsw_cp0*ctf - w_ih*h_pot_ihf
248 w_ih = w_ih_old - func/dfunc_dw_ih
250 if (w_ih .gt. 0.9_r8)
then 253 w_ih_final = sa_final
257 sa = sa_bulk/(1.0_r8 - w_ih)
261 if (w_ih .lt. 0.0_r8)
then
real(r8), parameter, public gsw_error_limit
elemental subroutine gsw_frazil_properties_potential_poly(sa_bulk, h_pot_bulk, p, sa_final, ct_final, w_ih_final)
real(r8), parameter gsw_cp0
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)