source: LMDZ6/trunk/libf/dyn3dmem/diverg_p.f90 @ 5271

Last change on this file since 5271 was 5271, checked in by abarral, 26 hours ago

Move dimensions.h into a module
Nb: doesn't compile yet

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