1 | subroutine groupe_loc(pext,pbaru,pbarv,pbarum,pbarvm,wm) |
---|
2 | USE parallel_lmdz |
---|
3 | USE Write_field_loc |
---|
4 | USE groupe_mod |
---|
5 | USE comconst_mod, ONLY: ngroup |
---|
6 | USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_DEBUGIO |
---|
7 | implicit none |
---|
8 | |
---|
9 | ! sous-programme servant a fitlrer les champs de flux de masse aux |
---|
10 | ! poles en "regroupant" les mailles 2 par 2 puis 4 par 4 etc. au fur |
---|
11 | ! et a mesure qu'on se rapproche du pole. |
---|
12 | ! |
---|
13 | ! en entree: pext, pbaru et pbarv |
---|
14 | ! |
---|
15 | ! en sortie: pbarum,pbarvm et wm. |
---|
16 | ! |
---|
17 | ! remarque, le wm est recalcule a partir des pbaru pbarv et on n'a donc |
---|
18 | ! pas besoin de w en entree. |
---|
19 | |
---|
20 | include "dimensions.h" |
---|
21 | include "paramet.h" |
---|
22 | include "comgeom2.h" |
---|
23 | |
---|
24 | ! integer ngroup |
---|
25 | ! parameter (ngroup=3) |
---|
26 | |
---|
27 | |
---|
28 | real :: pbaru(iip1,jjb_u:jje_u,llm),pbarv(iip1,jjb_v:jje_v,llm) |
---|
29 | real :: pext(iip1,jjb_u:jje_u,llm) |
---|
30 | |
---|
31 | real :: pbarum(iip1,jjb_u:jje_u,llm),pbarvm(iip1,jjb_v:jje_v,llm) |
---|
32 | real :: wm(iip1,jjb_u:jje_u,llm) |
---|
33 | |
---|
34 | |
---|
35 | real :: uu |
---|
36 | |
---|
37 | integer :: i,j,l |
---|
38 | |
---|
39 | logical :: firstcall |
---|
40 | save firstcall |
---|
41 | !$OMP THREADPRIVATE(firstcall) |
---|
42 | |
---|
43 | integer :: ijb,ije,jjb,jje |
---|
44 | |
---|
45 | ! Champs 1D |
---|
46 | |
---|
47 | call convflu_loc(pbaru,pbarv,llm,zconvm) |
---|
48 | |
---|
49 | ! |
---|
50 | ! call scopy(ijp1llm,zconvm,1,zconvmm,1) |
---|
51 | ! call scopy(ijmllm,pbarv,1,pbarvm,1) |
---|
52 | |
---|
53 | jjb=jj_begin |
---|
54 | jje=jj_end |
---|
55 | |
---|
56 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
57 | do l=1,llm |
---|
58 | zconvmm(:,jjb:jje,l)=zconvm(:,jjb:jje,l) |
---|
59 | enddo |
---|
60 | !$OMP END DO NOWAIT |
---|
61 | |
---|
62 | call groupeun_loc(jjp1,llm,jjb_u,jje_u,jjb,jje,zconvmm) |
---|
63 | |
---|
64 | jjb=jj_begin-1 |
---|
65 | jje=jj_end |
---|
66 | if (pole_nord) jjb=jj_begin |
---|
67 | if (pole_sud) jje=jj_end-1 |
---|
68 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
69 | do l=1,llm |
---|
70 | pbarvm(:,jjb:jje,l)=pbarv(:,jjb:jje,l) |
---|
71 | enddo |
---|
72 | !$OMP END DO NOWAIT |
---|
73 | |
---|
74 | IF (CPPKEY_DEBUGIO) THEN |
---|
75 | CALL WriteField_v('pbarvm',reshape(pbarvm,(/ip1jm,llm/))) |
---|
76 | END IF |
---|
77 | call groupeun_loc(jjm,llm,jjb_v,jje_v,jjb,jje,pbarvm) |
---|
78 | IF (CPPKEY_DEBUGIO) THEN |
---|
79 | CALL WriteField_v('pbarvm',reshape(pbarvm,(/ip1jm,llm/))) |
---|
80 | END IF |
---|
81 | ! Champs 3D |
---|
82 | |
---|
83 | jjb=jj_begin |
---|
84 | jje=jj_end |
---|
85 | if (pole_nord) jjb=jj_begin+1 |
---|
86 | if (pole_sud) jje=jj_end-1 |
---|
87 | |
---|
88 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
89 | do l=1,llm |
---|
90 | do j=jjb,jje |
---|
91 | uu=pbaru(iim,j,l) |
---|
92 | do i=1,iim |
---|
93 | uu=uu+pbarvm(i,j,l)-pbarvm(i,j-1,l)-zconvmm(i,j,l) |
---|
94 | pbarum(i,j,l)=uu |
---|
95 | ! zconvm(i,j,l ) = xflu(i-1,j,l)-xflu(i,j,l)+ |
---|
96 | ! * yflu(i,j,l)-yflu(i,j-1,l) |
---|
97 | enddo |
---|
98 | pbarum(iip1,j,l)=pbarum(1,j,l) |
---|
99 | enddo |
---|
100 | enddo |
---|
101 | !$OMP END DO NOWAIT |
---|
102 | ! integration de la convergence de masse de haut en bas ...... |
---|
103 | |
---|
104 | jjb=jj_begin |
---|
105 | jje=jj_end |
---|
106 | |
---|
107 | !$OMP BARRIER |
---|
108 | !$OMP MASTER |
---|
109 | do l = llm-1,1,-1 |
---|
110 | do j=jjb,jje |
---|
111 | do i=1,iip1 |
---|
112 | zconvmm(i,j,l)=zconvmm(i,j,l)+zconvmm(i,j,l+1) |
---|
113 | enddo |
---|
114 | enddo |
---|
115 | enddo |
---|
116 | |
---|
117 | if (.not. pole_sud) then |
---|
118 | zconvmm(:,jj_end+1,:)=0 |
---|
119 | !ym wm(:,jj_end+1,:)=0 |
---|
120 | endif |
---|
121 | |
---|
122 | !$OMP END MASTER |
---|
123 | !$OMP BARRIER |
---|
124 | |
---|
125 | CALL vitvert_loc(zconvmm,wm) |
---|
126 | |
---|
127 | return |
---|
128 | end subroutine groupe_loc |
---|
129 | |
---|