LMDZ
flumass_loc.F90
Go to the documentation of this file.
1 SUBROUTINE 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
8  IMPLICIT NONE
9  include "dimensions.h"
10  include "paramet.h"
11  include "comgeom.h"
12 !===============================================================================
13 ! Arguments:
14  REAL, INTENT(IN) :: massebx(ijb_u:ije_u,llm)
15  REAL, INTENT(IN) :: masseby(ijb_v:ije_v,llm)
16  REAL, INTENT(IN) :: vcont (ijb_v:ije_v,llm)
17  REAL, INTENT(IN) :: ucont (ijb_u:ije_u,llm)
18  REAL, INTENT(OUT) :: pbaru (ijb_u:ije_u,llm)
19  REAL, INTENT(OUT) :: pbarv (ijb_v:ije_v,llm)
20 !===============================================================================
21 ! Method used: A 2 equations system is solved.
22 ! * 1st one describes divergence computation at pole point nr. i (i=1 to im):
23 ! (0.5*(pbaru(i)-pbaru(i-1))-pbarv(i))/aire(i) = - SUM(pbarv(n))/aire pole
24 ! * 2nd one specifies that mean mass flux at pole is equal to 0:
25 ! SUM(pbaru(n)*local_area(n))=0
26 ! This way, we determine additive constant common to pbary elements representing
27 ! pbaru(0,j,l) in divergence computation equation for point i=1. (i=1 to im)
28 !===============================================================================
29 ! Local variables:
30  REAL :: sairen, saireun, ctn, ctn0, apbarun(iim)
31  REAL :: saires, saireus, cts, cts0, apbarus(iim)
32  INTEGER :: l, i, ij, ijb, ije
33 !===============================================================================
34 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
35  DO l=1,llm
36 
37  ijb=ij_begin
38  ije=ij_end+iip1
39  IF(pole_nord) ijb=ij_begin+iip1
40  IF(pole_sud) ije=ij_end-iip1
41  pbaru(ijb:ije,l)=massebx(ijb:ije,l)*ucont(ijb:ije,l)
42 
43  ijb=ij_begin-iip1
44  ije=ij_end+iip1
45  IF(pole_nord) ijb=ij_begin
46  IF(pole_sud) ije=ij_end-iip1
47  pbarv(ijb:ije,l)=masseby(ijb:ije,l)*vcont(ijb:ije,l)
48 
49  END DO
50 !$OMP END DO NOWAIT
51 
52  !--- North pole
53  IF(pole_nord) THEN
54  sairen =sum(aire(1:iim))
55  saireun=sum(aireu(1:iim))
56 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
57  DO l=1,llm
58  ctn=sum(pbarv(1:iim,l))/sairen
59  pbaru(1,l)= pbarv(1,l)-ctn*aire(1)
60  DO i=2,iim
61  pbaru(i,l)=pbaru(i-1,l)+pbarv(i,l)-ctn*aire(i)
62  END DO
63  apbarun(:)=aireu(1:iim)*pbaru(1:iim,l)
64  ctn0 = -sum(apbarun)/saireun
65  pbaru(1:iim,l)=2.*(pbaru(1:iim,l)+ctn0)
66  pbaru(iip1,l)=pbaru(1,l)
67  END DO
68 !$OMP END DO NOWAIT
69  END IF
70 
71  !--- South pole
72  IF(pole_sud) THEN
73  saires =sum(aire(ip1jm+1:ip1jmp1-1))
74  saireus=sum(aireu(ip1jm+1:ip1jmp1-1))
75 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
76  DO l=1,llm
77  cts=sum(pbarv(1+ip1jmi1:ip1jm-1,l))/saires
78  pbaru(1+ip1jm,l)=-pbarv(1+ip1jmi1,l)+cts*aire(1+ip1jm)
79  DO i=2,iim
80  pbaru(i+ip1jm,l)=pbaru(i-1+ip1jm,l)-pbarv(i+ip1jmi1,l)+cts*aire(i+ip1jm)
81  END DO
82  apbarus(:)=aireu(1+ip1jm:ip1jmp1-1)*pbaru(1+ip1jm:ip1jmp1-1,l)
83  cts0 = -sum(apbarus)/saireus
84  pbaru(1+ip1jm:ip1jmp1-1,l)=2.*(pbaru(1+ip1jm:ip1jmp1-1,l)+cts0)
85  pbaru(ip1jmp1,l)=pbaru(1+ip1jm,l)
86  END DO
87 !$OMP END DO NOWAIT
88  END IF
89 
90 END SUBROUTINE flumass_loc
91 
!$Header llmm1 INTEGER ip1jmi1
Definition: paramet.h:14
!$Header llmm1 INTEGER ip1jmp1
Definition: paramet.h:14
integer, save ij_end
logical, save pole_sud
!$Id Turb_fcg_gcssold get_uvd hqturb_gcssold endif!large scale llm day day1 day day1 *dt_toga endif!time annee_ref dt_toga u_toga vq_toga w_prof vq_prof llm day day1 day day1 *dt_dice endif!time annee_ref dt_dice swup_dice vg_dice omega_dice tg_prof vg_profd w_profd omega_profd!do llm!print llm l llm
!$Header!CDK comgeom COMMON comgeom aire
Definition: comgeom.h:25
integer, save ijb_v
!$Header llmm1 INTEGER ip1jm
Definition: paramet.h:14
subroutine flumass_loc(massebx, masseby, vcont, ucont, pbaru, pbarv)
Definition: flumass_loc.F90:2
!$Header!CDK comgeom COMMON comgeom aireu
Definition: comgeom.h:25
logical, save pole_nord
integer, save ij_begin
integer, save ije_v
c c zjulian c cym CALL iim cym klev iim
Definition: ini_bilKP_ave.h:24
integer, save ije_u
integer, save ijb_u