source: LMDZ6/trunk/libf/dyn3dpar/diverg_p.F @ 3981

Last change on this file since 3981 was 1907, checked in by lguez, 10 years ago

Added a copyright property to every file of the distribution, except
for the fcm files (which have their own copyright). Use svn propget on
a file to see the copyright. For instance:

$ svn propget copyright libf/phylmd/physiq.F90
Name of program: LMDZ
Creation date: 1984
Version: LMDZ5
License: CeCILL version 2
Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
See the license file in the root directory

Also added the files defining the CeCILL version 2 license, in French
and English, at the top of the LMDZ tree.

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1      SUBROUTINE diverg_p(klevel,x,y,div)
2c
3c     P. Le Van
4c
5c  *********************************************************************
6c  ... calcule la divergence a tous les niveaux d'1 vecteur de compos.
7c     x et y...
8c              x et y  etant des composantes covariantes   ...
9c  *********************************************************************
10      USE parallel_lmdz
11      IMPLICIT NONE
12c
13c      x  et  y  sont des arguments  d'entree pour le s-prog
14c        div      est  un argument  de sortie pour le s-prog
15c
16c
17c   ---------------------------------------------------------------------
18c
19c    ATTENTION : pendant ce s-pg , ne pas toucher au COMMON/scratch/  .
20c
21c   ---------------------------------------------------------------------
22#include "dimensions.h"
23#include "paramet.h"
24#include "comgeom.h"
25c
26c    ..........          variables en arguments    ...................
27c
28      INTEGER klevel
29      REAL x( ip1jmp1,klevel ),y( ip1jm,klevel ),div( ip1jmp1,klevel )
30      INTEGER   l,ij
31c
32c    ...............     variables  locales   .........................
33
34      REAL aiy1( iip1 ) , aiy2( iip1 )
35      REAL sumypn,sumyps
36      INTEGER ijb,ije
37c    ...................................................................
38c
39      EXTERNAL  SSUM
40      REAL      SSUM
41c
42c
43      ijb=ij_begin
44      ije=ij_end
45      if (pole_nord) ijb=ij_begin+iip1
46      if(pole_sud)  ije=ij_end-iip1
47     
48c$OMP DO SCHEDULE(STATIC,OMP_CHUNK)     
49      DO 10 l = 1,klevel
50c
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
56c
57c     ....  correction pour  div( 1,j,l)  ......
58c     ....   div(1,j,l)= div(iip1,j,l) ....
59c
60CDIR$ IVDEP
61        DO  ij = ijb,ije,iip1
62         div( ij,l ) = div( ij + iim,l )
63        ENDDO
64c
65c     ....  calcul  aux poles  .....
66c
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
72c
73          DO  ij = 1,iip1
74           div(     ij    , l ) = - sumypn
75          ENDDO
76        endif
77         
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
83c
84          DO  ij = 1,iip1
85           div( ij + ip1jm, l ) =   sumyps
86          ENDDO
87        endif
88
89
90  10  CONTINUE
91c$OMP END DO NOWAIT
92c
93
94ccc        CALL filtreg( div, jjp1, klevel, 2, 2, .TRUE., 1 )
95     
96c
97c$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
103c$OMP END DO NOWAIT
104c
105       RETURN
106       END
Note: See TracBrowser for help on using the repository browser.