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

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