| 1 | ! |
|---|
| 2 | ! $Header$ |
|---|
| 3 | ! |
|---|
| 4 | SUBROUTINE inter_barx ( idatmax,xidat,fdat,imodmax,ximod,fmod ) |
|---|
| 5 | |
|---|
| 6 | c .... Auteurs : Robert Sadourny , P. Le Van ..... |
|---|
| 7 | c |
|---|
| 8 | IMPLICIT NONE |
|---|
| 9 | c ---------------------------------------------------------- |
|---|
| 10 | c INTERPOLATION BARYCENTRIQUE BASEE SUR LES AIRES |
|---|
| 11 | c VERSION UNIDIMENSIONNELLE , EN LONGITUDE . |
|---|
| 12 | c ---------------------------------------------------------- |
|---|
| 13 | c |
|---|
| 14 | c idat : indice du champ de donnees, de 1 a idatmax |
|---|
| 15 | c imod : indice du champ du modele, de 1 a imodmax |
|---|
| 16 | c fdat(idat) : champ de donnees (entrees) |
|---|
| 17 | c fmod(imod) : champ du modele (sorties) |
|---|
| 18 | c xidat(idat): abscisses des interfaces des mailles donnees |
|---|
| 19 | c ximod(imod): abscisses des interfaces des mailles modele |
|---|
| 20 | c ( L'indice 1 correspond a l'interface mailLE 1 / maille 2) |
|---|
| 21 | c ( Les abscisses sont exprimes en degres) |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | INTEGER idatmax, imodmax |
|---|
| 25 | REAL xidat(idatmax),fdat(idatmax),ximod(imodmax),fmod(imodmax) |
|---|
| 26 | |
|---|
| 27 | c ... Variables locales ... |
|---|
| 28 | |
|---|
| 29 | REAL xxid(idatmax+1), xxd(idatmax+1), fdd(idatmax+1) |
|---|
| 30 | REAL fxd(idatmax+1), xchan(idatmax+1), fdchan(idatmax+1) |
|---|
| 31 | REAL xxim(imodmax) |
|---|
| 32 | |
|---|
| 33 | REAL x0,xim0,dx,dxm |
|---|
| 34 | REAL chmin,chmax,pi |
|---|
| 35 | |
|---|
| 36 | INTEGER imod,idat,i,ichang,id0,id1,nid,idatmax1 |
|---|
| 37 | |
|---|
| 38 | pi = 2. * ASIN(1.) |
|---|
| 39 | |
|---|
| 40 | c ----------------------------------------------------- |
|---|
| 41 | c REDEFINITION DE L'ORIGINE DES ABSCISSES |
|---|
| 42 | c A L'INTERFACE OUEST DE LA PREMIERE MAILLE DU MODELE |
|---|
| 43 | c ----------------------------------------------------- |
|---|
| 44 | DO imod = 1,imodmax |
|---|
| 45 | xxim(imod) = ximod(imod) |
|---|
| 46 | ENDDO |
|---|
| 47 | |
|---|
| 48 | CALL minmax( imodmax,xxim,chmin,chmax) |
|---|
| 49 | IF( chmax.LT.6.50 ) THEN |
|---|
| 50 | c PRINT 3 |
|---|
| 51 | c PRINT *,' conversion des longit. ximod (donnees en radians)' |
|---|
| 52 | c , ,' en degres .' |
|---|
| 53 | c PRINT 3 |
|---|
| 54 | DO imod = 1, imodmax |
|---|
| 55 | xxim(imod) = xxim(imod) * 180./pi |
|---|
| 56 | ENDDO |
|---|
| 57 | ENDIF |
|---|
| 58 | |
|---|
| 59 | xim0 = xxim(imodmax) - 360. |
|---|
| 60 | |
|---|
| 61 | DO imod = 1, imodmax |
|---|
| 62 | xxim(imod) = xxim(imod) - xim0 |
|---|
| 63 | ENDDO |
|---|
| 64 | |
|---|
| 65 | idatmax1 = idatmax +1 |
|---|
| 66 | |
|---|
| 67 | DO idat = 1, idatmax |
|---|
| 68 | xxd(idat) = xidat(idat) |
|---|
| 69 | ENDDO |
|---|
| 70 | |
|---|
| 71 | CALL minmax( idatmax,xxd,chmin,chmax) |
|---|
| 72 | IF( chmax.LT.6.50 ) THEN |
|---|
| 73 | c PRINT 3 |
|---|
| 74 | c PRINT *,' conversion des longit. ximod (donnees en radians)' |
|---|
| 75 | c , ,' en degres .' |
|---|
| 76 | c PRINT 3 |
|---|
| 77 | DO idat = 1, idatmax |
|---|
| 78 | xxd(idat) = xxd(idat) * 180./pi |
|---|
| 79 | ENDDO |
|---|
| 80 | ENDIF |
|---|
| 81 | |
|---|
| 82 | DO idat = 1, idatmax |
|---|
| 83 | xxd(idat) = MOD( xxd(idat) - xim0, 360. ) |
|---|
| 84 | fdd(idat) = fdat (idat) |
|---|
| 85 | ENDDO |
|---|
| 86 | c PRINT *,' xxd redef. origine abscisses ' |
|---|
| 87 | c PRINT 2,(xxd(i),i=1,idatmax) |
|---|
| 88 | |
|---|
| 89 | DO i = 2, idatmax |
|---|
| 90 | IF( ( xxd(i) - xxd(i-1)).LT.0. ) THEN |
|---|
| 91 | ichang = i |
|---|
| 92 | GO TO 5 |
|---|
| 93 | ENDIF |
|---|
| 94 | ENDDO |
|---|
| 95 | GO TO 6 |
|---|
| 96 | c |
|---|
| 97 | c *** reorganisation des longitudes entre 0. et 360. degres **** |
|---|
| 98 | c |
|---|
| 99 | 5 nid = idatmax - ichang +1 |
|---|
| 100 | DO i = 1, nid |
|---|
| 101 | xchan (i) = xxd(i+ichang -1 ) |
|---|
| 102 | fdchan(i) = fdd(i+ichang -1 ) |
|---|
| 103 | ENDDO |
|---|
| 104 | DO i=1,ichang -1 |
|---|
| 105 | xchan (i+ nid) = xxd(i) |
|---|
| 106 | fdchan(i+nid) = fdd(i) |
|---|
| 107 | ENDDO |
|---|
| 108 | DO i =1,idatmax |
|---|
| 109 | xxd(i) = xchan(i) |
|---|
| 110 | fdd(i) = fdchan(i) |
|---|
| 111 | ENDDO |
|---|
| 112 | |
|---|
| 113 | 6 continue |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | c ------------------------------------------------ |
|---|
| 117 | c translation des champs de donnees par rapport |
|---|
| 118 | c a la nouvelle origine, avec redondance de la |
|---|
| 119 | c maille a cheval sur les bords |
|---|
| 120 | c ----------------------------------------------- |
|---|
| 121 | |
|---|
| 122 | id0 = 0 |
|---|
| 123 | id1 = 0 |
|---|
| 124 | |
|---|
| 125 | DO idat = 1, idatmax |
|---|
| 126 | IF ( xxd( idatmax1- idat ).LT.360.) GO TO 10 |
|---|
| 127 | id1 = id1 + 1 |
|---|
| 128 | ENDDO |
|---|
| 129 | |
|---|
| 130 | 10 DO idat = 1, idatmax |
|---|
| 131 | IF (xxd(idat).GT.0.) GO TO 20 |
|---|
| 132 | id0 = id0 + 1 |
|---|
| 133 | END DO |
|---|
| 134 | |
|---|
| 135 | 20 IF( id1.EQ.0 ) GO TO 30 |
|---|
| 136 | DO idat = 1, id1 |
|---|
| 137 | xxid(idat) = xxd(idatmax - id1 + idat) - 360. |
|---|
| 138 | fxd (idat) = fdd(idatmax - id1 + idat) |
|---|
| 139 | END DO |
|---|
| 140 | DO idat = 1, idatmax - id1 |
|---|
| 141 | xxid(idat + id1) = xxd(idat) |
|---|
| 142 | fxd (idat + id1) = fdd(idat) |
|---|
| 143 | END DO |
|---|
| 144 | |
|---|
| 145 | 30 IF(id0.EQ.0) GO TO 40 |
|---|
| 146 | DO idat = 1, idatmax - id0 |
|---|
| 147 | xxid(idat) = xxd(idat + id0) |
|---|
| 148 | fxd (idat) = fdd(idat + id0) |
|---|
| 149 | END DO |
|---|
| 150 | |
|---|
| 151 | DO idat = 1, id0 |
|---|
| 152 | xxid (idatmax - id0 + idat) = xxd(idat) + 360. |
|---|
| 153 | fxd (idatmax - id0 + idat) = fdd(idat) |
|---|
| 154 | END DO |
|---|
| 155 | GO TO 50 |
|---|
| 156 | |
|---|
| 157 | 40 DO idat = 1, idatmax |
|---|
| 158 | xxid(idat) = xxd(idat) |
|---|
| 159 | fxd (idat) = fdd(idat) |
|---|
| 160 | ENDDO |
|---|
| 161 | |
|---|
| 162 | 50 xxid(idatmax1) = xxid(1) + 360. |
|---|
| 163 | fxd (idatmax1) = fxd(1) |
|---|
| 164 | |
|---|
| 165 | c ------------------------------------ |
|---|
| 166 | c initialisation du champ du modele |
|---|
| 167 | |
|---|
| 168 | DO imod = 1, imodmax |
|---|
| 169 | fmod(imod) = 0. |
|---|
| 170 | END DO |
|---|
| 171 | |
|---|
| 172 | c PRINT *,' id0 id1 ',id0,id1 |
|---|
| 173 | c PRINT *,' xxim apres translation ' |
|---|
| 174 | c PRINT 2,(xxim(i),i=1,imodmax) |
|---|
| 175 | c PRINT *,' xxid apres translation ' |
|---|
| 176 | c PRINT 2,(xxid(i),i=1,idatmax) |
|---|
| 177 | c --------------------------------------- |
|---|
| 178 | c iteration |
|---|
| 179 | |
|---|
| 180 | x0 = xim0 |
|---|
| 181 | dxm = 0. |
|---|
| 182 | imod = 1 |
|---|
| 183 | idat = 1 |
|---|
| 184 | |
|---|
| 185 | 100 IF (xxim(imod).LT.xxid(idat)) THEN |
|---|
| 186 | dx = xxim(imod) - x0 |
|---|
| 187 | dxm = dxm + dx |
|---|
| 188 | fmod(imod) = (fmod(imod) + dx * fxd(idat)) / dxm |
|---|
| 189 | x0 = xxim(imod) |
|---|
| 190 | dxm = 0. |
|---|
| 191 | imod = imod + 1 |
|---|
| 192 | IF (imod.LE.imodmax) GO TO 100 |
|---|
| 193 | |
|---|
| 194 | ELSE IF (xxim(imod).GT.xxid(idat)) THEN |
|---|
| 195 | dx = xxid(idat) - x0 |
|---|
| 196 | dxm = dxm + dx |
|---|
| 197 | fmod(imod) = fmod(imod) + dx * fxd(idat) |
|---|
| 198 | x0 = xxid(idat) |
|---|
| 199 | idat = idat + 1 |
|---|
| 200 | GO TO 100 |
|---|
| 201 | |
|---|
| 202 | ELSE |
|---|
| 203 | dx = xxim(imod) - x0 |
|---|
| 204 | dxm = dxm + dx |
|---|
| 205 | fmod(imod) = (fmod(imod) + dx * fxd(idat)) / dxm |
|---|
| 206 | x0 = xxim(imod) |
|---|
| 207 | dxm = 0. |
|---|
| 208 | imod = imod + 1 |
|---|
| 209 | idat = idat + 1 |
|---|
| 210 | IF (imod.LE.imodmax) GO TO 100 |
|---|
| 211 | END IF |
|---|
| 212 | |
|---|
| 213 | |
|---|
| 214 | 3 FORMAT(1x,70(1h-)) |
|---|
| 215 | 2 FORMAT(1x,8f8.2) |
|---|
| 216 | |
|---|
| 217 | RETURN |
|---|
| 218 | END |
|---|