/[lmdze]/trunk/phylmd/tetalevel.f90
ViewVC logotype

Contents of /trunk/phylmd/tetalevel.f90

Parent Directory Parent Directory | Revision Log Revision Log


Revision 81 - (show annotations)
Wed Mar 5 14:38:41 2014 UTC (10 years, 2 months ago) by guez
File size: 3472 byte(s)
 Converted to free source form files which were still in fixed source
form. The conversion was done using the polish mode of the NAG Fortran
Compiler.

In addition to converting to free source form, the processing of the
files also:

-- indented the code (including comments);

-- set Fortran keywords to uppercase, and set all other identifiers
to lower case;

-- added qualifiers to end statements (for example "end subroutine
conflx", instead of "end");

-- changed the terminating statements of all DO loops so that each
loop ends with an ENDDO statement (instead of a labeled continue).

1 ! ================================================================
2 ! ================================================================
3 SUBROUTINE tetalevel(ilon, ilev, lnew, pgcm, pres, qgcm, qpres)
4 ! ================================================================
5 ! ================================================================
6
7 USE dimens_m
8 USE paramet_m
9 USE dimphy
10 IMPLICIT NONE
11
12
13 ! ================================================================
14
15 ! Interpoler des champs 3-D u, v et g du modele a un niveau de
16 ! pression donnee (pres)
17
18 ! INPUT: ilon ----- nombre de points
19 ! ilev ----- nombre de couches
20 ! lnew ----- true si on doit reinitialiser les poids
21 ! pgcm ----- pressions modeles
22 ! pres ----- pression vers laquelle on interpolle
23 ! Qgcm ----- champ GCM
24 ! Qpres ---- champ interpolle au niveau pres
25
26 ! ================================================================
27
28 ! arguments :
29 ! -----------
30
31 INTEGER ilon, ilev
32 LOGICAL lnew
33
34 REAL pgcm(ilon, ilev)
35 REAL, INTENT (IN) :: qgcm(ilon, ilev)
36 REAL pres
37 REAL qpres(ilon)
38
39 ! local :
40 ! -------
41
42
43 INTEGER lt(ip1jmp1), lb(ip1jmp1)
44 REAL ptop, pbot, aist(ip1jmp1), aisb(ip1jmp1)
45 SAVE lt, lb, ptop, pbot, aist, aisb
46
47 INTEGER i, k
48
49 ! PRINT*,'tetalevel pres=',pres
50 ! =====================================================================
51 IF (lnew) THEN
52 ! on réinitialise les réindicages et les poids
53 ! =====================================================================
54
55
56 ! Chercher les 2 couches les plus proches du niveau a obtenir
57
58 ! Eventuellement, faire l'extrapolation a partir des deux couches
59 ! les plus basses ou les deux couches les plus hautes:
60 DO i = 1, ilon
61 ! IM IF ( ABS(pres-pgcm(i,ilev) ) .LT.
62 IF (abs(pres-pgcm(i,ilev))>abs(pres-pgcm(i,1))) THEN
63 lt(i) = ilev ! 2
64 lb(i) = ilev - 1 ! 1
65 ELSE
66 lt(i) = 2
67 lb(i) = 1
68 END IF
69 ! IM PRINT*,'i, ABS(pres-pgcm),ABS(pres-pgcm)',
70 ! IM .i, ABS(pres-pgcm(i,ilev)),ABS(pres-pgcm(i,1))
71 END DO
72 DO k = 1, ilev - 1
73 DO i = 1, ilon
74 pbot = pgcm(i, k)
75 ptop = pgcm(i, k+1)
76 ! IM IF (ptop.LE.pres .AND. pbot.GE.pres) THEN
77 IF (ptop>=pres .AND. pbot<=pres) THEN
78 lt(i) = k + 1
79 lb(i) = k
80 END IF
81 END DO
82 END DO
83
84 ! Interpolation lineaire:
85
86 DO i = 1, ilon
87 ! interpolation en logarithme de pression:
88
89 ! ... Modif . P. Le Van ( 20/01/98) ....
90 ! Modif Frédéric Hourdin (3/01/02)
91
92 ! IF(pgcm(i,lb(i)).NE.0.OR.
93 ! $ pgcm(i,lt(i)).NE.0.) THEN
94
95 ! PRINT*,'i,lb,lt,2pgcm,pres',i,lb(i),
96 ! . lt(i),pgcm(i,lb(i)),pgcm(i,lt(i)),pres
97
98 aist(i) = log(pgcm(i,lb(i))/pres)/log(pgcm(i,lb(i))/pgcm(i,lt(i)))
99 aisb(i) = log(pres/pgcm(i,lt(i)))/log(pgcm(i,lb(i))/pgcm(i,lt(i)))
100 END DO
101
102
103 END IF ! lnew
104
105 ! ======================================================================
106 ! inteprollation
107 ! ======================================================================
108
109 DO i = 1, ilon
110 qpres(i) = qgcm(i, lb(i))*aisb(i) + qgcm(i, lt(i))*aist(i)
111 END DO
112
113 ! Je mets les vents a zero quand je rencontre une montagne
114 DO i = 1, ilon
115 ! IM if (pgcm(i,1).LT.pres) THEN
116 IF (pgcm(i,1)>pres) THEN
117 ! Qpres(i)=1e33
118 qpres(i) = 1E+20
119 ! IM PRINT*,'i,pgcm(i,1),pres =',i,pgcm(i,1),pres
120 END IF
121 END DO
122
123
124 RETURN
125 END SUBROUTINE tetalevel

  ViewVC Help
Powered by ViewVC 1.1.21