FV3 Bundle
gsw_ct_freezing_first_derivatives.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental subroutine gsw_ct_freezing_first_derivatives (sa, p, &
3  saturation_fraction, ctfreezing_sa, ctfreezing_p)
4 !==========================================================================
5 !
6 ! Calculates the first derivatives of the Conservative Temperature at
7 ! which seawater freezes, with respect to Absolute Salinity SA and
8 ! pressure P (in Pa).
9 !
10 ! SA = Absolute Salinity [ g/kg ]
11 ! p = sea pressure [ dbar ]
12 ! ( i.e. absolute pressure - 10.1325 dbar )
13 ! saturation_fraction = the saturation fraction of dissolved air in
14 ! seawater
15 !
16 ! CTfreezing_SA = the derivative of the Conservative Temperature at
17 ! freezing (ITS-90) with respect to Absolute Salinity at
18 ! fixed pressure [ K/(g/kg) ] i.e. [ K kg/g ]
19 !
20 ! CTfreezing_P = the derivative of the Conservative Temperature at
21 ! freezing (ITS-90) with respect to pressure (in Pa) at
22 ! fixed Absolute Salinity [ K/Pa ]
23 !--------------------------------------------------------------------------
24 
28 
29 use gsw_mod_kinds
30 
31 implicit none
32 
33 real (r8), intent(in) :: sa, p, saturation_fraction
34 real (r8), intent(out), optional :: ctfreezing_sa, ctfreezing_p
35 
36 real (r8) :: tf_sa, tf_p, ct_sa_wrt_t, ct_t_wrt_t, ct_p_wrt_t, tf
37 
38 tf = gsw_t_freezing_exact(sa,p,saturation_fraction)
39 
40 if (present(ctfreezing_sa) .and. present(ctfreezing_p)) then
41 
42  call gsw_t_freezing_first_derivatives(sa,p,saturation_fraction, &
43  tfreezing_sa=tf_sa,tfreezing_p=tf_p)
45  ct_sa_wrt_t=ct_sa_wrt_t,ct_t_wrt_t=ct_t_wrt_t,ct_p_wrt_t=ct_p_wrt_t)
46 
47  ctfreezing_sa = ct_sa_wrt_t + ct_t_wrt_t*tf_sa
48  ctfreezing_p = ct_p_wrt_t + ct_t_wrt_t*tf_p
49 
50 else if (present(ctfreezing_sa) .and. .not. present(ctfreezing_p)) then
51 
52  call gsw_t_freezing_first_derivatives(sa,p,saturation_fraction, &
53  tfreezing_sa=tf_sa)
55  ct_sa_wrt_t=ct_sa_wrt_t,ct_t_wrt_t=ct_t_wrt_t)
56 
57  ctfreezing_sa = ct_sa_wrt_t + ct_t_wrt_t*tf_sa
58 
59 else if (.not. present(ctfreezing_sa) .and. present(ctfreezing_p)) then
60 
61  call gsw_t_freezing_first_derivatives(sa,p,saturation_fraction, &
62  tfreezing_p=tf_p)
64  ct_t_wrt_t=ct_t_wrt_t,ct_p_wrt_t=ct_p_wrt_t)
65 
66  ctfreezing_p = ct_p_wrt_t + ct_t_wrt_t*tf_p
67 
68 end if
69 
70 return
71 end subroutine
72 
73 !--------------------------------------------------------------------------
elemental subroutine gsw_ct_freezing_first_derivatives(sa, p, saturation_fraction, ctfreezing_sa, ctfreezing_p)