FV3 Bundle
gsw_pot_enthalpy_ice_freezing_first_derivatives_poly.f90
Go to the documentation of this file.
1 !==========================================================================
3  sa, p, pot_enthalpy_ice_freezing_sa, pot_enthalpy_ice_freezing_p)
4 !==========================================================================
5 !
6 ! Calculates the first derivatives of the potential enthalpy of ice Ih at
7 ! which ice melts into seawater with Absolute Salinity SA and at pressure
8 ! p. This code uses the comptationally efficient polynomial fit of the
9 ! freezing potential enthalpy of ice Ih (McDougall et al., 2015).
10 !
11 ! SA = Absolute Salinity [ g/kg ]
12 ! p = sea pressure [ dbar ]
13 ! ( i.e. absolute pressure - 10.1325 dbar )
14 !
15 ! pot_enthalpy_ice_freezing_SA = the derivative of the potential enthalpy
16 ! of ice at freezing (ITS-90) with respect to Absolute
17 ! salinity at fixed pressure [ (J/kg)/(g/kg) ] i.e. [ J/g ]
18 !
19 ! pot_enthalpy_ice_freezing_P = the derivative of the potential enthalpy
20 ! of ice at freezing (ITS-90) with respect to pressure
21 ! (in Pa) at fixed Absolute Salinity [ (J/kg)/Pa ]
22 !--------------------------------------------------------------------------
23 
24 use gsw_mod_kinds
25 
26 implicit none
27 
28 real (r8), intent(in) :: sa, p
29 real (r8), intent(out), optional :: pot_enthalpy_ice_freezing_sa
30 real (r8), intent(out), optional :: pot_enthalpy_ice_freezing_p
31 
32 real (r8) :: p_r, sa_r, x
33 
34 real (r8), parameter :: d1 = -1.249490228128056e4_r8
35 real (r8), parameter :: d2 = 1.336783910789822e4_r8
36 real (r8), parameter :: d3 = -4.811989517774642e4_r8
37 real (r8), parameter :: d4 = 8.044864276240987e4_r8
38 real (r8), parameter :: d5 = -7.124452125071862e4_r8
39 real (r8), parameter :: d6 = 2.280706828014839e4_r8
40 real (r8), parameter :: d7 = 0.315423710959628e3_r8
41 real (r8), parameter :: d8 = -3.592775732074710e2_r8
42 real (r8), parameter :: d9 = 1.644828513129230e3_r8
43 real (r8), parameter :: d10 = -4.809640968940840e3_r8
44 real (r8), parameter :: d11 = 2.901071777977272e3_r8
45 real (r8), parameter :: d12 = -9.218459682855746e2_r8
46 real (r8), parameter :: d13 = 0.379377450285737e3_r8
47 real (r8), parameter :: d14 = -2.672164989849465e3_r8
48 real (r8), parameter :: d15 = 5.044317489422632e3_r8
49 real (r8), parameter :: d16 = -2.631711865886377e3_r8
50 real (r8), parameter :: d17 = -0.160245473297112e3_r8
51 real (r8), parameter :: d18 = 4.029061696035465e2_r8
52 real (r8), parameter :: d19 = -3.682950019675760e2_r8
53 
54 real (r8), parameter :: f1 = -2.034535061416256e4_r8
55 real (r8), parameter :: f2 = 0.315423710959628e3_r8
56 real (r8), parameter :: f3 = -0.239518382138314e3_r8
57 real (r8), parameter :: f4 = 0.822414256564615e3_r8
58 real (r8), parameter :: f5 = -1.923856387576336e3_r8
59 real (r8), parameter :: f6 = 0.967023925992424e3_r8
60 real (r8), parameter :: f7 = -0.263384562367307e3_r8
61 real (r8), parameter :: f8 = -5.051613740291480e3_r8
62 real (r8), parameter :: f9 = 7.587549005714740e2_r8
63 real (r8), parameter :: f10 = -3.562886653132620e3_r8
64 real (r8), parameter :: f11 = 5.044317489422632e3_r8
65 real (r8), parameter :: f12 = -2.105369492709102e3_r8
66 real (r8), parameter :: f13 = 6.387082316647800e2_r8
67 real (r8), parameter :: f14 = -4.807364198913360e2_r8
68 real (r8), parameter :: f15 = 8.058123392070929e2_r8
69 real (r8), parameter :: f16 = -5.524425029513641e2_r8
70 
71 sa_r = sa*1e-2_r8
72 x = sqrt(sa_r)
73 p_r = p*1e-4_r8
74 
75 if (present(pot_enthalpy_ice_freezing_sa)) pot_enthalpy_ice_freezing_sa = &
76  (d1 + x*(d2 + x*(d3 + x*(d4 + x*(d5 + d6*x)))) &
77  + p_r*(d7 + x*(d8 + x*(d9 + x*(d10 + x*(d11 + d12*x)))) &
78  + p_r*(d13 + x*(d14 + x*(d15 + d16*x)) &
79  + p_r*(d17 + x*(d18 + d19*x)))))*1e-2_r8
80 
81 if (present(pot_enthalpy_ice_freezing_p)) pot_enthalpy_ice_freezing_p = &
82  (f1 + sa_r*(f2 + x*(f3 + x*(f4 + x*(f5 + x*(f6 + f7*x))))) &
83  + p_r*(f8 + sa_r*(f9 + x*(f10 + x*(f11 + f12*x))) &
84  + p_r*(f13 + sa_r*(f14 + x*(f15 + f16*x)))))*1e-8_r8
85 
86 return
87 end subroutine
88 
89 !--------------------------------------------------------------------------
elemental subroutine gsw_pot_enthalpy_ice_freezing_first_derivatives_poly(sa, p, pot_enthalpy_ice_freezing_sa, pot_enthalpy_ice_freezing_p)