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