source: LMDZ6/trunk/libf/dyn3dmem/groupe_loc.F90 @ 5267

Last change on this file since 5267 was 5258, checked in by abarral, 3 days ago

Wrap uses of cpp key DEBUG_IO

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 2.8 KB
Line 
1subroutine 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
74IF (CPPKEY_DEBUGIO) THEN
75  CALL WriteField_v('pbarvm',reshape(pbarvm,(/ip1jm,llm/)))
76END IF
77  call groupeun_loc(jjm,llm,jjb_v,jje_v,jjb,jje,pbarvm)
78IF (CPPKEY_DEBUGIO) THEN
79  CALL WriteField_v('pbarvm',reshape(pbarvm,(/ip1jm,llm/)))
80END 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
128end subroutine groupe_loc
129
Note: See TracBrowser for help on using the repository browser.