source: LMDZ6/branches/Amaury_dev/libf/dyn3dmem/flumass_loc.F90

Last change on this file was 5159, checked in by abarral, 7 weeks ago

Put dimensions.h and paramet.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: 3.2 KB
RevLine 
[2336]1SUBROUTINE flumass_loc(massebx,masseby, vcont, ucont, pbaru, pbarv )
[5099]2
[2336]3!-------------------------------------------------------------------------------
4! Authors: P. Le Van , Fr. Hourdin.
5!-------------------------------------------------------------------------------
6! Purpose: Compute mass flux at s levels.
7  USE parallel_lmdz
[5136]8  USE lmdz_comgeom
9
[5159]10USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
11  USE lmdz_paramet
[2336]12  IMPLICIT NONE
[5159]13
14
[2336]15!===============================================================================
16! Arguments:
17  REAL, INTENT(IN)  :: massebx(ijb_u:ije_u,llm)
18  REAL, INTENT(IN)  :: masseby(ijb_v:ije_v,llm)
19  REAL, INTENT(IN)  :: vcont  (ijb_v:ije_v,llm)
20  REAL, INTENT(IN)  :: ucont  (ijb_u:ije_u,llm)
21  REAL, INTENT(OUT) :: pbaru  (ijb_u:ije_u,llm)
22  REAL, INTENT(OUT) :: pbarv  (ijb_v:ije_v,llm)
23!===============================================================================
24! Method used:   A 2 equations system is solved.
25!   * 1st one describes divergence computation at pole point nr. i (i=1 to im):
26!     (0.5*(pbaru(i)-pbaru(i-1))-pbarv(i))/aire(i) = - SUM(pbarv(n))/aire pole
27!   * 2nd one specifies that mean mass flux at pole is equal to 0:
28!     SUM(pbaru(n)*local_area(n))=0
29! This way, we determine additive constant common to pbary elements representing
30!   pbaru(0,j,l) in divergence computation equation for point i=1. (i=1 to im)
31!===============================================================================
32! Local variables:
33  REAL    :: sairen, saireun, ctn, ctn0, apbarun(iim)
34  REAL    :: saires, saireus, cts, cts0, apbarus(iim)
35  INTEGER :: l, i, ij, ijb, ije
36!===============================================================================
37!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)   
38  DO l=1,llm
[1632]39
[2336]40    ijb=ij_begin
41    ije=ij_end+iip1
42    IF(pole_nord) ijb=ij_begin+iip1
43    IF(pole_sud)  ije=ij_end-iip1
44    pbaru(ijb:ije,l)=massebx(ijb:ije,l)*ucont(ijb:ije,l)
[1632]45
[2336]46    ijb=ij_begin-iip1
47    ije=ij_end+iip1
48    IF(pole_nord) ijb=ij_begin
49    IF(pole_sud)  ije=ij_end-iip1
50    pbarv(ijb:ije,l)=masseby(ijb:ije,l)*vcont(ijb:ije,l)
[1632]51
[2336]52  END DO
53!$OMP END DO NOWAIT
[1632]54
[2336]55  !--- North pole
56  IF(pole_nord) THEN
57    sairen =SUM(aire (1:iim))
58    saireun=SUM(aireu(1:iim))
59!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)   
60    DO l=1,llm
61      ctn=SUM(pbarv(1:iim,l))/sairen
62      pbaru(1,l)= pbarv(1,l)-ctn*aire(1)
63      DO i=2,iim
64        pbaru(i,l)=pbaru(i-1,l)+pbarv(i,l)-ctn*aire(i)
65      END DO
66      apbarun(:)=aireu(1:iim)*pbaru(1:iim,l)
67      ctn0 = -SUM(apbarun)/saireun
68      pbaru(1:iim,l)=2.*(pbaru(1:iim,l)+ctn0)
69      pbaru(iip1,l)=pbaru(1,l)
70    END DO
71!$OMP END DO NOWAIT             
72  END IF
[1632]73
[2336]74  !--- South pole
75  IF(pole_sud) THEN
76    saires =SUM(aire (ip1jm+1:ip1jmp1-1))
77    saireus=SUM(aireu(ip1jm+1:ip1jmp1-1))
78!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)   
79    DO l=1,llm
80      cts=SUM(pbarv(1+ip1jmi1:ip1jm-1,l))/saires
81      pbaru(1+ip1jm,l)=-pbarv(1+ip1jmi1,l)+cts*aire(1+ip1jm)
82      DO i=2,iim
83        pbaru(i+ip1jm,l)=pbaru(i-1+ip1jm,l)-pbarv(i+ip1jmi1,l)+cts*aire(i+ip1jm)
84      END DO
85      apbarus(:)=aireu(1+ip1jm:ip1jmp1-1)*pbaru(1+ip1jm:ip1jmp1-1,l)
86      cts0 = -SUM(apbarus)/saireus
87      pbaru(1+ip1jm:ip1jmp1-1,l)=2.*(pbaru(1+ip1jm:ip1jmp1-1,l)+cts0)
88      pbaru(ip1jmp1,l)=pbaru(1+ip1jm,l)
89    END DO
90!$OMP END DO NOWAIT         
91  END IF
[1632]92
[2336]93END SUBROUTINE flumass_loc
[1632]94
Note: See TracBrowser for help on using the repository browser.