FV3 Bundle
gsw_pot_enthalpy_ice_freezing_first_derivatives.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental subroutine gsw_pot_enthalpy_ice_freezing_first_derivatives (sa, &
3  p, pot_enthalpy_ice_freezing_sa, pot_enthalpy_ice_freezing_p)
4 !==========================================================================
5 !
6 ! Calculates the first derivatives of the potential enthalpy of ice 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 !
14 ! pot_enthalpy_ice_freezing_SA = the derivative of the potential enthalpy
15 ! of ice at freezing (ITS-90) with respect to Absolute
16 ! salinity at fixed pressure [ K/(g/kg) ] i.e. [ K kg/g ]
17 !
18 ! pot_enthalpy_ice_freezing_P = the derivative of the potential enthalpy
19 ! of ice at freezing (ITS-90) with respect to pressure
20 ! (in Pa) at fixed Absolute Salinity [ K/Pa ]
21 !--------------------------------------------------------------------------
22 
26 
28 
29 use gsw_mod_kinds
30 
31 implicit none
32 
33 real (r8), intent(in) :: sa, p
34 real (r8), intent(out), optional :: pot_enthalpy_ice_freezing_sa
35 real (r8), intent(out), optional :: pot_enthalpy_ice_freezing_p
36 
37 real (r8) :: cp_ihf, pt_icef, ratio_temp, tf, tf_p, tf_sa
38 
39 real (r8), parameter :: saturation_fraction = 0.0_r8
40 
41 tf = gsw_t_freezing_exact(sa,p,saturation_fraction)
42 pt_icef = gsw_pt0_from_t_ice(tf,p)
43 ratio_temp = (gsw_t0 + pt_icef)/(gsw_t0 + tf)
44 
45 cp_ihf = gsw_cp_ice(tf,p)
46 
47 if (present(pot_enthalpy_ice_freezing_sa) .and. present(pot_enthalpy_ice_freezing_p)) then
48  call gsw_t_freezing_first_derivatives(sa,p,saturation_fraction,tf_sa,tf_p)
49 else if (present(pot_enthalpy_ice_freezing_sa)) then
50  call gsw_t_freezing_first_derivatives(sa,p,saturation_fraction, &
51  tfreezing_sa=tf_sa)
52 else if (present(pot_enthalpy_ice_freezing_p)) then
53  call gsw_t_freezing_first_derivatives(sa,p,saturation_fraction, &
54  tfreezing_p=tf_p)
55 end if
56 
57 if (present(pot_enthalpy_ice_freezing_sa)) &
58  pot_enthalpy_ice_freezing_sa = ratio_temp*cp_ihf*tf_sa
59 
60 if (present(pot_enthalpy_ice_freezing_p)) &
61  pot_enthalpy_ice_freezing_p = ratio_temp*cp_ihf*tf_p &
62  - (gsw_t0 + pt_icef)*gsw_gibbs_ice(1,1,tf,p)
63 
64 return
65 end subroutine
66 
67 !--------------------------------------------------------------------------
elemental subroutine gsw_pot_enthalpy_ice_freezing_first_derivatives(sa, p, pot_enthalpy_ice_freezing_sa, pot_enthalpy_ice_freezing_p)