My Project
 All Classes Files Functions Variables Macros
groupe_p.F
Go to the documentation of this file.
1  subroutine groupe_p(pext,pbaru,pbarv,pbarum,pbarvm,wm)
2  USE parallel
3  implicit none
4 
5 c sous-programme servant a fitlrer les champs de flux de masse aux
6 c poles en "regroupant" les mailles 2 par 2 puis 4 par 4 etc. au fur
7 c et a mesure qu'on se rapproche du pole.
8 c
9 c en entree: pext, pbaru et pbarv
10 c
11 c en sortie: pbarum,pbarvm et wm.
12 c
13 c remarque, le wm est recalcule a partir des pbaru pbarv et on n'a donc
14 c pas besoin de w en entree.
15 
16 #include "dimensions.h"
17 #include "paramet.h"
18 #include "comconst.h"
19 #include "comgeom2.h"
20 #include "comvert.h"
21 
22  integer ngroup
23  parameter(ngroup=3)
24 
25 
26  real pbaru(iip1,jjp1,llm),pbarv(iip1,jjm,llm)
27  real pext(iip1,jjp1,llm)
28 
29  real pbarum(iip1,jjp1,llm),pbarvm(iip1,jjm,llm)
30  real wm(iip1,jjp1,llm)
31 
32  real,save :: zconvm(iip1,jjp1,llm)
33  real,save :: zconvmm(iip1,jjp1,llm)
34 
35  real uu
36 
37  integer i,j,l
38 
39  logical firstcall,groupe_ok
40  save firstcall,groupe_ok
41 c$OMP THREADPRIVATE(firstcall,groupe_ok)
42 
43  data firstcall/.true./
44  data groupe_ok/.true./
45 
46  integer ijb,ije,jjb,jje
47 
48  if (iim==1) then
49  groupe_ok=.false.
50  endif
51 
52  if (firstcall) then
53  if (groupe_ok) then
54  if(mod(iim,2**ngroup).ne.0) stop'probleme du nombre de point'
55  endif
56  firstcall=.false.
57  endif
58 
59 c Champs 1D
60 
61  call convflu_p(pbaru,pbarv,llm,zconvm)
62 
63 c
64 c call scopy(ijp1llm,zconvm,1,zconvmm,1)
65 c call scopy(ijmllm,pbarv,1,pbarvm,1)
66 
67  jjb=jj_begin
68  jje=jj_end
69 
70 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
71  do l=1,llm
72  zconvmm(:,jjb:jje,l)=zconvm(:,jjb:jje,l)
73  enddo
74 c$OMP END DO NOWAIT
75 
76  if (groupe_ok) then
77  call groupeun_p(jjp1,llm,jjb,jje,zconvmm)
78  endif
79 
80  jjb=jj_begin-1
81  jje=jj_end
82  if (pole_nord) jjb=jj_begin
83  if (pole_sud) jje=jj_end-1
84 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
85  do l=1,llm
86  pbarvm(:,jjb:jje,l)=pbarv(:,jjb:jje,l)
87  enddo
88 c$OMP END DO NOWAIT
89 
90  if (groupe_ok) then
91  call groupeun_p(jjm,llm,jjb,jje,pbarvm)
92  endif
93 
94 c Champs 3D
95 
96  jjb=jj_begin
97  jje=jj_end
98  if (pole_nord) jjb=jj_begin+1
99  if (pole_sud) jje=jj_end-1
100 
101 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
102  do l=1,llm
103  do j=jjb,jje
104  uu=pbaru(iim,j,l)
105  do i=1,iim
106  uu=uu+pbarvm(i,j,l)-pbarvm(i,j-1,l)-zconvmm(i,j,l)
107  pbarum(i,j,l)=uu
108 c zconvm(i,j,l ) = xflu(i-1,j,l)-xflu(i,j,l)+
109 c * yflu(i,j,l)-yflu(i,j-1,l)
110  enddo
111  pbarum(iip1,j,l)=pbarum(1,j,l)
112  enddo
113  enddo
114 c$OMP END DO NOWAIT
115 
116 c integration de la convergence de masse de haut en bas ......
117 
118  jjb=jj_begin
119  jje=jj_end
120 
121 c$OMP BARRIER
122 c$OMP MASTER
123  do l = llm-1,1,-1
124  do j=jjb,jje
125  do i=1,iip1
126  zconvmm(i,j,l)=zconvmm(i,j,l)+zconvmm(i,j,l+1)
127  enddo
128  enddo
129  enddo
130 
131  if (.not. pole_sud) then
132  zconvmm(:,jj_end+1,:)=0
133 cym wm(:,jj_end+1,:)=0
134  endif
135 
136 c$OMP END MASTER
137 c$OMP BARRIER
138 
139  CALL vitvert_p(zconvmm(1,1,1),wm(1,1,1))
140 
141  return
142  end
143