source: LMDZ6/branches/Amaury_dev/libf/dyn3dmem/diverg_p.f90 @ 5153

Last change on this file since 5153 was 5140, checked in by abarral, 8 weeks ago

Put comsoil.h, conema3.h, cvflag.h into modules

  • 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
File size: 2.4 KB
Line 
1SUBROUTINE 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  USE lmdz_ssum_scopy, ONLY: ssum
12  USE lmdz_comgeom
13
14  IMPLICIT NONE
15  !
16  !  x  et  y  sont des arguments  d'entree pour le s-prog
17  !    div      est  un argument  de sortie pour le s-prog
18  !
19
20  INCLUDE "dimensions.h"
21  INCLUDE "paramet.h"
22  !
23  !    ..........          variables en arguments    ...................
24  !
25  INTEGER :: klevel
26  REAL :: x( ip1jmp1,klevel ),y( ip1jm,klevel ),div( ip1jmp1,klevel )
27  INTEGER :: l,ij
28  !
29  !    ...............     variables  locales   .........................
30
31  REAL :: aiy1( iip1 ) , aiy2( iip1 )
32  REAL :: sumypn,sumyps
33  INTEGER :: ijb,ije
34  !    ...................................................................
35  !
36  !
37  ijb=ij_begin
38  ije=ij_end
39  IF (pole_nord) ijb=ij_begin+iip1
40  IF(pole_sud)  ije=ij_end-iip1
41
42!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
43  DO l = 1,klevel
44  !
45    DO  ij = ijb, ije - 1
46     div( ij + 1, l )     = &
47           cvusurcu( ij+1 ) * x( ij+1,l ) - cvusurcu( ij ) * x( ij , l) + &
48           cuvsurcv(ij-iim) * y(ij-iim,l) - cuvsurcv(ij+1) * y(ij+1,l)
49    ENDDO
50  !
51  ! ....  correction pour  div( 1,j,l)  ......
52  ! ....   div(1,j,l)= div(iip1,j,l) ....
53  !
54  !DIR$ IVDEP
55    DO  ij = ijb,ije,iip1
56     div( ij,l ) = div( ij + iim,l )
57    ENDDO
58  !
59  ! ....  calcul  aux poles  .....
60  !
61    IF (pole_nord) THEN
62      DO  ij  = 1,iim
63       aiy1(ij) =    cuvsurcv(    ij       ) * y(     ij     , l )
64      ENDDO
65      sumypn = SSUM ( iim,aiy1,1 ) / apoln
66  !
67      DO  ij = 1,iip1
68       div(     ij    , l ) = - sumypn
69      ENDDO
70    endif
71
72   IF (pole_sud) THEN
73      DO  ij  = 1,iim
74       aiy2(ij) =    cuvsurcv( ij+ ip1jmi1 ) * y( ij+ ip1jmi1, l )
75      ENDDO
76      sumyps = SSUM ( iim,aiy2,1 ) / apols
77  !
78      DO  ij = 1,iip1
79       div( ij + ip1jm, l ) =   sumyps
80      ENDDO
81    endif
82
83
84  END DO
85!$OMP END DO NOWAIT
86  !
87
88  !cc        CALL filtreg( div, jjp1, klevel, 2, 2, .TRUE., 1 )
89
90  !
91!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
92    DO l = 1, klevel
93       DO ij = ijb,ije
94        div(ij,l) = div(ij,l) * unsaire(ij)
95      ENDDO
96    ENDDO
97!$OMP END DO NOWAIT
98  !
99
100END SUBROUTINE diverg_p
Note: See TracBrowser for help on using the repository browser.