source: LMDZ5/trunk/libf/dyn3dmem/diverg_p.F @ 1749

Last change on this file since 1749 was 1632, checked in by Laurent Fairhead, 12 years ago

Import initial du répertoire dyn3dmem

Attention! ceci n'est qu'une version préliminaire du code "basse mémoire":
le code contenu dans ce répertoire est basé sur la r1320 et a donc besoin
d'être mis à jour par rapport à la dynamique parallèle d'aujourd'hui.
Ce code est toutefois mis à disposition pour circonvenir à des problèmes
de mémoire que certaines configurations du modèle pourraient rencontrer.
Dans l'état, il compile et tourne sur vargas et au CCRT


Initial import of dyn3dmem

Warning! this is just a preliminary version of the memory light code:
it is based on r1320 of the code and thus needs to be updated before
it can replace the present dyn3dpar code. It is nevertheless put at your
disposal to circumvent some memory problems some LMDZ configurations may
encounter. In its present state, it will compile and run on vargas and CCRT

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
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.