1 | !#define DEBUG_IO |
---|
2 | MODULE call_calfis_mod |
---|
3 | |
---|
4 | REAL,POINTER,SAVE :: ucov(:,:) |
---|
5 | REAL,POINTER,SAVE :: vcov(:,:) |
---|
6 | REAL,POINTER,SAVE :: teta(:,:) |
---|
7 | REAL,POINTER,SAVE :: masse(:,:) |
---|
8 | REAL,POINTER,SAVE :: ps(:) |
---|
9 | REAL,POINTER,SAVE :: phis(:) |
---|
10 | REAL,POINTER,SAVE :: q(:,:,:) |
---|
11 | REAL,POINTER,SAVE :: flxw(:,:) |
---|
12 | |
---|
13 | REAL,POINTER,SAVE :: p(:,:) |
---|
14 | REAL,POINTER,SAVE :: pks(:) |
---|
15 | REAL,POINTER,SAVE :: pk(:,:) |
---|
16 | REAL,POINTER,SAVE :: pkf(:,:) |
---|
17 | REAL,POINTER,SAVE :: phi(:,:) |
---|
18 | REAL,POINTER,SAVE :: du(:,:) |
---|
19 | REAL,POINTER,SAVE :: dv(:,:) |
---|
20 | REAL,POINTER,SAVE :: dteta(:,:) |
---|
21 | REAL,POINTER,SAVE :: dq(:,:,:) |
---|
22 | REAL,POINTER,SAVE :: dufi(:,:) |
---|
23 | REAL,POINTER,SAVE :: dvfi(:,:) |
---|
24 | REAL,POINTER,SAVE :: dtetafi(:,:) |
---|
25 | REAL,POINTER,SAVE :: dqfi(:,:,:) |
---|
26 | REAL,POINTER,SAVE :: dpfi(:) |
---|
27 | |
---|
28 | |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | CONTAINS |
---|
33 | |
---|
34 | SUBROUTINE call_calfis_allocate |
---|
35 | USE bands |
---|
36 | USE allocate_field_mod |
---|
37 | USE parallel_lmdz |
---|
38 | USE dimensions_mod |
---|
39 | USE infotrac |
---|
40 | IMPLICIT NONE |
---|
41 | TYPE(distrib),POINTER :: d |
---|
42 | d=>distrib_physic |
---|
43 | |
---|
44 | CALL allocate_u(ucov,llm,d) |
---|
45 | CALL allocate_v(vcov,llm,d) |
---|
46 | CALL allocate_u(teta,llm,d) |
---|
47 | CALL allocate_u(masse,llm,d) |
---|
48 | CALL allocate_u(ps,d) |
---|
49 | CALL allocate_u(phis,d) |
---|
50 | CALL allocate_u(q,llm,nqtot,d) |
---|
51 | CALL allocate_u(flxw,llm,d) |
---|
52 | CALL allocate_u(p,llmp1,d) |
---|
53 | CALL allocate_u(pks,d) |
---|
54 | CALL allocate_u(pk,llm,d) |
---|
55 | CALL allocate_u(pkf,llm,d) |
---|
56 | CALL allocate_u(phi,llm,d) |
---|
57 | CALL allocate_u(du,llm,d) |
---|
58 | CALL allocate_v(dv,llm,d) |
---|
59 | CALL allocate_u(dteta,llm,d) |
---|
60 | CALL allocate_u(dq,llm,nqtot,d) |
---|
61 | CALL allocate_u(dufi,llm,d) |
---|
62 | CALL allocate_v(dvfi,llm,d) |
---|
63 | CALL allocate_u(dtetafi,llm,d) |
---|
64 | CALL allocate_u(dqfi,llm,nqtot,d) |
---|
65 | CALL allocate_u(dpfi,d) |
---|
66 | |
---|
67 | END SUBROUTINE call_calfis_allocate |
---|
68 | |
---|
69 | |
---|
70 | SUBROUTINE call_calfis(itau,lafin,ucov_dyn,vcov_dyn,teta_dyn,masse_dyn,ps_dyn, & |
---|
71 | phis_dyn,q_dyn,flxw_dyn) |
---|
72 | USE dimensions_mod |
---|
73 | use exner_hyb_loc_m, only: exner_hyb_loc |
---|
74 | use exner_milieu_loc_m, only: exner_milieu_loc |
---|
75 | USE parallel_lmdz |
---|
76 | USE times |
---|
77 | USE mod_hallo |
---|
78 | USE Bands |
---|
79 | USE vampir |
---|
80 | USE infotrac |
---|
81 | USE control_mod |
---|
82 | USE write_field_loc |
---|
83 | USE write_field |
---|
84 | IMPLICIT NONE |
---|
85 | INCLUDE "comconst.h" |
---|
86 | INCLUDE "comvert.h" |
---|
87 | INCLUDE "logic.h" |
---|
88 | INCLUDE "temps.h" |
---|
89 | INCLUDE "iniprint.h" |
---|
90 | |
---|
91 | INTEGER,INTENT(IN) :: itau ! (time) iteration step number |
---|
92 | LOGICAL,INTENT(IN) :: lafin ! .true. if final time step |
---|
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) ! potential temperature |
---|
96 | REAL,INTENT(INOUT) :: masse_dyn(ijb_u:ije_u,llm) ! air mass |
---|
97 | REAL,INTENT(INOUT) :: ps_dyn(ijb_u:ije_u) ! surface pressure |
---|
98 | REAL,INTENT(INOUT) :: phis_dyn(ijb_u:ije_u) ! surface geopotential |
---|
99 | REAL,INTENT(INOUT) :: q_dyn(ijb_u:ije_u,llm,nqtot) ! advected tracers |
---|
100 | REAL,INTENT(INOUT) :: flxw_dyn(ijb_u:ije_u,llm) ! vertical mass flux |
---|
101 | |
---|
102 | REAL :: dufi_tmp(iip1,llm) |
---|
103 | REAL :: dvfi_tmp(iip1,llm) |
---|
104 | REAL :: dtetafi_tmp(iip1,llm) |
---|
105 | REAL :: dpfi_tmp(iip1) |
---|
106 | REAL :: dqfi_tmp(iip1,llm,nqtot) |
---|
107 | |
---|
108 | REAL :: jD_cur, jH_cur |
---|
109 | CHARACTER(LEN=15) :: ztit |
---|
110 | TYPE(Request),SAVE :: Request_physic |
---|
111 | !$OMP THREADPRIVATE(Request_physic ) |
---|
112 | INTEGER :: ijb,ije,l,j |
---|
113 | |
---|
114 | |
---|
115 | #ifdef DEBUG_IO |
---|
116 | CALL WriteField_u('ucovfi',ucov) |
---|
117 | CALL WriteField_v('vcovfi',vcov) |
---|
118 | CALL WriteField_u('tetafi',teta) |
---|
119 | CALL WriteField_u('pfi',p) |
---|
120 | CALL WriteField_u('pkfi',pk) |
---|
121 | DO j=1,nqtot |
---|
122 | CALL WriteField_u('qfi'//trim(int2str(j)),q(:,:,j)) |
---|
123 | ENDDO |
---|
124 | #endif |
---|
125 | |
---|
126 | ! |
---|
127 | ! ....... Ajout P.Le Van ( 17/04/96 ) ........... |
---|
128 | ! |
---|
129 | |
---|
130 | |
---|
131 | !$OMP MASTER |
---|
132 | CALL suspend_timer(timer_caldyn) |
---|
133 | IF (prt_level >= 10) THEN |
---|
134 | WRITE(lunout,*) 'leapfrog_p: Entree dans la physique : Iteration No ',itau |
---|
135 | ENDIF |
---|
136 | !$OMP END MASTER |
---|
137 | |
---|
138 | jD_cur = jD_ref + day_ini - day_ref & |
---|
139 | & + itau/day_step |
---|
140 | |
---|
141 | IF (planet_type .eq."generic") THEN |
---|
142 | ! AS: we make jD_cur to be pday |
---|
143 | jD_cur = int(day_ini + itau/day_step) |
---|
144 | ENDIF |
---|
145 | |
---|
146 | jH_cur = jH_ref + start_time + & |
---|
147 | & mod(itau,day_step)/float(day_step) |
---|
148 | if (jH_cur > 1.0 ) then |
---|
149 | jD_cur = jD_cur +1. |
---|
150 | jH_cur = jH_cur -1. |
---|
151 | endif |
---|
152 | |
---|
153 | ! Inbterface avec les routines de phylmd (phymars ... ) |
---|
154 | ! ----------------------------------------------------- |
---|
155 | |
---|
156 | !+jld |
---|
157 | |
---|
158 | ! Diagnostique de conservation de l'energie : initialisation |
---|
159 | |
---|
160 | !-jld |
---|
161 | !$OMP BARRIER |
---|
162 | !$OMP MASTER |
---|
163 | CALL VTb(VThallo) |
---|
164 | !$OMP END MASTER |
---|
165 | |
---|
166 | #ifdef DEBUG_IO |
---|
167 | CALL WriteField_u('ucovfi',ucov) |
---|
168 | CALL WriteField_v('vcovfi',vcov) |
---|
169 | CALL WriteField_u('tetafi',teta) |
---|
170 | CALL WriteField_u('pfi',p) |
---|
171 | CALL WriteField_u('pkfi',pk) |
---|
172 | #endif |
---|
173 | |
---|
174 | CALL SetTag(Request_physic,800) |
---|
175 | CALL Register_SwapField_u(ucov_dyn,ucov,distrib_physic,Request_physic,up=2,down=2) |
---|
176 | CALL Register_SwapField_v(vcov_dyn,vcov,distrib_physic,Request_physic,up=2,down=2) |
---|
177 | CALL Register_SwapField_u(teta_dyn,teta,distrib_physic,Request_physic,up=2,down=2) |
---|
178 | CALL Register_SwapField_u(masse_dyn,masse,distrib_physic,Request_physic,up=1,down=2) |
---|
179 | CALL Register_SwapField_u(ps_dyn,ps,distrib_physic,Request_physic,up=2,down=2) |
---|
180 | CALL Register_SwapField_u(phis_dyn,phis,distrib_physic,Request_physic,up=2,down=2) |
---|
181 | CALL Register_SwapField_u(q_dyn,q,distrib_physic,Request_physic,up=2,down=2) |
---|
182 | CALL Register_SwapField_u(flxw_dyn,flxw,distrib_physic,Request_physic,up=2,down=2) |
---|
183 | |
---|
184 | CALL SendRequest(Request_Physic) |
---|
185 | !$OMP BARRIER |
---|
186 | CALL WaitRequest(Request_Physic) |
---|
187 | |
---|
188 | !$OMP BARRIER |
---|
189 | !$OMP MASTER |
---|
190 | CALL Set_Distrib(distrib_Physic) |
---|
191 | CALL VTe(VThallo) |
---|
192 | |
---|
193 | CALL VTb(VTphysiq) |
---|
194 | !$OMP END MASTER |
---|
195 | !$OMP BARRIER |
---|
196 | |
---|
197 | CALL pression_loc ( ip1jmp1, ap, bp, ps, p ) |
---|
198 | |
---|
199 | !$OMP BARRIER |
---|
200 | CALL exner_hyb_loc( ip1jmp1, ps, p, pks, pk, pkf ) |
---|
201 | !$OMP BARRIER |
---|
202 | CALL geopot_loc ( ip1jmp1, teta , pk , pks, phis , phi ) |
---|
203 | |
---|
204 | |
---|
205 | CALL Register_Hallo_u(p,llmp1,2,2,2,2,Request_physic) |
---|
206 | CALL Register_Hallo_u(pk,llm,2,2,2,2,Request_physic) |
---|
207 | CALL Register_Hallo_u(phi,llm,2,2,2,2,Request_physic) |
---|
208 | |
---|
209 | CALL SendRequest(Request_Physic) |
---|
210 | !$OMP BARRIER |
---|
211 | CALL WaitRequest(Request_Physic) |
---|
212 | |
---|
213 | !$OMP BARRIER |
---|
214 | |
---|
215 | |
---|
216 | #ifdef DEBUG_IO |
---|
217 | CALL WriteField_u('ucovfi',ucov) |
---|
218 | CALL WriteField_v('vcovfi',vcov) |
---|
219 | CALL WriteField_u('tetafi',teta) |
---|
220 | CALL WriteField_u('pfi',p) |
---|
221 | CALL WriteField_u('pkfi',pk) |
---|
222 | DO j=1,nqtot |
---|
223 | CALL WriteField_u('qfi'//trim(int2str(j)),q(:,:,j)) |
---|
224 | ENDDO |
---|
225 | #endif |
---|
226 | |
---|
227 | !$OMP BARRIER |
---|
228 | |
---|
229 | CALL calfis_loc(lafin ,jD_cur, jH_cur, & |
---|
230 | ucov,vcov,teta,q,masse,ps,p,pk,phis,phi , & |
---|
231 | du,dv,dteta,dq, & |
---|
232 | flxw, dufi,dvfi,dtetafi,dqfi,dpfi ) |
---|
233 | |
---|
234 | ijb=ij_begin |
---|
235 | ije=ij_end |
---|
236 | IF ( .not. pole_nord) THEN |
---|
237 | |
---|
238 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
239 | DO l=1,llm |
---|
240 | dufi_tmp(1:iip1,l) = dufi(ijb:ijb+iim,l) |
---|
241 | dvfi_tmp(1:iip1,l) = dvfi(ijb:ijb+iim,l) |
---|
242 | dtetafi_tmp(1:iip1,l)= dtetafi(ijb:ijb+iim,l) |
---|
243 | dqfi_tmp(1:iip1,l,:) = dqfi(ijb:ijb+iim,l,:) |
---|
244 | ENDDO |
---|
245 | !$OMP END DO NOWAIT |
---|
246 | |
---|
247 | !$OMP MASTER |
---|
248 | dpfi_tmp(1:iip1) = dpfi(ijb:ijb+iim) |
---|
249 | !$OMP END MASTER |
---|
250 | |
---|
251 | ENDIF ! of if ( .not. pole_nord) |
---|
252 | |
---|
253 | !$OMP BARRIER |
---|
254 | !$OMP MASTER |
---|
255 | CALL Set_Distrib(distrib_Physic_bis) |
---|
256 | CALL VTb(VThallo) |
---|
257 | !$OMP END MASTER |
---|
258 | !$OMP BARRIER |
---|
259 | |
---|
260 | CALL Register_Hallo_u(dufi,llm,1,0,0,1,Request_physic) |
---|
261 | CALL Register_Hallo_v(dvfi,llm,1,0,0,1,Request_physic) |
---|
262 | CALL Register_Hallo_u(dtetafi,llm,1,0,0,1,Request_physic) |
---|
263 | CALL Register_Hallo_u(dpfi,1,1,0,0,1,Request_physic) |
---|
264 | |
---|
265 | DO j=1,nqtot |
---|
266 | CALL Register_Hallo_u(dqfi(:,:,j),llm,1,0,0,1,Request_physic) |
---|
267 | ENDDO |
---|
268 | |
---|
269 | CALL SendRequest(Request_Physic) |
---|
270 | !$OMP BARRIER |
---|
271 | CALL WaitRequest(Request_Physic) |
---|
272 | |
---|
273 | !$OMP BARRIER |
---|
274 | !$OMP MASTER |
---|
275 | CALL VTe(VThallo) |
---|
276 | CALL Set_Distrib(distrib_Physic) |
---|
277 | !$OMP END MASTER |
---|
278 | !$OMP BARRIER |
---|
279 | ijb=ij_begin |
---|
280 | IF (.not. pole_nord) THEN |
---|
281 | |
---|
282 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
283 | DO l=1,llm |
---|
284 | dufi(ijb:ijb+iim,l) = dufi(ijb:ijb+iim,l)+dufi_tmp(1:iip1,l) |
---|
285 | dvfi(ijb:ijb+iim,l) = dvfi(ijb:ijb+iim,l)+dvfi_tmp(1:iip1,l) |
---|
286 | dtetafi(ijb:ijb+iim,l) = dtetafi(ijb:ijb+iim,l)+dtetafi_tmp(1:iip1,l) |
---|
287 | dqfi(ijb:ijb+iim,l,:) = dqfi(ijb:ijb+iim,l,:) + dqfi_tmp(1:iip1,l,:) |
---|
288 | ENDDO |
---|
289 | !$OMP END DO NOWAIT |
---|
290 | |
---|
291 | !$OMP MASTER |
---|
292 | dpfi(ijb:ijb+iim) = dpfi(ijb:ijb+iim)+ dpfi_tmp(1:iip1) |
---|
293 | !$OMP END MASTER |
---|
294 | |
---|
295 | endif ! of if (.not. pole_nord) |
---|
296 | |
---|
297 | |
---|
298 | #ifdef DEBUG_IO |
---|
299 | CALL WriteField_u('dufi',dufi) |
---|
300 | CALL WriteField_v('dvfi',dvfi) |
---|
301 | CALL WriteField_u('dtetafi',dtetafi) |
---|
302 | CALL WriteField_u('dpfi',dpfi) |
---|
303 | DO j=1,nqtot |
---|
304 | CALL WriteField_u('dqfi'//trim(int2str(j)),dqfi(:,:,j)) |
---|
305 | ENDDO |
---|
306 | #endif |
---|
307 | |
---|
308 | !$OMP BARRIER |
---|
309 | |
---|
310 | ! ajout des tendances physiques: |
---|
311 | ! ------------------------------ |
---|
312 | #ifdef DEBUG_IO |
---|
313 | CALL WriteField_u('ucovfi',ucov) |
---|
314 | CALL WriteField_v('vcovfi',vcov) |
---|
315 | CALL WriteField_u('tetafi',teta) |
---|
316 | CALL WriteField_u('psfi',ps) |
---|
317 | DO j=1,nqtot |
---|
318 | CALL WriteField_u('qfi'//trim(int2str(j)),q(:,:,j)) |
---|
319 | ENDDO |
---|
320 | #endif |
---|
321 | |
---|
322 | #ifdef DEBUG_IO |
---|
323 | CALL WriteField_u('ucovfi',ucov) |
---|
324 | CALL WriteField_v('vcovfi',vcov) |
---|
325 | CALL WriteField_u('tetafi',teta) |
---|
326 | CALL WriteField_u('psfi',ps) |
---|
327 | DO j=1,nqtot |
---|
328 | CALL WriteField_u('qfi'//trim(int2str(j)),q(:,:,j)) |
---|
329 | ENDDO |
---|
330 | #endif |
---|
331 | |
---|
332 | CALL addfi_loc( dtphys, leapf, forward , & |
---|
333 | ucov, vcov, teta , q ,ps , & |
---|
334 | dufi, dvfi, dtetafi , dqfi ,dpfi ) |
---|
335 | ! since addfi updates ps(), also update p(), masse() and pk() |
---|
336 | CALL pression_loc(ip1jmp1,ap,bp,ps,p) |
---|
337 | !$OMP BARRIER |
---|
338 | CALL massdair_loc(p,masse) |
---|
339 | !$OMP BARRIER |
---|
340 | if (pressure_exner) then |
---|
341 | CALL exner_hyb_loc(ijnb_u,ps,p,pks,pk,pkf) |
---|
342 | else |
---|
343 | CALL exner_milieu_loc(ijnb_u,ps,p,pks,pk,pkf) |
---|
344 | endif |
---|
345 | !$OMP BARRIER |
---|
346 | |
---|
347 | #ifdef DEBUG_IO |
---|
348 | CALL WriteField_u('ucovfi',ucov) |
---|
349 | CALL WriteField_v('vcovfi',vcov) |
---|
350 | CALL WriteField_u('tetafi',teta) |
---|
351 | CALL WriteField_u('psfi',ps) |
---|
352 | DO j=1,nqtot |
---|
353 | CALL WriteField_u('qfi'//trim(int2str(j)),q(:,:,j)) |
---|
354 | ENDDO |
---|
355 | #endif |
---|
356 | |
---|
357 | IF (ok_strato) THEN |
---|
358 | ! CALL top_bound_loc( vcov,ucov,teta,masse,dufi,dvfi,dtetafi) |
---|
359 | CALL top_bound_loc(vcov,ucov,teta,masse,dtphys) |
---|
360 | ENDIF |
---|
361 | |
---|
362 | !$OMP BARRIER |
---|
363 | !$OMP MASTER |
---|
364 | CALL VTe(VTphysiq) |
---|
365 | CALL VTb(VThallo) |
---|
366 | !$OMP END MASTER |
---|
367 | |
---|
368 | CALL SetTag(Request_physic,800) |
---|
369 | CALL Register_SwapField_u(ucov,ucov_dyn,distrib_caldyn,Request_physic) |
---|
370 | CALL Register_SwapField_v(vcov,vcov_dyn,distrib_caldyn,Request_physic) |
---|
371 | CALL Register_SwapField_u(teta,teta_dyn,distrib_caldyn,Request_physic) |
---|
372 | CALL Register_SwapField_u(masse,masse_dyn,distrib_caldyn,Request_physic) |
---|
373 | CALL Register_SwapField_u(ps,ps_dyn,distrib_caldyn,Request_physic) |
---|
374 | CALL Register_SwapField_u(q,q_dyn,distrib_caldyn,Request_physic) |
---|
375 | CALL SendRequest(Request_Physic) |
---|
376 | !$OMP BARRIER |
---|
377 | CALL WaitRequest(Request_Physic) |
---|
378 | |
---|
379 | !$OMP BARRIER |
---|
380 | !$OMP MASTER |
---|
381 | CALL VTe(VThallo) |
---|
382 | CALL set_distrib(distrib_caldyn) |
---|
383 | !$OMP END MASTER |
---|
384 | !$OMP BARRIER |
---|
385 | |
---|
386 | ! |
---|
387 | ! Diagnostique de conservation de l'energie : difference |
---|
388 | IF (ip_ebil_dyn.ge.1 ) THEN |
---|
389 | ztit='bil phys' |
---|
390 | ! CALL diagedyn(ztit,2,1,1,dtphys,ucov, vcov , ps, p ,pk , teta , q(:,:,1), q(:,:,2)) |
---|
391 | write(lunout,*)"call_calfis: diagedyn disabled in dyn3dmem !!" |
---|
392 | ENDIF |
---|
393 | |
---|
394 | #ifdef DEBUG_IO |
---|
395 | CALL WriteField_u('ucovfi',ucov_dyn) |
---|
396 | CALL WriteField_v('vcovfi',vcov_dyn) |
---|
397 | CALL WriteField_u('tetafi',teta_dyn) |
---|
398 | CALL WriteField_u('psfi',ps_dyn) |
---|
399 | DO j=1,nqtot |
---|
400 | CALL WriteField_u('qfi'//trim(int2str(j)),q_dyn(:,:,j)) |
---|
401 | ENDDO |
---|
402 | #endif |
---|
403 | |
---|
404 | |
---|
405 | !-jld |
---|
406 | !$OMP MASTER |
---|
407 | CALL resume_timer(timer_caldyn) |
---|
408 | !$OMP END MASTER |
---|
409 | |
---|
410 | END SUBROUTINE call_calfis |
---|
411 | |
---|
412 | END MODULE call_calfis_mod |
---|