source: LMDZ5/branches/AI-cosp/libf/phylmd/vertical_layers_mod.F90 @ 5444

Last change on this file since 5444 was 2315, checked in by Ehouarn Millour, 10 years ago

More on physics/dynamics separation: make a vertical_layers_mod module to contain information on the vertical discretization. This module should be used from within the physics (instead of including comvert.h from dynamics).
EM

File size: 1.8 KB
Line 
1! $Id: $
2
3MODULE vertical_layers_mod
4
5   REAL,SAVE             :: preff  ! reference surface pressure (Pa)
6   REAL,SAVE             :: scaleheight ! atmospheric reference scale height (km)
7   REAL,SAVE,ALLOCATABLE :: ap(:) ! hybrid (pressure contribution) coordinate
8                                  ! at layer interfaces (Pa)
9   REAL,SAVE,ALLOCATABLE :: bp(:) ! hybrid (sigma contribution) coordinate
10                                  ! at layer interfaces (Pa)
11   REAL,SAVE,ALLOCATABLE :: presnivs(:) ! reference pressure at mid-layer (Pa),
12                                        ! based on preff, ap and bp
13   REAL,SAVE,ALLOCATABLE :: pseudoalt(:) ! pseudo-altitude of model layers (km),
14                                         ! based on preff and scaleheight
15   
16!$OMP THREADPRIVATE(preff,scaleheight,ap,bp,presnivs,pseudoalt)
17
18
19CONTAINS
20
21  SUBROUTINE init_vertical_layers(nlayer,preff_,scaleheight_,ap_,bp_,&
22                                 presnivs_, pseudoalt_)
23    IMPLICIT NONE
24    INTEGER,INTENT(IN) :: nlayer ! number of atmospheric layers
25    REAL,INTENT(IN)    :: preff_ ! reference surface pressure (Pa)
26    REAL,INTENT(IN)    :: scaleheight_ ! atmospheric scale height (km)
27    REAL,INTENT(IN)    :: ap_(nlayer+1) ! hybrid coordinate at interfaces
28    REAL,INTENT(IN)    :: bp_(nlayer+1) ! hybrid coordinate at interfaces
29    REAL,INTENT(IN)    :: presnivs_(nlayer) ! Appproximative pressure of atm. layers (Pa)
30    REAL,INTENT(IN)    :: pseudoalt_(nlayer) ! pseudo-altitude of atm. layers (km)
31 
32    ALLOCATE(ap(nlayer+1))
33    ALLOCATE(bp(nlayer+1))
34    ALLOCATE(presnivs(nlayer))
35    ALLOCATE(pseudoalt(nlayer))
36 
37    preff = preff_
38    scaleheight=scaleheight_
39    ap(:) = ap_(:)
40    bp(:) = bp_(:)
41    presnivs(:) = presnivs_(:)
42    pseudoalt(:) = pseudoalt_(:)
43
44  END SUBROUTINE init_vertical_layers
45
46END MODULE vertical_layers_mod
Note: See TracBrowser for help on using the repository browser.