1 | MODULE eqn_state_seawater_mod |
---|
2 | |
---|
3 | !------------------------------------------------------------------------------! |
---|
4 | ! Actual revisions: |
---|
5 | ! ----------------- |
---|
6 | ! |
---|
7 | ! |
---|
8 | ! Former revisions: |
---|
9 | ! ----------------- |
---|
10 | ! $Id:$ |
---|
11 | ! |
---|
12 | ! Initial revision |
---|
13 | ! |
---|
14 | ! |
---|
15 | ! Description: |
---|
16 | ! ------------ |
---|
17 | ! Equation of state for seawater as a function of potential temperature, |
---|
18 | ! salinity, and pressure. |
---|
19 | ! For coefficients see Jackett et al., 2006: J. Atm. Ocean Tech. |
---|
20 | !------------------------------------------------------------------------------! |
---|
21 | |
---|
22 | IMPLICIT NONE |
---|
23 | |
---|
24 | PRIVATE |
---|
25 | PUBLIC eqn_state_seawater, eqn_state_seawater_func |
---|
26 | |
---|
27 | REAL, DIMENSION(12), PARAMETER :: nom = & |
---|
28 | (/ 9.9984085444849347D2, 7.3471625860981584D0, & |
---|
29 | -5.3211231792841769D-2, 3.6492439109814549D-4, & |
---|
30 | 2.5880571023991390D0, -6.7168282786692354D-3, & |
---|
31 | 1.9203202055760151D-3, 1.1798263740430364D-2, & |
---|
32 | 9.8920219266399117D-8, 4.6996642771754730D-6, & |
---|
33 | -2.5862187075154352D-8, -3.2921414007960662D-12 /) |
---|
34 | |
---|
35 | REAL, DIMENSION(13), PARAMETER :: den = & |
---|
36 | (/ 1.0, 7.2815210113327091D-3, & |
---|
37 | -4.4787265461983921D-5, 3.3851002965802430D-7, & |
---|
38 | 1.3651202389758572D-10, 1.7632126669040377D-3, & |
---|
39 | -8.8066583251206474D-6, -1.8832689434804897D-10, & |
---|
40 | 5.7463776745432097D-6, 1.4716275472242334D-9, & |
---|
41 | 6.7103246285651894D-6, -2.4461698007024582D-17, & |
---|
42 | -9.1534417604289062D-18 /) |
---|
43 | |
---|
44 | INTERFACE eqn_state_seawater |
---|
45 | MODULE PROCEDURE eqn_state_seawater |
---|
46 | MODULE PROCEDURE eqn_state_seawater_ij |
---|
47 | END INTERFACE eqn_state_seawater |
---|
48 | |
---|
49 | INTERFACE eqn_state_seawater_func |
---|
50 | MODULE PROCEDURE eqn_state_seawater_func |
---|
51 | END INTERFACE eqn_state_seawater_func |
---|
52 | |
---|
53 | CONTAINS |
---|
54 | |
---|
55 | |
---|
56 | !------------------------------------------------------------------------------! |
---|
57 | ! Call for all grid points |
---|
58 | !------------------------------------------------------------------------------! |
---|
59 | SUBROUTINE eqn_state_seawater |
---|
60 | |
---|
61 | USE arrays_3d |
---|
62 | USE indices |
---|
63 | |
---|
64 | IMPLICIT NONE |
---|
65 | |
---|
66 | INTEGER :: i, j, k |
---|
67 | |
---|
68 | REAL :: p1, p2, p3, pt1, pt2, pt3, pt4, sa1, sa15, sa2 |
---|
69 | |
---|
70 | DO i = nxl, nxr |
---|
71 | DO j = nys, nyn |
---|
72 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
73 | ! |
---|
74 | !-- Pressure is needed in dbar |
---|
75 | p1 = hyp(k) * 1E-4 |
---|
76 | p2 = p1 * p1 |
---|
77 | p3 = p2 * p1 |
---|
78 | |
---|
79 | ! |
---|
80 | !-- Temperature needed in degree Celsius |
---|
81 | pt1 = pt_p(k,j,i) - 273.15 |
---|
82 | pt2 = pt1 * pt1 |
---|
83 | pt3 = pt1 * pt2 |
---|
84 | pt4 = pt2 * pt2 |
---|
85 | |
---|
86 | sa1 = sa_p(k,j,i) |
---|
87 | sa15 = sa1 * SQRT( sa1 ) |
---|
88 | sa2 = sa1 * sa1 |
---|
89 | |
---|
90 | rho(k,j,i) = & |
---|
91 | ( nom(1) + nom(2)*pt1 + nom(3)*pt2 + & |
---|
92 | nom(4)*pt3 + nom(5)*sa1 + nom(6)*sa1*pt1 + & |
---|
93 | nom(7)*sa2 + nom(8)*p1 + nom(9)*p1*pt2 + & |
---|
94 | nom(10)*p1*sa1 + nom(11)*p2 + nom(12)*p2*pt2 & |
---|
95 | ) / & |
---|
96 | ( den(1) + den(2)*pt1 + den(3)*pt2 + & |
---|
97 | den(4)*pt3 + den(5)*pt4 + den(6)*sa1 + & |
---|
98 | den(7)*sa1*pt1 + den(8)*sa1*pt3 + den(9)*sa15 + & |
---|
99 | den(10)*sa15*pt2 + den(11)*p1 + den(12)*p2*pt3 + & |
---|
100 | den(13)*p3*pt1 & |
---|
101 | ) |
---|
102 | |
---|
103 | ENDDO |
---|
104 | ENDDO |
---|
105 | ENDDO |
---|
106 | |
---|
107 | END SUBROUTINE eqn_state_seawater |
---|
108 | |
---|
109 | |
---|
110 | !------------------------------------------------------------------------------! |
---|
111 | ! Call for grid point i,j |
---|
112 | !------------------------------------------------------------------------------! |
---|
113 | SUBROUTINE eqn_state_seawater_ij( i, j ) |
---|
114 | |
---|
115 | USE arrays_3d |
---|
116 | USE indices |
---|
117 | |
---|
118 | IMPLICIT NONE |
---|
119 | |
---|
120 | INTEGER :: i, j, k |
---|
121 | |
---|
122 | REAL :: p1, p2, p3, pt1, pt2, pt3, pt4, sa1, sa15, sa2 |
---|
123 | |
---|
124 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
125 | ! |
---|
126 | !-- Pressure is needed in dbar |
---|
127 | p1 = hyp(k) * 1E-4 |
---|
128 | p2 = p1 * p1 |
---|
129 | p3 = p2 * p1 |
---|
130 | |
---|
131 | ! |
---|
132 | !-- Temperature needed in degree Celsius |
---|
133 | pt1 = pt_p(k,j,i) - 273.15 |
---|
134 | pt2 = pt1 * pt1 |
---|
135 | pt3 = pt1 * pt2 |
---|
136 | pt4 = pt2 * pt2 |
---|
137 | |
---|
138 | sa1 = sa_p(k,j,i) |
---|
139 | sa15 = sa1 * SQRT( sa1 ) |
---|
140 | sa2 = sa1 * sa1 |
---|
141 | |
---|
142 | rho(k,j,i) = ( nom(1) + nom(2)*pt1 + nom(3)*pt2 + & |
---|
143 | nom(4)*pt3 + nom(5)*sa1 + nom(6)*sa1*pt1 + & |
---|
144 | nom(7)*sa2 + nom(8)*p1 + nom(9)*p1*pt2 + & |
---|
145 | nom(10)*p1*sa1 + nom(11)*p2 + nom(12)*p2*pt2 & |
---|
146 | ) / & |
---|
147 | ( den(1) + den(2)*pt1 + den(3)*pt2 + & |
---|
148 | den(4)*pt3 + den(5)*pt4 + den(6)*sa1 + & |
---|
149 | den(7)*sa1*pt1 + den(8)*sa1*pt3 + den(9)*sa15 + & |
---|
150 | den(10)*sa15*pt2 + den(11)*p1 + den(12)*p2*pt3 + & |
---|
151 | den(13)*p3*pt1 & |
---|
152 | ) |
---|
153 | ENDDO |
---|
154 | |
---|
155 | END SUBROUTINE eqn_state_seawater_ij |
---|
156 | |
---|
157 | |
---|
158 | !------------------------------------------------------------------------------! |
---|
159 | ! Equation of state as a function |
---|
160 | !------------------------------------------------------------------------------! |
---|
161 | REAL FUNCTION eqn_state_seawater_func( p, pt, sa ) |
---|
162 | |
---|
163 | IMPLICIT NONE |
---|
164 | |
---|
165 | REAL :: p, p1, p2, p3, pt, pt1, pt2, pt3, pt4, sa, sa15, sa2 |
---|
166 | |
---|
167 | ! |
---|
168 | !-- Pressure is needed in dbar |
---|
169 | p1 = p * 1E-4 |
---|
170 | p2 = p1 * p1 |
---|
171 | p3 = p2 * p1 |
---|
172 | |
---|
173 | ! |
---|
174 | !-- Temperature needed in degree Celsius |
---|
175 | pt1 = pt - 273.15 |
---|
176 | pt2 = pt1 * pt1 |
---|
177 | pt3 = pt1 * pt2 |
---|
178 | pt4 = pt2 * pt2 |
---|
179 | |
---|
180 | sa15 = sa * SQRT( sa ) |
---|
181 | sa2 = sa * sa |
---|
182 | |
---|
183 | |
---|
184 | eqn_state_seawater_func = & |
---|
185 | ( nom(1) + nom(2)*pt1 + nom(3)*pt2 + nom(4)*pt3 + & |
---|
186 | nom(5)*sa + nom(6)*sa*pt1 + nom(7)*sa2 + nom(8)*p1 + & |
---|
187 | nom(9)*p1*pt2 + nom(10)*p1*sa + nom(11)*p2 + nom(12)*p2*pt2 & |
---|
188 | ) / & |
---|
189 | ( den(1) + den(2)*pt1 + den(3)*pt2 + den(4)*pt3 + & |
---|
190 | den(5)*pt4 + den(6)*sa + den(7)*sa*pt1 + den(8)*sa*pt3 + & |
---|
191 | den(9)*sa15 + den(10)*sa15*pt2 + den(11)*p1 + den(12)*p2*pt3 + & |
---|
192 | den(13)*p3*pt1 & |
---|
193 | ) |
---|
194 | |
---|
195 | |
---|
196 | END FUNCTION eqn_state_seawater_func |
---|
197 | |
---|
198 | END MODULE eqn_state_seawater_mod |
---|