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 | IMPLICIT NONE |
---|
22 | ! |
---|
23 | INCLUDE "dimensions.h" |
---|
24 | INCLUDE "paramet.h" |
---|
25 | INCLUDE "comgeom.h" |
---|
26 | INCLUDE "comdissipn.h" |
---|
27 | ! |
---|
28 | ! ........ variables en arguments ........ |
---|
29 | |
---|
30 | INTEGER :: klevel |
---|
31 | REAL :: xcov( ijb_u:ije_u,klevel ), ycov( ijb_v:ije_v,klevel ) |
---|
32 | REAL :: gdx_out( ijb_u:ije_u,klevel ), gdy_out( ijb_v:ije_v,klevel) |
---|
33 | ! |
---|
34 | ! ........ variables locales ......... |
---|
35 | ! |
---|
36 | REAL :: tmp_div2(ijb_u:ije_u,llm) |
---|
37 | REAL :: signe, nugrads |
---|
38 | INTEGER :: l,ij,iter,ld |
---|
39 | INTEGER :: ijb,ije,jjb,jje |
---|
40 | Type(Request),SAVE :: request_dissip |
---|
41 | !$OMP THREADPRIVATE(request_dissip) |
---|
42 | ! ........................................................ |
---|
43 | ! |
---|
44 | ! |
---|
45 | ! CALL SCOPY( ip1jmp1 * klevel, xcov, 1, gdx, 1 ) |
---|
46 | ! CALL SCOPY( ip1jm * klevel, ycov, 1, gdy, 1 ) |
---|
47 | |
---|
48 | ijb=ij_begin |
---|
49 | ije=ij_end |
---|
50 | |
---|
51 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
52 | DO l = 1, klevel |
---|
53 | gdx(ijb:ije,l)=xcov(ijb:ije,l) |
---|
54 | ENDDO |
---|
55 | !$OMP END DO NOWAIT |
---|
56 | |
---|
57 | ijb=ij_begin |
---|
58 | ije=ij_end |
---|
59 | if(pole_sud) ije=ij_end-iip1 |
---|
60 | |
---|
61 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
62 | DO l = 1, klevel |
---|
63 | gdy(ijb:ije,l)=ycov(ijb:ije,l) |
---|
64 | ENDDO |
---|
65 | !$OMP END DO NOWAIT |
---|
66 | |
---|
67 | !$OMP BARRIER |
---|
68 | CALL Register_Hallo_v(gdy,llm,1,0,0,1,Request_dissip) |
---|
69 | CALL SendRequest(Request_dissip) |
---|
70 | !$OMP BARRIER |
---|
71 | CALL WaitRequest(Request_dissip) |
---|
72 | !$OMP BARRIER |
---|
73 | ! |
---|
74 | ! |
---|
75 | signe = (-1.)**ld |
---|
76 | nugrads = signe * cdivu |
---|
77 | ! |
---|
78 | |
---|
79 | |
---|
80 | CALL divergf_loc( klevel, gdx, gdy , div ) |
---|
81 | ! CALL write_field3d_p('div1',reshape(div,(/iip1,jjp1,llm/))) |
---|
82 | |
---|
83 | IF( ld>1 ) THEN |
---|
84 | !$OMP BARRIER |
---|
85 | CALL Register_Hallo_u(div,llm,1,1,1,1,Request_dissip) |
---|
86 | CALL SendRequest(Request_dissip) |
---|
87 | !$OMP BARRIER |
---|
88 | CALL WaitRequest(Request_dissip) |
---|
89 | !$OMP BARRIER |
---|
90 | CALL laplacien_loc( klevel, div, div ) |
---|
91 | |
---|
92 | ! ...... Iteration de l'operateur laplacien_gam ....... |
---|
93 | ! CALL write_field3d_p('div2',reshape(div,(/iip1,jjp1,llm/))) |
---|
94 | |
---|
95 | DO iter = 1, ld -2 |
---|
96 | !$OMP BARRIER |
---|
97 | CALL Register_Hallo_u(div,llm,1,1,1,1,Request_dissip) |
---|
98 | CALL SendRequest(Request_dissip) |
---|
99 | !$OMP BARRIER |
---|
100 | CALL WaitRequest(Request_dissip) |
---|
101 | |
---|
102 | !$OMP BARRIER |
---|
103 | |
---|
104 | CALL laplacien_gam_loc(klevel,cuvscvgam1,cvuscugam1, & |
---|
105 | unsair_gam1,unsapolnga1, unsapolsga1, & |
---|
106 | div, div ) |
---|
107 | ENDDO |
---|
108 | ! CALL write_field3d_p('div3',reshape(div,(/iip1,jjp1,llm/))) |
---|
109 | ENDIF |
---|
110 | |
---|
111 | jjb=jj_begin |
---|
112 | jje=jj_end |
---|
113 | |
---|
114 | CALL filtreg_p( div ,jjb_u,jje_u,jjb,jje, jjp1, & |
---|
115 | klevel, 2, 1, .TRUE., 1 ) |
---|
116 | ! CALL exchange_Hallo(div,ip1jmp1,llm,0,1) |
---|
117 | !$OMP BARRIER |
---|
118 | CALL Register_Hallo_u(div,llm,1,1,1,1,Request_dissip) |
---|
119 | CALL SendRequest(Request_dissip) |
---|
120 | !$OMP BARRIER |
---|
121 | CALL WaitRequest(Request_dissip) |
---|
122 | |
---|
123 | !$OMP BARRIER |
---|
124 | |
---|
125 | |
---|
126 | CALL grad_loc( klevel, div, gdx, gdy ) |
---|
127 | |
---|
128 | ! |
---|
129 | ijb=ij_begin |
---|
130 | ije=ij_end |
---|
131 | |
---|
132 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
133 | DO l = 1, klevel |
---|
134 | |
---|
135 | if (pole_sud) ije=ij_end |
---|
136 | DO ij = ijb, ije |
---|
137 | gdx_out( ij,l ) = gdx( ij,l ) * nugrads |
---|
138 | ENDDO |
---|
139 | |
---|
140 | if (pole_sud) ije=ij_end-iip1 |
---|
141 | DO ij = ijb, ije |
---|
142 | gdy_out( ij,l ) = gdy( ij,l ) * nugrads |
---|
143 | ENDDO |
---|
144 | |
---|
145 | ENDDO |
---|
146 | !$OMP END DO NOWAIT |
---|
147 | ! |
---|
148 | |
---|
149 | END SUBROUTINE gradiv2_loc |
---|