source: LMDZ5/trunk/libf/dyn3d_common/exner_hyb_m.F90 @ 2598

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

Cleanup in the dynamics: turn serre.h into module serre_mod.F90
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: 4.3 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    IMPLICIT NONE
37   
38    include "dimensions.h"
39    include "paramet.h"
40    include "comgeom.h"
41    include "comvert.h"
42
43    INTEGER  ngrid
44    REAL p(ngrid,llmp1),pk(ngrid,llm)
45    real, optional:: pkf(ngrid,llm)
46    REAL ps(ngrid),pks(ngrid), alpha(ngrid,llm),beta(ngrid,llm)
47
48    !    .... variables locales   ...
49
50    INTEGER l, ij
51    REAL unpl2k,dellta
52
53    logical,save :: firstcall=.true.
54    character(len=*),parameter :: modname="exner_hyb"
55
56    ! Sanity check
57    if (firstcall) then
58       ! sanity checks for Shallow Water case (1 vertical layer)
59       if (llm.eq.1) then
60          if (kappa.ne.1) then
61             call abort_gcm(modname, &
62                  "kappa!=1 , but running in Shallow Water mode!!",42)
63          endif
64          if (cpp.ne.r) then
65             call abort_gcm(modname, &
66                  "cpp!=r , but running in Shallow Water mode!!",42)
67          endif
68       endif ! of if (llm.eq.1)
69
70       firstcall=.false.
71    endif ! of if (firstcall)
72
73    ! Specific behaviour for Shallow Water (1 vertical layer) case:
74    if (llm.eq.1) then
75
76       ! Compute pks(:),pk(:),pkf(:)
77
78       DO   ij  = 1, ngrid
79          pks(ij) = (cpp/preff) * ps(ij)
80          pk(ij,1) = .5*pks(ij)
81       ENDDO
82
83       if (present(pkf)) then
84          pkf = pk
85          CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
86       end if
87
88       ! our work is done, exit routine
89       return
90    endif ! of if (llm.eq.1)
91
92    ! General case:
93
94    unpl2k    = 1.+ 2.* kappa
95
96    !     -------------
97    !     Calcul de pks
98    !     -------------
99
100    DO   ij  = 1, ngrid
101       pks(ij) = cpp * ( ps(ij)/preff ) ** kappa
102    ENDDO
103
104    !    .... Calcul des coeff. alpha et beta  pour la couche l = llm ..
105    !
106    DO     ij      = 1, ngrid
107       alpha(ij,llm) = 0.
108       beta (ij,llm) = 1./ unpl2k
109    ENDDO
110    !
111    !     ... Calcul des coeff. alpha et beta  pour l = llm-1  a l = 2 ...
112    !
113    DO l = llm -1 , 2 , -1
114       !
115       DO ij = 1, ngrid
116          dellta = p(ij,l)* unpl2k + p(ij,l+1)* ( beta(ij,l+1)-unpl2k )
117          alpha(ij,l)  = - p(ij,l+1) / dellta * alpha(ij,l+1)
118          beta (ij,l)  =   p(ij,l  ) / dellta   
119       ENDDO
120    ENDDO
121
122    !  ***********************************************************************
123    !     .....  Calcul de pk pour la couche 1 , pres du sol  ....
124    !
125    DO   ij   = 1, ngrid
126       pk(ij,1) = ( p(ij,1)*pks(ij) - 0.5*alpha(ij,2)*p(ij,2) )  / &
127            (  p(ij,1)* (1.+kappa) + 0.5*( beta(ij,2)-unpl2k )* p(ij,2) )
128    ENDDO
129    !
130    !    ..... Calcul de pk(ij,l) , pour l = 2 a l = llm  ........
131    !
132    DO l = 2, llm
133       DO   ij   = 1, ngrid
134          pk(ij,l) = alpha(ij,l) + beta(ij,l) * pk(ij,l-1)
135       ENDDO
136    ENDDO
137
138    if (present(pkf)) then
139       !    calcul de pkf
140       pkf = pk
141       CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
142    end if
143
144  END SUBROUTINE exner_hyb
145
146end module exner_hyb_m
Note: See TracBrowser for help on using the repository browser.