1 | ! $Id: caladvtrac_p.F 1299 2010-01-20 14:27:21Z fairhead $ |
---|
2 | |
---|
3 | ! |
---|
4 | ! |
---|
5 | SUBROUTINE caladvtrac_loc(q, pbaru, pbarv, & |
---|
6 | p, masse, dq, teta, & |
---|
7 | flxw, pk, iapptrac) |
---|
8 | USE parallel_lmdz |
---|
9 | USE infotrac, ONLY: nqtot |
---|
10 | USE control_mod, ONLY: iapp_tracvl, planet_type |
---|
11 | USE caladvtrac_mod |
---|
12 | USE mod_hallo |
---|
13 | USE bands |
---|
14 | USE times |
---|
15 | USE lmdz_vampir |
---|
16 | USE write_field_loc |
---|
17 | USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_DEBUGIO |
---|
18 | |
---|
19 | IMPLICIT NONE |
---|
20 | ! |
---|
21 | ! Auteurs: F.Hourdin , P.Le Van, F.Forget, F.Codron |
---|
22 | ! |
---|
23 | ! F.Codron (10/99) : ajout humidite specifique pour eau vapeur |
---|
24 | !======================================================================= |
---|
25 | ! |
---|
26 | ! Shema de Van Leer |
---|
27 | ! |
---|
28 | !======================================================================= |
---|
29 | |
---|
30 | INCLUDE "dimensions.h" |
---|
31 | INCLUDE "paramet.h" |
---|
32 | |
---|
33 | ! Arguments: |
---|
34 | ! ---------- |
---|
35 | REAL :: pbaru(ijb_u:ije_u, llm), pbarv(ijb_v:ije_v, llm) |
---|
36 | REAL :: masse(ijb_u:ije_u, llm) |
---|
37 | REAL :: p(ijb_u:ije_u, llmp1) |
---|
38 | REAL :: q(ijb_u:ije_u, llm, nqtot), dq(ijb_u:ije_u, llm, nqtot) |
---|
39 | REAL :: teta(ijb_u:ije_u, llm), pk(ijb_u:ije_u, llm) |
---|
40 | REAL :: flxw(ijb_u:ije_u, llm) |
---|
41 | INTEGER :: iapptrac |
---|
42 | ! Local: |
---|
43 | ! ------ |
---|
44 | ! REAL :: pbarug(ijb_u:ije_u,llm) |
---|
45 | ! REAL :: pbarvg(ijb_v:ije_v,llm) |
---|
46 | ! REAL :: wg(ijb_u:ije_u,llm) |
---|
47 | |
---|
48 | REAL :: flxw_adv(distrib_vanleer%ijb_u:distrib_vanleer%ije_u, llm) |
---|
49 | INTEGER, SAVE :: iadvtr = 0 |
---|
50 | !$OMP THREADPRIVATE(iadvtr) |
---|
51 | INTEGER :: ijb, ije, ijbu, ijbv, ijeu, ijev, j |
---|
52 | INTEGER :: ij, l |
---|
53 | TYPE(Request), SAVE :: Request_vanleer |
---|
54 | !$OMP THREADPRIVATE(Request_vanleer) |
---|
55 | |
---|
56 | !WRITE(*,*) 'caladvtrac 58: entree' |
---|
57 | ijbu = ij_begin |
---|
58 | ijeu = ij_end |
---|
59 | |
---|
60 | ijbv = ij_begin - iip1 |
---|
61 | ijev = ij_end |
---|
62 | IF (pole_nord) ijbv = ij_begin |
---|
63 | IF (pole_sud) ijev = ij_end - iip1 |
---|
64 | |
---|
65 | IF(iadvtr==0) THEN |
---|
66 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
67 | DO l = 1, llm |
---|
68 | pbaruc(ijbu:ijeu, l) = 0. |
---|
69 | pbarvc(ijbv:ijev, l) = 0. |
---|
70 | ENDDO |
---|
71 | !$OMP END DO NOWAIT |
---|
72 | ENDIF |
---|
73 | |
---|
74 | ! accumulation des flux de masse horizontaux |
---|
75 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
76 | DO l = 1, llm |
---|
77 | DO ij = ijbu, ijeu |
---|
78 | pbaruc(ij, l) = pbaruc(ij, l) + pbaru(ij, l) |
---|
79 | ENDDO |
---|
80 | DO ij = ijbv, ijev |
---|
81 | pbarvc(ij, l) = pbarvc(ij, l) + pbarv(ij, l) |
---|
82 | ENDDO |
---|
83 | ENDDO |
---|
84 | !$OMP END DO NOWAIT |
---|
85 | |
---|
86 | ! selection de la masse instantannee des mailles avant le transport. |
---|
87 | IF(iadvtr==0) THEN |
---|
88 | |
---|
89 | ijb = ij_begin |
---|
90 | ije = ij_end |
---|
91 | |
---|
92 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
93 | DO l = 1, llm |
---|
94 | massem(ijb:ije, l) = masse(ijb:ije, l) |
---|
95 | ENDDO |
---|
96 | !$OMP END DO NOWAIT |
---|
97 | |
---|
98 | ENDIF |
---|
99 | |
---|
100 | iadvtr = iadvtr + 1 |
---|
101 | |
---|
102 | !$OMP MASTER |
---|
103 | iapptrac = iadvtr |
---|
104 | !$OMP END MASTER |
---|
105 | |
---|
106 | ! Test pour savoir si on advecte a ce pas de temps |
---|
107 | |
---|
108 | IF (iadvtr==iapp_tracvl) THEN |
---|
109 | !WRITE(*,*) 'caladvtrac 133' |
---|
110 | !$OMP MASTER |
---|
111 | CALL suspend_timer(timer_caldyn) |
---|
112 | !$OMP END MASTER |
---|
113 | |
---|
114 | ijb = ij_begin |
---|
115 | ije = ij_end |
---|
116 | |
---|
117 | !c .. Modif P.Le Van ( 20/12/97 ) .... |
---|
118 | !c |
---|
119 | |
---|
120 | ! traitement des flux de masse avant advection. |
---|
121 | ! 1. calcul de w |
---|
122 | ! 2. groupement des mailles pres du pole. |
---|
123 | |
---|
124 | CALL groupe_loc(massem, pbaruc, pbarvc, pbarug, pbarvg, wg) |
---|
125 | |
---|
126 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
127 | DO l = 1, llm |
---|
128 | flxw(ijb:ije, l) = wg(ijb:ije, l) / REAL(iapp_tracvl) |
---|
129 | ENDDO |
---|
130 | !$OMP ENDDO NOWAIT |
---|
131 | |
---|
132 | IF (CPPKEY_DEBUGIO) THEN |
---|
133 | CALL WriteField_u('pbarug1', pbarug) |
---|
134 | CALL WriteField_v('pbarvg1', pbarvg) |
---|
135 | CALL WriteField_u('wg1', wg) |
---|
136 | END IF |
---|
137 | |
---|
138 | !$OMP BARRIER |
---|
139 | |
---|
140 | |
---|
141 | !$OMP MASTER |
---|
142 | CALL VTb(VTHallo) |
---|
143 | !$OMP END MASTER |
---|
144 | |
---|
145 | CALL Register_SwapField_u(pbarug, pbarug_adv, distrib_vanleer, & |
---|
146 | Request_vanleer) |
---|
147 | CALL Register_SwapField_v(pbarvg, pbarvg_adv, distrib_vanleer, & |
---|
148 | Request_vanleer, up = 1) |
---|
149 | CALL Register_SwapField_u(massem, massem_adv, distrib_vanleer, & |
---|
150 | Request_vanleer) |
---|
151 | CALL Register_SwapField_u(wg, wg_adv, distrib_vanleer, & |
---|
152 | Request_vanleer) |
---|
153 | CALL Register_SwapField_u(teta, teta_adv, distrib_vanleer, & |
---|
154 | Request_vanleer, up = 1, down = 1) |
---|
155 | CALL Register_SwapField_u(p, p_adv, distrib_vanleer, & |
---|
156 | Request_vanleer, up = 1, down = 1) |
---|
157 | CALL Register_SwapField_u(pk, pk_adv, distrib_vanleer, & |
---|
158 | Request_vanleer, up = 1, down = 1) |
---|
159 | CALL Register_SwapField_u(q, q_adv, distrib_vanleer, & |
---|
160 | Request_vanleer) |
---|
161 | |
---|
162 | CALL SendRequest(Request_vanleer) |
---|
163 | !$OMP BARRIER |
---|
164 | CALL WaitRequest(Request_vanleer) |
---|
165 | |
---|
166 | |
---|
167 | !$OMP BARRIER |
---|
168 | !$OMP MASTER |
---|
169 | CALL Set_Distrib(distrib_vanleer) |
---|
170 | CALL VTe(VTHallo) |
---|
171 | CALL VTb(VTadvection) |
---|
172 | CALL start_timer(timer_vanleer) |
---|
173 | !$OMP END MASTER |
---|
174 | !$OMP BARRIER |
---|
175 | ! CALL WriteField_u('pbarug_adv',pbarug_adv) |
---|
176 | ! CALL WriteField_u('',) |
---|
177 | |
---|
178 | IF (CPPKEY_DEBUGIO) THEN |
---|
179 | CALL WriteField_u('pbarug1', pbarug_adv) |
---|
180 | CALL WriteField_v('pbarvg1', pbarvg_adv) |
---|
181 | CALL WriteField_u('wg1', wg_adv) |
---|
182 | END IF |
---|
183 | !WRITE(*,*) 'caladvtrac 185' |
---|
184 | CALL advtrac_loc(pbarug_adv, pbarvg_adv, wg_adv, & |
---|
185 | p_adv, massem_adv, q_adv, teta_adv, & |
---|
186 | pk_adv) |
---|
187 | !WRITE(*,*) 'caladvtrac 189' |
---|
188 | |
---|
189 | |
---|
190 | !$OMP MASTER |
---|
191 | CALL VTe(VTadvection) |
---|
192 | CALL stop_timer(timer_vanleer) |
---|
193 | CALL VTb(VThallo) |
---|
194 | !$OMP END MASTER |
---|
195 | |
---|
196 | CALL Register_SwapField_u(q_adv, q, distrib_caldyn, & |
---|
197 | Request_vanleer) |
---|
198 | |
---|
199 | CALL SendRequest(Request_vanleer) |
---|
200 | !$OMP BARRIER |
---|
201 | CALL WaitRequest(Request_vanleer) |
---|
202 | |
---|
203 | !$OMP BARRIER |
---|
204 | !$OMP MASTER |
---|
205 | CALL Set_Distrib(distrib_caldyn) |
---|
206 | CALL VTe(VThallo) |
---|
207 | CALL resume_timer(timer_caldyn) |
---|
208 | !$OMP END MASTER |
---|
209 | !$OMP BARRIER |
---|
210 | iadvtr = 0 |
---|
211 | ENDIF ! if iadvtr.EQ.iapp_tracvl |
---|
212 | |
---|
213 | END SUBROUTINE caladvtrac_loc |
---|
214 | |
---|
215 | |
---|