[5099] | 1 | |
---|
[524] | 2 | ! $Header$ |
---|
[5099] | 3 | |
---|
[5105] | 4 | SUBROUTINE diverg(klevel,x,y,div) |
---|
[5159] | 5 | |
---|
[5105] | 6 | ! P. Le Van |
---|
[5159] | 7 | |
---|
[5105] | 8 | ! ********************************************************************* |
---|
| 9 | ! ... calcule la divergence a tous les niveaux d'1 vecteur de compos. |
---|
| 10 | ! x et y... |
---|
| 11 | ! x et y etant des composantes covariantes ... |
---|
| 12 | ! ********************************************************************* |
---|
[5123] | 13 | USE lmdz_ssum_scopy, ONLY: ssum |
---|
[5136] | 14 | USE lmdz_comgeom |
---|
[5123] | 15 | |
---|
[5159] | 16 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
| 17 | USE lmdz_paramet |
---|
[5105] | 18 | IMPLICIT NONE |
---|
[5159] | 19 | |
---|
[5105] | 20 | ! x et y sont des arguments d'entree pour le s-prog |
---|
| 21 | ! div est un argument de sortie pour le s-prog |
---|
| 22 | ! |
---|
[5140] | 23 | |
---|
[5159] | 24 | |
---|
| 25 | |
---|
| 26 | |
---|
[5105] | 27 | ! .......... variables en arguments ................... |
---|
[5159] | 28 | |
---|
[5105] | 29 | INTEGER :: klevel |
---|
| 30 | REAL :: x( ip1jmp1,klevel ),y( ip1jm,klevel ),div( ip1jmp1,klevel ) |
---|
| 31 | INTEGER :: l,ij |
---|
[5159] | 32 | |
---|
[5105] | 33 | ! ............... variables locales ......................... |
---|
[524] | 34 | |
---|
[5105] | 35 | REAL :: aiy1( iip1 ) , aiy2( iip1 ) |
---|
| 36 | REAL :: sumypn,sumyps |
---|
| 37 | ! ................................................................... |
---|
[5123] | 38 | |
---|
[5105] | 39 | DO l = 1,klevel |
---|
[5159] | 40 | |
---|
[5105] | 41 | DO ij = iip2, ip1jm - 1 |
---|
| 42 | div( ij + 1, l ) = & |
---|
| 43 | cvusurcu( ij+1 ) * x( ij+1,l ) - cvusurcu( ij ) * x( ij , l) + & |
---|
| 44 | cuvsurcv(ij-iim) * y(ij-iim,l) - cuvsurcv(ij+1) * y(ij+1,l) |
---|
| 45 | ENDDO |
---|
[5159] | 46 | |
---|
[5105] | 47 | ! .... correction pour div( 1,j,l) ...... |
---|
| 48 | ! .... div(1,j,l)= div(iip1,j,l) .... |
---|
[5159] | 49 | |
---|
[5105] | 50 | !DIR$ IVDEP |
---|
| 51 | DO ij = iip2,ip1jm,iip1 |
---|
| 52 | div( ij,l ) = div( ij + iim,l ) |
---|
| 53 | ENDDO |
---|
[5159] | 54 | |
---|
[5105] | 55 | ! .... calcul aux poles ..... |
---|
[5159] | 56 | |
---|
[5105] | 57 | DO ij = 1,iim |
---|
| 58 | aiy1(ij) = cuvsurcv( ij ) * y( ij , l ) |
---|
| 59 | aiy2(ij) = cuvsurcv( ij+ ip1jmi1 ) * y( ij+ ip1jmi1, l ) |
---|
| 60 | ENDDO |
---|
| 61 | sumypn = SSUM ( iim,aiy1,1 ) / apoln |
---|
| 62 | sumyps = SSUM ( iim,aiy2,1 ) / apols |
---|
[5159] | 63 | |
---|
[5105] | 64 | DO ij = 1,iip1 |
---|
| 65 | div( ij , l ) = - sumypn |
---|
| 66 | div( ij + ip1jm, l ) = sumyps |
---|
| 67 | ENDDO |
---|
| 68 | END DO |
---|
| 69 | ! |
---|
[524] | 70 | |
---|
[5105] | 71 | !cc CALL filtreg( div, jjp1, klevel, 2, 2, .TRUE., 1 ) |
---|
| 72 | |
---|
[5159] | 73 | |
---|
[5105] | 74 | DO l = 1, klevel |
---|
| 75 | DO ij = iip2,ip1jm |
---|
| 76 | div(ij,l) = div(ij,l) * unsaire(ij) |
---|
| 77 | ENDDO |
---|
| 78 | ENDDO |
---|
[5159] | 79 | |
---|
[5105] | 80 | RETURN |
---|
| 81 | END SUBROUTINE diverg |
---|