source: LMDZ6/trunk/libf/dyn3d_common/exner_milieu_m.f90 @ 5272

Last change on this file since 5272 was 5272, checked in by abarral, 25 hours 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
File size: 3.8 KB
Line 
1module exner_milieu_m
2
3  IMPLICIT NONE
4
5contains
6
7  SUBROUTINE  exner_milieu ( ngrid, ps, p, pks, pk, pkf )
8    !
9    !     Auteurs :  F. Forget , Y. Wanherdrick
10    ! P.Le Van  , Fr. Hourdin  .
11    !    ..........
12    !
13    !    ....  ngrid, ps,p             sont des argum.d'entree  au sous-prog ...
14    !    ....  pks,pk,pkf   sont des argum.de sortie au sous-prog ...
15    !
16    !   ************************************************************************
17    !    Calcule la fonction d'Exner pk = Cp * (p/preff) ** kappa , aux milieux des
18    !    couches .   Pk(l) sera calcule aux milieux  des couches l ,entre les
19    !    pressions p(l) et p(l+1) ,definis aux interfaces des llm couches .
20    !   ************************************************************************
21    !  .. N.B : Au sommet de l'atmosphere,  p(llm+1) = 0. , et ps et pks sont
22    !    la pression et la fonction d'Exner  au  sol  .
23    !
24    !     WARNING : CECI est une version speciale de exner_hyb originale
25    !               Utilise dans la version martienne pour pouvoir
26    !               tourner avec des coordonnees verticales complexe
27    !              => Il ne verifie PAS la condition la proportionalite en
28    !              energie totale/ interne / potentielle (F.Forget 2001)
29    !    ( voir note de Fr.Hourdin )  ,
30    !
31    !
32    USE comconst_mod, ONLY: jmp1, cpp, kappa, r
33    USE comvert_mod, ONLY: preff
34   
35    USE dimensions_mod, ONLY: iim, jjm, llm, ndm
36USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, &
37          ip1jmi1, ijp1llm, ijmllm, mvar, jcfil, jcfllm
38IMPLICIT NONE
39
40
41
42    include "comgeom.h"
43
44    INTEGER  ngrid
45    REAL p(ngrid,llmp1),pk(ngrid,llm)
46    real, optional:: pkf(ngrid,llm)
47    REAL ps(ngrid),pks(ngrid)
48
49    !    .... variables locales   ...
50
51    INTEGER l, ij
52    REAL dum1
53
54    logical,save :: firstcall=.true.
55    character(len=*),parameter :: modname="exner_milieu"
56
57    ! Sanity check
58    if (firstcall) then
59       ! sanity checks for Shallow Water case (1 vertical layer)
60       if (llm.eq.1) then
61          if (kappa.ne.1) then
62             call abort_gcm(modname, &
63                  "kappa!=1 , but running in Shallow Water mode!!",42)
64          endif
65          if (cpp.ne.r) then
66             call abort_gcm(modname, &
67                  "cpp!=r , but running in Shallow Water mode!!",42)
68          endif
69       endif ! of if (llm.eq.1)
70
71       firstcall=.false.
72    endif ! of if (firstcall)
73
74    ! Specific behaviour for Shallow Water (1 vertical layer) case:
75    if (llm.eq.1) then
76
77       ! Compute pks(:),pk(:),pkf(:)
78
79       DO   ij  = 1, ngrid
80          pks(ij) = (cpp/preff) * ps(ij)
81          pk(ij,1) = .5*pks(ij)
82       ENDDO
83
84       if (present(pkf)) then
85          pkf = pk
86          CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
87       end if
88
89       ! our work is done, exit routine
90       return
91    endif ! of if (llm.eq.1)
92
93    ! General case:
94
95    !     -------------
96    !     Calcul de pks
97    !     -------------
98
99    DO   ij  = 1, ngrid
100       pks(ij) = cpp * ( ps(ij)/preff ) ** kappa
101    ENDDO
102
103    !    .... Calcul de pk  pour la couche l
104    !    --------------------------------------------
105    !
106    dum1 = cpp * (2*preff)**(-kappa)
107    DO l = 1, llm-1
108       DO   ij   = 1, ngrid
109          pk(ij,l) = dum1 * (p(ij,l) + p(ij,l+1))**kappa
110       ENDDO
111    ENDDO
112
113    !    .... Calcul de pk  pour la couche l = llm ..
114    !    (on met la meme distance (en log pression)  entre Pk(llm)
115    !    et Pk(llm -1) qu'entre Pk(llm-1) et Pk(llm-2)
116
117    DO   ij   = 1, ngrid
118       pk(ij,llm) = pk(ij,llm-1)**2 / pk(ij,llm-2)
119    ENDDO
120
121    if (present(pkf)) then
122       !    calcul de pkf
123       pkf = pk
124       CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
125    end if
126
127  END SUBROUTINE exner_milieu
128
129end module exner_milieu_m
Note: See TracBrowser for help on using the repository browser.