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