FV3 Bundle
gsw_pot_enthalpy_from_pt_ice_poly.f90
Go to the documentation of this file.
1 !==========================================================================
2 elemental function gsw_pot_enthalpy_from_pt_ice_poly (pt0_ice)
3 !==========================================================================
4 !
5 ! Calculates the potential enthalpy of ice from potential temperature of
6 ! ice (whose reference sea pressure is zero dbar). This is a
7 ! compuationally efficient polynomial fit to the potential enthalpy of
8 ! ice.
9 !
10 ! pt0_ice = potential temperature of ice (ITS-90) [ deg C ]
11 !
12 ! pot_enthalpy_ice = potential enthalpy of ice [ J/kg ]
13 !--------------------------------------------------------------------------
14 
17 
18 use gsw_mod_kinds
19 
20 implicit none
21 
22 real (r8), intent(in) :: pt0_ice
23 
25 
26 integer :: iteration
27 real (r8) :: df_dt, f, pot_enthalpy_ice
28 real (r8) :: pot_enthalpy_ice_mid, pot_enthalpy_ice_old
29 
30 real (r8), parameter :: p0 = -3.333601570157700e5_r8
31 real (r8), parameter :: p1 = 2.096693916810367e3_r8
32 real (r8), parameter :: p2 = 3.687110754043292_r8
33 real (r8), parameter :: p3 = 4.559401565980682e-4_r8
34 real (r8), parameter :: p4 = -2.516011957758120e-6_r8
35 real (r8), parameter :: p5 = -1.040364574632784e-8_r8
36 real (r8), parameter :: p6 = -1.701786588412454e-10_r8
37 real (r8), parameter :: p7 = -7.667191301635057e-13_r8
38 
39 ! initial estimate of the potential enthalpy.
40 pot_enthalpy_ice = p0 + pt0_ice*(p1 + pt0_ice*(p2 + pt0_ice*(p3 &
41  + pt0_ice*(p4 + pt0_ice*(p5 + pt0_ice*(p6 &
42  + pt0_ice*p7))))))
43 
44 df_dt = gsw_pt_from_pot_enthalpy_ice_poly_dh(pot_enthalpy_ice)
45 
46 do iteration = 1, 5
47  pot_enthalpy_ice_old = pot_enthalpy_ice
48  f = gsw_pt_from_pot_enthalpy_ice_poly(pot_enthalpy_ice_old) - pt0_ice
49  pot_enthalpy_ice = pot_enthalpy_ice_old - f/df_dt
50  pot_enthalpy_ice_mid = 0.5_r8*(pot_enthalpy_ice + pot_enthalpy_ice_old)
51  df_dt = gsw_pt_from_pot_enthalpy_ice_poly_dh(pot_enthalpy_ice_mid)
52  pot_enthalpy_ice = pot_enthalpy_ice_old - f/df_dt
53 end do
54 
55 ! The error of this fit ranges between -6e-3 and 6e-3 J/kg over the potential
56 ! temperature range of -100 to 2 deg C, or the potential enthalpy range of
57 ! -5.7 x 10^5 to -3.3 x 10^5 J/kg.
58 
59 gsw_pot_enthalpy_from_pt_ice_poly = pot_enthalpy_ice
60 
61 return
62 end function
63 
64 !--------------------------------------------------------------------------
elemental real(r8) function gsw_pot_enthalpy_from_pt_ice_poly(pt0_ice)