Changeset 1454
- Timestamp:
- Jun 16, 2015, 7:01:30 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.TITAN/Tools/angmom.F90
r1356 r1454 47 47 integer,dimension(4) :: datashape4d ! shape of 4D datasets 48 48 49 real :: miss_val =9.99e+33! special "missing value" to specify missing data50 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"49 real :: miss_val ! special "missing value" to specify missing data 50 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 51 51 real :: pi 52 52 real,dimension(:),allocatable :: lon ! longitude 53 53 integer lonlength ! # of grid points along longitude 54 54 real,dimension(:),allocatable :: lat ! latitude 55 real,dimension(:),allocatable :: latrad ! latitude in radian55 real,dimension(:),allocatable :: coslat ! cos of latitude 56 56 integer latlength ! # of grid points along latitude 57 57 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 117 117 118 118 pi = 2.*asin(1.) 119 miss_val = miss_val_def 119 120 120 121 write(*,*) "" … … 160 161 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 161 162 162 allocate(latrad(latlength)) 163 latrad = lat*pi/180. 163 allocate(coslat(latlength)) 164 ! Beware of rounding problems at poles... 165 coslat(:) = max(0.,cos(lat(:)*pi/180.)) 164 166 165 167 ! Lat, lon pressure intervals 166 deltalat = abs(lat rad(2)-latrad(1))168 deltalat = abs(lat(2)-lat(1))*pi/180. 167 169 deltalon = abs(lon(2)-lon(1))*pi/180. 168 170 … … 281 283 endif 282 284 283 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)285 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 284 286 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get U ID" 285 287 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind" … … 295 297 296 298 !text="zareoid" 297 !call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)299 !call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 298 300 !if (ierr1.ne.NF_NOERR) stop "Error: Failed to get za ID" 299 301 !if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zareoid" … … 309 311 text="DUVDF" 310 312 endif 311 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,duvdf, ierr1,ierr2)313 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,duvdf,miss_val,ierr1,ierr2) 312 314 if (ierr1.ne.NF_NOERR) then 313 315 write(*,*) "Failed to get duvdf ID" … … 357 359 358 360 text="dugwo" 359 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,dugwo, ierr1,ierr2)361 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,dugwo,miss_val,ierr1,ierr2) 360 362 if (ierr1.ne.NF_NOERR) then 361 363 write(*,*) "Failed to get dugwo ID" … … 367 369 368 370 text="dugwno" 369 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,dugwno, ierr1,ierr2)371 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,dugwno,miss_val,ierr1,ierr2) 370 372 if (ierr1.ne.NF_NOERR) then 371 373 write(*,*) "Failed to get dugwno ID" … … 390 392 391 393 text="duajs" 392 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,duajs, ierr1,ierr2)394 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,duajs,miss_val,ierr1,ierr2) 393 395 if (ierr1.ne.NF_NOERR) then 394 396 write(*,*) "Failed to get duajs ID" … … 414 416 text="DUDYN" 415 417 endif 416 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,dudyn, ierr1,ierr2)418 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,dudyn,miss_val,ierr1,ierr2) 417 419 if (ierr1.ne.NF_NOERR) then 418 420 write(*,*) "Failed to get dudyn ID" … … 486 488 enddo ! timelength 487 489 488 call cellmass(infid,latlength,lonlength,altlength,timelength, &489 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &490 call cellmass(infid,latlength,lonlength,altlength,timelength,lmdflag, & 491 miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 490 492 dmass ) 491 493 … … 504 506 osam(ilon,ilat,ilev,itim) = & 505 507 rayon(ilon,ilat,ilev,itim)*rayon(ilon,ilat,ilev,itim) & 506 * cos (latrad(ilat))*cos(latrad(ilat)) &508 * coslat(ilat)*coslat(ilat) & 507 509 * omega 508 510 rsam(ilon,ilat,ilev,itim) = vitu(ilon,ilat,ilev,itim) & 509 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat))511 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) 510 512 else 511 513 osam(ilon,ilat,ilev,itim) = miss_val … … 569 571 tmpp = (ps(ilon+1,ilat,itim) +ps(ilon,ilat,itim))/2. 570 572 endif 571 tmou(itim) = tmou(itim) + a0*a0* deltalat*cos (latrad(ilat)) &573 tmou(itim) = tmou(itim) + a0*a0* deltalat*coslat(ilat) & 572 574 * signe*dz*tmpp & 573 575 / hadley … … 582 584 if (rayon(ilon,ilat,ilev,itim).ne.miss_val) then 583 585 tdyn(itim) = tdyn(itim) + dudyn(ilon,ilat,ilev,itim) & 584 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat)) &586 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) & 585 587 * dmass(ilon,ilat,ilev,itim) & 586 588 / hadley … … 599 601 if (rayon(ilon,ilat,ilev,itim).ne.miss_val) then 600 602 tajs(itim) = tajs(itim) + duajs(ilon,ilat,ilev,itim) & 601 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat)) &603 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) & 602 604 * dmass(ilon,ilat,ilev,itim) & 603 605 / hadley … … 616 618 if (rayon(ilon,ilat,ilev,itim).ne.miss_val) then 617 619 tbls(itim) = tbls(itim) + duvdf(ilon,ilat,ilev,itim) & 618 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat)) &620 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) & 619 621 * dmass(ilon,ilat,ilev,itim) & 620 622 / hadley … … 633 635 if (rayon(ilon,ilat,ilev,itim).ne.miss_val) then 634 636 tgwo(itim) = tgwo(itim) + dugwo(ilon,ilat,ilev,itim) & 635 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat)) &637 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) & 636 638 * dmass(ilon,ilat,ilev,itim) & 637 639 / hadley … … 650 652 if (rayon(ilon,ilat,ilev,itim).ne.miss_val) then 651 653 tgwno(itim) = tgwno(itim) + dugwno(ilon,ilat,ilev,itim) & 652 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat)) &654 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) & 653 655 * dmass(ilon,ilat,ilev,itim) & 654 656 / hadley -
trunk/LMDZ.TITAN/Tools/compile_pgf
r1356 r1454 1 1 # path for netcdf should be adapted to your configuration ! 2 2 3 \cp -f $2.h planet.h3 #\cp -f $2.h planet.h 4 4 pgf95 -Bstatic cpdet.F90 moyzon.F moyzon2.F moytim.F dx_dp.F epflux.F90 \ 5 5 io.F90 dmass.F90 reverse.F90 $1.F90 \ -
trunk/LMDZ.TITAN/Tools/compilefft_pgf
r816 r1454 2 2 # path for fftw3 should be adapted to your configuration ! 3 3 4 \rm planet.h5 ln -s $2.h planet.h4 #\rm planet.h 5 #ln -s $2.h planet.h 6 6 pgf95 -Bstatic cpdet.F90 moyzon.F moyzon2.F moytim.F dx_dp.F epflux.F90 \ 7 7 io.F90 dmass.F90 reverse.F90 $1.F90 \ -
trunk/LMDZ.TITAN/Tools/dmass.F90
r816 r1454 1 subroutine cellmass(infid,latlength,lonlength,altlength,timelength, &2 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &1 subroutine cellmass(infid,latlength,lonlength,altlength,timelength,lmdflag, & 2 miss_val,deltalon,deltalat,latrad,plev,ps,grav,rayon, & 3 3 dmass ) 4 4 … … 14 14 integer timelength ! # of points along time 15 15 logical lmdflag ! true=LMD, false=CAM 16 real :: miss_val ! missing value 16 17 real :: deltalat,deltalon ! lat and lon intervals in radians 17 18 real,dimension(latlength) :: latrad ! latitudes in radians … … 32 33 real :: p0 ! GCM reference pressure 33 34 integer tmpvarid 34 real :: miss_val=9.99e+33 ! special "missing value" to specify missing data35 real,parameter :: miss_val_def=9.99e+33 ! default value for "missing value"36 35 37 36 include "planet.h" … … 46 45 if(lmdflag) then ! LMD vs CAM 47 46 text="pres" 48 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,press, ierr1,ierr2)47 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,press,miss_val,ierr1,ierr2) 49 48 if (ierr1.ne.NF_NOERR) then 50 49 ! assume we are using _P files -
trunk/LMDZ.TITAN/Tools/dx_dp.F
r816 r1454 30 30 c----------------------------------------------------------------------- 31 31 do j=1,jjp1 32 if ((x(j,1). lt.indefini).and.(x(j,2).lt.indefini)) then32 if ((x(j,1).ne.indefini).and.(x(j,2).ne.indefini)) then 33 33 dxdp(j,1) = (x(j,2)-x(j,1))/(pniv(2) - pniv(1)) 34 34 else … … 37 37 38 38 do l=2,llm-1 39 if ((x(j,l-1). lt.indefini).and.(x(j,l+1).lt.indefini))then39 if ((x(j,l-1).ne.indefini).and.(x(j,l+1).ne.indefini))then 40 40 dxdp(j,l)= (x(j,l+1)-x(j,l-1))/(pniv(l+1) - pniv(l-1)) 41 else if((x(j,l+1). lt.indefini).and.(x(j,l).lt.indefini))then41 else if((x(j,l+1).ne.indefini).and.(x(j,l).ne.indefini))then 42 42 dxdp(j,l)= (x(j,l+1)-x(j,l)) /(pniv(l+1) - pniv(l)) 43 else if((x(j,l-1). lt.indefini).and.(x(j,l).lt.indefini))then43 else if((x(j,l-1).ne.indefini).and.(x(j,l).ne.indefini))then 44 44 dxdp(j,l)= (x(j,l)-x(j,l-1)) /(pniv(l) - pniv(l-1)) 45 45 else … … 47 47 end if 48 48 end do 49 if ((x(j,llm). lt.indefini).and.(x(j,llm-1).lt.indefini)) then49 if ((x(j,llm).ne.indefini).and.(x(j,llm-1).ne.indefini)) then 50 50 dxdp(j,llm)= (x(j,llm)-x(j,llm-1))/(pniv(llm)-pniv(llm-1)) 51 51 else … … 58 58 do j=1,jjp1 59 59 do l = 1, llm 60 if ( (abs(dxdp(j,l)).gt.( indefini/100.)).and.60 if ( (abs(dxdp(j,l)).gt.(abs(indefini)/100.)).and. 61 61 . (dxdp(j,l).ne.indefini)) then 62 62 write(*,*) '----> j= ', j , ' l= ' , l -
trunk/LMDZ.TITAN/Tools/energy.F90
r816 r1454 36 36 integer,dimension(4) :: datashape4d ! shape of 4D datasets 37 37 38 real :: miss_val =9.99e+33! special "missing value" to specify missing data39 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"38 real :: miss_val ! special "missing value" to specify missing data 39 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 40 40 real :: pi 41 41 real,dimension(:),allocatable :: lon ! longitude 42 42 integer lonlength ! # of grid points along longitude 43 43 real,dimension(:),allocatable :: lat ! latitude 44 real,dimension(:),allocatable :: latrad ! latitude in radian44 real,dimension(:),allocatable :: coslat ! cos of latitude 45 45 integer latlength ! # of grid points along latitude 46 46 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 80 80 81 81 pi = 2.*asin(1.) 82 miss_val = miss_val_def 82 83 83 84 write(*,*) "" … … 123 124 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 124 125 125 allocate(latrad(latlength)) 126 latrad = lat*pi/180. 126 allocate(coslat(latlength)) 127 ! Beware of rounding problems at poles... 128 coslat(:) = max(0.,cos(lat(:)*pi/180.)) 127 129 128 130 ! Lat, lon pressure intervals 129 deltalat = abs(lat rad(2)-latrad(1))131 deltalat = abs(lat(2)-lat(1))*pi/180. 130 132 deltalon = abs(lon(2)-lon(1))*pi/180. 131 133 … … 193 195 text="T" 194 196 endif 195 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)197 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 196 198 if (ierr1.ne.NF_NOERR) then 197 199 write(*,*) " looking for t instead... " 198 200 text="t" 199 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)201 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 200 202 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get temperature ID" 201 203 endif … … 216 218 text="U" 217 219 endif 218 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)220 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 219 221 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitu ID" 220 222 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind" … … 228 230 text="V" 229 231 endif 230 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)232 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 231 233 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID" 232 234 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind" … … 242 244 243 245 !text="zareoid" 244 !call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)246 !call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 245 247 !if (ierr1.ne.NF_NOERR) stop "Error: Failed to get za ID" 246 248 !if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zareoid" … … 276 278 enddo ! timelength 277 279 278 call cellmass(infid,latlength,lonlength,altlength,timelength, &279 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &280 call cellmass(infid,latlength,lonlength,altlength,timelength,lmdflag, & 281 miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 280 282 dmass ) 281 283 -
trunk/LMDZ.TITAN/Tools/epflux.F90
r816 r1454 1 subroutine epflux(iip1,jjp1,llm,indefini, rlatu,rbar &1 subroutine epflux(iip1,jjp1,llm,indefini,latdeg,rbar & 2 2 ,teta,u3d,v3d,w3d,press & 3 3 ,epy2d,epz2d,divep2d,vtem2d,wtem2d,acc_meridien2d & … … 41 41 42 42 integer :: iip1,jjp1,llm 43 real :: indefini, rlatu(jjp1),rbar(jjp1,llm)43 real :: indefini,latdeg(jjp1),rbar(jjp1,llm) 44 44 REAL :: teta(iip1,jjp1,llm) 45 45 REAL :: u3d(iip1,jjp1,llm),v3d(iip1,jjp1,llm) … … 75 75 ! Autres 76 76 ! ------ 77 real :: rlatu(jjp1) ! lat in radians (beware of rounding effects at poles) 77 78 real :: pi 78 79 REAL :: tetas(llm) … … 88 89 jjm = jjp1-1 89 90 pi = 2.*asin(1.) 91 92 ! To avoid rounding effects at poles 93 rlatu(:)=latdeg(:)*pi/180.00001 90 94 91 95 ! Calcul de moyennes zonales … … 108 112 n= 0 109 113 do j=2,jjm 110 if (tetabar(j,l). lt.indefini) then114 if (tetabar(j,l).ne.indefini) then 111 115 tetas(l) = tetas(l) + tetabar(j,l) 112 116 n = n+1 … … 237 241 do l=1,llm 238 242 239 if ((ubar(2,l). lt.indefini).and.(ubar(1,l).lt.indefini))then243 if ((ubar(2,l).ne.indefini).and.(ubar(1,l).ne.indefini))then 240 244 ducosdlat(1,l) = ( ubar(2,l)*cos(rlatu(2))-ubar(1,l)*cos(rlatu(1)) ) & 241 245 /( rlatu(2) - rlatu(1)) … … 244 248 end if 245 249 do j=2,jjm 246 if ((ubar(j+1,l). lt.indefini).and.(ubar(j-1,l).lt.indefini))then250 if ((ubar(j+1,l).ne.indefini).and.(ubar(j-1,l).ne.indefini))then 247 251 ducosdlat(j,l) = ( ubar(j+1,l)*cos(rlatu(j+1))-ubar(j-1,l)*cos(rlatu(j-1))) & 248 252 /( rlatu(j+1) - rlatu(j-1)) … … 251 255 end if 252 256 enddo 253 if ((ubar(jjp1,l). lt.indefini).and.(ubar(jjm,l).lt.indefini))then257 if ((ubar(jjp1,l).ne.indefini).and.(ubar(jjm,l).ne.indefini))then 254 258 ducosdlat(jjp1,l) = ( ubar(jjp1,l)*cos(rlatu(jjp1)) & 255 259 -ubar(jjm,l)*cos(rlatu(jjm)) ) & … … 260 264 261 265 do j=1,jjp1 262 if ((vptetapbar(j,l). lt.indefini).and. &263 (dtetabardp(j,l). lt.indefini)) then266 if ((vptetapbar(j,l).ne.indefini).and. & 267 (dtetabardp(j,l).ne.indefini)) then 264 268 vz(j,l) = vptetapbar(j,l)/dtetabardp(j,l) 265 269 wlat(j,l) = cos(rlatu(j))*vz(j,l) … … 284 288 ! ------------ 285 289 286 if ( (rbar(j,l). lt.indefini).and. &287 (vpupbar(j,l). lt.indefini).and. &288 (dubardp(j,l). lt.indefini).and. &289 (vz(j,l). lt.indefini)) then290 if ( (rbar(j,l).ne.indefini).and. & 291 (vpupbar(j,l).ne.indefini).and. & 292 (dubardp(j,l).ne.indefini).and. & 293 (vz(j,l).ne.indefini)) then 290 294 291 295 epy2d(j,l) = rbar(j,l) * cos(rlatu(j))* ( vpupbar(j,l) & … … 303 307 ! ------------ 304 308 305 if ( (rbar(j,l). lt.indefini).and. &306 (wpupbar(j,l). lt.indefini).and. &307 (ducosdlat(j,l). lt.indefini).and. &308 (vz(j,l). lt.indefini)) then309 if ( (rbar(j,l).ne.indefini).and. & 310 (wpupbar(j,l).ne.indefini).and. & 311 (ducosdlat(j,l).ne.indefini).and. & 312 (vz(j,l).ne.indefini)) then 309 313 310 314 epz2d(j,l) = rbar(j,l) * cos(rlatu(j))* & … … 330 334 do l=1,llm 331 335 332 if ( (wlat(2,l). lt.indefini) .and. &333 (wlat(1,l). lt.indefini) ) then336 if ( (wlat(2,l).ne.indefini) .and. & 337 (wlat(1,l).ne.indefini) ) then 334 338 dwlatdlat(1,l)=(wlat(2,l)-wlat(1,l)) & 335 339 /(rlatu(2)-rlatu(1)) … … 338 342 end if 339 343 do j=2,jjm 340 if ( (wlat(j+1,l). lt.indefini) .and. &341 (wlat(j-1,l). lt.indefini) ) then344 if ( (wlat(j+1,l).ne.indefini) .and. & 345 (wlat(j-1,l).ne.indefini) ) then 342 346 dwlatdlat(j,l)=(wlat(j+1,l)-wlat(j-1,l)) & 343 347 /(rlatu(j+1)-rlatu(j-1)) … … 346 350 end if 347 351 enddo 348 if ( (wlat(jjp1,l). lt.indefini) .and. &349 (wlat(jjm, l). lt.indefini) ) then352 if ( (wlat(jjp1,l).ne.indefini) .and. & 353 (wlat(jjm, l).ne.indefini) ) then 350 354 dwlatdlat(jjp1,l)=(wlat(jjp1,l)-wlat(jjm,l)) & 351 355 /(rlatu(jjp1)-rlatu(jjm)) … … 355 359 356 360 do j=1,jjp1 357 if ( (dvzdp(j,l). lt.indefini) &358 .and.(vbar(j,l). lt.indefini)) then361 if ( (dvzdp(j,l).ne.indefini) & 362 .and.(vbar(j,l).ne.indefini)) then 359 363 vtem2d(j,l) = vbar(j,l)-dvzdp(j,l) 360 364 else … … 364 368 365 369 do j=1,jjp1 366 if ( (rbar(j,l). lt.indefini).and. &367 (dwlatdlat(j,l). lt.indefini).and. &368 (wbar(j,l). lt.indefini)) then370 if ( (rbar(j,l).ne.indefini).and. & 371 (dwlatdlat(j,l).ne.indefini).and. & 372 (wbar(j,l).ne.indefini)) then 369 373 wtem2d(j,l) = wbar(j,l)+dwlatdlat(j,l)/(rbar(j,l)*cos(rlatu(j))) 370 374 else … … 385 389 do l=1,llm 386 390 do j=1,jjp1 387 if ( (rbar(j,l). lt.indefini) &388 .and.(vtem2d(j,l). lt.indefini) &389 .and.(wtem2d(j,l). lt.indefini) &390 .and.(ducosdlat(j,l). lt.indefini) &391 .and.(dubardp(j,l). lt.indefini)) then391 if ( (rbar(j,l).ne.indefini) & 392 .and.(vtem2d(j,l).ne.indefini) & 393 .and.(wtem2d(j,l).ne.indefini) & 394 .and.(ducosdlat(j,l).ne.indefini) & 395 .and.(dubardp(j,l).ne.indefini)) then 392 396 acc_meridien2d(j,l) = & 393 397 vtem2d(j,l)*(ducosdlat(j,l)/(rbar(j,l)*cos(rlatu(j))) & … … 410 414 divep2d(1,l) =0 411 415 do j=2,jjm 412 if ( (rbar(j,l). lt.indefini) .and. &413 (epy2d(j+1,l). lt.indefini) .and. &414 (epy2d(j-1,l). lt.indefini) .and. &415 (depzdp(j,l). lt.indefini) ) then416 if ( (rbar(j,l).ne.indefini) .and. & 417 (epy2d(j+1,l).ne.indefini) .and. & 418 (epy2d(j-1,l).ne.indefini) .and. & 419 (depzdp(j,l).ne.indefini) ) then 416 420 417 421 depycosdlat=(epy2d(j+1,l)*cos(rlatu(j+1)) & -
trunk/LMDZ.TITAN/Tools/fft.F90
r888 r1454 63 63 integer,dimension(4) :: datashape4d ! shape of 4D datasets 64 64 65 real :: miss_val =9.99e+33! special "missing value" to specify missing data66 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"65 real :: miss_val ! special "missing value" to specify missing data 66 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 67 67 real :: pi 68 68 real,dimension(:),allocatable :: lon ! longitude 69 69 integer lonlength ! # of grid points along longitude 70 70 real,dimension(:),allocatable :: lat ! latitude 71 real,dimension(:),allocatable :: latrad ! latitude in radian72 71 integer latlength ! # of grid points along latitude 73 72 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 125 124 logical :: lmdflag 126 125 126 ! Tuning parameters 127 real :: fcoup1,fcoup2,width 128 real :: fcoup1tmp,fcoup2tmp,widthtmp 129 logical,dimension(4) :: ok_out 130 character (len=1) :: ok_outtmp 131 127 132 include "planet.h" 128 include "filter.h"129 133 130 134 #include <fftw3.f> … … 135 139 136 140 pi = 2.*asin(1.) 141 miss_val = miss_val_def 137 142 138 143 write(*,*) "" 139 144 write(*,*) "You are working on the atmosphere of ",planet 145 146 ! initialisation 147 !---------------- 148 149 ! Par defaut 150 151 ! Define the filters 152 ! Low cutting frequency, in Hz : fcoup1 153 fcoup1=2.5e-6 154 ! High cutting frequency, in Hz : fcoup2 155 fcoup2=6.5e-6 156 ! Half-width of the filters, in Hz : width 157 width=4.e-7 158 ! Outputs (U, V, W, T) 159 ok_out=(/.true.,.true.,.false.,.true./) 160 161 print*,"Low cutting frequency, in Hz ?" 162 print*,"between 1e-5 and 1e-7, 0 for default => 2.5e-6" 163 read(*,*) fcoup1tmp 164 if ((fcoup1tmp.lt.1e-5).and.(fcoup1tmp.gt.1e-7)) fcoup1=fcoup1tmp 165 print*,"=",fcoup1 166 print*,"High cutting frequency, in Hz ?" 167 print*,"between 1e-5 and 1e-7, 0 for default => 6.5e-6" 168 read(*,*) fcoup2tmp 169 if ((fcoup2tmp.lt.1e-5).and.(fcoup2tmp.gt.1e-7)) fcoup2=fcoup2tmp 170 print*,"=",fcoup2 171 print*,"Half-width of the filters, in Hz ?" 172 print*,"between 1e-6 and 1e-8, 0 for default => 4e-7)" 173 read(*,*) widthtmp 174 if ((widthtmp.lt.1e-6).and.(widthtmp.gt.1e-8)) width=widthtmp 175 print*,"=",width 176 !width = 3./time(timelength) 177 178 ! Outputs 179 print*,"Output of zonal wind ? (y or n, default is y)" 180 read(*,'(a1)') ok_outtmp 181 if (ok_outtmp.eq."n") ok_out(1)=.false. 182 print*,"=",ok_out(1) 183 print*,"Output of meridional wind ? (y or n, default is y)" 184 read(*,'(a1)') ok_outtmp 185 if (ok_outtmp.eq."n") ok_out(2)=.false. 186 print*,"=",ok_out(2) 187 print*,"Output of vertical wind ? (y or n, default is n)" 188 read(*,'(a1)') ok_outtmp 189 if (ok_outtmp.eq."y") ok_out(3)=.true. 190 print*,"=",ok_out(3) 191 print*,"Output of temperature ? (y or n, default is y)" 192 read(*,'(a1)') ok_outtmp 193 if (ok_outtmp.eq."n") ok_out(4)=.false. 194 print*,"=",ok_out(4) 140 195 141 196 !=============================================================================== … … 172 227 ierr=NF_GET_VAR_REAL(infid,lat_varid,lat) 173 228 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 174 175 allocate(latrad(latlength))176 latrad = lat*pi/180.177 229 178 230 allocate(plev(altlength)) … … 212 264 213 265 text="temp" 214 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)266 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 215 267 if (ierr1.ne.NF_NOERR) then 216 268 write(*,*) " looking for t instead... " 217 269 text="t" 218 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)270 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 219 271 if (ierr1.ne.NF_NOERR) then 220 272 print*,"Error: Failed to get temperature ID" … … 236 288 237 289 text="vitu" 238 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)290 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 239 291 if (ierr1.ne.NF_NOERR) then 240 292 print*,"Error: Failed to get vitu ID" … … 252 304 253 305 text="vitv" 254 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)306 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 255 307 if (ierr1.ne.NF_NOERR) then 256 308 print*,"Error: Failed to get vitv ID" … … 268 320 269 321 text="vitw" 270 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw, ierr1,ierr2)322 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw,miss_val,ierr1,ierr2) 271 323 if (ierr1.ne.NF_NOERR) then 272 324 print*,"Error: Failed to get vitw ID" … … 288 340 ! 2.2.1 FFT and filtering 289 341 !=============================================================================== 342 290 343 ! allocations 291 344 !------------- … … 405 458 enddo 406 459 407 ! Define the filters408 409 ! IN filter.h :410 ! Low cutting frequency, in Hz : fcoup1411 ! High cutting frequency, in Hz : fcoup2412 ! Half-width of the filters, in Hz : width413 414 !print*,"Low cutting frequency, in Hz ?"415 !read(*,*) fcoup1416 !print*,"High cutting frequency, in Hz ?"417 !read(*,*) fcoup2418 !print*,"Half-width of the filters, in Hz ?"419 !read(*,*) width420 !width = 3./time(timelength)421 422 460 do itim=1,M_fft+1 423 461 if (freq(itim).lt.(fcoup1-width)) then -
trunk/LMDZ.TITAN/Tools/io.F90
r816 r1454 218 218 !=========================================================================== 219 219 220 subroutine get_var4d(infid,dim1,dim2,dim3,dim4,text,var, ierr1,ierr2)220 subroutine get_var4d(infid,dim1,dim2,dim3,dim4,text,var,missing,ierr1,ierr2) 221 221 222 222 implicit none … … 229 229 character (len=64) :: text ! name of variable to read 230 230 real,dimension(dim1,dim2,dim3,dim4) :: var ! variable to read 231 integer :: ierr1,ierr2 ! NetCDF routines return code 231 real :: missing ! missing value 232 integer :: ierr1,ierr2,miss ! NetCDF routines return code 232 233 233 234 ! local … … 240 241 write(*,*) "ID ok for ",trim(text) 241 242 ierr2=NF_GET_VAR_REAL(infid,tmpvarid,var) 243 miss=NF_GET_ATT_REAL(infid,tmpvarid,"missing_value",missing) 242 244 endif 243 245 -
trunk/LMDZ.TITAN/Tools/moytim.F
r816 r1454 33 33 n = 0 34 34 do t=1,nt 35 if (x(i,j,l,t). lt.indefini) then35 if (x(i,j,l,t).ne.indefini) then 36 36 xmean(i,j,l) = xmean(i,j,l) + x(i,j,l,t) 37 37 n = n+1 -
trunk/LMDZ.TITAN/Tools/moyzon.F
r816 r1454 32 32 n = 0 33 33 do i=1,iim 34 if (x(i,j,l). lt.indefini) then34 if (x(i,j,l).ne.indefini) then 35 35 xbar(j,l) = xbar(j,l) + x(i,j,l) 36 36 n = n+1 -
trunk/LMDZ.TITAN/Tools/moyzon2.F
r816 r1454 34 34 n = 0 35 35 do i=1,iim 36 if (x(i,j,l). lt.indefini) then36 if (x(i,j,l).ne.indefini) then 37 37 xbar(j,l) = xbar(j,l) + x(i,j,l) 38 38 n = n+1 -
trunk/LMDZ.TITAN/Tools/psi.F90
r1120 r1454 31 31 integer,dimension(4) :: datashape4d ! shape of 4D datasets 32 32 33 real :: miss_val =9.99e+33! special "missing value" to specify missing data34 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"33 real :: miss_val ! special "missing value" to specify missing data 34 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 35 35 real :: pi 36 36 real,dimension(:),allocatable :: lon ! longitude 37 37 integer lonlength ! # of grid points along longitude 38 38 real,dimension(:),allocatable :: lat ! latitude 39 real,dimension(:),allocatable :: latrad ! latitude in radian39 real,dimension(:),allocatable :: coslat ! cos of latitude 40 40 integer latlength ! # of grid points along latitude 41 41 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 66 66 67 67 pi = 2.*asin(1.) 68 miss_val = miss_val_def 68 69 69 70 write(*,*) "" … … 104 105 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 105 106 106 allocate(latrad(latlength)) 107 latrad = lat*pi/180. 107 allocate(coslat(latlength)) 108 ! Beware of rounding problems at poles... 109 coslat(:) = max(0.,cos(lat(:)*pi/180.)) 108 110 109 111 ! Lat, lon pressure intervals 110 deltalat = abs(lat rad(2)-latrad(1))112 deltalat = abs(lat(2)-lat(1))*pi/180. 111 113 deltalon = abs(lon(2)-lon(1))*pi/180. 112 114 … … 160 162 ! meridional wind vitv (in m/s) 161 163 text="vitv" 162 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)164 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 163 165 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID" 164 166 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind" … … 173 175 174 176 text="zareoid" 175 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)177 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 176 178 if (ierr1.ne.NF_NOERR) then 177 179 write(*,*) " looking for geop instead... " 178 180 text="geop" 179 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)181 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 180 182 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get geop ID" 181 183 do itim=1,timelength … … 225 227 enddo ! timelength 226 228 227 call cellmass(infid,latlength,lonlength,altlength,timelength, &228 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &229 call cellmass(infid,latlength,lonlength,altlength,timelength,lmdflag, & 230 miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 229 231 dmass ) 230 232 -
trunk/LMDZ.TITAN/Tools/stability.F90
r816 r1454 31 31 integer,dimension(4) :: datashape4d ! shape of 4D datasets 32 32 33 real :: miss_val =9.99e+33! special "missing value" to specify missing data34 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"33 real :: miss_val ! special "missing value" to specify missing data 34 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 35 35 real :: pi 36 36 real,dimension(:),allocatable :: lon ! longitude 37 37 integer lonlength ! # of grid points along longitude 38 38 real,dimension(:),allocatable :: lat ! latitude 39 real,dimension(:),allocatable :: latrad ! latitude in radian39 real,dimension(:),allocatable :: coslat ! cos of latitude 40 40 integer latlength ! # of grid points along latitude 41 41 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 91 91 92 92 pi = 2.*asin(1.) 93 miss_val = miss_val_def 93 94 94 95 write(*,*) "" … … 129 130 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 130 131 131 allocate(latrad(latlength)) 132 latrad = lat*pi/180. 132 allocate(coslat(latlength)) 133 ! Beware of rounding problems at poles... 134 coslat(:) = max(0.,cos(lat(:)*pi/180.)) 133 135 134 136 ! Lat, lon pressure intervals 135 deltalat = abs(lat rad(2)-latrad(1))137 deltalat = abs(lat(2)-lat(1))*pi/180. 136 138 deltalon = abs(lon(2)-lon(1))*pi/180. 137 139 … … 180 182 181 183 text="temp" 182 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)184 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 183 185 if (ierr1.ne.NF_NOERR) then 184 186 write(*,*) " looking for t instead... " 185 187 text="t" 186 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)188 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 187 189 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get temperature ID" 188 190 endif … … 197 199 ! zonal wind vitu (in m/s) 198 200 text="vitu" 199 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)201 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 200 202 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitu ID" 201 203 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind" … … 203 205 ! meridional wind vitv (in m/s) 204 206 text="vitv" 205 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)207 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 206 208 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID" 207 209 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind" … … 215 217 216 218 ! text="zareoid" 217 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)219 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 218 220 ! if (ierr1.ne.NF_NOERR) stop "Error: Failed to get za ID" 219 221 ! if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zareoid" … … 276 278 grav(lonlength+1,:,:,:) = grav(1,:,:,:) 277 279 278 call cellmass(infid,latlength,lonlength+1,altlength,timelength, &279 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &280 call cellmass(infid,latlength,lonlength+1,altlength,timelength,lmdflag, & 281 miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 280 282 dmass ) 281 283 … … 364 366 365 367 do ilat=2,latlength-1 366 if (tan(lat rad(ilat)).ne.0.) then367 fac1 = R0/tan(lat rad(ilat))368 if (tan(lat(ilat)*pi/180.).ne.0.) then 369 fac1 = R0/tan(lat(ilat)*pi/180.) 368 370 else 369 371 fac1 = miss_val -
trunk/LMDZ.TITAN/Tools/tem.F90
r816 r1454 37 37 integer,dimension(3) :: datashape3d ! shape of 3D datasets 38 38 39 real :: miss_val =9.99e+33! special "missing value" to specify missing data40 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"39 real :: miss_val ! special "missing value" to specify missing data 40 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 41 41 real :: pi 42 42 real,dimension(:),allocatable :: lon ! longitude 43 43 integer lonlength ! # of grid points along longitude 44 44 real,dimension(:),allocatable :: lat ! latitude 45 real,dimension(:),allocatable :: latrad ! latitude in radian45 real,dimension(:),allocatable :: coslat ! cos of latitude 46 46 integer latlength ! # of grid points along latitude 47 47 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 107 107 108 108 pi = 2.*asin(1.) 109 miss_val = miss_val_def 109 110 110 111 write(*,*) "" … … 145 146 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 146 147 147 allocate(latrad(latlength)) 148 latrad = lat*pi/180. 148 allocate(coslat(latlength)) 149 ! Beware of rounding problems at poles... 150 coslat(:) = max(0.,cos(lat(:)*pi/180.)) 149 151 150 152 ! Lat, lon pressure intervals 151 deltalat = abs(lat rad(2)-latrad(1))153 deltalat = abs(lat(2)-lat(1))*pi/180. 152 154 deltalon = abs(lon(2)-lon(1))*pi/180. 153 155 … … 196 198 197 199 text="temp" 198 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)200 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 199 201 if (ierr1.ne.NF_NOERR) then 200 202 write(*,*) " looking for t instead... " 201 203 text="t" 202 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)204 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 203 205 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get temperature ID" 204 206 endif … … 214 216 ! zonal wind vitu (in m/s) 215 217 text="vitu" 216 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)218 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 217 219 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitu ID" 218 220 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind" … … 220 222 ! meridional wind vitv (in m/s) 221 223 text="vitv" 222 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)224 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 223 225 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID" 224 226 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind" … … 226 228 ! vertical wind vitw (in Pa/s) 227 229 text="vitw" 228 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw, ierr1,ierr2)230 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw,miss_val,ierr1,ierr2) 229 231 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitw ID" 230 232 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading vertical wind" … … 238 240 239 241 ! text="zareoid" 240 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)242 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 241 243 ! if (ierr1.ne.NF_NOERR) stop "Error: Failed to get za ID" 242 244 ! if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zareoid" … … 312 314 grav(lonlength+1,:,:,:) = grav(1,:,:,:) 313 315 314 call cellmass(infid,latlength,lonlength+1,altlength,timelength, &315 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &316 call cellmass(infid,latlength,lonlength+1,altlength,timelength,lmdflag, & 317 miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 316 318 dmass ) 317 319 … … 359 361 call moyzon(lonlength,latlength,altlength,miss_val,u3d,ubar) 360 362 361 call epflux(lonlength+1,latlength,altlength,miss_val,lat rad,rbar &363 call epflux(lonlength+1,latlength,altlength,miss_val,lat,rbar & 362 364 ,teta,u3d,v3d,w3d,plev & 363 365 ,epy2d,epz2d,div2d,vtem2d,wtem2d,ammc2d & … … 376 378 ! rsurg: r*dp/g = dm/(r cos(lat) dlon dlat) !!! 377 379 rsurg(ilon,ilat,ilev) = dmass(ilon,ilat,ilev,itim) & 378 / (r3d(ilon,ilat,ilev)*cos (latrad(ilat))*deltalon*deltalat)380 / (r3d(ilon,ilat,ilev)*coslat(ilat)*deltalon*deltalat) 379 381 else 380 382 rsurg(ilon,ilat,ilev) = miss_val … … 391 393 (rsurgbar(ilat,ilev).ne.miss_val) ) then 392 394 vm(ilat,ilev) = vtem2d(ilat,ilev) & 393 * 2.*pi*rsurgbar(ilat,ilev)*cos (latrad(ilat))395 * 2.*pi*rsurgbar(ilat,ilev)*coslat(ilat) 394 396 else 395 397 vm(ilat,ilev) = miss_val -
trunk/LMDZ.TITAN/Tools/tmc.F90
r816 r1454 49 49 integer,dimension(4) :: datashape4d ! shape of 4D datasets 50 50 51 real :: miss_val =9.99e+33! special "missing value" to specify missing data52 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"51 real :: miss_val ! special "missing value" to specify missing data 52 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 53 53 real :: pi 54 54 real,dimension(:),allocatable :: lon ! longitude 55 55 integer lonlength ! # of grid points along longitude 56 56 real,dimension(:),allocatable :: lat ! latitude 57 real,dimension(:),allocatable :: latrad ! latitude in radian57 real,dimension(:),allocatable :: coslat ! cos of latitude 58 58 integer latlength ! # of grid points along latitude 59 59 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 141 141 142 142 pi = 2.*asin(1.) 143 miss_val = miss_val_def 143 144 144 145 write(*,*) "" … … 179 180 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 180 181 181 allocate(latrad(latlength)) 182 latrad = lat*pi/180. 182 allocate(coslat(latlength)) 183 ! Beware of rounding problems at poles... 184 coslat(:) = max(0.,cos(lat(:)*pi/180.)) 183 185 184 186 ! Lat, lon pressure intervals 185 deltalat = abs(lat rad(2)-latrad(1))187 deltalat = abs(lat(2)-lat(1))*pi/180. 186 188 deltalon = abs(lon(2)-lon(1))*pi/180. 187 189 … … 233 235 ! zonal wind vitu (in m/s) 234 236 text="vitu" 235 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)237 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 236 238 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitu ID" 237 239 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind" … … 239 241 ! meridional wind vitv (in m/s) 240 242 text="vitv" 241 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)243 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 242 244 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID" 243 245 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind" … … 245 247 ! vertical wind vitw (in Pa/s) 246 248 text="vitw" 247 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw, ierr1,ierr2)249 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw,miss_val,ierr1,ierr2) 248 250 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitw ID" 249 251 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading vertical wind" … … 257 259 258 260 ! text="zareoid" 259 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)261 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 260 262 ! if (ierr1.ne.NF_NOERR) stop "Error: Failed to get za ID" 261 263 ! if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zareoid" … … 293 295 enddo ! timelength 294 296 295 call cellmass(infid,latlength,lonlength,altlength,timelength, &296 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &297 call cellmass(infid,latlength,lonlength,altlength,timelength,lmdflag, & 298 miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 297 299 dmass ) 298 300 … … 316 318 osam(ilon,ilat,ilev,itim) = & 317 319 rayon(ilon,ilat,ilev,itim)*rayon(ilon,ilat,ilev,itim) & 318 * cos (latrad(ilat))*cos(latrad(ilat)) &320 * coslat(ilat)*coslat(ilat) & 319 321 * omega 320 322 rsam(ilon,ilat,ilev,itim) = vitu(ilon,ilat,ilev,itim) & 321 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat))323 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) 322 324 tsam(ilon,ilat,ilev,itim) = osam(ilon,ilat,ilev,itim)& 323 325 + rsam(ilon,ilat,ilev,itim) -
trunk/LMDZ.VENUS/Tools/angmom.F90
r1356 r1454 47 47 integer,dimension(4) :: datashape4d ! shape of 4D datasets 48 48 49 real :: miss_val =9.99e+33! special "missing value" to specify missing data50 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"49 real :: miss_val ! special "missing value" to specify missing data 50 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 51 51 real :: pi 52 52 real,dimension(:),allocatable :: lon ! longitude 53 53 integer lonlength ! # of grid points along longitude 54 54 real,dimension(:),allocatable :: lat ! latitude 55 real,dimension(:),allocatable :: latrad ! latitude in radian55 real,dimension(:),allocatable :: coslat ! cos of latitude 56 56 integer latlength ! # of grid points along latitude 57 57 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 117 117 118 118 pi = 2.*asin(1.) 119 miss_val = miss_val_def 119 120 120 121 write(*,*) "" … … 160 161 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 161 162 162 allocate(latrad(latlength)) 163 latrad = lat*pi/180. 163 allocate(coslat(latlength)) 164 ! Beware of rounding problems at poles... 165 coslat(:) = max(0.,cos(lat(:)*pi/180.)) 164 166 165 167 ! Lat, lon pressure intervals 166 deltalat = abs(lat rad(2)-latrad(1))168 deltalat = abs(lat(2)-lat(1))*pi/180. 167 169 deltalon = abs(lon(2)-lon(1))*pi/180. 168 170 … … 281 283 endif 282 284 283 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)285 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 284 286 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get U ID" 285 287 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind" … … 295 297 296 298 !text="zareoid" 297 !call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)299 !call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 298 300 !if (ierr1.ne.NF_NOERR) stop "Error: Failed to get za ID" 299 301 !if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zareoid" … … 309 311 text="DUVDF" 310 312 endif 311 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,duvdf, ierr1,ierr2)313 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,duvdf,miss_val,ierr1,ierr2) 312 314 if (ierr1.ne.NF_NOERR) then 313 315 write(*,*) "Failed to get duvdf ID" … … 357 359 358 360 text="dugwo" 359 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,dugwo, ierr1,ierr2)361 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,dugwo,miss_val,ierr1,ierr2) 360 362 if (ierr1.ne.NF_NOERR) then 361 363 write(*,*) "Failed to get dugwo ID" … … 367 369 368 370 text="dugwno" 369 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,dugwno, ierr1,ierr2)371 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,dugwno,miss_val,ierr1,ierr2) 370 372 if (ierr1.ne.NF_NOERR) then 371 373 write(*,*) "Failed to get dugwno ID" … … 390 392 391 393 text="duajs" 392 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,duajs, ierr1,ierr2)394 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,duajs,miss_val,ierr1,ierr2) 393 395 if (ierr1.ne.NF_NOERR) then 394 396 write(*,*) "Failed to get duajs ID" … … 414 416 text="DUDYN" 415 417 endif 416 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,dudyn, ierr1,ierr2)418 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,dudyn,miss_val,ierr1,ierr2) 417 419 if (ierr1.ne.NF_NOERR) then 418 420 write(*,*) "Failed to get dudyn ID" … … 486 488 enddo ! timelength 487 489 488 call cellmass(infid,latlength,lonlength,altlength,timelength, &489 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &490 call cellmass(infid,latlength,lonlength,altlength,timelength,lmdflag, & 491 miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 490 492 dmass ) 491 493 … … 504 506 osam(ilon,ilat,ilev,itim) = & 505 507 rayon(ilon,ilat,ilev,itim)*rayon(ilon,ilat,ilev,itim) & 506 * cos (latrad(ilat))*cos(latrad(ilat)) &508 * coslat(ilat)*coslat(ilat) & 507 509 * omega 508 510 rsam(ilon,ilat,ilev,itim) = vitu(ilon,ilat,ilev,itim) & 509 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat))511 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) 510 512 else 511 513 osam(ilon,ilat,ilev,itim) = miss_val … … 569 571 tmpp = (ps(ilon+1,ilat,itim) +ps(ilon,ilat,itim))/2. 570 572 endif 571 tmou(itim) = tmou(itim) + a0*a0* deltalat*cos (latrad(ilat)) &573 tmou(itim) = tmou(itim) + a0*a0* deltalat*coslat(ilat) & 572 574 * signe*dz*tmpp & 573 575 / hadley … … 582 584 if (rayon(ilon,ilat,ilev,itim).ne.miss_val) then 583 585 tdyn(itim) = tdyn(itim) + dudyn(ilon,ilat,ilev,itim) & 584 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat)) &586 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) & 585 587 * dmass(ilon,ilat,ilev,itim) & 586 588 / hadley … … 599 601 if (rayon(ilon,ilat,ilev,itim).ne.miss_val) then 600 602 tajs(itim) = tajs(itim) + duajs(ilon,ilat,ilev,itim) & 601 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat)) &603 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) & 602 604 * dmass(ilon,ilat,ilev,itim) & 603 605 / hadley … … 616 618 if (rayon(ilon,ilat,ilev,itim).ne.miss_val) then 617 619 tbls(itim) = tbls(itim) + duvdf(ilon,ilat,ilev,itim) & 618 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat)) &620 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) & 619 621 * dmass(ilon,ilat,ilev,itim) & 620 622 / hadley … … 633 635 if (rayon(ilon,ilat,ilev,itim).ne.miss_val) then 634 636 tgwo(itim) = tgwo(itim) + dugwo(ilon,ilat,ilev,itim) & 635 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat)) &637 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) & 636 638 * dmass(ilon,ilat,ilev,itim) & 637 639 / hadley … … 650 652 if (rayon(ilon,ilat,ilev,itim).ne.miss_val) then 651 653 tgwno(itim) = tgwno(itim) + dugwno(ilon,ilat,ilev,itim) & 652 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat)) &654 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) & 653 655 * dmass(ilon,ilat,ilev,itim) & 654 656 / hadley -
trunk/LMDZ.VENUS/Tools/compilefft_pgf
r816 r1454 2 2 # path for fftw3 should be adapted to your configuration ! 3 3 4 \rm planet.h5 ln -s $2.h planet.h4 #\rm planet.h 5 #ln -s $2.h planet.h 6 6 pgf95 -Bstatic cpdet.F90 moyzon.F moyzon2.F moytim.F dx_dp.F epflux.F90 \ 7 7 io.F90 dmass.F90 reverse.F90 $1.F90 \ -
trunk/LMDZ.VENUS/Tools/dmass.F90
r816 r1454 1 subroutine cellmass(infid,latlength,lonlength,altlength,timelength, &2 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &1 subroutine cellmass(infid,latlength,lonlength,altlength,timelength,lmdflag, & 2 miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 3 3 dmass ) 4 4 … … 14 14 integer timelength ! # of points along time 15 15 logical lmdflag ! true=LMD, false=CAM 16 real :: miss_val ! missing value 16 17 real :: deltalat,deltalon ! lat and lon intervals in radians 17 real,dimension(latlength) :: latrad ! latitudes in radians18 real,dimension(latlength) :: coslat ! cos of latitudes 18 19 real,dimension(altlength) :: plev ! Pressure levels (Pa) 19 20 real,dimension(lonlength,latlength,timelength),intent(in) :: ps ! surface pressure … … 32 33 real :: p0 ! GCM reference pressure 33 34 integer tmpvarid 34 real :: miss_val=9.99e+33 ! special "missing value" to specify missing data35 real,parameter :: miss_val_def=9.99e+33 ! default value for "missing value"36 35 37 36 include "planet.h" … … 46 45 if(lmdflag) then ! LMD vs CAM 47 46 text="pres" 48 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,press, ierr1,ierr2)47 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,press,miss_val,ierr1,ierr2) 49 48 if (ierr1.ne.NF_NOERR) then 50 49 ! assume we are using _P files … … 119 118 do ilat=1,latlength 120 119 tmpp=ps(ilon,ilat,itim) 121 pp=press(ilon,ilat,:,itim) 120 ! Beware when miss_val is negative... 121 do ilev=1,altlength 122 if (press(ilon,ilat,ilev,itim).eq.miss_val) then 123 pp(ilev)=1.e33 124 else 125 pp(ilev)=press(ilon,ilat,ilev,itim) 126 endif 127 enddo 122 128 if (tmpp.ge.pp(1)) then 123 129 deltap(ilon,ilat,1,itim)= tmpp - exp((log(pp(1))+log(pp(2)))/2.) ! initialization, rectified with ps below … … 136 142 do ilat=1,latlength 137 143 tmpp=ps(ilon,ilat,itim) 138 pp=press(ilon,ilat,:,itim) 144 ! Beware when miss_val is negative... 145 do ilev=1,altlength 146 if (press(ilon,ilat,ilev,itim).eq.miss_val) then 147 pp(ilev)=1.e33 148 else 149 pp(ilev)=press(ilon,ilat,ilev,itim) 150 endif 151 enddo 139 152 do ilev=altlength,2,-1 140 153 if ((pp(ilev).le.tmpp).and.(pp(ilev-1).gt.tmpp)) then … … 163 176 .and. (grav(ilon,ilat,ilev,itim).ne.miss_val)) then 164 177 dmass(ilon,ilat,ilev,itim) = & 165 rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat))*deltalon &178 rayon(ilon,ilat,ilev,itim)*coslat(ilat)*deltalon & 166 179 * rayon(ilon,ilat,ilev,itim)*deltalat & 167 180 * deltap(ilon,ilat,ilev,itim)/grav(ilon,ilat,ilev,itim) -
trunk/LMDZ.VENUS/Tools/dx_dp.F
r816 r1454 30 30 c----------------------------------------------------------------------- 31 31 do j=1,jjp1 32 if ((x(j,1). lt.indefini).and.(x(j,2).lt.indefini)) then32 if ((x(j,1).ne.indefini).and.(x(j,2).ne.indefini)) then 33 33 dxdp(j,1) = (x(j,2)-x(j,1))/(pniv(2) - pniv(1)) 34 34 else … … 37 37 38 38 do l=2,llm-1 39 if ((x(j,l-1). lt.indefini).and.(x(j,l+1).lt.indefini))then39 if ((x(j,l-1).ne.indefini).and.(x(j,l+1).ne.indefini))then 40 40 dxdp(j,l)= (x(j,l+1)-x(j,l-1))/(pniv(l+1) - pniv(l-1)) 41 else if((x(j,l+1). lt.indefini).and.(x(j,l).lt.indefini))then41 else if((x(j,l+1).ne.indefini).and.(x(j,l).ne.indefini))then 42 42 dxdp(j,l)= (x(j,l+1)-x(j,l)) /(pniv(l+1) - pniv(l)) 43 else if((x(j,l-1). lt.indefini).and.(x(j,l).lt.indefini))then43 else if((x(j,l-1).ne.indefini).and.(x(j,l).ne.indefini))then 44 44 dxdp(j,l)= (x(j,l)-x(j,l-1)) /(pniv(l) - pniv(l-1)) 45 45 else … … 47 47 end if 48 48 end do 49 if ((x(j,llm). lt.indefini).and.(x(j,llm-1).lt.indefini)) then49 if ((x(j,llm).ne.indefini).and.(x(j,llm-1).ne.indefini)) then 50 50 dxdp(j,llm)= (x(j,llm)-x(j,llm-1))/(pniv(llm)-pniv(llm-1)) 51 51 else … … 58 58 do j=1,jjp1 59 59 do l = 1, llm 60 if ( (abs(dxdp(j,l)).gt.( indefini/100.)).and.60 if ( (abs(dxdp(j,l)).gt.(abs(indefini)/100.)).and. 61 61 . (dxdp(j,l).ne.indefini)) then 62 62 write(*,*) '----> j= ', j , ' l= ' , l -
trunk/LMDZ.VENUS/Tools/energy.F90
r816 r1454 36 36 integer,dimension(4) :: datashape4d ! shape of 4D datasets 37 37 38 real :: miss_val =9.99e+33! special "missing value" to specify missing data39 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"38 real :: miss_val ! special "missing value" to specify missing data 39 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 40 40 real :: pi 41 41 real,dimension(:),allocatable :: lon ! longitude 42 42 integer lonlength ! # of grid points along longitude 43 43 real,dimension(:),allocatable :: lat ! latitude 44 real,dimension(:),allocatable :: latrad ! latitude in radian44 real,dimension(:),allocatable :: coslat ! cos of latitude 45 45 integer latlength ! # of grid points along latitude 46 46 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 80 80 81 81 pi = 2.*asin(1.) 82 miss_val = miss_val_def 82 83 83 84 write(*,*) "" … … 123 124 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 124 125 125 allocate(latrad(latlength)) 126 latrad = lat*pi/180. 126 allocate(coslat(latlength)) 127 ! Beware of rounding problems at poles... 128 coslat(:) = max(0.,cos(lat(:)*pi/180.)) 127 129 128 130 ! Lat, lon pressure intervals 129 deltalat = abs(lat rad(2)-latrad(1))131 deltalat = abs(lat(2)-lat(1))*pi/180. 130 132 deltalon = abs(lon(2)-lon(1))*pi/180. 131 133 … … 193 195 text="T" 194 196 endif 195 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)197 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 196 198 if (ierr1.ne.NF_NOERR) then 197 199 write(*,*) " looking for t instead... " 198 200 text="t" 199 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)201 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 200 202 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get temperature ID" 201 203 endif … … 216 218 text="U" 217 219 endif 218 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)220 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 219 221 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitu ID" 220 222 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind" … … 228 230 text="V" 229 231 endif 230 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)232 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 231 233 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID" 232 234 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind" … … 242 244 243 245 !text="zareoid" 244 !call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)246 !call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 245 247 !if (ierr1.ne.NF_NOERR) stop "Error: Failed to get za ID" 246 248 !if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zareoid" … … 276 278 enddo ! timelength 277 279 278 call cellmass(infid,latlength,lonlength,altlength,timelength, &279 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &280 call cellmass(infid,latlength,lonlength,altlength,timelength,lmdflag, & 281 miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 280 282 dmass ) 281 283 -
trunk/LMDZ.VENUS/Tools/epflux.F90
r816 r1454 1 subroutine epflux(iip1,jjp1,llm,indefini, rlatu,rbar &1 subroutine epflux(iip1,jjp1,llm,indefini,latdeg,rbar & 2 2 ,teta,u3d,v3d,w3d,press & 3 3 ,epy2d,epz2d,divep2d,vtem2d,wtem2d,acc_meridien2d & … … 41 41 42 42 integer :: iip1,jjp1,llm 43 real :: indefini, rlatu(jjp1),rbar(jjp1,llm)43 real :: indefini,latdeg(jjp1),rbar(jjp1,llm) 44 44 REAL :: teta(iip1,jjp1,llm) 45 45 REAL :: u3d(iip1,jjp1,llm),v3d(iip1,jjp1,llm) … … 75 75 ! Autres 76 76 ! ------ 77 real :: rlatu(jjp1) ! lat in radians (beware of rounding effects at poles) 77 78 real :: pi 78 79 REAL :: tetas(llm) … … 88 89 jjm = jjp1-1 89 90 pi = 2.*asin(1.) 91 92 ! To avoid rounding effects at poles 93 rlatu(:)=latdeg(:)*pi/180.00001 90 94 91 95 ! Calcul de moyennes zonales … … 108 112 n= 0 109 113 do j=2,jjm 110 if (tetabar(j,l). lt.indefini) then114 if (tetabar(j,l).ne.indefini) then 111 115 tetas(l) = tetas(l) + tetabar(j,l) 112 116 n = n+1 … … 237 241 do l=1,llm 238 242 239 if ((ubar(2,l). lt.indefini).and.(ubar(1,l).lt.indefini))then243 if ((ubar(2,l).ne.indefini).and.(ubar(1,l).ne.indefini))then 240 244 ducosdlat(1,l) = ( ubar(2,l)*cos(rlatu(2))-ubar(1,l)*cos(rlatu(1)) ) & 241 245 /( rlatu(2) - rlatu(1)) … … 244 248 end if 245 249 do j=2,jjm 246 if ((ubar(j+1,l). lt.indefini).and.(ubar(j-1,l).lt.indefini))then250 if ((ubar(j+1,l).ne.indefini).and.(ubar(j-1,l).ne.indefini))then 247 251 ducosdlat(j,l) = ( ubar(j+1,l)*cos(rlatu(j+1))-ubar(j-1,l)*cos(rlatu(j-1))) & 248 252 /( rlatu(j+1) - rlatu(j-1)) … … 251 255 end if 252 256 enddo 253 if ((ubar(jjp1,l). lt.indefini).and.(ubar(jjm,l).lt.indefini))then257 if ((ubar(jjp1,l).ne.indefini).and.(ubar(jjm,l).ne.indefini))then 254 258 ducosdlat(jjp1,l) = ( ubar(jjp1,l)*cos(rlatu(jjp1)) & 255 259 -ubar(jjm,l)*cos(rlatu(jjm)) ) & … … 260 264 261 265 do j=1,jjp1 262 if ((vptetapbar(j,l). lt.indefini).and. &263 (dtetabardp(j,l). lt.indefini)) then266 if ((vptetapbar(j,l).ne.indefini).and. & 267 (dtetabardp(j,l).ne.indefini)) then 264 268 vz(j,l) = vptetapbar(j,l)/dtetabardp(j,l) 265 269 wlat(j,l) = cos(rlatu(j))*vz(j,l) … … 284 288 ! ------------ 285 289 286 if ( (rbar(j,l). lt.indefini).and. &287 (vpupbar(j,l). lt.indefini).and. &288 (dubardp(j,l). lt.indefini).and. &289 (vz(j,l). lt.indefini)) then290 if ( (rbar(j,l).ne.indefini).and. & 291 (vpupbar(j,l).ne.indefini).and. & 292 (dubardp(j,l).ne.indefini).and. & 293 (vz(j,l).ne.indefini)) then 290 294 291 295 epy2d(j,l) = rbar(j,l) * cos(rlatu(j))* ( vpupbar(j,l) & … … 303 307 ! ------------ 304 308 305 if ( (rbar(j,l). lt.indefini).and. &306 (wpupbar(j,l). lt.indefini).and. &307 (ducosdlat(j,l). lt.indefini).and. &308 (vz(j,l). lt.indefini)) then309 if ( (rbar(j,l).ne.indefini).and. & 310 (wpupbar(j,l).ne.indefini).and. & 311 (ducosdlat(j,l).ne.indefini).and. & 312 (vz(j,l).ne.indefini)) then 309 313 310 314 epz2d(j,l) = rbar(j,l) * cos(rlatu(j))* & … … 330 334 do l=1,llm 331 335 332 if ( (wlat(2,l). lt.indefini) .and. &333 (wlat(1,l). lt.indefini) ) then336 if ( (wlat(2,l).ne.indefini) .and. & 337 (wlat(1,l).ne.indefini) ) then 334 338 dwlatdlat(1,l)=(wlat(2,l)-wlat(1,l)) & 335 339 /(rlatu(2)-rlatu(1)) … … 338 342 end if 339 343 do j=2,jjm 340 if ( (wlat(j+1,l). lt.indefini) .and. &341 (wlat(j-1,l). lt.indefini) ) then344 if ( (wlat(j+1,l).ne.indefini) .and. & 345 (wlat(j-1,l).ne.indefini) ) then 342 346 dwlatdlat(j,l)=(wlat(j+1,l)-wlat(j-1,l)) & 343 347 /(rlatu(j+1)-rlatu(j-1)) … … 346 350 end if 347 351 enddo 348 if ( (wlat(jjp1,l). lt.indefini) .and. &349 (wlat(jjm, l). lt.indefini) ) then352 if ( (wlat(jjp1,l).ne.indefini) .and. & 353 (wlat(jjm, l).ne.indefini) ) then 350 354 dwlatdlat(jjp1,l)=(wlat(jjp1,l)-wlat(jjm,l)) & 351 355 /(rlatu(jjp1)-rlatu(jjm)) … … 355 359 356 360 do j=1,jjp1 357 if ( (dvzdp(j,l). lt.indefini) &358 .and.(vbar(j,l). lt.indefini)) then361 if ( (dvzdp(j,l).ne.indefini) & 362 .and.(vbar(j,l).ne.indefini)) then 359 363 vtem2d(j,l) = vbar(j,l)-dvzdp(j,l) 360 364 else … … 364 368 365 369 do j=1,jjp1 366 if ( (rbar(j,l). lt.indefini).and. &367 (dwlatdlat(j,l). lt.indefini).and. &368 (wbar(j,l). lt.indefini)) then370 if ( (rbar(j,l).ne.indefini).and. & 371 (dwlatdlat(j,l).ne.indefini).and. & 372 (wbar(j,l).ne.indefini)) then 369 373 wtem2d(j,l) = wbar(j,l)+dwlatdlat(j,l)/(rbar(j,l)*cos(rlatu(j))) 370 374 else … … 385 389 do l=1,llm 386 390 do j=1,jjp1 387 if ( (rbar(j,l). lt.indefini) &388 .and.(vtem2d(j,l). lt.indefini) &389 .and.(wtem2d(j,l). lt.indefini) &390 .and.(ducosdlat(j,l). lt.indefini) &391 .and.(dubardp(j,l). lt.indefini)) then391 if ( (rbar(j,l).ne.indefini) & 392 .and.(vtem2d(j,l).ne.indefini) & 393 .and.(wtem2d(j,l).ne.indefini) & 394 .and.(ducosdlat(j,l).ne.indefini) & 395 .and.(dubardp(j,l).ne.indefini)) then 392 396 acc_meridien2d(j,l) = & 393 397 vtem2d(j,l)*(ducosdlat(j,l)/(rbar(j,l)*cos(rlatu(j))) & … … 410 414 divep2d(1,l) =0 411 415 do j=2,jjm 412 if ( (rbar(j,l). lt.indefini) .and. &413 (epy2d(j+1,l). lt.indefini) .and. &414 (epy2d(j-1,l). lt.indefini) .and. &415 (depzdp(j,l). lt.indefini) ) then416 if ( (rbar(j,l).ne.indefini) .and. & 417 (epy2d(j+1,l).ne.indefini) .and. & 418 (epy2d(j-1,l).ne.indefini) .and. & 419 (depzdp(j,l).ne.indefini) ) then 416 420 417 421 depycosdlat=(epy2d(j+1,l)*cos(rlatu(j+1)) & -
trunk/LMDZ.VENUS/Tools/fft.F90
r888 r1454 63 63 integer,dimension(4) :: datashape4d ! shape of 4D datasets 64 64 65 real :: miss_val =9.99e+33! special "missing value" to specify missing data66 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"65 real :: miss_val ! special "missing value" to specify missing data 66 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 67 67 real :: pi 68 68 real,dimension(:),allocatable :: lon ! longitude 69 69 integer lonlength ! # of grid points along longitude 70 70 real,dimension(:),allocatable :: lat ! latitude 71 real,dimension(:),allocatable :: latrad ! latitude in radian72 71 integer latlength ! # of grid points along latitude 73 72 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 125 124 logical :: lmdflag 126 125 126 ! Tuning parameters 127 real :: fcoup1,fcoup2,width 128 real :: fcoup1tmp,fcoup2tmp,widthtmp 129 logical,dimension(4) :: ok_out 130 character (len=1) :: ok_outtmp 131 127 132 include "planet.h" 128 include "filter.h"129 133 130 134 #include <fftw3.f> … … 135 139 136 140 pi = 2.*asin(1.) 141 miss_val = miss_val_def 137 142 138 143 write(*,*) "" 139 144 write(*,*) "You are working on the atmosphere of ",planet 145 146 ! initialisation 147 !---------------- 148 149 ! Par defaut 150 151 ! Define the filters 152 ! Low cutting frequency, in Hz : fcoup1 153 fcoup1=6.e-7 154 ! High cutting frequency, in Hz : fcoup2 155 fcoup2=1.4e-6 156 ! Half-width of the filters, in Hz : width 157 width=2.e-7 158 ! Outputs (U, V, W, T) 159 ok_out=(/.true.,.true.,.false.,.true./) 160 161 print*,"Low cutting frequency, in Hz ?" 162 print*,"between 1e-5 and 1e-7, 0 for default => 6.e-7" 163 read(*,*) fcoup1tmp 164 if ((fcoup1tmp.lt.1e-5).and.(fcoup1tmp.gt.1e-7)) fcoup1=fcoup1tmp 165 print*,"=",fcoup1 166 print*,"High cutting frequency, in Hz ?" 167 print*,"between 1e-5 and 1e-7, 0 for default => 1.4e-6" 168 read(*,*) fcoup2tmp 169 if ((fcoup2tmp.lt.1e-5).and.(fcoup2tmp.gt.1e-7)) fcoup2=fcoup2tmp 170 print*,"=",fcoup2 171 print*,"Half-width of the filters, in Hz ?" 172 print*,"between 1e-6 and 1e-8, 0 for default => 2e-7)" 173 read(*,*) widthtmp 174 if ((widthtmp.lt.1e-6).and.(widthtmp.gt.1e-8)) width=widthtmp 175 print*,"=",width 176 !width = 3./time(timelength) 177 178 ! Outputs 179 print*,"Output of zonal wind ? (y or n, default is y)" 180 read(*,'(a1)') ok_outtmp 181 if (ok_outtmp.eq."n") ok_out(1)=.false. 182 print*,"=",ok_out(1) 183 print*,"Output of meridional wind ? (y or n, default is y)" 184 read(*,'(a1)') ok_outtmp 185 if (ok_outtmp.eq."n") ok_out(2)=.false. 186 print*,"=",ok_out(2) 187 print*,"Output of vertical wind ? (y or n, default is n)" 188 read(*,'(a1)') ok_outtmp 189 if (ok_outtmp.eq."y") ok_out(3)=.true. 190 print*,"=",ok_out(3) 191 print*,"Output of temperature ? (y or n, default is y)" 192 read(*,'(a1)') ok_outtmp 193 if (ok_outtmp.eq."n") ok_out(4)=.false. 194 print*,"=",ok_out(4) 140 195 141 196 !=============================================================================== … … 172 227 ierr=NF_GET_VAR_REAL(infid,lat_varid,lat) 173 228 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 174 175 allocate(latrad(latlength))176 latrad = lat*pi/180.177 229 178 230 allocate(plev(altlength)) … … 212 264 213 265 text="temp" 214 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)266 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 215 267 if (ierr1.ne.NF_NOERR) then 216 268 write(*,*) " looking for t instead... " 217 269 text="t" 218 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)270 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 219 271 if (ierr1.ne.NF_NOERR) then 220 272 print*,"Error: Failed to get temperature ID" … … 236 288 237 289 text="vitu" 238 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)290 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 239 291 if (ierr1.ne.NF_NOERR) then 240 292 print*,"Error: Failed to get vitu ID" … … 252 304 253 305 text="vitv" 254 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)306 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 255 307 if (ierr1.ne.NF_NOERR) then 256 308 print*,"Error: Failed to get vitv ID" … … 268 320 269 321 text="vitw" 270 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw, ierr1,ierr2)322 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw,miss_val,ierr1,ierr2) 271 323 if (ierr1.ne.NF_NOERR) then 272 324 print*,"Error: Failed to get vitw ID" … … 288 340 ! 2.2.1 FFT and filtering 289 341 !=============================================================================== 342 290 343 ! allocations 291 344 !------------- … … 405 458 enddo 406 459 407 ! Define the filters408 409 ! IN filter.h :410 ! Low cutting frequency, in Hz : fcoup1411 ! High cutting frequency, in Hz : fcoup2412 ! Half-width of the filters, in Hz : width413 414 !print*,"Low cutting frequency, in Hz ?"415 !read(*,*) fcoup1416 !print*,"High cutting frequency, in Hz ?"417 !read(*,*) fcoup2418 !print*,"Half-width of the filters, in Hz ?"419 !read(*,*) width420 !width = 3./time(timelength)421 422 460 do itim=1,M_fft+1 423 461 if (freq(itim).lt.(fcoup1-width)) then -
trunk/LMDZ.VENUS/Tools/io.F90
r816 r1454 218 218 !=========================================================================== 219 219 220 subroutine get_var4d(infid,dim1,dim2,dim3,dim4,text,var, ierr1,ierr2)220 subroutine get_var4d(infid,dim1,dim2,dim3,dim4,text,var,missing,ierr1,ierr2) 221 221 222 222 implicit none … … 229 229 character (len=64) :: text ! name of variable to read 230 230 real,dimension(dim1,dim2,dim3,dim4) :: var ! variable to read 231 integer :: ierr1,ierr2 ! NetCDF routines return code 231 real :: missing ! missing value 232 integer :: ierr1,ierr2,miss ! NetCDF routines return code 232 233 233 234 ! local … … 240 241 write(*,*) "ID ok for ",trim(text) 241 242 ierr2=NF_GET_VAR_REAL(infid,tmpvarid,var) 243 miss=NF_GET_ATT_REAL(infid,tmpvarid,"missing_value",missing) 242 244 endif 243 245 -
trunk/LMDZ.VENUS/Tools/moytim.F
r816 r1454 33 33 n = 0 34 34 do t=1,nt 35 if (x(i,j,l,t). lt.indefini) then35 if (x(i,j,l,t).ne.indefini) then 36 36 xmean(i,j,l) = xmean(i,j,l) + x(i,j,l,t) 37 37 n = n+1 -
trunk/LMDZ.VENUS/Tools/moyzon.F
r816 r1454 32 32 n = 0 33 33 do i=1,iim 34 if (x(i,j,l). lt.indefini) then34 if (x(i,j,l).ne.indefini) then 35 35 xbar(j,l) = xbar(j,l) + x(i,j,l) 36 36 n = n+1 -
trunk/LMDZ.VENUS/Tools/moyzon2.F
r816 r1454 34 34 n = 0 35 35 do i=1,iim 36 if (x(i,j,l). lt.indefini) then36 if (x(i,j,l).ne.indefini) then 37 37 xbar(j,l) = xbar(j,l) + x(i,j,l) 38 38 n = n+1 -
trunk/LMDZ.VENUS/Tools/psi.F90
r980 r1454 31 31 integer,dimension(4) :: datashape4d ! shape of 4D datasets 32 32 33 real :: miss_val =9.99e+33! special "missing value" to specify missing data34 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"33 real :: miss_val ! special "missing value" to specify missing data 34 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 35 35 real :: pi 36 36 real,dimension(:),allocatable :: lon ! longitude 37 37 integer lonlength ! # of grid points along longitude 38 38 real,dimension(:),allocatable :: lat ! latitude 39 real,dimension(:),allocatable :: latrad ! latitude in radian39 real,dimension(:),allocatable :: coslat ! cos of latitude 40 40 integer latlength ! # of grid points along latitude 41 41 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 66 66 67 67 pi = 2.*asin(1.) 68 miss_val = miss_val_def 68 69 69 70 write(*,*) "" … … 104 105 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 105 106 106 allocate(latrad(latlength)) 107 latrad = lat*pi/180. 107 allocate(coslat(latlength)) 108 ! Beware of rounding problems at poles... 109 coslat(:) = max(0.,cos(lat(:)*pi/180.)) 108 110 109 111 ! Lat, lon pressure intervals 110 deltalat = abs(lat rad(2)-latrad(1))112 deltalat = abs(lat(2)-lat(1))*pi/180. 111 113 deltalon = abs(lon(2)-lon(1))*pi/180. 112 114 … … 160 162 ! meridional wind vitv (in m/s) 161 163 text="vitv" 162 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)164 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 163 165 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID" 164 166 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind" … … 173 175 174 176 text="zareoid" 175 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)177 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 176 178 if (ierr1.ne.NF_NOERR) then 177 179 write(*,*) " looking for geop instead... " 178 180 text="geop" 179 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)181 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 180 182 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get geop ID" 181 183 do itim=1,timelength … … 226 228 227 229 call cellmass(infid,latlength,lonlength,altlength,timelength, & 228 lmdflag,deltalon,deltalat, latrad,plev,ps,grav,rayon, &230 lmdflag,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 229 231 dmass ) 230 232 -
trunk/LMDZ.VENUS/Tools/stability.F90
r816 r1454 31 31 integer,dimension(4) :: datashape4d ! shape of 4D datasets 32 32 33 real :: miss_val =9.99e+33! special "missing value" to specify missing data34 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"33 real :: miss_val ! special "missing value" to specify missing data 34 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 35 35 real :: pi 36 36 real,dimension(:),allocatable :: lon ! longitude 37 37 integer lonlength ! # of grid points along longitude 38 38 real,dimension(:),allocatable :: lat ! latitude 39 real,dimension(:),allocatable :: latrad ! latitude in radian39 real,dimension(:),allocatable :: coslat ! cos of latitude 40 40 integer latlength ! # of grid points along latitude 41 41 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 91 91 92 92 pi = 2.*asin(1.) 93 miss_val = miss_val_def 93 94 94 95 write(*,*) "" … … 129 130 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 130 131 131 allocate(latrad(latlength)) 132 latrad = lat*pi/180. 132 allocate(coslat(latlength)) 133 ! Beware of rounding problems at poles... 134 coslat(:) = max(0.,cos(lat(:)*pi/180.)) 133 135 134 136 ! Lat, lon pressure intervals 135 deltalat = abs(lat rad(2)-latrad(1))137 deltalat = abs(lat(2)-lat(1))*pi/180. 136 138 deltalon = abs(lon(2)-lon(1))*pi/180. 137 139 … … 180 182 181 183 text="temp" 182 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)184 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 183 185 if (ierr1.ne.NF_NOERR) then 184 186 write(*,*) " looking for t instead... " 185 187 text="t" 186 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)188 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 187 189 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get temperature ID" 188 190 endif … … 197 199 ! zonal wind vitu (in m/s) 198 200 text="vitu" 199 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)201 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 200 202 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitu ID" 201 203 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind" … … 203 205 ! meridional wind vitv (in m/s) 204 206 text="vitv" 205 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)207 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 206 208 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID" 207 209 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind" … … 215 217 216 218 ! text="zareoid" 217 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)219 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 218 220 ! if (ierr1.ne.NF_NOERR) stop "Error: Failed to get za ID" 219 221 ! if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zareoid" … … 276 278 grav(lonlength+1,:,:,:) = grav(1,:,:,:) 277 279 278 call cellmass(infid,latlength,lonlength+1,altlength,timelength, &279 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &280 call cellmass(infid,latlength,lonlength+1,altlength,timelength,lmdflag, & 281 miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 280 282 dmass ) 281 283 … … 364 366 365 367 do ilat=2,latlength-1 366 if (tan(lat rad(ilat)).ne.0.) then367 fac1 = R0/tan(lat rad(ilat))368 if (tan(lat(ilat)*pi/180.).ne.0.) then 369 fac1 = R0/tan(lat(ilat)*pi/180.) 368 370 else 369 371 fac1 = miss_val -
trunk/LMDZ.VENUS/Tools/tem.F90
r816 r1454 37 37 integer,dimension(3) :: datashape3d ! shape of 3D datasets 38 38 39 real :: miss_val =9.99e+33! special "missing value" to specify missing data40 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"39 real :: miss_val ! special "missing value" to specify missing data 40 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 41 41 real :: pi 42 42 real,dimension(:),allocatable :: lon ! longitude 43 43 integer lonlength ! # of grid points along longitude 44 44 real,dimension(:),allocatable :: lat ! latitude 45 real,dimension(:),allocatable :: latrad ! latitude in radian45 real,dimension(:),allocatable :: coslat ! cos of latitude 46 46 integer latlength ! # of grid points along latitude 47 47 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 107 107 108 108 pi = 2.*asin(1.) 109 miss_val = miss_val_def 109 110 110 111 write(*,*) "" … … 145 146 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 146 147 147 allocate(latrad(latlength)) 148 latrad = lat*pi/180. 148 allocate(coslat(latlength)) 149 ! Beware of rounding problems at poles... 150 coslat(:) = max(0.,cos(lat(:)*pi/180.)) 149 151 150 152 ! Lat, lon pressure intervals 151 deltalat = abs(lat rad(2)-latrad(1))153 deltalat = abs(lat(2)-lat(1))*pi/180. 152 154 deltalon = abs(lon(2)-lon(1))*pi/180. 153 155 … … 196 198 197 199 text="temp" 198 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)200 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 199 201 if (ierr1.ne.NF_NOERR) then 200 202 write(*,*) " looking for t instead... " 201 203 text="t" 202 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)204 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 203 205 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get temperature ID" 204 206 endif … … 214 216 ! zonal wind vitu (in m/s) 215 217 text="vitu" 216 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)218 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 217 219 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitu ID" 218 220 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind" … … 220 222 ! meridional wind vitv (in m/s) 221 223 text="vitv" 222 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)224 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 223 225 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID" 224 226 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind" … … 226 228 ! vertical wind vitw (in Pa/s) 227 229 text="vitw" 228 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw, ierr1,ierr2)230 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw,miss_val,ierr1,ierr2) 229 231 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitw ID" 230 232 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading vertical wind" … … 238 240 239 241 ! text="zareoid" 240 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)242 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 241 243 ! if (ierr1.ne.NF_NOERR) stop "Error: Failed to get za ID" 242 244 ! if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zareoid" … … 312 314 grav(lonlength+1,:,:,:) = grav(1,:,:,:) 313 315 314 call cellmass(infid,latlength,lonlength+1,altlength,timelength, &315 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &316 call cellmass(infid,latlength,lonlength+1,altlength,timelength,lmdflag, & 317 miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 316 318 dmass ) 317 319 … … 359 361 call moyzon(lonlength,latlength,altlength,miss_val,u3d,ubar) 360 362 361 call epflux(lonlength+1,latlength,altlength,miss_val,lat rad,rbar &363 call epflux(lonlength+1,latlength,altlength,miss_val,lat,rbar & 362 364 ,teta,u3d,v3d,w3d,plev & 363 365 ,epy2d,epz2d,div2d,vtem2d,wtem2d,ammc2d & … … 376 378 ! rsurg: r*dp/g = dm/(r cos(lat) dlon dlat) !!! 377 379 rsurg(ilon,ilat,ilev) = dmass(ilon,ilat,ilev,itim) & 378 / (r3d(ilon,ilat,ilev)*cos (latrad(ilat))*deltalon*deltalat)380 / (r3d(ilon,ilat,ilev)*coslat(ilat)*deltalon*deltalat) 379 381 else 380 382 rsurg(ilon,ilat,ilev) = miss_val … … 391 393 (rsurgbar(ilat,ilev).ne.miss_val) ) then 392 394 vm(ilat,ilev) = vtem2d(ilat,ilev) & 393 * 2.*pi*rsurgbar(ilat,ilev)*cos (latrad(ilat))395 * 2.*pi*rsurgbar(ilat,ilev)*coslat(ilat) 394 396 else 395 397 vm(ilat,ilev) = miss_val -
trunk/LMDZ.VENUS/Tools/tmc.F90
r816 r1454 49 49 integer,dimension(4) :: datashape4d ! shape of 4D datasets 50 50 51 real :: miss_val =9.99e+33! special "missing value" to specify missing data52 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"51 real :: miss_val ! special "missing value" to specify missing data 52 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 53 53 real :: pi 54 54 real,dimension(:),allocatable :: lon ! longitude 55 55 integer lonlength ! # of grid points along longitude 56 56 real,dimension(:),allocatable :: lat ! latitude 57 real,dimension(:),allocatable :: latrad ! latitude in radian57 real,dimension(:),allocatable :: coslat ! cos of latitude 58 58 integer latlength ! # of grid points along latitude 59 59 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 141 141 142 142 pi = 2.*asin(1.) 143 miss_val = miss_val_def 143 144 144 145 write(*,*) "" … … 179 180 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 180 181 181 allocate(latrad(latlength)) 182 latrad = lat*pi/180. 182 allocate(coslat(latlength)) 183 ! Beware of rounding problems at poles... 184 coslat(:) = max(0.,cos(lat(:)*pi/180.)) 183 185 184 186 ! Lat, lon pressure intervals 185 deltalat = abs(lat rad(2)-latrad(1))187 deltalat = abs(lat(2)-lat(1))*pi/180. 186 188 deltalon = abs(lon(2)-lon(1))*pi/180. 187 189 … … 233 235 ! zonal wind vitu (in m/s) 234 236 text="vitu" 235 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)237 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 236 238 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitu ID" 237 239 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind" … … 239 241 ! meridional wind vitv (in m/s) 240 242 text="vitv" 241 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)243 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 242 244 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID" 243 245 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind" … … 245 247 ! vertical wind vitw (in Pa/s) 246 248 text="vitw" 247 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw, ierr1,ierr2)249 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw,miss_val,ierr1,ierr2) 248 250 if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitw ID" 249 251 if (ierr2.ne.NF_NOERR) stop "Error: Failed reading vertical wind" … … 257 259 258 260 ! text="zareoid" 259 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za, ierr1,ierr2)261 ! call get_var4d(infid,lonlength,latlength,altlength,timelength,text,za,miss_val,ierr1,ierr2) 260 262 ! if (ierr1.ne.NF_NOERR) stop "Error: Failed to get za ID" 261 263 ! if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zareoid" … … 293 295 enddo ! timelength 294 296 295 call cellmass(infid,latlength,lonlength,altlength,timelength, &296 lmdflag,deltalon,deltalat,latrad,plev,ps,grav,rayon, &297 call cellmass(infid,latlength,lonlength,altlength,timelength,lmdflag, & 298 miss_val,deltalon,deltalat,coslat,plev,ps,grav,rayon, & 297 299 dmass ) 298 300 … … 316 318 osam(ilon,ilat,ilev,itim) = & 317 319 rayon(ilon,ilat,ilev,itim)*rayon(ilon,ilat,ilev,itim) & 318 * cos (latrad(ilat))*cos(latrad(ilat)) &320 * coslat(ilat)*coslat(ilat) & 319 321 * omega 320 322 rsam(ilon,ilat,ilev,itim) = vitu(ilon,ilat,ilev,itim) & 321 * rayon(ilon,ilat,ilev,itim)*cos (latrad(ilat))323 * rayon(ilon,ilat,ilev,itim)*coslat(ilat) 322 324 tsam(ilon,ilat,ilev,itim) = osam(ilon,ilat,ilev,itim)& 323 325 + rsam(ilon,ilat,ilev,itim)
Note: See TracChangeset
for help on using the changeset viewer.