source: LMDZ6/branches/Amaury_dev/libf/dyn3dmem/gradiv2_loc.f90 @ 5327

Last change on this file since 5327 was 5159, checked in by abarral, 3 months ago

Put dimensions.h and paramet.h into modules

  • 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: 3.6 KB
RevLine 
[5105]1SUBROUTINE gradiv2_loc(klevel, xcov, ycov, ld, gdx_out, gdy_out )
[5159]2
[5105]3  ! P. Le Van
[5159]4
[5105]5  !   **********************************************************
6  !                            ld
7  !   calcul  de  (grad (div) )   du vect. v ....
[5159]8
[5105]9  ! xcov et ycov etant les composant.covariantes de v
10  !   **********************************************************
11  ! xcont , ycont et ld  sont des arguments  d'entree pour le s-prog
12  !  gdx   et  gdy       sont des arguments de sortie pour le s-prog
[5159]13
14
[5105]15  USE parallel_lmdz
16  USE times
17  USE Write_field_p
18  USE mod_hallo
[5106]19  USE lmdz_filtreg_p
[5105]20  USE gradiv2_mod
[5134]21  USE lmdz_comdissipn, ONLY: tetaudiv, tetaurot, tetah, cdivu, crot, cdivh
[5136]22  USE lmdz_comgeom
[5134]23
[5159]24USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
25  USE lmdz_paramet
[5105]26  IMPLICIT NONE
27  !
[5159]28
29
30
[5105]31  ! ........    variables en arguments      ........
[1632]32
[5105]33  INTEGER :: klevel
34  REAL :: xcov( ijb_u:ije_u,klevel ), ycov( ijb_v:ije_v,klevel )
35  REAL :: gdx_out( ijb_u:ije_u,klevel ), gdy_out( ijb_v:ije_v,klevel)
[5159]36
[5105]37  ! ........       variables locales       .........
[5159]38
[5105]39  REAL      :: tmp_div2(ijb_u:ije_u,llm)
40  REAL :: signe, nugrads
41  INTEGER :: l,ij,iter,ld
42  INTEGER :: ijb,ije,jjb,jje
43  Type(Request),SAVE  :: request_dissip
44!$OMP THREADPRIVATE(request_dissip)
45  !    ........................................................
[5159]46
47
[5105]48  !  CALL SCOPY( ip1jmp1 * klevel, xcov, 1, gdx, 1 )
49  !  CALL SCOPY(   ip1jm * klevel, ycov, 1, gdy, 1 )
[1632]50
[5105]51  ijb=ij_begin
52  ije=ij_end
[1632]53
[5105]54!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
55  DO   l = 1, klevel
56    gdx(ijb:ije,l)=xcov(ijb:ije,l)
57  ENDDO
58!$OMP END DO NOWAIT
[1632]59
[5105]60  ijb=ij_begin
61  ije=ij_end
[5116]62  IF(pole_sud) ije=ij_end-iip1
[1632]63
[5105]64!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
65  DO   l = 1, klevel
66    gdy(ijb:ije,l)=ycov(ijb:ije,l)
67  ENDDO
68!$OMP END DO NOWAIT
[1632]69
[5105]70!$OMP BARRIER
71   CALL Register_Hallo_v(gdy,llm,1,0,0,1,Request_dissip)
72   CALL SendRequest(Request_dissip)
73!$OMP BARRIER
74   CALL WaitRequest(Request_dissip)
75!$OMP BARRIER
[5159]76
77
[5105]78  signe   = (-1.)**ld
79  nugrads = signe * cdivu
80  !
[1632]81
82
[5105]83  CALL    divergf_loc( klevel, gdx,   gdy , div )
84   ! CALL write_field3d_p('div1',reshape(div,(/iip1,jjp1,llm/)))
[1632]85
[5105]86  IF( ld>1 )   THEN
87!$OMP BARRIER
88   CALL Register_Hallo_u(div,llm,1,1,1,1,Request_dissip)
89   CALL SendRequest(Request_dissip)
90!$OMP BARRIER
91   CALL WaitRequest(Request_dissip)
92!$OMP BARRIER
93    CALL laplacien_loc( klevel, div,  div     )
[1632]94
[5105]95  !    ......  Iteration de l'operateur laplacien_gam   .......
96      ! CALL write_field3d_p('div2',reshape(div,(/iip1,jjp1,llm/)))
[1632]97
[5105]98    DO iter = 1, ld -2
99!$OMP BARRIER
100   CALL Register_Hallo_u(div,llm,1,1,1,1,Request_dissip)
101   CALL SendRequest(Request_dissip)
102!$OMP BARRIER
103   CALL WaitRequest(Request_dissip)
[1632]104
[5105]105!$OMP BARRIER
[1632]106
[5105]107     CALL laplacien_gam_loc(klevel,cuvscvgam1,cvuscugam1, &
108           unsair_gam1,unsapolnga1, unsapolsga1, &
109           div, div       )
110    ENDDO
111     ! CALL write_field3d_p('div3',reshape(div,(/iip1,jjp1,llm/)))
112  ENDIF
[1632]113
[5105]114   jjb=jj_begin
115   jje=jj_end
[1632]116
[5105]117   CALL filtreg_p( div   ,jjb_u,jje_u,jjb,jje, jjp1, &
118         klevel, 2, 1, .TRUE., 1 )
119    ! CALL exchange_Hallo(div,ip1jmp1,llm,0,1)
120!$OMP BARRIER
121   CALL Register_Hallo_u(div,llm,1,1,1,1,Request_dissip)
122   CALL SendRequest(Request_dissip)
123!$OMP BARRIER
124   CALL WaitRequest(Request_dissip)
125
126!$OMP BARRIER
127
128
129   CALL  grad_loc( klevel,  div,   gdx,  gdy )
130
[5159]131
[5105]132  ijb=ij_begin
133  ije=ij_end
134
135!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
136   DO   l = 1, klevel
137
[5117]138     IF (pole_sud) ije=ij_end
[5105]139     DO  ij = ijb, ije
140      gdx_out( ij,l ) = gdx( ij,l ) * nugrads
141     ENDDO
142
[5117]143     IF (pole_sud) ije=ij_end-iip1
[5105]144     DO  ij = ijb, ije
145      gdy_out( ij,l ) = gdy( ij,l ) * nugrads
146     ENDDO
147
148   ENDDO
149!$OMP END DO NOWAIT
150  !
151
152END SUBROUTINE gradiv2_loc
Note: See TracBrowser for help on using the repository browser.