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 comdissipn_mod_h |
---|
16 | USE parallel_lmdz |
---|
17 | USE times |
---|
18 | USE Write_field_p |
---|
19 | USE mod_hallo |
---|
20 | USE mod_filtreg_p |
---|
21 | USE gradiv2_mod |
---|
22 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
23 | USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, & |
---|
24 | ip1jmi1, ijp1llm, ijmllm, mvar, jcfil, jcfllm |
---|
25 | IMPLICIT NONE |
---|
26 | ! |
---|
27 | |
---|
28 | |
---|
29 | INCLUDE "comgeom.h" |
---|
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.GT.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 | RETURN |
---|
152 | END SUBROUTINE gradiv2_loc |
---|