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