source: LMDZ6/trunk/libf/dyn3dmem/diverg_gam_loc.f90 @ 5279

Last change on this file since 5279 was 5272, checked in by abarral, 33 hours ago

Turn paramet.h into a module

  • 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.8 KB
Line 
1SUBROUTINE diverg_gam_loc(klevel,cuvscvgam,cvuscugam,unsairegam, &
2        unsapolnga,unsapolsga,  x, y,  div )
3  !
4  ! P. Le Van
5  !
6  !  *********************************************************************
7  !  ... calcule la divergence a tous les niveaux d'1 vecteur de compos.
8  ! x et y...
9  !          x et y  etant des composantes covariantes   ...
10  !  *********************************************************************
11  USE parallel_lmdz
12  USE dimensions_mod, ONLY: iim, jjm, llm, ndm
13USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, &
14          ip1jmi1, ijp1llm, ijmllm, mvar, jcfil, jcfllm
15IMPLICIT NONE
16  !
17  !  x  et  y  sont des arguments  d'entree pour le s-prog
18  !    div      est  un argument  de sortie pour le s-prog
19  !
20  !
21  !   ---------------------------------------------------------------------
22  !
23  !    ATTENTION : pendant ce s-pg , ne pas toucher au COMMON/scratch/  .
24  !
25  !   ---------------------------------------------------------------------
26
27
28  INCLUDE "comgeom.h"
29  !
30  !    ..........          variables en arguments    ...................
31  !
32  INTEGER :: klevel
33  REAL :: x( ijb_u:ije_u,klevel ),y( ijb_v:ije_v,klevel )
34  REAL :: div( ijb_u:ije_u,klevel )
35  REAL :: cuvscvgam(ip1jm),cvuscugam(ip1jmp1),unsairegam(ip1jmp1)
36  REAL :: unsapolnga,unsapolsga
37  !
38  !    ...............     variables  locales   .........................
39
40  REAL :: aiy1( iip1 ) , aiy2( iip1 )
41  REAL :: sumypn,sumyps
42  INTEGER :: l,ij
43  !    ...................................................................
44  !
45  EXTERNAL  SSUM
46  REAL :: SSUM
47  INTEGER :: ijb,ije,jjb,jje
48  !
49  !
50  ijb=ij_begin
51  ije=ij_end
52  if (pole_nord) ijb=ij_begin+iip1
53  if(pole_sud)  ije=ij_end-iip1
54
55!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
56  DO l = 1,klevel
57  !
58    DO  ij = ijb, ije - 1
59     div( ij + 1, l )     = ( &
60           cvuscugam( ij+1 ) * x( ij+1,l ) - cvuscugam( ij ) * x( ij , l) + &
61           cuvscvgam(ij-iim) * y(ij-iim,l) - cuvscvgam(ij+1) * y(ij+1,l) )* &
62           unsairegam( ij+1 )
63    ENDDO
64  !
65  ! ....  correction pour  div( 1,j,l)  ......
66  ! ....   div(1,j,l)= div(iip1,j,l) ....
67  !
68  !DIR$ IVDEP
69    DO  ij = ijb,ije,iip1
70     div( ij,l ) = div( ij + iim,l )
71    ENDDO
72  !
73  ! ....  calcul  aux poles  .....
74  !
75   if (pole_nord) then
76      DO  ij  = 1,iim
77       aiy1(ij) =    cuvscvgam(    ij       ) * y(     ij     , l )
78      ENDDO
79      sumypn = SSUM ( iim,aiy1,1 ) * unsapolnga
80  !
81      DO  ij = 1,iip1
82       div(     ij    , l ) = - sumypn
83      ENDDO
84   endif
85
86    if (pole_sud) then
87      DO  ij  = 1,iim
88       aiy2(ij) =    cuvscvgam( ij+ ip1jmi1 ) * y( ij+ ip1jmi1, l )
89      ENDDO
90      sumyps = SSUM ( iim,aiy2,1 ) * unsapolsga
91  !
92      DO  ij = 1,iip1
93       div( ij + ip1jm, l ) =   sumyps
94      ENDDO
95   endif
96  END DO
97!$OMP END DO NOWAIT
98  !
99
100   RETURN
101END SUBROUTINE diverg_gam_loc
Note: See TracBrowser for help on using the repository browser.