1 | ! $Id$ |
---|
2 | |
---|
3 | SUBROUTINE addfi_loc(pdt, leapf, forward, & |
---|
4 | pucov, pvcov, pteta, pq, pps, & |
---|
5 | pdufi, pdvfi, pdhfi, pdqfi, pdpfi) |
---|
6 | USE parallel_lmdz |
---|
7 | USE lmdz_infotrac, ONLY: nqtot |
---|
8 | USE control_mod, ONLY: planet_type |
---|
9 | USE lmdz_ssum_scopy, ONLY: ssum |
---|
10 | USE lmdz_comgeom |
---|
11 | |
---|
12 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
13 | USE lmdz_paramet |
---|
14 | IMPLICIT NONE |
---|
15 | |
---|
16 | !======================================================================= |
---|
17 | |
---|
18 | ! Addition of the physical tendencies |
---|
19 | |
---|
20 | ! Interface : |
---|
21 | ! ----------- |
---|
22 | |
---|
23 | ! Input : |
---|
24 | ! ------- |
---|
25 | ! pdt time step of integration |
---|
26 | ! leapf logical |
---|
27 | ! forward logical |
---|
28 | ! pucov(ip1jmp1,llm) first component of the covariant velocity |
---|
29 | ! pvcov(ip1ip1jm,llm) second component of the covariant velocity |
---|
30 | ! pteta(ip1jmp1,llm) potential temperature |
---|
31 | ! pts(ip1jmp1,llm) surface temperature |
---|
32 | ! pdufi(ip1jmp1,llm) | |
---|
33 | ! pdvfi(ip1jm,llm) | respective |
---|
34 | ! pdhfi(ip1jmp1) | tendencies |
---|
35 | ! pdtsfi(ip1jmp1) | |
---|
36 | |
---|
37 | ! Output : |
---|
38 | ! -------- |
---|
39 | ! pucov |
---|
40 | ! pvcov |
---|
41 | ! ph |
---|
42 | ! pts |
---|
43 | |
---|
44 | |
---|
45 | !======================================================================= |
---|
46 | |
---|
47 | !----------------------------------------------------------------------- |
---|
48 | |
---|
49 | ! 0. Declarations : |
---|
50 | ! ------------------ |
---|
51 | ! |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | ! Arguments : |
---|
56 | ! ----------- |
---|
57 | |
---|
58 | REAL, INTENT(IN) :: pdt ! time step for the integration (s) |
---|
59 | |
---|
60 | REAL, INTENT(INOUT) :: pvcov(ijb_v:ije_v, llm) ! covariant meridional wind |
---|
61 | REAL, INTENT(INOUT) :: pucov(ijb_u:ije_u, llm) ! covariant zonal wind |
---|
62 | REAL, INTENT(INOUT) :: pteta(ijb_u:ije_u, llm) ! potential temperature |
---|
63 | REAL, INTENT(INOUT) :: pq(ijb_u:ije_u, llm, nqtot) ! tracers |
---|
64 | REAL, INTENT(INOUT) :: pps(ijb_u:ije_u) ! surface pressure (Pa) |
---|
65 | ! respective tendencies (.../s) to add |
---|
66 | REAL, INTENT(IN) :: pdvfi(ijb_v:ije_v, llm) |
---|
67 | REAL, INTENT(IN) :: pdufi(ijb_u:ije_u, llm) |
---|
68 | REAL, INTENT(IN) :: pdqfi(ijb_u:ije_u, llm, nqtot) |
---|
69 | REAL, INTENT(IN) :: pdhfi(ijb_u:ije_u, llm) |
---|
70 | REAL, INTENT(IN) :: pdpfi(ijb_u:ije_u) |
---|
71 | |
---|
72 | LOGICAL, INTENT(IN) :: leapf, forward ! not used |
---|
73 | |
---|
74 | |
---|
75 | ! Local variables : |
---|
76 | ! ----------------- |
---|
77 | |
---|
78 | REAL :: xpn(iim), xps(iim), tpn, tps |
---|
79 | INTEGER :: j, k, iq, ij |
---|
80 | REAL, PARAMETER :: qtestw = 1.0e-15 |
---|
81 | REAL, PARAMETER :: qtestt = 1.0e-40 |
---|
82 | |
---|
83 | INTEGER :: ijb, ije |
---|
84 | |
---|
85 | !----------------------------------------------------------------------- |
---|
86 | |
---|
87 | ijb = ij_begin |
---|
88 | ije = ij_end |
---|
89 | |
---|
90 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
91 | DO k = 1, llm |
---|
92 | DO j = ijb, ije |
---|
93 | pteta(j, k) = pteta(j, k) + pdhfi(j, k) * pdt |
---|
94 | ENDDO |
---|
95 | ENDDO |
---|
96 | !$OMP END DO NOWAIT |
---|
97 | |
---|
98 | IF (pole_nord) THEN |
---|
99 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
100 | DO k = 1, llm |
---|
101 | DO ij = 1, iim |
---|
102 | xpn(ij) = aire(ij) * pteta(ij, k) |
---|
103 | ENDDO |
---|
104 | tpn = SSUM(iim, xpn, 1) / apoln |
---|
105 | |
---|
106 | DO ij = 1, iip1 |
---|
107 | pteta(ij, k) = tpn |
---|
108 | ENDDO |
---|
109 | ENDDO |
---|
110 | !$OMP END DO NOWAIT |
---|
111 | ENDIF |
---|
112 | |
---|
113 | IF (pole_sud) THEN |
---|
114 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
115 | DO k = 1, llm |
---|
116 | DO ij = 1, iim |
---|
117 | xps(ij) = aire(ij + ip1jm) * pteta(ij + ip1jm, k) |
---|
118 | ENDDO |
---|
119 | tps = SSUM(iim, xps, 1) / apols |
---|
120 | |
---|
121 | DO ij = 1, iip1 |
---|
122 | pteta(ij + ip1jm, k) = tps |
---|
123 | ENDDO |
---|
124 | ENDDO |
---|
125 | !$OMP END DO NOWAIT |
---|
126 | ENDIF |
---|
127 | ! |
---|
128 | |
---|
129 | ijb = ij_begin |
---|
130 | ije = ij_end |
---|
131 | IF (pole_nord) ijb = ij_begin + iip1 |
---|
132 | IF (pole_sud) ije = ij_end - iip1 |
---|
133 | |
---|
134 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
135 | DO k = 1, llm |
---|
136 | DO j = ijb, ije |
---|
137 | pucov(j, k) = pucov(j, k) + pdufi(j, k) * pdt |
---|
138 | ENDDO |
---|
139 | ENDDO |
---|
140 | !$OMP END DO NOWAIT |
---|
141 | |
---|
142 | IF (pole_nord) ijb = ij_begin |
---|
143 | |
---|
144 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
145 | DO k = 1, llm |
---|
146 | DO j = ijb, ije |
---|
147 | pvcov(j, k) = pvcov(j, k) + pdvfi(j, k) * pdt |
---|
148 | ENDDO |
---|
149 | ENDDO |
---|
150 | !$OMP END DO NOWAIT |
---|
151 | |
---|
152 | |
---|
153 | IF (pole_sud) ije = ij_end |
---|
154 | !$OMP MASTER |
---|
155 | DO j = ijb, ije |
---|
156 | pps(j) = pps(j) + pdpfi(j) * pdt |
---|
157 | ENDDO |
---|
158 | !$OMP END MASTER |
---|
159 | |
---|
160 | IF (planet_type=="earth") THEN |
---|
161 | ! earth case, special treatment for first 2 tracers (water) |
---|
162 | DO iq = 1, 2 |
---|
163 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
164 | DO k = 1, llm |
---|
165 | DO j = ijb, ije |
---|
166 | pq(j, k, iq) = pq(j, k, iq) + pdqfi(j, k, iq) * pdt |
---|
167 | pq(j, k, iq) = AMAX1(pq(j, k, iq), qtestw) |
---|
168 | ENDDO |
---|
169 | ENDDO |
---|
170 | !$OMP END DO NOWAIT |
---|
171 | ENDDO |
---|
172 | |
---|
173 | DO iq = 3, nqtot |
---|
174 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
175 | DO k = 1, llm |
---|
176 | DO j = ijb, ije |
---|
177 | pq(j, k, iq) = pq(j, k, iq) + pdqfi(j, k, iq) * pdt |
---|
178 | pq(j, k, iq) = AMAX1(pq(j, k, iq), qtestt) |
---|
179 | ENDDO |
---|
180 | ENDDO |
---|
181 | !$OMP END DO NOWAIT |
---|
182 | ENDDO |
---|
183 | else |
---|
184 | ! general case, treat all tracers equally) |
---|
185 | DO iq = 1, nqtot |
---|
186 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
187 | DO k = 1, llm |
---|
188 | DO j = ijb, ije |
---|
189 | pq(j, k, iq) = pq(j, k, iq) + pdqfi(j, k, iq) * pdt |
---|
190 | pq(j, k, iq) = AMAX1(pq(j, k, iq), qtestt) |
---|
191 | ENDDO |
---|
192 | ENDDO |
---|
193 | !$OMP END DO NOWAIT |
---|
194 | ENDDO |
---|
195 | ENDIF ! of if (planet_type=="earth") |
---|
196 | |
---|
197 | !$OMP MASTER |
---|
198 | IF (pole_nord) THEN |
---|
199 | DO ij = 1, iim |
---|
200 | xpn(ij) = aire(ij) * pps(ij) |
---|
201 | ENDDO |
---|
202 | |
---|
203 | tpn = SSUM(iim, xpn, 1) / apoln |
---|
204 | |
---|
205 | DO ij = 1, iip1 |
---|
206 | pps (ij) = tpn |
---|
207 | ENDDO |
---|
208 | |
---|
209 | ENDIF |
---|
210 | |
---|
211 | IF (pole_sud) THEN |
---|
212 | DO ij = 1, iim |
---|
213 | xps(ij) = aire(ij + ip1jm) * pps(ij + ip1jm) |
---|
214 | ENDDO |
---|
215 | |
---|
216 | tps = SSUM(iim, xps, 1) / apols |
---|
217 | |
---|
218 | DO ij = 1, iip1 |
---|
219 | pps (ij + ip1jm) = tps |
---|
220 | ENDDO |
---|
221 | |
---|
222 | ENDIF |
---|
223 | !$OMP END MASTER |
---|
224 | |
---|
225 | IF (pole_nord) THEN |
---|
226 | DO iq = 1, nqtot |
---|
227 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
228 | DO k = 1, llm |
---|
229 | DO ij = 1, iim |
---|
230 | xpn(ij) = aire(ij) * pq(ij, k, iq) |
---|
231 | ENDDO |
---|
232 | tpn = SSUM(iim, xpn, 1) / apoln |
---|
233 | |
---|
234 | DO ij = 1, iip1 |
---|
235 | pq (ij, k, iq) = tpn |
---|
236 | ENDDO |
---|
237 | ENDDO |
---|
238 | !$OMP END DO NOWAIT |
---|
239 | ENDDO |
---|
240 | ENDIF |
---|
241 | |
---|
242 | IF (pole_sud) THEN |
---|
243 | DO iq = 1, nqtot |
---|
244 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
245 | DO k = 1, llm |
---|
246 | DO ij = 1, iim |
---|
247 | xps(ij) = aire(ij + ip1jm) * pq(ij + ip1jm, k, iq) |
---|
248 | ENDDO |
---|
249 | tps = SSUM(iim, xps, 1) / apols |
---|
250 | |
---|
251 | DO ij = 1, iip1 |
---|
252 | pq (ij + ip1jm, k, iq) = tps |
---|
253 | ENDDO |
---|
254 | ENDDO |
---|
255 | !$OMP END DO NOWAIT |
---|
256 | ENDDO |
---|
257 | ENDIF |
---|
258 | |
---|
259 | END SUBROUTINE addfi_loc |
---|