[709] | 1 | SUBROUTINE gradiv2_p(klevel, xcov, ycov, ld, gdx_out, gdy_out ) |
---|
[630] | 2 | c |
---|
| 3 | c P. Le Van |
---|
| 4 | c |
---|
| 5 | c ********************************************************** |
---|
| 6 | c ld |
---|
| 7 | c calcul de (grad (div) ) du vect. v .... |
---|
| 8 | c |
---|
| 9 | c xcov et ycov etant les composant.covariantes de v |
---|
| 10 | c ********************************************************** |
---|
| 11 | c xcont , ycont et ld sont des arguments d'entree pour le s-prog |
---|
| 12 | c gdx et gdy sont des arguments de sortie pour le s-prog |
---|
| 13 | c |
---|
| 14 | c |
---|
| 15 | USE parallel |
---|
| 16 | USE times |
---|
| 17 | USE Write_field_p |
---|
| 18 | IMPLICIT NONE |
---|
| 19 | c |
---|
| 20 | #include "dimensions.h" |
---|
| 21 | #include "paramet.h" |
---|
| 22 | #include "comgeom.h" |
---|
| 23 | #include "comdissipn.h" |
---|
| 24 | c |
---|
| 25 | c ........ variables en arguments ........ |
---|
| 26 | |
---|
| 27 | INTEGER klevel |
---|
| 28 | REAL xcov( ip1jmp1,klevel ), ycov( ip1jm,klevel ) |
---|
[709] | 29 | REAL,SAVE :: gdx( ip1jmp1,llm ), gdy( ip1jm,llm ) |
---|
| 30 | REAL gdx_out( ip1jmp1,klevel ), gdy_out( ip1jm,klevel ) |
---|
[630] | 31 | c |
---|
| 32 | c ........ variables locales ......... |
---|
| 33 | c |
---|
[709] | 34 | REAL,SAVE :: div(ip1jmp1,llm) |
---|
[630] | 35 | REAL signe, nugrads |
---|
| 36 | INTEGER l,ij,iter,ld |
---|
| 37 | INTEGER :: ijb,ije,jjb,jje |
---|
| 38 | |
---|
| 39 | c ........................................................ |
---|
| 40 | c |
---|
| 41 | c |
---|
| 42 | c CALL SCOPY( ip1jmp1 * klevel, xcov, 1, gdx, 1 ) |
---|
| 43 | c CALL SCOPY( ip1jm * klevel, ycov, 1, gdy, 1 ) |
---|
| 44 | |
---|
| 45 | ijb=ij_begin |
---|
| 46 | ije=ij_end |
---|
| 47 | |
---|
[709] | 48 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
| 49 | DO l = 1, klevel |
---|
| 50 | gdx(ijb:ije,l)=xcov(ijb:ije,l) |
---|
| 51 | ENDDO |
---|
| 52 | c$OMP END DO NOWAIT |
---|
| 53 | |
---|
[630] | 54 | ijb=ij_begin |
---|
| 55 | ije=ij_end |
---|
| 56 | if(pole_sud) ije=ij_end-iip1 |
---|
[709] | 57 | |
---|
| 58 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
| 59 | DO l = 1, klevel |
---|
| 60 | gdy(ijb:ije,l)=ycov(ijb:ije,l) |
---|
| 61 | ENDDO |
---|
| 62 | c$OMP END DO NOWAIT |
---|
| 63 | |
---|
| 64 | c$OMP BARRIER |
---|
| 65 | c$OMP MASTER |
---|
[630] | 66 | call suspend_timer(timer_dissip) |
---|
| 67 | call exchange_Hallo(gdy,ip1jm,llm,1,0) |
---|
| 68 | call resume_timer(timer_dissip) |
---|
[709] | 69 | c$OMP END MASTER |
---|
| 70 | c$OMP BARRIER |
---|
[630] | 71 | c |
---|
| 72 | c |
---|
| 73 | signe = (-1.)**ld |
---|
| 74 | nugrads = signe * cdivu |
---|
| 75 | c |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | CALL divergf_p( klevel, gdx, gdy , div ) |
---|
| 79 | c call write_field3d_p('div1',reshape(div,(/iip1,jjp1,llm/))) |
---|
| 80 | |
---|
| 81 | IF( ld.GT.1 ) THEN |
---|
[709] | 82 | c$OMP BARRIER |
---|
| 83 | c$OMP MASTER |
---|
[630] | 84 | call suspend_timer(timer_dissip) |
---|
| 85 | call exchange_Hallo(div,ip1jmp1,llm,1,1) |
---|
| 86 | call resume_timer(timer_dissip) |
---|
[709] | 87 | c$OMP END MASTER |
---|
| 88 | c$OMP BARRIER |
---|
[630] | 89 | CALL laplacien_p ( klevel, div, div ) |
---|
| 90 | |
---|
| 91 | c ...... Iteration de l'operateur laplacien_gam ....... |
---|
| 92 | c call write_field3d_p('div2',reshape(div,(/iip1,jjp1,llm/))) |
---|
| 93 | |
---|
| 94 | DO iter = 1, ld -2 |
---|
[709] | 95 | c$OMP BARRIER |
---|
| 96 | c$OMP MASTER |
---|
[630] | 97 | call suspend_timer(timer_dissip) |
---|
| 98 | call exchange_Hallo(div,ip1jmp1,llm,1,1) |
---|
| 99 | call resume_timer(timer_dissip) |
---|
[709] | 100 | c$OMP END MASTER |
---|
| 101 | c$OMP BARRIER |
---|
[630] | 102 | CALL laplacien_gam ( klevel,cuvscvgam1,cvuscugam1,unsair_gam1, |
---|
| 103 | * unsapolnga1, unsapolsga1, div, div ) |
---|
| 104 | ENDDO |
---|
| 105 | c call write_field3d_p('div3',reshape(div,(/iip1,jjp1,llm/))) |
---|
| 106 | ENDIF |
---|
| 107 | |
---|
| 108 | jjb=jj_begin |
---|
| 109 | jje=jj_end |
---|
| 110 | |
---|
| 111 | CALL filtreg_p( div ,jjb,jje, jjp1, klevel, 2, 1, .TRUE., 1 ) |
---|
| 112 | c call exchange_Hallo(div,ip1jmp1,llm,0,1) |
---|
[709] | 113 | c$OMP BARRIER |
---|
| 114 | c$OMP MASTER |
---|
[630] | 115 | call suspend_timer(timer_dissip) |
---|
| 116 | call exchange_Hallo(div,ip1jmp1,llm,1,1) |
---|
| 117 | call resume_timer(timer_dissip) |
---|
[709] | 118 | c$OMP END MASTER |
---|
| 119 | c$OMP BARRIER |
---|
[630] | 120 | c call write_field3d_p('div4',reshape(div,(/iip1,jjp1,llm/))) |
---|
| 121 | CALL grad_p ( klevel, div, gdx, gdy ) |
---|
| 122 | |
---|
| 123 | c |
---|
| 124 | ijb=ij_begin |
---|
| 125 | ije=ij_end |
---|
| 126 | |
---|
[709] | 127 | c$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
[630] | 128 | DO l = 1, klevel |
---|
| 129 | |
---|
| 130 | if (pole_sud) ije=ij_end |
---|
| 131 | DO ij = ijb, ije |
---|
[709] | 132 | gdx_out( ij,l ) = gdx( ij,l ) * nugrads |
---|
[630] | 133 | ENDDO |
---|
| 134 | |
---|
| 135 | if (pole_sud) ije=ij_end-iip1 |
---|
| 136 | DO ij = ijb, ije |
---|
[709] | 137 | gdy_out( ij,l ) = gdy( ij,l ) * nugrads |
---|
[630] | 138 | ENDDO |
---|
| 139 | |
---|
| 140 | ENDDO |
---|
[709] | 141 | c$OMP END DO NOWAIT |
---|
[630] | 142 | c |
---|
| 143 | RETURN |
---|
| 144 | END |
---|