source: LMDZ5/trunk/libf/dyn3d_common/exner_milieu_m.F90 @ 2360

Last change on this file since 2360 was 2021, checked in by lguez, 11 years ago

Removed unused variables pks, pk, pkf from main program unit gcm.

Encapsulated procedures exner_hyb, exner_hyb_p, exner_hyb_loc,
exner_milieu, exner_milieu_p and exner_milieu_loc into
modules. (Compulsory to allow optional arguments.)

In the procedures exner_hyb, exner_hyb_p, exner_hyb_loc, donwgraded
arguments alpha and beta to local variables. In exner_milieu,
exner_milieu_p and exner_milieu_loc, removed beta altogether. In the
six procedures exner_*, made pkf an optional argument. Made some
cosmetic modifications in order to keep the six procedures exner_* as
close as possible.

In the six procedures exner_*, removed the averaging of pks at the
poles: this is not useful because ps is already the same at all
longitudes at the poles. This modification changes the results of the
program. Motivation: had to do this for exner_hyb because we call it
from test_disvert with a few surface pressure values.

In all the procedures calling exner_*, removed the variables alpha and
beta. Also removed variables alpha and beta from module leapfrog_mod
and from module call_calfis_mod.

Removed actual argument pkf in call to exner_hyb* and exner_milieu*
from guide_interp, guide_main, iniacademic and iniacademic_loc (pkf
was not used in those procedures).

Argument workvar of startget_dyn is used only if varname is tpot or

  1. When varname is tpot or q, the actual argument associated to

workvar in etat0_netcdf is not y. So y in etat0_netcdf is a
place-holder, never used. So we remove optional argument y in the
calls to exner_hyb and exner_milieu from etat0_netcdf.

Created procedure test_disvert, called only by etat0_netcdf. This
procedure tests the order of pressure values at half-levels and full
levels.

  • 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.6 KB
RevLine 
[2021]1module exner_milieu_m
[1520]2
[2021]3  IMPLICIT NONE
[1520]4
[2021]5contains
[1520]6
[2021]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    include "dimensions.h"
33    include "paramet.h"
34    include "comconst.h"
35    include "comgeom.h"
36    include "comvert.h"
37    include "serre.h"
[1520]38
[2021]39    INTEGER  ngrid
40    REAL p(ngrid,llmp1),pk(ngrid,llm)
41    real, optional:: pkf(ngrid,llm)
42    REAL ps(ngrid),pks(ngrid)
[1520]43
[2021]44    !    .... variables locales   ...
45
46    INTEGER l, ij
47    REAL dum1
48
49    logical,save :: firstcall=.true.
50    character(len=*),parameter :: modname="exner_milieu"
51
52    ! Sanity check
53    if (firstcall) then
54       ! sanity checks for Shallow Water case (1 vertical layer)
55       if (llm.eq.1) then
[1520]56          if (kappa.ne.1) then
[2021]57             call abort_gcm(modname, &
58                  "kappa!=1 , but running in Shallow Water mode!!",42)
[1520]59          endif
60          if (cpp.ne.r) then
[2021]61             call abort_gcm(modname, &
62                  "cpp!=r , but running in Shallow Water mode!!",42)
[1520]63          endif
[2021]64       endif ! of if (llm.eq.1)
[1520]65
[2021]66       firstcall=.false.
67    endif ! of if (firstcall)
[1520]68
[2021]69    ! Specific behaviour for Shallow Water (1 vertical layer) case:
70    if (llm.eq.1) then
71
72       ! Compute pks(:),pk(:),pkf(:)
73
74       DO   ij  = 1, ngrid
75          pks(ij) = (cpp/preff) * ps(ij)
[1520]76          pk(ij,1) = .5*pks(ij)
[2021]77       ENDDO
[1520]78
[2021]79       if (present(pkf)) then
80          pkf = pk
81          CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
82       end if
[1520]83
[2021]84       ! our work is done, exit routine
85       return
86    endif ! of if (llm.eq.1)
[1520]87
[2021]88    ! General case:
[1520]89
[2021]90    !     -------------
91    !     Calcul de pks
92    !     -------------
[1520]93
[2021]94    DO   ij  = 1, ngrid
95       pks(ij) = cpp * ( ps(ij)/preff ) ** kappa
96    ENDDO
[1520]97
[2021]98    !    .... Calcul de pk  pour la couche l
99    !    --------------------------------------------
100    !
101    dum1 = cpp * (2*preff)**(-kappa)
102    DO l = 1, llm-1
103       DO   ij   = 1, ngrid
104          pk(ij,l) = dum1 * (p(ij,l) + p(ij,l+1))**kappa
105       ENDDO
106    ENDDO
[1520]107
[2021]108    !    .... Calcul de pk  pour la couche l = llm ..
109    !    (on met la meme distance (en log pression)  entre Pk(llm)
110    !    et Pk(llm -1) qu'entre Pk(llm-1) et Pk(llm-2)
[1520]111
[2021]112    DO   ij   = 1, ngrid
113       pk(ij,llm) = pk(ij,llm-1)**2 / pk(ij,llm-2)
114    ENDDO
[1520]115
[2021]116    if (present(pkf)) then
117       !    calcul de pkf
118       pkf = pk
119       CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
120    end if
[1520]121
[2021]122  END SUBROUTINE exner_milieu
123
124end module exner_milieu_m
Note: See TracBrowser for help on using the repository browser.