[3] | 1 | subroutine ballon (iam,dtphys,rjour,rsec,plat,plon, |
---|
| 2 | i temp, p, u, v, geop) |
---|
| 3 | |
---|
[101] | 4 | use dimphy |
---|
[1530] | 5 | use mod_grid_phy_lmdz, only: nbp_lon, nbp_lat |
---|
[3] | 6 | implicit none |
---|
| 7 | |
---|
| 8 | c====================================================================== |
---|
| 9 | c Auteur: S. Lebonnois (LMD/CNRS) date: 20091201 |
---|
| 10 | c Object: Compute balloon trajectories. |
---|
| 11 | C No outputs, every quantities are written on the iam+ Files. |
---|
| 12 | c |
---|
| 13 | c Called by physiq.F if flag ballons activated: |
---|
| 14 | c |
---|
| 15 | c integer ballons |
---|
| 16 | c (...) |
---|
| 17 | c ballons = 1 ! (in initialisations) |
---|
| 18 | c (...) |
---|
| 19 | C OUVERTURE DES FICHIERS FORMATTES CONTENANT LES POSITIONS ET VITESSES |
---|
| 20 | C DES BALLONS |
---|
| 21 | c if (ballons.eq.1) then |
---|
| 22 | c open(30,file='ballons-lat.out',form='formatted') |
---|
| 23 | c open(31,file='ballons-lon.out',form='formatted') |
---|
| 24 | c open(32,file='ballons-u.out',form='formatted') |
---|
| 25 | c open(33,file='ballons-v.out',form='formatted') |
---|
| 26 | c open(34,file='ballons-alt.out',form='formatted') |
---|
| 27 | c write(*,*)'Ouverture des ballons*.out' |
---|
| 28 | c endif !ballons |
---|
| 29 | c (...) |
---|
| 30 | C CALL ballon(30,pdtphys,rjourvrai,gmtime,rlatd,rlond, |
---|
| 31 | CC C t,pplay,u,v,pphi) ! alt above surface (smoothed for GCM) |
---|
| 32 | C C t,pplay,u,v,zphi) ! alt above planet average radius |
---|
| 33 | c (...) |
---|
| 34 | C FERMETURE DES FICHIERS FORMATTES CONTENANT LES POSITIONS ET VITESSES |
---|
| 35 | C DES BALLONS |
---|
| 36 | c if (ballons.eq.1) then |
---|
| 37 | c write(*,*)'Fermeture des ballons*.out' |
---|
| 38 | c close(30) |
---|
| 39 | c close(31) |
---|
| 40 | c close(32) |
---|
| 41 | c close(33) |
---|
| 42 | c close(34) |
---|
| 43 | c endif !ballons |
---|
| 44 | c |
---|
| 45 | C====================================================================== |
---|
| 46 | c Explicit Arguments: |
---|
| 47 | c ================== |
---|
| 48 | c iam-----input-I-File number where latitudes are written |
---|
| 49 | c It is a formatted file that has been opened |
---|
| 50 | c in physiq.F |
---|
| 51 | c other files: iam+1=longitudes |
---|
| 52 | c iam+2=zonal speeds |
---|
| 53 | c iam+3=meridional speeds |
---|
| 54 | c iam+4=altitudes |
---|
| 55 | c dtphys--input-R-pas de temps physique |
---|
| 56 | c rjour---input-R-Jour compte depuis le debut de la simu (run.def) |
---|
| 57 | c rsec----input-R-Seconde de la journee |
---|
| 58 | c plat ---input-R-Latitude en degres |
---|
| 59 | c plon ---input-R-Longitude en degres |
---|
| 60 | c temp----input-R-Temperature (K) at model levels |
---|
| 61 | c p-------input-R-Pressure (Pa) at model levels |
---|
| 62 | c u-------input-R-Horizontal wind (m/s) |
---|
| 63 | c v-------input-R-Meridional wind (m/s) |
---|
| 64 | c geop----input-R-Geopotential !! above surface OR average radius |
---|
| 65 | c |
---|
| 66 | c |
---|
| 67 | c Implicit Arguments: |
---|
| 68 | c =================== |
---|
| 69 | c |
---|
| 70 | c iim--common-I: Number of longitude intervals |
---|
| 71 | c jjm--common-I: Number of latitude intervals |
---|
| 72 | c klon-common-I: Number of points seen by the physics |
---|
| 73 | c iim*(jjm-1)+2 for instance |
---|
| 74 | c klev-common-I: Number of vertical layers |
---|
| 75 | c RPI,RKBOL--common-R: Pi, KBoltzman |
---|
| 76 | c RDAY,RA,RG-common-R: day length in s, planet radius, gravity |
---|
| 77 | c====================================================================== |
---|
| 78 | c Local Variables: |
---|
| 79 | c ================ |
---|
| 80 | c |
---|
| 81 | c nb ---I: number of balloons (parameter) |
---|
| 82 | c phib ---R: Latitude of balloon in radians |
---|
| 83 | c lamb ---R: Longitude of balloon in radians |
---|
| 84 | c lognb ---R: log(density) of balloon |
---|
| 85 | c ub ---R: zonal speed of balloon |
---|
| 86 | c vb ---R: meridional speed of balloon |
---|
| 87 | c altb ---R: altitude of balloon |
---|
| 88 | c zlat ---R: Latitude in radians |
---|
| 89 | c zlon ---R: Longitude in radians |
---|
| 90 | c logn ---R: log(density) |
---|
| 91 | c alt ---R: altitude !! above surface OR average radius |
---|
| 92 | c ull ---R: zonal wind for one balloon on the lognb surface |
---|
| 93 | c vll ---R: meridional wind for one balloon on the lognb surface |
---|
| 94 | c aal ---R: altitude for one balloon on the lognb surface |
---|
| 95 | c====================================================================== |
---|
| 96 | |
---|
| 97 | #include "YOMCST.h" |
---|
| 98 | c |
---|
| 99 | c ARGUMENTS |
---|
| 100 | c |
---|
| 101 | INTEGER iam |
---|
| 102 | REAL dtphys,rjour,rsec,plat(klon),plon(klon) |
---|
| 103 | REAL temp(klon,klev),p(klon,klev) |
---|
| 104 | REAL u(klon,klev),v(klon,klev),geop(klon,klev) |
---|
| 105 | c |
---|
| 106 | c Variables locales: |
---|
| 107 | c |
---|
| 108 | INTEGER i,j,k,l,nb,n |
---|
| 109 | parameter (nb=20) !! Adjust the format on line 100 !! |
---|
| 110 | INTEGER jj,ii,ll |
---|
| 111 | |
---|
[1530] | 112 | REAL,SAVE,ALLOCATABLE :: zlon(:),zlat(:) |
---|
[3] | 113 | |
---|
| 114 | REAL time |
---|
| 115 | REAL logn(klon,klev),ull(klon),vll(klon) |
---|
| 116 | REAL alt(klon,klev),aal(klon) |
---|
| 117 | real ub(nb),vb(nb),phib(nb),lamb(nb),lognb(nb),altb(nb) |
---|
| 118 | save phib,lamb,lognb |
---|
| 119 | |
---|
| 120 | REAL factalt |
---|
| 121 | |
---|
| 122 | c RungeKutta order - If not RK, Nrk=1 |
---|
| 123 | integer Nrk,irk |
---|
| 124 | parameter (Nrk=1) |
---|
| 125 | real dtrk |
---|
| 126 | |
---|
| 127 | logical first |
---|
| 128 | save first |
---|
| 129 | data first/.true./ |
---|
| 130 | |
---|
| 131 | time = rjour*RDAY+rsec |
---|
| 132 | logn(:,:) = log10(p(:,:)/(RKBOL*temp(:,:))) |
---|
| 133 | alt(:,:) = geop(:,:)/RG |
---|
| 134 | |
---|
| 135 | c--------------------------------------------- |
---|
| 136 | C INITIALIZATIONS |
---|
| 137 | c--------------------------------------------- |
---|
| 138 | if (first) then |
---|
| 139 | |
---|
| 140 | print*,"BALLOONS ACTIVATED" |
---|
| 141 | |
---|
[1530] | 142 | allocate(zlon(nbp_lon+1)) |
---|
| 143 | allocate(zlat(nbp_lat)) |
---|
| 144 | |
---|
[3] | 145 | C Latitudes: |
---|
| 146 | zlat(1)=plat(1)*RPI/180. |
---|
[1530] | 147 | do j = 2,nbp_lat-1 |
---|
| 148 | k=(j-2)*nbp_lon+2 |
---|
[3] | 149 | zlat(j)=plat(k)*RPI/180. |
---|
| 150 | enddo |
---|
[1530] | 151 | zlat(nbp_lat)=plat(klon)*RPI/180. |
---|
[3] | 152 | |
---|
| 153 | C Longitudes: |
---|
[1530] | 154 | do i = 1,nbp_lon |
---|
[3] | 155 | k=i+1 |
---|
| 156 | zlon(i)=plon(k)*RPI/180. |
---|
| 157 | enddo |
---|
[1530] | 158 | zlon(nbp_lon+1)=zlon(1)+2.*RPI |
---|
[3] | 159 | |
---|
| 160 | c verif init lat de 90 à -90, lon de -180 à 180 |
---|
| 161 | c print*,"Latitudes:",zlat*180./RPI |
---|
| 162 | c print*,"Longitudes:",zlon*180./RPI |
---|
| 163 | c stop |
---|
| 164 | |
---|
| 165 | c initial positions of balloons (in degrees for lat/lon) |
---|
| 166 | do j=1,5 |
---|
| 167 | do i=1,4 |
---|
| 168 | k=(j-1)*4+i |
---|
| 169 | phib(k)= (j-1)*20.*RPI/180. |
---|
| 170 | lamb(k)= (i-3)*90.*RPI/180. ! de -180 à 90 |
---|
[1442] | 171 | c lognb(k)= log10(5.e4/(RKBOL*300.)) ! ~55km in VIRA model |
---|
| 172 | lognb(k)= log10(5.e5/(RKBOL*300.)) ! 5 bars (for Blamont, mai2015) |
---|
[3] | 173 | enddo |
---|
| 174 | enddo |
---|
| 175 | print*,"Balloon density (m^-3)=",10.**(lognb(1)) |
---|
| 176 | |
---|
| 177 | c print*,"log(density) profile:" |
---|
| 178 | c do l=1,klev |
---|
| 179 | c print*,logn(klon/2,l) |
---|
| 180 | c enddo |
---|
| 181 | c stop !verif init |
---|
| 182 | |
---|
| 183 | first=.false. |
---|
| 184 | endif ! first |
---|
| 185 | c--------------------------------------------- |
---|
| 186 | |
---|
| 187 | c------------------------------------------------- |
---|
| 188 | c loop over the balloons |
---|
| 189 | c------------------------------------------------- |
---|
| 190 | do n=1,nb |
---|
| 191 | |
---|
| 192 | c Interpolation in altitudes |
---|
| 193 | c------------------------------------------------- |
---|
| 194 | do k=1,klon |
---|
| 195 | ll=1 ! en bas |
---|
| 196 | do l=2,klev |
---|
| 197 | if (lognb(n).lt.logn(k,l)) ll=l |
---|
| 198 | enddo |
---|
| 199 | factalt= (lognb(n)-logn(k,ll))/(logn(k,ll+1)-logn(k,ll)) |
---|
| 200 | ull(k) = u(k,ll+1)*factalt + u(k,ll)*(1-factalt) |
---|
| 201 | vll(k) = v(k,ll+1)*factalt + v(k,ll)*(1-factalt) |
---|
| 202 | aal(k) = alt(k,ll+1)*factalt + alt(k,ll)*(1-factalt) |
---|
| 203 | enddo |
---|
| 204 | |
---|
| 205 | c Interpolation in latitudes and longitudes |
---|
| 206 | c------------------------------------------- |
---|
| 207 | call wind_interp(ull,vll,aal,zlat,zlon, |
---|
| 208 | . phib(n),lamb(n),ub(n),vb(n),altb(n)) |
---|
| 209 | |
---|
| 210 | enddo ! over balloons |
---|
| 211 | c------------------------------------------------- |
---|
| 212 | |
---|
| 213 | c------------------------------------------------- |
---|
| 214 | c Output of positions and speed at time |
---|
| 215 | c------------------------------------------------- |
---|
| 216 | |
---|
| 217 | c Venus regardee a l'envers: lon et lat inversees |
---|
| 218 | write(iam, 100) time, (-1)*phib*180./RPI |
---|
| 219 | write(iam+1,100) time, (-1)*lamb*180./RPI |
---|
| 220 | write(iam+2,100) time, ub |
---|
| 221 | c Venus regardee a l'envers: v inversee |
---|
| 222 | write(iam+3,100) time, (-1)*vb |
---|
| 223 | write(iam+4,100) time, altb |
---|
| 224 | c stop !verif init |
---|
| 225 | |
---|
| 226 | c !!!!!!!!!!!!!!!! nb !!!!!!!!!!!!!!!!! |
---|
| 227 | 100 format(E14.7,20(1x,E12.5)) |
---|
| 228 | |
---|
| 229 | c------------------------------------------------- |
---|
| 230 | c Implementation: positions at time+dt |
---|
| 231 | c RK order Nrk |
---|
| 232 | c------------------------------------------------- |
---|
| 233 | |
---|
| 234 | dtrk = dtphys/Nrk |
---|
| 235 | time=time+dtrk |
---|
| 236 | |
---|
| 237 | do n=1,nb |
---|
| 238 | call pos_implem(phib(n),lamb(n),ub(n),vb(n),dtrk) |
---|
| 239 | enddo |
---|
| 240 | |
---|
| 241 | if (Nrk.gt.1) then |
---|
| 242 | do irk=2,Nrk |
---|
| 243 | do n=1,nb |
---|
| 244 | time=time+dtrk |
---|
| 245 | call wind_interp(ull,vll,aal,zlat,zlon, |
---|
| 246 | . phib(n),lamb(n),ub(n),vb(n),altb(n)) |
---|
| 247 | call pos_implem(phib(n),lamb(n),ub(n),vb(n),dtrk) |
---|
| 248 | enddo |
---|
| 249 | enddo |
---|
| 250 | endif |
---|
| 251 | |
---|
| 252 | end |
---|
| 253 | |
---|
| 254 | c====================================================================== |
---|
| 255 | c====================================================================== |
---|
| 256 | c====================================================================== |
---|
| 257 | |
---|
| 258 | subroutine wind_interp(map_u,map_v,map_a,latit,longit, |
---|
| 259 | . phi,lam,ubal,vbal,abal) |
---|
| 260 | |
---|
[101] | 261 | use dimphy |
---|
[1530] | 262 | use mod_grid_phy_lmdz, only: nbp_lon, nbp_lat |
---|
[3] | 263 | implicit none |
---|
| 264 | |
---|
| 265 | c====================================================================== |
---|
| 266 | c Auteur: S. Lebonnois (LMD/CNRS) date: 20091201 |
---|
| 267 | c Object: interpolate balloon speed from its position. |
---|
| 268 | C====================================================================== |
---|
| 269 | c Explicit Arguments: |
---|
| 270 | c ================== |
---|
| 271 | c map_u ---R: zonal wind on the lognb surface |
---|
| 272 | c map_v ---R: meridional wind on the lognb surface |
---|
| 273 | c map_a ---R: altitude on the lognb surface |
---|
| 274 | c latit ---R: Latitude in radians |
---|
| 275 | c longit---R: Longitude in radians |
---|
| 276 | c phi ---R: Latitude of balloon in radians |
---|
| 277 | c lam ---R: Longitude of balloon in radians |
---|
| 278 | c ubal ---R: zonal speed of balloon |
---|
| 279 | c vbal ---R: meridional speed of balloon |
---|
| 280 | c abal ---R: altitude of balloon |
---|
| 281 | c====================================================================== |
---|
| 282 | c Local Variables: |
---|
| 283 | c ================ |
---|
| 284 | c |
---|
| 285 | c ujj ---R: zonal wind interpolated in latitude |
---|
| 286 | c vjj ---R: meridional wind interpolated in latitude |
---|
| 287 | c ajj ---R: altitude interpolated in latitude |
---|
| 288 | c====================================================================== |
---|
| 289 | |
---|
| 290 | #include "YOMCST.h" |
---|
| 291 | c |
---|
| 292 | c ARGUMENTS |
---|
| 293 | c |
---|
| 294 | real map_u(klon),map_v(klon),map_a(klon) |
---|
[1530] | 295 | real latit(nbp_lat),longit(nbp_lon) |
---|
[3] | 296 | real phi,lam,ubal,vbal,abal |
---|
| 297 | c |
---|
| 298 | c Variables locales: |
---|
| 299 | c |
---|
| 300 | INTEGER i,j,k |
---|
| 301 | INTEGER jj,ii |
---|
[1530] | 302 | REAL ujj(nbp_lon+1),vjj(nbp_lon+1),ajj(nbp_lon+1) |
---|
[3] | 303 | REAL factlat,factlon |
---|
| 304 | |
---|
| 305 | c Interpolation in latitudes |
---|
| 306 | c------------------------------------------------- |
---|
| 307 | jj=1 ! POLE NORD |
---|
[1530] | 308 | do j=2,nbp_lat-1 |
---|
[3] | 309 | if (phi.lt.latit(j)) jj=j |
---|
| 310 | enddo |
---|
| 311 | factlat = (phi-latit(jj))/(latit(jj+1)-latit(jj)) |
---|
| 312 | |
---|
| 313 | c pole nord |
---|
| 314 | if (jj.eq.1) then |
---|
[1530] | 315 | do i=1,nbp_lon |
---|
[3] | 316 | ujj(i) = map_u(i+1)*factlat + map_u(1)*(1-factlat) |
---|
| 317 | vjj(i) = map_v(i+1)*factlat + map_v(1)*(1-factlat) |
---|
| 318 | ajj(i) = map_a(i+1)*factlat + map_a(1)*(1-factlat) |
---|
| 319 | enddo |
---|
| 320 | c pole sud |
---|
[1530] | 321 | elseif (jj.eq.nbp_lat-1) then |
---|
| 322 | do i=1,nbp_lon |
---|
| 323 | k = (jj-2)*nbp_lon+1+i |
---|
[3] | 324 | ujj(i) = map_u(klon)*factlat + map_u(k)*(1-factlat) |
---|
| 325 | vjj(i) = map_v(klon)*factlat + map_v(k)*(1-factlat) |
---|
| 326 | ajj(i) = map_a(klon)*factlat + map_a(k)*(1-factlat) |
---|
| 327 | enddo |
---|
| 328 | c autres latitudes |
---|
| 329 | else |
---|
[1530] | 330 | do i=1,nbp_lon |
---|
| 331 | k = (jj-2)*nbp_lon+1+i |
---|
| 332 | ujj(i) = map_u(k+nbp_lon)*factlat + map_u(k)*(1-factlat) |
---|
| 333 | vjj(i) = map_v(k+nbp_lon)*factlat + map_v(k)*(1-factlat) |
---|
| 334 | ajj(i) = map_a(k+nbp_lon)*factlat + map_a(k)*(1-factlat) |
---|
[3] | 335 | enddo |
---|
| 336 | endif |
---|
[1530] | 337 | ujj(nbp_lon+1)=ujj(1) |
---|
| 338 | vjj(nbp_lon+1)=vjj(1) |
---|
| 339 | ajj(nbp_lon+1)=ajj(1) |
---|
[3] | 340 | |
---|
| 341 | c Interpolation in longitudes |
---|
| 342 | c------------------------------------------------- |
---|
| 343 | ii=1 ! lon=-180 |
---|
[1530] | 344 | do i=2,nbp_lon |
---|
[3] | 345 | if (lam.gt.longit(i)) ii=i |
---|
| 346 | enddo |
---|
| 347 | factlon = (lam-longit(ii))/(longit(ii+1)-longit(ii)) |
---|
| 348 | ubal = ujj(ii+1)*factlon + ujj(ii)*(1-factlon) |
---|
| 349 | vbal = vjj(ii+1)*factlon + vjj(ii)*(1-factlon) |
---|
| 350 | abal = ajj(ii+1)*factlon + ajj(ii)*(1-factlon) |
---|
| 351 | |
---|
| 352 | end |
---|
| 353 | |
---|
| 354 | c====================================================================== |
---|
| 355 | c====================================================================== |
---|
| 356 | c====================================================================== |
---|
| 357 | |
---|
| 358 | subroutine pos_implem(phi,lam,ubal,vbal,dt) |
---|
| 359 | |
---|
[101] | 360 | use dimphy |
---|
[3] | 361 | implicit none |
---|
| 362 | |
---|
| 363 | c====================================================================== |
---|
| 364 | c Auteur: S. Lebonnois (LMD/CNRS) date: 20091201 |
---|
| 365 | c Object: implementation of balloon position. |
---|
| 366 | C====================================================================== |
---|
| 367 | c Explicit Arguments: |
---|
| 368 | c ================== |
---|
| 369 | c phi ---R: Latitude of balloon in radians |
---|
| 370 | c lam ---R: Longitude of balloon in radians |
---|
| 371 | c ubal ---R: zonal speed of balloon |
---|
| 372 | c vbal ---R: meridional speed of balloon |
---|
| 373 | c dt ---R: time step |
---|
| 374 | c====================================================================== |
---|
| 375 | |
---|
| 376 | #include "YOMCST.h" |
---|
| 377 | c |
---|
| 378 | c ARGUMENTS |
---|
| 379 | c |
---|
| 380 | real phi,lam,ubal,vbal,abal,dt |
---|
| 381 | |
---|
| 382 | c incrementation longitude |
---|
| 383 | lam = lam + ubal*dt/(RA*cos(phi)) |
---|
| 384 | c maintenue entre -PI et PI: |
---|
| 385 | do while (lam.ge.RPI) |
---|
| 386 | lam=lam-2*RPI |
---|
| 387 | enddo |
---|
| 388 | do while (lam.lt.(-1.*RPI)) |
---|
| 389 | lam=lam+2*RPI |
---|
| 390 | enddo |
---|
| 391 | c incrementation latitude |
---|
| 392 | phi = phi + vbal*dt/RA |
---|
| 393 | c maintenue entre -PI/2 et PI/2: |
---|
| 394 | if (phi.ge.( 0.5*RPI)) phi= RPI-phi |
---|
| 395 | if (phi.le.(-0.5*RPI)) phi=-1.*RPI-phi |
---|
| 396 | |
---|
| 397 | end |
---|