source: LMDZ4/trunk/libf/dyn3d/pres2lev.F @ 524

Last change on this file since 524 was 524, checked in by lmdzadmin, 20 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1!
2! $Header$
3!
4c******************************************************
5      SUBROUTINE   pres2lev(varo,varn,lmo,lmn,po,pn,
6     %                      ni,nj)
7c
8c interpolation lineaire pour passer
9c a une nouvelle discretisation verticale pour
10c les variables de GCM
11c Francois Forget (01/1995)
12c
13c MOdif remy roca 12/97 pour passer de pres2sig
14c**********************************************************
15
16      IMPLICIT NONE
17
18c   Declarations:
19c ==============
20c
21c  ARGUMENTS
22c  """""""""
23
24       INTEGER lmo ! dimensions ancienne couches (input)
25       INTEGER lmn ! dimensions nouvelle couches (input)
26       INTEGER lmomx ! dimensions ancienne couches (input)
27       INTEGER lmnmx ! dimensions nouvelle couches (input)
28
29       parameter(lmomx=10000,lmnmx=10000)
30
31        real po(lmo)! niveau de pression en millibars
32        real pn(ni,nj,lmn) ! niveau de pression en pascals
33
34       INTEGER i,j,Nhoriz,ni,nj ! nombre de point horizontale (input)
35
36       REAL varo(ni,nj,lmo) ! var dans l'ancienne grille (input)
37       REAL varn(ni,nj,lmn) ! var dans la nouvelle grille (output)
38
39       real zvaro(lmomx),zpo(lmomx)
40
41c Autres variables
42c """"""""""""""""
43       INTEGER n, ln ,lo
44       REAL coef
45
46c run
47c ====
48        do i=1,ni
49        do j=1,nj
50c a chaque point de grille correspond un nouveau sigma old
51c qui vaut pres(l)/ps(i,j)
52           do lo=1,lmo
53              zpo(lo)=po(lmo+1-lo)
54              zvaro(lo)=varo(i,j,lmo+1-lo)
55           enddo
56       
57           do ln=1,lmn
58              if (pn(i,j,ln).ge.zpo(1))then
59                 varn(i,j,ln) =  zvaro(1)
60              else if (pn(i,j,ln).le.zpo(lmo)) then
61                 varn(i,j,ln) =  zvaro(lmo)
62              else
63                 do lo=1,lmo-1
64                    if ( (pn(i,j,ln).le.zpo(lo)).and.
65     &                 (pn(i,j,ln).gt.zpo(lo+1)) )then
66                       coef=(pn(i,j,ln)-zpo(lo))
67     &                 /(zpo(lo+1)-zpo(lo))
68                       varn(i,j,ln)=zvaro(lo)
69     &                 +coef*(zvaro(lo+1)-zvaro(lo))
70c       print*,'pn(',ln,')=',pn(i,j,ln),varn(i,j,ln)
71                    end if
72                 enddo           
73              endif
74           enddo
75
76        enddo
77        enddo
78      return
79      end   
Note: See TracBrowser for help on using the repository browser.