MOM6
MOM_TFreeze.F90
1 !> Freezing point expressions
2 module mom_tfreeze
3 
4 ! This file is part of MOM6. See LICENSE.md for the license.
5 
6 !********+*********+*********+*********+*********+*********+*********+**
7 !* The subroutines in this file determine the potential temperature *
8 !* at which sea-water freezes. *
9 !********+*********+*********+*********+*********+*********+*********+**
10 use gsw_mod_toolbox, only : gsw_ct_freezing_exact
11 
12 implicit none ; private
13 
15 
16 !> Compute the freezing point potential temperature [degC] from salinity [ppt] and
17 !! pressure [Pa] using a simple linear expression, with coefficients passed in as arguments.
19  module procedure calculate_tfreeze_linear_scalar, calculate_tfreeze_linear_array
20 end interface calculate_tfreeze_linear
21 
22 !> Compute the freezing point potential temperature [degC] from salinity [PSU] and
23 !! pressure [Pa] using the expression from Millero (1978) (and in appendix A of Gill 1982),
24 !! but with the of the pressure dependence changed from 7.53e-8 to 7.75e-8 to make this an
25 !! expression for potential temperature (not in situ temperature), using a
26 !! value that is correct at the freezing point at 35 PSU and 5e6 Pa (500 dbar).
28  module procedure calculate_tfreeze_millero_scalar, calculate_tfreeze_millero_array
29 end interface calculate_tfreeze_millero
30 
31 !> Compute the freezing point conservative temperature [degC] from absolute salinity [g/kg]
32 !! and pressure [Pa] using the TEOS10 package.
34  module procedure calculate_tfreeze_teos10_scalar, calculate_tfreeze_teos10_array
35 end interface calculate_tfreeze_teos10
36 
37 contains
38 
39 !> This subroutine computes the freezing point potential temperature
40 !! [degC] from salinity [ppt], and pressure [Pa] using a simple
41 !! linear expression, with coefficients passed in as arguments.
42 subroutine calculate_tfreeze_linear_scalar(S, pres, T_Fr, TFr_S0_P0, &
43  dTFr_dS, dTFr_dp)
44  real, intent(in) :: S !< salinity [ppt].
45  real, intent(in) :: pres !< pressure [Pa].
46  real, intent(out) :: T_Fr !< Freezing point potential temperature [degC].
47  real, intent(in) :: TFr_S0_P0 !< The freezing point at S=0, p=0 [degC].
48  real, intent(in) :: dTFr_dS !< The derivative of freezing point with salinity,
49  !! [degC ppt-1].
50  real, intent(in) :: dTFr_dp !< The derivative of freezing point with pressure,
51  !! [degC Pa-1].
52 
53  t_fr = (tfr_s0_p0 + dtfr_ds*s) + dtfr_dp*pres
54 
55 end subroutine calculate_tfreeze_linear_scalar
56 
57 !> This subroutine computes an array of freezing point potential temperatures
58 !! [degC] from salinity [ppt], and pressure [Pa] using a simple
59 !! linear expression, with coefficients passed in as arguments.
60 subroutine calculate_tfreeze_linear_array(S, pres, T_Fr, start, npts, &
61  TFr_S0_P0, dTFr_dS, dTFr_dp)
62  real, dimension(:), intent(in) :: S !< salinity [ppt].
63  real, dimension(:), intent(in) :: pres !< pressure [Pa].
64  real, dimension(:), intent(out) :: T_Fr !< Freezing point potential temperature [degC].
65  integer, intent(in) :: start !< the starting point in the arrays.
66  integer, intent(in) :: npts !< the number of values to calculate.
67  real, intent(in) :: TFr_S0_P0 !< The freezing point at S=0, p=0, [degC].
68  real, intent(in) :: dTFr_dS !< The derivative of freezing point with salinity,
69  !! [degC PSU-1].
70  real, intent(in) :: dTFr_dp !< The derivative of freezing point with pressure,
71  !! [degC Pa-1].
72  integer :: j
73 
74  do j=start,start+npts-1
75  t_fr(j) = (tfr_s0_p0 + dtfr_ds*s(j)) + dtfr_dp*pres(j)
76  enddo
77 
78 end subroutine calculate_tfreeze_linear_array
79 
80 !> This subroutine computes the freezing point potential temperature
81 !! [degC] from salinity [ppt], and pressure [Pa] using the expression
82 !! from Millero (1978) (and in appendix A of Gill 1982), but with the of the
83 !! pressure dependence changed from 7.53e-8 to 7.75e-8 to make this an
84 !! expression for potential temperature (not in situ temperature), using a
85 !! value that is correct at the freezing point at 35 PSU and 5e6 Pa (500 dbar).
86 subroutine calculate_tfreeze_millero_scalar(S, pres, T_Fr)
87  real, intent(in) :: S !< Salinity in PSU.
88  real, intent(in) :: pres !< Pressure [Pa].
89  real, intent(out) :: T_Fr !< Freezing point potential temperature [degC].
90 
91  ! Local variables
92  real, parameter :: cS1 = -0.0575, cs3_2 = 1.710523e-3, cs2 = -2.154996e-4
93  real, parameter :: dTFr_dp = -7.75e-8
94 
95  t_fr = s*(cs1 + (cs3_2 * sqrt(max(s,0.0)) + cs2 * s)) + dtfr_dp*pres
96 
97 end subroutine calculate_tfreeze_millero_scalar
98 
99 !> This subroutine computes the freezing point potential temperature
100 !! [degC] from salinity [ppt], and pressure [Pa] using the expression
101 !! from Millero (1978) (and in appendix A of Gill 1982), but with the of the
102 !! pressure dependence changed from 7.53e-8 to 7.75e-8 to make this an
103 !! expression for potential temperature (not in situ temperature), using a
104 !! value that is correct at the freezing point at 35 PSU and 5e6 Pa (500 dbar).
105 subroutine calculate_tfreeze_millero_array(S, pres, T_Fr, start, npts)
106  real, dimension(:), intent(in) :: S !< Salinity [PSU].
107  real, dimension(:), intent(in) :: pres !< Pressure [Pa].
108  real, dimension(:), intent(out) :: T_Fr !< Freezing point potential temperature [degC].
109  integer, intent(in) :: start !< The starting point in the arrays.
110  integer, intent(in) :: npts !< The number of values to calculate.
111 
112  ! Local variables
113  real, parameter :: cS1 = -0.0575, cs3_2 = 1.710523e-3, cs2 = -2.154996e-4
114  real, parameter :: dTFr_dp = -7.75e-8
115  integer :: j
116 
117  do j=start,start+npts-1
118  t_fr(j) = s(j)*(cs1 + (cs3_2 * sqrt(max(s(j),0.0)) + cs2 * s(j))) + &
119  dtfr_dp*pres(j)
120  enddo
121 
122 end subroutine calculate_tfreeze_millero_array
123 
124 !> This subroutine computes the freezing point conservative temperature
125 !! [degC] from absolute salinity [g/kg], and pressure [Pa] using the
126 !! TEOS10 package.
127 subroutine calculate_tfreeze_teos10_scalar(S, pres, T_Fr)
128  real, intent(in) :: S !< Absolute salinity [g/kg].
129  real, intent(in) :: pres !< Pressure [Pa].
130  real, intent(out) :: T_Fr !< Freezing point conservative temperature [degC].
131 
132  ! Local variables
133  real, dimension(1) :: S0, pres0
134  real, dimension(1) :: tfr0
135 
136  s0(1) = s
137  pres0(1) = pres
138 
139  call calculate_tfreeze_teos10_array(s0, pres0, tfr0, 1, 1)
140  t_fr = tfr0(1)
141 
142 end subroutine calculate_tfreeze_teos10_scalar
143 
144 !> This subroutine computes the freezing point conservative temperature
145 !! [degC] from absolute salinity [g/kg], and pressure [Pa] using the
146 !! TEOS10 package.
147 subroutine calculate_tfreeze_teos10_array(S, pres, T_Fr, start, npts)
148  real, dimension(:), intent(in) :: S !< absolute salinity [g/kg].
149  real, dimension(:), intent(in) :: pres !< pressure [Pa].
150  real, dimension(:), intent(out) :: T_Fr !< Freezing point conservative temperature [degC].
151  integer, intent(in) :: start !< the starting point in the arrays.
152  integer, intent(in) :: npts !< the number of values to calculate.
153 
154  ! Local variables
155  real, parameter :: Pa2db = 1.e-4 ! The conversion factor from Pa to dbar.
156  real :: zs,zp
157  integer :: j
158  ! Assume sea-water contains no dissolved air.
159  real, parameter :: saturation_fraction = 0.0
160 
161  do j=start,start+npts-1
162  !Conversions
163  zs = s(j)
164  zp = pres(j)* pa2db !Convert pressure from Pascal to decibar
165 
166  if (s(j) < -1.0e-10) cycle !Can we assume safely that this is a missing value?
167  t_fr(j) = gsw_ct_freezing_exact(zs,zp,saturation_fraction)
168  enddo
169 
170 end subroutine calculate_tfreeze_teos10_array
171 
172 end module mom_tfreeze
mom_tfreeze
Freezing point expressions.
Definition: MOM_TFreeze.F90:2
mom_tfreeze::calculate_tfreeze_millero
Compute the freezing point potential temperature [degC] from salinity [PSU] and pressure [Pa] using t...
Definition: MOM_TFreeze.F90:27
mom_tfreeze::calculate_tfreeze_linear
Compute the freezing point potential temperature [degC] from salinity [ppt] and pressure [Pa] using a...
Definition: MOM_TFreeze.F90:18
mom_tfreeze::calculate_tfreeze_teos10
Compute the freezing point conservative temperature [degC] from absolute salinity [g/kg] and pressure...
Definition: MOM_TFreeze.F90:33