1 | MODULE call_dissip_mod |
---|
2 | |
---|
3 | REAL,POINTER,SAVE :: ucov(:,:) |
---|
4 | REAL,POINTER,SAVE :: vcov(:,:) |
---|
5 | REAL,POINTER,SAVE :: teta(:,:) |
---|
6 | REAL,POINTER,SAVE :: p(:,: ) |
---|
7 | REAL,POINTER,SAVE :: pk(:,:) |
---|
8 | |
---|
9 | REAL,POINTER,SAVE :: ucont(:,:) |
---|
10 | REAL,POINTER,SAVE :: vcont(:,:) |
---|
11 | REAL,POINTER,SAVE :: ecin(:,:) |
---|
12 | REAL,POINTER,SAVE :: ecin0(:,:) |
---|
13 | REAL,POINTER,SAVE :: dudis(:,:) |
---|
14 | REAL,POINTER,SAVE :: dvdis(:,:) |
---|
15 | REAL,POINTER,SAVE :: dtetadis(:,:) |
---|
16 | REAL,POINTER,SAVE :: dtetaecdt(:,:) |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | CONTAINS |
---|
21 | |
---|
22 | SUBROUTINE call_dissip_allocate |
---|
23 | USE bands |
---|
24 | USE allocate_field_mod |
---|
25 | USE parallel_lmdz |
---|
26 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
27 | USE paramet_mod_h |
---|
28 | USE dissip_mod, ONLY : dissip_allocate |
---|
29 | IMPLICIT NONE |
---|
30 | TYPE(distrib),POINTER :: d |
---|
31 | d=>distrib_dissip |
---|
32 | |
---|
33 | CALL allocate_u(ucov,llm,d) |
---|
34 | ucov(:,:)=0 |
---|
35 | CALL allocate_v(vcov,llm,d) |
---|
36 | vcov(:,:)=0 |
---|
37 | CALL allocate_u(teta,llm,d) |
---|
38 | CALL allocate_u(p,llmp1,d) |
---|
39 | CALL allocate_u(pk,llm,d) |
---|
40 | CALL allocate_u(ucont,llm,d) |
---|
41 | CALL allocate_v(vcont,llm,d) |
---|
42 | CALL allocate_u(ecin,llm,d) |
---|
43 | CALL allocate_u(ecin0,llm,d) |
---|
44 | CALL allocate_u(dudis,llm,d) |
---|
45 | CALL allocate_v(dvdis,llm,d) |
---|
46 | CALL allocate_u(dtetadis,llm,d) |
---|
47 | CALL allocate_u(dtetaecdt,llm,d) |
---|
48 | |
---|
49 | |
---|
50 | CALL dissip_allocate |
---|
51 | |
---|
52 | END SUBROUTINE call_dissip_allocate |
---|
53 | |
---|
54 | SUBROUTINE call_dissip_switch_dissip(dist) |
---|
55 | USE allocate_field_mod |
---|
56 | USE bands |
---|
57 | USE parallel_lmdz |
---|
58 | USE dissip_mod, ONLY : dissip_switch_dissip |
---|
59 | IMPLICIT NONE |
---|
60 | TYPE(distrib),INTENT(IN) :: dist |
---|
61 | |
---|
62 | CALL switch_u(ucov,distrib_dissip,dist) |
---|
63 | CALL switch_v(vcov,distrib_dissip,dist) |
---|
64 | CALL switch_u(teta,distrib_dissip,dist) |
---|
65 | CALL switch_u(p,distrib_dissip,dist) |
---|
66 | CALL switch_u(pk,distrib_dissip,dist) |
---|
67 | CALL switch_u(ucont,distrib_dissip,dist) |
---|
68 | CALL switch_v(vcont,distrib_dissip,dist) |
---|
69 | CALL switch_u(ecin,distrib_dissip,dist) |
---|
70 | CALL switch_u(ecin0,distrib_dissip,dist) |
---|
71 | CALL switch_u(dudis,distrib_dissip,dist) |
---|
72 | CALL switch_v(dvdis,distrib_dissip,dist) |
---|
73 | CALL switch_u(dtetadis,distrib_dissip,dist) |
---|
74 | CALL switch_u(dtetaecdt,distrib_dissip,dist) |
---|
75 | |
---|
76 | CALL dissip_switch_dissip(dist) |
---|
77 | |
---|
78 | END SUBROUTINE call_dissip_switch_dissip |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | SUBROUTINE call_dissip(ucov_dyn,vcov_dyn,teta_dyn,p_dyn,pk_dyn,ps_dyn) |
---|
83 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
84 | USE paramet_mod_h |
---|
85 | USE parallel_lmdz |
---|
86 | USE times |
---|
87 | USE mod_hallo |
---|
88 | USE Bands |
---|
89 | USE vampir |
---|
90 | USE write_field_loc |
---|
91 | USE comgeom_mod_h |
---|
92 | IMPLICIT NONE |
---|
93 | REAL,INTENT(INOUT) :: ucov_dyn(ijb_u:ije_u,llm) ! covariant zonal wind |
---|
94 | REAL,INTENT(INOUT) :: vcov_dyn(ijb_v:ije_v,llm) ! covariant meridional wind |
---|
95 | REAL,INTENT(INOUT) :: teta_dyn(ijb_u:ije_u,llm) ! covariant meridional wind |
---|
96 | REAL,INTENT(INOUT) :: p_dyn(ijb_u:ije_u,llmp1 ) ! pressure at interlayer |
---|
97 | REAL,INTENT(INOUT) :: pk_dyn(ijb_u:ije_u,llm) ! Exner at midlayer |
---|
98 | REAL,INTENT(INOUT) :: ps_dyn(ijb_u:ije_u) ! surface pressure |
---|
99 | REAL :: tppn(iim),tpps(iim) |
---|
100 | REAL :: tpn,tps |
---|
101 | |
---|
102 | REAL SSUM |
---|
103 | LOGICAL,PARAMETER :: dissip_conservative=.TRUE. |
---|
104 | TYPE(Request),SAVE :: Request_dissip |
---|
105 | !$OMP THREADPRIVATE(Request_dissip ) |
---|
106 | INTEGER :: ij,l,ijb,ije |
---|
107 | |
---|
108 | |
---|
109 | !$OMP MASTER |
---|
110 | CALL suspend_timer(timer_caldyn) |
---|
111 | |
---|
112 | ! print*,'Entree dans la dissipation : Iteration No ',true_itau |
---|
113 | ! calcul de l'energie cinetique avant dissipation |
---|
114 | ! print *,'Passage dans la dissipation' |
---|
115 | |
---|
116 | CALL VTb(VThallo) |
---|
117 | !$OMP END MASTER |
---|
118 | |
---|
119 | !$OMP BARRIER |
---|
120 | |
---|
121 | CALL Register_SwapField_u(ucov_dyn,ucov,distrib_dissip, Request_dissip,up=1,down=1) |
---|
122 | CALL Register_SwapField_v(vcov_dyn,vcov,distrib_dissip, Request_dissip,up=1,down=1) |
---|
123 | CALL Register_SwapField_u(teta_dyn,teta,distrib_dissip, Request_dissip) |
---|
124 | CALL Register_SwapField_u(p_dyn,p,distrib_dissip,Request_dissip) |
---|
125 | CALL Register_SwapField_u(pk_dyn,pk,distrib_dissip,Request_dissip) |
---|
126 | |
---|
127 | CALL SendRequest(Request_dissip) |
---|
128 | !$OMP BARRIER |
---|
129 | CALL WaitRequest(Request_dissip) |
---|
130 | |
---|
131 | !$OMP BARRIER |
---|
132 | !$OMP MASTER |
---|
133 | CALL set_distrib(distrib_dissip) |
---|
134 | CALL VTe(VThallo) |
---|
135 | CALL VTb(VTdissipation) |
---|
136 | CALL start_timer(timer_dissip) |
---|
137 | !$OMP END MASTER |
---|
138 | !$OMP BARRIER |
---|
139 | |
---|
140 | CALL covcont_loc(llm,ucov,vcov,ucont,vcont) |
---|
141 | CALL enercin_loc(vcov,ucov,vcont,ucont,ecin0) |
---|
142 | |
---|
143 | ! dissipation |
---|
144 | |
---|
145 | ! CALL FTRACE_REGION_BEGIN("dissip") |
---|
146 | CALL dissip_loc(vcov,ucov,teta,p,dvdis,dudis,dtetadis) |
---|
147 | |
---|
148 | ! CALL FTRACE_REGION_END("dissip") |
---|
149 | |
---|
150 | ijb=ij_begin |
---|
151 | ije=ij_end |
---|
152 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
153 | DO l=1,llm |
---|
154 | ucov(ijb:ije,l)=ucov(ijb:ije,l)+dudis(ijb:ije,l) |
---|
155 | ENDDO |
---|
156 | !$OMP END DO NOWAIT |
---|
157 | |
---|
158 | IF (pole_sud) ije=ije-iip1 |
---|
159 | |
---|
160 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
161 | DO l=1,llm |
---|
162 | vcov(ijb:ije,l)=vcov(ijb:ije,l)+dvdis(ijb:ije,l) |
---|
163 | ENDDO |
---|
164 | !$OMP END DO NOWAIT |
---|
165 | |
---|
166 | ! teta=teta+dtetadis |
---|
167 | |
---|
168 | |
---|
169 | !------------------------------------------------------------------------ |
---|
170 | IF (dissip_conservative) THEN |
---|
171 | ! On rajoute la tendance due a la transform. Ec -> E therm. cree |
---|
172 | ! lors de la dissipation |
---|
173 | !$OMP BARRIER |
---|
174 | !$OMP MASTER |
---|
175 | CALL suspend_timer(timer_dissip) |
---|
176 | CALL VTb(VThallo) |
---|
177 | !$OMP END MASTER |
---|
178 | CALL Register_Hallo_u(ucov,llm,1,1,1,1,Request_Dissip) |
---|
179 | CALL Register_Hallo_v(vcov,llm,1,1,1,1,Request_Dissip) |
---|
180 | CALL SendRequest(Request_Dissip) |
---|
181 | !$OMP BARRIER |
---|
182 | CALL WaitRequest(Request_Dissip) |
---|
183 | !$OMP MASTER |
---|
184 | CALL VTe(VThallo) |
---|
185 | CALL resume_timer(timer_dissip) |
---|
186 | !$OMP END MASTER |
---|
187 | !$OMP BARRIER |
---|
188 | CALL covcont_loc(llm,ucov,vcov,ucont,vcont) |
---|
189 | CALL enercin_loc(vcov,ucov,vcont,ucont,ecin) |
---|
190 | |
---|
191 | ijb=ij_begin |
---|
192 | ije=ij_end |
---|
193 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
194 | DO l=1,llm |
---|
195 | DO ij=ijb,ije |
---|
196 | dtetaecdt(ij,l)= (ecin0(ij,l)-ecin(ij,l))/ pk(ij,l) |
---|
197 | dtetadis(ij,l)=dtetadis(ij,l)+dtetaecdt(ij,l) |
---|
198 | ENDDO |
---|
199 | ENDDO |
---|
200 | !$OMP END DO NOWAIT |
---|
201 | |
---|
202 | ENDIF |
---|
203 | |
---|
204 | ijb=ij_begin |
---|
205 | ije=ij_end |
---|
206 | |
---|
207 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
208 | DO l=1,llm |
---|
209 | DO ij=ijb,ije |
---|
210 | teta(ij,l)=teta(ij,l)+dtetadis(ij,l) |
---|
211 | ENDDO |
---|
212 | ENDDO |
---|
213 | !$OMP END DO NOWAIT |
---|
214 | |
---|
215 | !------------------------------------------------------------------------ |
---|
216 | |
---|
217 | |
---|
218 | ! ....... P. Le Van ( ajout le 17/04/96 ) ........... |
---|
219 | ! ... Calcul de la valeur moyenne, unique de h aux poles ..... |
---|
220 | ! |
---|
221 | |
---|
222 | ijb=ij_begin |
---|
223 | ije=ij_end |
---|
224 | |
---|
225 | IF (pole_nord) THEN |
---|
226 | |
---|
227 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
228 | DO l = 1, llm |
---|
229 | DO ij = 1,iim |
---|
230 | tppn(ij) = aire( ij ) * teta( ij ,l) |
---|
231 | ENDDO |
---|
232 | tpn = SSUM(iim,tppn,1)/apoln |
---|
233 | |
---|
234 | DO ij = 1, iip1 |
---|
235 | teta( ij ,l) = tpn |
---|
236 | ENDDO |
---|
237 | ENDDO |
---|
238 | !$OMP END DO NOWAIT |
---|
239 | |
---|
240 | if (1 == 0) then |
---|
241 | !!! Ehouarn: lines here 1) kill 1+1=2 in the dynamics |
---|
242 | !!! 2) should probably not be here anyway |
---|
243 | !!! but are kept for those who would want to revert to previous behaviour |
---|
244 | !$OMP MASTER |
---|
245 | DO ij = 1,iim |
---|
246 | tppn(ij) = aire( ij ) * ps_dyn ( ij ) |
---|
247 | ENDDO |
---|
248 | tpn = SSUM(iim,tppn,1)/apoln |
---|
249 | |
---|
250 | DO ij = 1, iip1 |
---|
251 | ps_dyn( ij ) = tpn |
---|
252 | ENDDO |
---|
253 | !$OMP END MASTER |
---|
254 | |
---|
255 | ENDIF ! of if (1 == 0) |
---|
256 | endif ! of of (pole_nord) |
---|
257 | |
---|
258 | IF (pole_sud) THEN |
---|
259 | |
---|
260 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
261 | DO l = 1, llm |
---|
262 | DO ij = 1,iim |
---|
263 | tpps(ij) = aire(ij+ip1jm) * teta(ij+ip1jm,l) |
---|
264 | ENDDO |
---|
265 | |
---|
266 | tps = SSUM(iim,tpps,1)/apols |
---|
267 | |
---|
268 | DO ij = 1, iip1 |
---|
269 | teta(ij+ip1jm,l) = tps |
---|
270 | ENDDO |
---|
271 | ENDDO |
---|
272 | !$OMP END DO NOWAIT |
---|
273 | |
---|
274 | if (1 == 0) then |
---|
275 | !!! Ehouarn: lines here 1) kill 1+1=2 in the dynamics |
---|
276 | !!! 2) should probably not be here anyway |
---|
277 | !!! but are kept for those who would want to revert to previous behaviour |
---|
278 | !$OMP MASTER |
---|
279 | DO ij = 1,iim |
---|
280 | tpps(ij) = aire(ij+ip1jm) * ps_dyn (ij+ip1jm) |
---|
281 | ENDDO |
---|
282 | tps = SSUM(iim,tpps,1)/apols |
---|
283 | |
---|
284 | DO ij = 1, iip1 |
---|
285 | ps_dyn(ij+ip1jm) = tps |
---|
286 | ENDDO |
---|
287 | !$OMP END MASTER |
---|
288 | ENDIF ! of if (1 == 0) |
---|
289 | endif ! of if (pole_sud) |
---|
290 | |
---|
291 | |
---|
292 | !$OMP BARRIER |
---|
293 | !$OMP MASTER |
---|
294 | CALL VTe(VTdissipation) |
---|
295 | CALL stop_timer(timer_dissip) |
---|
296 | CALL VTb(VThallo) |
---|
297 | !$OMP END MASTER |
---|
298 | |
---|
299 | CALL Register_SwapField_u(ucov,ucov_dyn,distrib_caldyn,Request_dissip) |
---|
300 | CALL Register_SwapField_v(vcov,vcov_dyn,distrib_caldyn,Request_dissip) |
---|
301 | CALL Register_SwapField_u(teta,teta_dyn,distrib_caldyn,Request_dissip) |
---|
302 | CALL Register_SwapField_u(p,p_dyn,distrib_caldyn,Request_dissip) |
---|
303 | CALL Register_SwapField_u(pk,pk_dyn,distrib_caldyn,Request_dissip) |
---|
304 | |
---|
305 | CALL SendRequest(Request_dissip) |
---|
306 | |
---|
307 | !$OMP BARRIER |
---|
308 | CALL WaitRequest(Request_dissip) |
---|
309 | !$OMP BARRIER |
---|
310 | !$OMP MASTER |
---|
311 | CALL set_distrib(distrib_caldyn) |
---|
312 | CALL VTe(VThallo) |
---|
313 | CALL resume_timer(timer_caldyn) |
---|
314 | ! print *,'fin dissipation' |
---|
315 | !$OMP END MASTER |
---|
316 | !$OMP BARRIER |
---|
317 | |
---|
318 | |
---|
319 | END SUBROUTINE call_dissip |
---|
320 | |
---|
321 | END MODULE call_dissip_mod |
---|