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