3 sa_seaice, t_seaice, sa_freeze, ct_freeze, w_seaice)
50 real (r8),
intent(in) :: sa, ct, p, sa_seaice, t_seaice
51 real (r8),
intent(out) :: sa_freeze, ct_freeze, w_seaice
53 integer :: number_of_iterations
54 real (r8) :: ctf, ctf_mean, ctf_old, ctf_plus1, ctf_zero
55 real (r8) :: dfunc_dsaf, func, func_plus1, func_zero, h, h_brine
56 real (r8) :: h_ih, sa_freezing, saf, saf_mean, saf_old
57 real (r8) :: salt_ratio, tf_sa_seaice, h_hat_sa, h_hat_ct, ctf_sa
59 real (r8),
parameter :: sa0 = 0.0_r8, saturation_fraction = 0.0_r8
61 character (*),
parameter :: func_name =
"gsw_seaice_fraction_to_freeze_seawater" 73 if (t_seaice .gt. tf_sa_seaice)
then 92 salt_ratio = sa_seaice/sa_freezing
99 - h) - (h - h_ih) + salt_ratio*(h_brine - h_ih)
103 + sa*((h - h_ih) - salt_ratio*(h_brine - h_ih))
105 saf = -(sa+1.0_r8)*func_zero/(func_plus1 - func_zero)
109 ctfreezing_sa=ctf_sa)
111 dfunc_dsaf = (sa - sa_seaice)*(h_hat_sa + h_hat_ct*ctf_sa) &
112 - (h - h_ih) + salt_ratio*(h_brine - h_ih)
114 do number_of_iterations = 1, 4
118 - (saf_old - sa)*((h - h_ih) - salt_ratio*(h_brine - h_ih))
119 saf = saf_old - func/dfunc_dsaf
120 saf_mean = 0.5_r8*(saf + saf_old)
125 ctfreezing_sa=ctf_sa)
126 dfunc_dsaf = (sa - sa_seaice)*(h_hat_sa + h_hat_ct*ctf_sa) &
127 - (h - h_ih) + salt_ratio*(h_brine - h_ih)
128 saf = saf_old - func/dfunc_dsaf
140 (h - h_ih - salt_ratio*(h_brine - h_ih))
elemental subroutine gsw_seaice_fraction_to_freeze_seawater(sa, ct, p, sa_seaice, t_seaice, sa_freeze, ct_freeze, w_seaice)
real(r8), parameter, public gsw_error_limit
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)