source: LMDZ5/trunk/libf/dyn3d/caldyn.F @ 2597

Last change on this file since 2597 was 2597, checked in by Ehouarn Millour, 8 years ago

Cleanup in the dynamics: get rid of comconst.h, make it a module comconst_mod.
EM

  • 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
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.3 KB
Line 
1!
2! $Id: caldyn.F 2597 2016-07-22 06:44:47Z emillour $
3!
4      SUBROUTINE caldyn
5     $ (itau,ucov,vcov,teta,ps,masse,pk,pkf,phis ,
6     $  phi,conser,du,dv,dteta,dp,w,pbaru,pbarv,time )
7
8      IMPLICIT NONE
9
10!=======================================================================
11!
12!  Auteur :  P. Le Van
13!
14!   Objet:
15!   ------
16!
17!   Calcul des tendances dynamiques.
18!
19! Modif 04/93 F.Forget
20!=======================================================================
21
22!-----------------------------------------------------------------------
23!   0. Declarations:
24!   ----------------
25
26      include "dimensions.h"
27      include "paramet.h"
28      include "comvert.h"
29      include "comgeom.h"
30
31!   Arguments:
32!   ----------
33
34      LOGICAL,INTENT(IN) :: conser ! triggers printing some diagnostics
35      INTEGER,INTENT(IN) :: itau ! time step index
36      REAL,INTENT(IN) :: vcov(ip1jm,llm) ! covariant meridional wind
37      REAL,INTENT(IN) :: ucov(ip1jmp1,llm) ! covariant zonal wind
38      REAL,INTENT(IN) :: teta(ip1jmp1,llm) ! potential temperature
39      REAL,INTENT(IN) :: ps(ip1jmp1) ! surface pressure
40      REAL,INTENT(IN) :: phis(ip1jmp1) ! geopotential at the surface
41      REAL,INTENT(IN) :: pk(ip1jmp1,llm) ! Exner at mid-layer
42      REAL,INTENT(IN) :: pkf(ip1jmp1,llm) ! filtered Exner
43      REAL,INTENT(IN) :: phi(ip1jmp1,llm) ! geopotential
44      REAL,INTENT(OUT) :: masse(ip1jmp1,llm) ! air mass
45      REAL,INTENT(OUT) :: dv(ip1jm,llm) ! tendency on vcov
46      REAL,INTENT(OUT) :: du(ip1jmp1,llm) ! tendency on ucov
47      REAL,INTENT(OUT) :: dteta(ip1jmp1,llm) ! tenddency on teta
48      REAL,INTENT(OUT) :: dp(ip1jmp1) ! tendency on ps
49      REAL,INTENT(OUT) :: w(ip1jmp1,llm) ! vertical velocity
50      REAL,INTENT(OUT) :: pbaru(ip1jmp1,llm) ! mass flux in the zonal direction
51      REAL,INTENT(OUT) :: pbarv(ip1jm,llm) ! mass flux in the meridional direction
52      REAL,INTENT(IN) :: time ! current time
53
54!   Local:
55!   ------
56
57      REAL vcont(ip1jm,llm),ucont(ip1jmp1,llm)
58      REAL ang(ip1jmp1,llm),p(ip1jmp1,llmp1)
59      REAL massebx(ip1jmp1,llm),masseby(ip1jm,llm),psexbarxy(ip1jm)
60      REAL vorpot(ip1jm,llm)
61      REAL ecin(ip1jmp1,llm),convm(ip1jmp1,llm)
62      REAL bern(ip1jmp1,llm)
63      REAL massebxy(ip1jm,llm)
64   
65
66      INTEGER   ij,l
67
68!-----------------------------------------------------------------------
69!   Compute dynamical tendencies:
70!--------------------------------
71
72      ! compute contravariant winds ucont() and vcont
73      CALL covcont  ( llm    , ucov    , vcov , ucont, vcont        )
74      ! compute pressure p()
75      CALL pression ( ip1jmp1, ap      , bp   ,  ps  , p            )
76      ! compute psexbarxy() XY-area weighted-averaged surface pressure (what for?)
77      CALL psextbar (   ps   , psexbarxy                            )
78      ! compute mass in each atmospheric mesh: masse()
79      CALL massdair (    p   , masse                                )
80      ! compute X and Y-averages of mass, massebx() and masseby()
81      CALL massbar  (   masse, massebx , masseby                    )
82      ! compute XY-average of mass, massebxy()
83      call massbarxy(   masse, massebxy                             )
84      ! compute mass fluxes pbaru() and pbarv()
85      CALL flumass  ( massebx, masseby , vcont, ucont ,pbaru, pbarv )
86      ! compute dteta() , horizontal converging flux of theta
87      CALL dteta1   (   teta , pbaru   , pbarv, dteta               )
88      ! compute convm(), horizontal converging flux of mass
89      CALL convmas  (   pbaru, pbarv   , convm                      )
90
91      ! compute pressure variation due to mass convergence
92      DO ij =1, ip1jmp1
93         dp( ij ) = convm( ij,1 ) / airesurg( ij )
94      ENDDO
95
96      ! compute vertical velocity w()
97      CALL vitvert ( convm  , w                                  )
98      ! compute potential vorticity vorpot()
99      CALL tourpot ( vcov   , ucov  , massebxy  , vorpot         )
100      ! compute rotation induced du() and dv()
101      CALL dudv1   ( vorpot , pbaru , pbarv     , du     , dv    )
102      ! compute kinetic energy ecin()
103      CALL enercin ( vcov   , ucov  , vcont     , ucont  , ecin  )
104      ! compute Bernouilli function bern()
105      CALL bernoui ( ip1jmp1, llm   , phi       , ecin   , bern  )
106      ! compute and add du() and dv() contributions from Bernouilli and pressure
107      CALL dudv2   ( teta   , pkf   , bern      , du     , dv    )
108
109
110      DO l=1,llm
111         DO ij=1,ip1jmp1
112            ang(ij,l) = ucov(ij,l) + constang(ij)
113         ENDDO
114      ENDDO
115
116      ! compute vertical advection contributions to du(), dv() and dteta()
117      CALL advect( ang, vcov, teta, w, massebx, masseby, du, dv,dteta )
118
119!  WARNING probleme de peridocite de dv sur les PC/linux. Pb d'arrondi
120!          probablement. Observe sur le code compile avec pgf90 3.0-1
121
122      DO l = 1, llm
123         DO ij = 1, ip1jm, iip1
124           IF( dv(ij,l).NE.dv(ij+iim,l) )  THEN
125!         PRINT *,'!!!ATTENTION!!! probleme de periodicite sur vcov', 
126!    ,   ' dans caldyn'
127!         PRINT *,' l,  ij = ', l, ij, ij+iim,dv(ij+iim,l),dv(ij,l)
128          dv(ij+iim,l) = dv(ij,l)
129           ENDIF
130         ENDDO
131      ENDDO
132
133!-----------------------------------------------------------------------
134!   Output some control variables:
135!---------------------------------
136
137      IF( conser )  THEN
138        CALL sortvarc
139     & ( itau,ucov,teta,ps,masse,pk,phis,vorpot,phi,bern,dp,time,vcov )
140      ENDIF
141
142      END
Note: See TracBrowser for help on using the repository browser.