1 | SUBROUTINE gradiv2_loc(klevel, xcov, ycov, ld, gdx_out, gdy_out ) |
---|
2 | |
---|
3 | ! P. Le Van |
---|
4 | |
---|
5 | ! ********************************************************** |
---|
6 | ! ld |
---|
7 | ! calcul de (grad (div) ) du vect. v .... |
---|
8 | |
---|
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 |
---|
13 | |
---|
14 | |
---|
15 | USE parallel_lmdz |
---|
16 | USE times |
---|
17 | USE Write_field_p |
---|
18 | USE mod_hallo |
---|
19 | USE lmdz_filtreg_p |
---|
20 | USE gradiv2_mod |
---|
21 | USE lmdz_comdissipn, ONLY: tetaudiv, tetaurot, tetah, cdivu, crot, cdivh |
---|
22 | USE lmdz_comgeom |
---|
23 | |
---|
24 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
25 | USE lmdz_paramet |
---|
26 | IMPLICIT NONE |
---|
27 | ! |
---|
28 | |
---|
29 | |
---|
30 | |
---|
31 | ! ........ variables en arguments ........ |
---|
32 | |
---|
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) |
---|
36 | |
---|
37 | ! ........ variables locales ......... |
---|
38 | |
---|
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 | ! ........................................................ |
---|
46 | |
---|
47 | |
---|
48 | ! CALL SCOPY( ip1jmp1 * klevel, xcov, 1, gdx, 1 ) |
---|
49 | ! CALL SCOPY( ip1jm * klevel, ycov, 1, gdy, 1 ) |
---|
50 | |
---|
51 | ijb=ij_begin |
---|
52 | ije=ij_end |
---|
53 | |
---|
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 |
---|
59 | |
---|
60 | ijb=ij_begin |
---|
61 | ije=ij_end |
---|
62 | IF(pole_sud) ije=ij_end-iip1 |
---|
63 | |
---|
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 |
---|
69 | |
---|
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 |
---|
76 | |
---|
77 | |
---|
78 | signe = (-1.)**ld |
---|
79 | nugrads = signe * cdivu |
---|
80 | ! |
---|
81 | |
---|
82 | |
---|
83 | CALL divergf_loc( klevel, gdx, gdy , div ) |
---|
84 | ! CALL write_field3d_p('div1',reshape(div,(/iip1,jjp1,llm/))) |
---|
85 | |
---|
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 ) |
---|
94 | |
---|
95 | ! ...... Iteration de l'operateur laplacien_gam ....... |
---|
96 | ! CALL write_field3d_p('div2',reshape(div,(/iip1,jjp1,llm/))) |
---|
97 | |
---|
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) |
---|
104 | |
---|
105 | !$OMP BARRIER |
---|
106 | |
---|
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 |
---|
113 | |
---|
114 | jjb=jj_begin |
---|
115 | jje=jj_end |
---|
116 | |
---|
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 | |
---|
131 | |
---|
132 | ijb=ij_begin |
---|
133 | ije=ij_end |
---|
134 | |
---|
135 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
136 | DO l = 1, klevel |
---|
137 | |
---|
138 | IF (pole_sud) ije=ij_end |
---|
139 | DO ij = ijb, ije |
---|
140 | gdx_out( ij,l ) = gdx( ij,l ) * nugrads |
---|
141 | ENDDO |
---|
142 | |
---|
143 | IF (pole_sud) ije=ij_end-iip1 |
---|
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 | |
---|
152 | END SUBROUTINE gradiv2_loc |
---|