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

Last change on this file since 5272 was 5272, checked in by abarral, 23 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
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
1module exner_hyb_m
2
3  IMPLICIT NONE
4
5contains
6
7  SUBROUTINE  exner_hyb ( ngrid, ps, p, pks, pk, pkf )
8
9    !     Auteurs :  P.Le Van  , Fr. Hourdin  .
10    !    ..........
11    !
12    !    ....  ngrid, ps,p             sont des argum.d'entree  au sous-prog ...
13    !    ....  pks,pk,pkf   sont des argum.de sortie au sous-prog ...
14    !
15    !   ************************************************************************
16    !    Calcule la fonction d'Exner pk = Cp * (p/preff) ** kappa , aux milieux des
17    !    couches .   Pk(l) sera calcule aux milieux  des couches l ,entre les
18    !    pressions p(l) et p(l+1) ,definis aux interfaces des llm couches .
19    !   ************************************************************************
20    !  .. N.B : Au sommet de l'atmosphere,  p(llm+1) = 0. , et ps et pks sont
21    !    la pression et la fonction d'Exner  au  sol  .
22    !
23    !                                 -------- z
24    !    A partir des relations  ( 1 ) p*dz(pk) = kappa *pk*dz(p)      et
25    !                            ( 2 ) pk(l) = alpha(l)+ beta(l)*pk(l-1)
26    !    ( voir note de Fr.Hourdin )  ,
27    !
28    !    on determine successivement , du haut vers le bas des couches, les
29    !    coef. alpha(llm),beta(llm) .,.,alpha(l),beta(l),,,alpha(2),beta(2),
30    !    puis pk(ij,1). Ensuite ,on calcule,du bas vers le haut des couches, 
31    !     pk(ij,l)  donne  par la relation (2),  pour l = 2 a l = llm .
32    !
33    !
34    !
35    USE comconst_mod, ONLY: jmp1, cpp, kappa, r
36    USE comvert_mod, ONLY: preff
37   
38    USE dimensions_mod, ONLY: iim, jjm, llm, ndm
39USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, &
40          ip1jmi1, ijp1llm, ijmllm, mvar, jcfil, jcfllm
41IMPLICIT NONE
42
43
44
45    include "comgeom.h"
46
47    INTEGER  ngrid
48    REAL p(ngrid,llmp1),pk(ngrid,llm)
49    real, optional:: pkf(ngrid,llm)
50    REAL ps(ngrid),pks(ngrid), alpha(ngrid,llm),beta(ngrid,llm)
51
52    !    .... variables locales   ...
53
54    INTEGER l, ij
55    REAL unpl2k,dellta
56
57    logical,save :: firstcall=.true.
58    character(len=*),parameter :: modname="exner_hyb"
59
60    ! Sanity check
61    if (firstcall) then
62       ! sanity checks for Shallow Water case (1 vertical layer)
63       if (llm.eq.1) then
64          if (kappa.ne.1) then
65             call abort_gcm(modname, &
66                  "kappa!=1 , but running in Shallow Water mode!!",42)
67          endif
68          if (cpp.ne.r) then
69             call abort_gcm(modname, &
70                  "cpp!=r , but running in Shallow Water mode!!",42)
71          endif
72       endif ! of if (llm.eq.1)
73
74       firstcall=.false.
75    endif ! of if (firstcall)
76
77    ! Specific behaviour for Shallow Water (1 vertical layer) case:
78    if (llm.eq.1) then
79
80       ! Compute pks(:),pk(:),pkf(:)
81
82       DO   ij  = 1, ngrid
83          pks(ij) = (cpp/preff) * ps(ij)
84          pk(ij,1) = .5*pks(ij)
85       ENDDO
86
87       if (present(pkf)) then
88          pkf = pk
89          CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
90       end if
91
92       ! our work is done, exit routine
93       return
94    endif ! of if (llm.eq.1)
95
96    ! General case:
97
98    unpl2k    = 1.+ 2.* kappa
99
100    !     -------------
101    !     Calcul de pks
102    !     -------------
103
104    DO   ij  = 1, ngrid
105       pks(ij) = cpp * ( ps(ij)/preff ) ** kappa
106    ENDDO
107
108    !    .... Calcul des coeff. alpha et beta  pour la couche l = llm ..
109    !
110    DO     ij      = 1, ngrid
111       alpha(ij,llm) = 0.
112       beta (ij,llm) = 1./ unpl2k
113    ENDDO
114    !
115    !     ... Calcul des coeff. alpha et beta  pour l = llm-1  a l = 2 ...
116    !
117    DO l = llm -1 , 2 , -1
118       !
119       DO ij = 1, ngrid
120          dellta = p(ij,l)* unpl2k + p(ij,l+1)* ( beta(ij,l+1)-unpl2k )
121          alpha(ij,l)  = - p(ij,l+1) / dellta * alpha(ij,l+1)
122          beta (ij,l)  =   p(ij,l  ) / dellta   
123       ENDDO
124    ENDDO
125
126    !  ***********************************************************************
127    !     .....  Calcul de pk pour la couche 1 , pres du sol  ....
128    !
129    DO   ij   = 1, ngrid
130       pk(ij,1) = ( p(ij,1)*pks(ij) - 0.5*alpha(ij,2)*p(ij,2) )  / &
131            (  p(ij,1)* (1.+kappa) + 0.5*( beta(ij,2)-unpl2k )* p(ij,2) )
132    ENDDO
133    !
134    !    ..... Calcul de pk(ij,l) , pour l = 2 a l = llm  ........
135    !
136    DO l = 2, llm
137       DO   ij   = 1, ngrid
138          pk(ij,l) = alpha(ij,l) + beta(ij,l) * pk(ij,l-1)
139       ENDDO
140    ENDDO
141
142    if (present(pkf)) then
143       !    calcul de pkf
144       pkf = pk
145       CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
146    end if
147
148  END SUBROUTINE exner_hyb
149
150end module exner_hyb_m
Note: See TracBrowser for help on using the repository browser.