source: trunk/LMDZ.COMMON/libf/dyn3dpar/groupe_p.F @ 1453

Last change on this file since 1453 was 1422, checked in by milmd, 10 years ago

In GENERIC, MARS and COMMON models replace some include files by modules (usefull for decoupling physics with dynamics).

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