[5105] | 1 | SUBROUTINE divergf_loc(klevel,x,y,div) |
---|
| 2 | ! |
---|
| 3 | ! P. Le Van |
---|
| 4 | ! |
---|
| 5 | ! ********************************************************************* |
---|
| 6 | ! ... calcule la divergence a tous les niveaux d'1 vecteur de compos. |
---|
| 7 | ! x et y... |
---|
| 8 | ! x et y etant des composantes covariantes ... |
---|
| 9 | ! ********************************************************************* |
---|
| 10 | USE parallel_lmdz |
---|
[5106] | 11 | USE lmdz_filtreg_p |
---|
[5123] | 12 | USE lmdz_ssum_scopy, ONLY: ssum |
---|
[5136] | 13 | USE lmdz_comgeom |
---|
[5123] | 14 | |
---|
[5105] | 15 | IMPLICIT NONE |
---|
| 16 | ! |
---|
| 17 | ! x et y sont des arguments d'entree pour le s-prog |
---|
| 18 | ! div est un argument de sortie pour le s-prog |
---|
| 19 | ! |
---|
| 20 | ! |
---|
| 21 | ! --------------------------------------------------------------------- |
---|
| 22 | ! |
---|
| 23 | ! ATTENTION : pendant ce s-pg , ne pas toucher au COMMON/scratch/ . |
---|
| 24 | ! |
---|
| 25 | ! --------------------------------------------------------------------- |
---|
| 26 | INCLUDE "dimensions.h" |
---|
| 27 | INCLUDE "paramet.h" |
---|
| 28 | ! |
---|
| 29 | ! .......... variables en arguments ................... |
---|
| 30 | ! |
---|
| 31 | INTEGER :: klevel |
---|
| 32 | REAL :: x( ijb_u:ije_u,klevel ),y( ijb_v:ije_v,klevel ) |
---|
| 33 | REAL :: div( ijb_u:ije_u,klevel ) |
---|
| 34 | INTEGER :: l,ij |
---|
| 35 | ! |
---|
| 36 | ! ............... variables locales ......................... |
---|
[1632] | 37 | |
---|
[5105] | 38 | REAL :: aiy1( iip1 ) , aiy2( iip1 ) |
---|
| 39 | REAL :: sumypn,sumyps |
---|
| 40 | ! ................................................................... |
---|
| 41 | INTEGER :: ijb,ije,jjb,jje |
---|
| 42 | ! |
---|
| 43 | ! |
---|
| 44 | ijb=ij_begin |
---|
| 45 | ije=ij_end |
---|
[5117] | 46 | IF (pole_nord) ijb=ij_begin+iip1 |
---|
[5116] | 47 | IF(pole_sud) ije=ij_end-iip1 |
---|
[1632] | 48 | |
---|
[5105] | 49 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
| 50 | DO l = 1,klevel |
---|
| 51 | ! |
---|
| 52 | DO ij = ijb, ije - 1 |
---|
| 53 | div( ij + 1, l ) = & |
---|
| 54 | cvusurcu( ij+1 ) * x( ij+1,l ) - cvusurcu( ij ) * x( ij , l) + & |
---|
| 55 | cuvsurcv(ij-iim) * y(ij-iim,l) - cuvsurcv(ij+1) * y(ij+1,l) |
---|
| 56 | ENDDO |
---|
[1632] | 57 | |
---|
[5105] | 58 | ! |
---|
| 59 | ! .... correction pour div( 1,j,l) ...... |
---|
| 60 | ! .... div(1,j,l)= div(iip1,j,l) .... |
---|
| 61 | ! |
---|
| 62 | !DIR$ IVDEP |
---|
| 63 | DO ij = ijb,ije,iip1 |
---|
| 64 | div( ij,l ) = div( ij + iim,l ) |
---|
| 65 | ENDDO |
---|
| 66 | ! |
---|
| 67 | ! .... calcul aux poles ..... |
---|
| 68 | ! |
---|
[5117] | 69 | IF (pole_nord) THEN |
---|
[5105] | 70 | DO ij = 1,iim |
---|
| 71 | aiy1(ij) = cuvsurcv( ij ) * y( ij , l ) |
---|
| 72 | ENDDO |
---|
| 73 | sumypn = SSUM ( iim,aiy1,1 ) / apoln |
---|
[1632] | 74 | |
---|
[5105] | 75 | ! |
---|
| 76 | DO ij = 1,iip1 |
---|
| 77 | div( ij , l ) = - sumypn |
---|
| 78 | ENDDO |
---|
| 79 | |
---|
| 80 | endif |
---|
| 81 | |
---|
[5117] | 82 | IF (pole_sud) THEN |
---|
[5105] | 83 | DO ij = 1,iim |
---|
| 84 | aiy2(ij) = cuvsurcv( ij+ ip1jmi1 ) * y( ij+ ip1jmi1, l ) |
---|
| 85 | ENDDO |
---|
| 86 | sumyps = SSUM ( iim,aiy2,1 ) / apols |
---|
| 87 | ! |
---|
| 88 | DO ij = 1,iip1 |
---|
| 89 | div( ij + ip1jm, l ) = sumyps |
---|
| 90 | ENDDO |
---|
| 91 | |
---|
| 92 | endif |
---|
| 93 | |
---|
| 94 | END DO |
---|
| 95 | !$OMP END DO NOWAIT |
---|
| 96 | |
---|
| 97 | ! |
---|
| 98 | jjb=jj_begin |
---|
| 99 | jje=jj_end |
---|
[5117] | 100 | IF (pole_sud) jje=jj_end-1 |
---|
[5105] | 101 | |
---|
| 102 | CALL filtreg_p( div,jjb_u,jje_u,jjb,jje, jjp1, & |
---|
| 103 | klevel, 2, 2, .TRUE., 1 ) |
---|
| 104 | |
---|
| 105 | ! |
---|
| 106 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
| 107 | DO l = 1, klevel |
---|
| 108 | DO ij = ijb,ije |
---|
| 109 | div(ij,l) = div(ij,l) * unsaire(ij) |
---|
| 110 | ENDDO |
---|
| 111 | ENDDO |
---|
| 112 | !$OMP END DO NOWAIT |
---|
| 113 | ! |
---|
| 114 | |
---|
| 115 | END SUBROUTINE divergf_loc |
---|