[5246] | 1 | SUBROUTINE diverg_p(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 |
---|
| 11 | IMPLICIT NONE |
---|
| 12 | ! |
---|
| 13 | ! x et y sont des arguments d'entree pour le s-prog |
---|
| 14 | ! div est un argument de sortie pour le s-prog |
---|
| 15 | ! |
---|
| 16 | ! |
---|
| 17 | ! --------------------------------------------------------------------- |
---|
| 18 | ! |
---|
| 19 | ! ATTENTION : pendant ce s-pg , ne pas toucher au COMMON/scratch/ . |
---|
| 20 | ! |
---|
| 21 | ! --------------------------------------------------------------------- |
---|
| 22 | INCLUDE "dimensions.h" |
---|
| 23 | INCLUDE "paramet.h" |
---|
| 24 | INCLUDE "comgeom.h" |
---|
| 25 | ! |
---|
| 26 | ! .......... variables en arguments ................... |
---|
| 27 | ! |
---|
| 28 | INTEGER :: klevel |
---|
| 29 | REAL :: x( ip1jmp1,klevel ),y( ip1jm,klevel ),div( ip1jmp1,klevel ) |
---|
| 30 | INTEGER :: l,ij |
---|
| 31 | ! |
---|
| 32 | ! ............... variables locales ......................... |
---|
[1632] | 33 | |
---|
[5246] | 34 | REAL :: aiy1( iip1 ) , aiy2( iip1 ) |
---|
| 35 | REAL :: sumypn,sumyps |
---|
| 36 | INTEGER :: ijb,ije |
---|
| 37 | ! ................................................................... |
---|
| 38 | ! |
---|
| 39 | EXTERNAL SSUM |
---|
| 40 | REAL :: SSUM |
---|
| 41 | ! |
---|
| 42 | ! |
---|
| 43 | ijb=ij_begin |
---|
| 44 | ije=ij_end |
---|
| 45 | if (pole_nord) ijb=ij_begin+iip1 |
---|
| 46 | if(pole_sud) ije=ij_end-iip1 |
---|
[1632] | 47 | |
---|
[5246] | 48 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
| 49 | DO l = 1,klevel |
---|
| 50 | ! |
---|
| 51 | DO ij = ijb, ije - 1 |
---|
| 52 | div( ij + 1, l ) = & |
---|
| 53 | cvusurcu( ij+1 ) * x( ij+1,l ) - cvusurcu( ij ) * x( ij , l) + & |
---|
| 54 | cuvsurcv(ij-iim) * y(ij-iim,l) - cuvsurcv(ij+1) * y(ij+1,l) |
---|
| 55 | ENDDO |
---|
| 56 | ! |
---|
| 57 | ! .... correction pour div( 1,j,l) ...... |
---|
| 58 | ! .... div(1,j,l)= div(iip1,j,l) .... |
---|
| 59 | ! |
---|
| 60 | !DIR$ IVDEP |
---|
| 61 | DO ij = ijb,ije,iip1 |
---|
| 62 | div( ij,l ) = div( ij + iim,l ) |
---|
| 63 | ENDDO |
---|
| 64 | ! |
---|
| 65 | ! .... calcul aux poles ..... |
---|
| 66 | ! |
---|
| 67 | if (pole_nord) then |
---|
| 68 | DO ij = 1,iim |
---|
| 69 | aiy1(ij) = cuvsurcv( ij ) * y( ij , l ) |
---|
| 70 | ENDDO |
---|
| 71 | sumypn = SSUM ( iim,aiy1,1 ) / apoln |
---|
| 72 | ! |
---|
| 73 | DO ij = 1,iip1 |
---|
| 74 | div( ij , l ) = - sumypn |
---|
| 75 | ENDDO |
---|
| 76 | endif |
---|
[1632] | 77 | |
---|
[5246] | 78 | if (pole_sud) then |
---|
| 79 | DO ij = 1,iim |
---|
| 80 | aiy2(ij) = cuvsurcv( ij+ ip1jmi1 ) * y( ij+ ip1jmi1, l ) |
---|
| 81 | ENDDO |
---|
| 82 | sumyps = SSUM ( iim,aiy2,1 ) / apols |
---|
| 83 | ! |
---|
| 84 | DO ij = 1,iip1 |
---|
| 85 | div( ij + ip1jm, l ) = sumyps |
---|
| 86 | ENDDO |
---|
| 87 | endif |
---|
[1632] | 88 | |
---|
[5246] | 89 | |
---|
| 90 | END DO |
---|
| 91 | !$OMP END DO NOWAIT |
---|
| 92 | ! |
---|
| 93 | |
---|
| 94 | !cc CALL filtreg( div, jjp1, klevel, 2, 2, .TRUE., 1 ) |
---|
| 95 | |
---|
| 96 | ! |
---|
| 97 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
| 98 | DO l = 1, klevel |
---|
| 99 | DO ij = ijb,ije |
---|
| 100 | div(ij,l) = div(ij,l) * unsaire(ij) |
---|
| 101 | ENDDO |
---|
| 102 | ENDDO |
---|
| 103 | !$OMP END DO NOWAIT |
---|
| 104 | ! |
---|
| 105 | RETURN |
---|
| 106 | END SUBROUTINE diverg_p |
---|