3 sa_final, ct_final, w_ih_final)
56 real (r8),
intent(in) :: sa_bulk, h_bulk, p
57 real (r8),
intent(out) :: sa_final, ct_final, w_ih_final
59 integer :: number_of_iterations
60 real (r8) :: cp_ih, ctf_sa, ctf, dfunc_dw_ih, dfunc_dw_ih_mean_poly
61 real (r8) :: func, func0, hf, h_hat_ct, h_hat_sa
62 real (r8) :: h_ihf, sa, tf_sa, tf, w_ih_mean, w_ih_old, w_ih
65 real (r8),
parameter :: saturation_fraction = 0.0_r8
67 real (r8),
parameter :: num_f = 5.0e-2_r8
68 real (r8),
parameter :: num_f2 = 6.9e-7_r8
69 real (r8),
parameter :: num_p = 2.21_r8
71 character (*),
parameter :: func_name =
"gsw_frazil_properties" 86 if (func0 .ge. 0.0_r8)
then 103 dfunc_dw_ih_mean_poly = 3.347814e+05_r8 &
104 - num_f*func0*(1.0_r8 + num_f2*func0) - num_p*p
105 w_ih =
min(-func0/dfunc_dw_ih_mean_poly, 0.95_r8)
106 sa = sa_bulk/(1.0_r8 - w_ih)
107 if (sa .lt. 0.0_r8 .or. sa .gt. 120.0_r8)
then 110 w_ih_final = sa_final
127 dfunc_dw_ih = hf - h_ihf &
128 - sa*(h_hat_sa + h_hat_ct*ctf_sa + w_ih*cp_ih*tf_sa/(1.0_r8 - w_ih))
133 do number_of_iterations = 1, 3
135 if (number_of_iterations .gt. 1)
then 143 func = h_bulk - (1.0_r8 - w_ih)*hf - w_ih*h_ihf
146 w_ih = w_ih_old - func/dfunc_dw_ih
147 w_ih_mean = 0.5_r8*(w_ih + w_ih_old)
149 if (w_ih_mean .gt. 0.9_r8)
then 153 w_ih_final = sa_final
157 sa = sa_bulk/(1.0_r8 - w_ih_mean)
167 dfunc_dw_ih = hf - h_ihf - sa*(h_hat_sa + h_hat_ct*ctf_sa &
168 + w_ih_mean*cp_ih*tf_sa/(1.0_r8 - w_ih_mean))
170 w_ih = w_ih_old - func/dfunc_dw_ih
172 if (w_ih .gt. 0.9_r8)
then 176 w_ih_final = sa_final
180 sa = sa_bulk/(1.0_r8 - w_ih)
187 if (w_ih_final .lt. 0.0_r8)
then elemental subroutine gsw_frazil_properties(sa_bulk, h_bulk, p, sa_final, ct_final, w_ih_final)
real(r8), parameter, public gsw_error_limit
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)