source: LMDZ6/trunk/libf/dyn3d/caldyn.f90 @ 5272

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