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