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