Changeset 5095 for LMDZ6/branches/Amaury_dev/libf/phylmd/cosp
- Timestamp:
- Jul 22, 2024, 9:46:57 AM (12 months ago)
- Location:
- LMDZ6/branches/Amaury_dev/libf/phylmd/cosp
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/MISR_simulator.F
r5082 r5095 133 133 134 134 ! define location of "layer top" 135 if(ilev ==1 .or. ilev==nlev) then135 if(ilev.eq.1 .or. ilev.eq.nlev) then 136 136 ztest=zfull(j,ilev) 137 137 else … … 144 144 do loop=2,n_MISR_CTH 145 145 146 if ( ztest >146 if ( ztest .gt. 147 147 & 1000*MISR_CTH_boundaries(loop+1) ) then 148 148 … … 173 173 dtau=0 174 174 175 if (frac_out(j,ibox,ilev) ==1) then175 if (frac_out(j,ibox,ilev).eq.1) then 176 176 dtau = dtau_s(j,ilev) 177 177 endif 178 178 179 if (frac_out(j,ibox,ilev) ==2) then179 if (frac_out(j,ibox,ilev).eq.2) then 180 180 dtau = dtau_c(j,ilev) 181 181 end if … … 186 186 ! NOW for MISR .. 187 187 ! if there a cloud ... start the counter ... store this height 188 if(thres_crossed_MISR == 0 .and. dtau >0.) then188 if(thres_crossed_MISR .eq. 0 .and. dtau .gt. 0.) then 189 189 190 190 ! first encountered a "cloud" … … 193 193 endif 194 194 195 if( thres_crossed_MISR <99 .and.196 & thres_crossed_MISR >0 ) then195 if( thres_crossed_MISR .lt. 99 .and. 196 & thres_crossed_MISR .gt. 0 ) then 197 197 198 if( dtau ==0.) then198 if( dtau .eq. 0.) then 199 199 200 200 ! we have come to the end of the current cloud … … 212 212 ! then MISR will like see a top below the top of the current 213 213 ! layer 214 if( dtau >0 .and. (cloud_dtau-dtau) <1) then215 216 if(dtau < 1 .or. ilev==1 .or. ilev==nlev) then214 if( dtau.gt.0 .and. (cloud_dtau-dtau) .lt. 1) then 215 216 if(dtau .lt. 1 .or. ilev.eq.1 .or. ilev.eq.nlev) then 217 217 218 218 ! MISR will likely penetrate to some point … … 233 233 234 234 ! check for a distinctive water layer 235 if(dtau > 1 .and. at(j,ilev)>273 ) then235 if(dtau .gt. 1 .and. at(j,ilev).gt.273 ) then 236 236 237 237 ! must be a water cloud ... … … 242 242 ! if the total column optical depth is "large" than 243 243 ! MISR can't seen anything else ... set current point as CTH level 244 if(tau(j,ibox) > 5) then244 if(tau(j,ibox) .gt. 5) then 245 245 246 246 thres_crossed_MISR=99 … … 254 254 ! check to see if there was a cloud for which we didn't 255 255 ! set a MISR cloud top boundary 256 if( thres_crossed_MISR ==1) then256 if( thres_crossed_MISR .eq. 1) then 257 257 258 258 ! if the cloud has a total optical depth of greater … … 260 260 ! with a height near the true cloud top 261 261 ! otherwise there should be no CTH 262 if( tau(j,ibox) >0.5) then262 if( tau(j,ibox) .gt. 0.5) then 263 263 264 264 ! keep MISR detected CTH 265 265 266 elseif(tau(j,ibox) >0.2) then266 elseif(tau(j,ibox) .gt. 0.2) then 267 267 268 268 ! MISR may detect but wont likley have a good height … … 294 294 ! This setup assumes the columns represent a about a 1 to 4 km scale 295 295 ! it will need to be modified significantly, otherwise 296 if(ncol ==1) then296 if(ncol.eq.1) then 297 297 298 298 ! adjust based on neightboring points ... i.e. only 2D grid was input 299 299 do j=2,npoints-1 300 300 301 if(box_MISR_ztop(j-1,1) >0 .and.302 & box_MISR_ztop(j+1,1) >0 ) then301 if(box_MISR_ztop(j-1,1).gt.0 .and. 302 & box_MISR_ztop(j+1,1).gt.0 ) then 303 303 304 304 if( abs( box_MISR_ztop(j-1,1) - 305 & box_MISR_ztop(j+1,1) ) < 500305 & box_MISR_ztop(j+1,1) ) .lt. 500 306 306 & .and. 307 & box_MISR_ztop(j,1) <307 & box_MISR_ztop(j,1) .lt. 308 308 & box_MISR_ztop(j+1,1) ) then 309 309 … … 319 319 do ibox=2,ncol-1 320 320 321 if(box_MISR_ztop(1,ibox-1) >0 .and.322 & box_MISR_ztop(1,ibox+1) >0 ) then321 if(box_MISR_ztop(1,ibox-1).gt.0 .and. 322 & box_MISR_ztop(1,ibox+1).gt.0 ) then 323 323 324 324 if( abs( box_MISR_ztop(1,ibox-1) - 325 & box_MISR_ztop(1,ibox+1) ) < 500325 & box_MISR_ztop(1,ibox+1) ) .lt. 500 326 326 & .and. 327 & box_MISR_ztop(1,ibox) <327 & box_MISR_ztop(1,ibox) .lt. 328 328 & box_MISR_ztop(1,ibox+1) ) then 329 329 … … 357 357 do ibox=1,ncol 358 358 359 if (tau(j,ibox) >(tauchk)) then359 if (tau(j,ibox) .gt. (tauchk)) then 360 360 box_cloudy(j,ibox)=.true. 361 361 endif … … 366 366 367 367 !determine optical depth category 368 if (tau(j,ibox) <isccp_taumin) then368 if (tau(j,ibox) .lt. isccp_taumin) then 369 369 itau=1 370 else if (tau(j,ibox) >= isccp_taumin371 & .and. tau(j,ibox) <1.3) then370 else if (tau(j,ibox) .ge. isccp_taumin 371 & .and. tau(j,ibox) .lt. 1.3) then 372 372 itau=2 373 else if (tau(j,ibox) >= 1.3374 & .and. tau(j,ibox) <3.6) then373 else if (tau(j,ibox) .ge. 1.3 374 & .and. tau(j,ibox) .lt. 3.6) then 375 375 itau=3 376 else if (tau(j,ibox) >= 3.6377 & .and. tau(j,ibox) <9.4) then376 else if (tau(j,ibox) .ge. 3.6 377 & .and. tau(j,ibox) .lt. 9.4) then 378 378 itau=4 379 else if (tau(j,ibox) >= 9.4380 & .and. tau(j,ibox) <23.) then379 else if (tau(j,ibox) .ge. 9.4 380 & .and. tau(j,ibox) .lt. 23.) then 381 381 itau=5 382 else if (tau(j,ibox) >= 23.383 & .and. tau(j,ibox) <60.) then382 else if (tau(j,ibox) .ge. 23. 383 & .and. tau(j,ibox) .lt. 60.) then 384 384 itau=6 385 else if (tau(j,ibox) >=60.) then385 else if (tau(j,ibox) .ge. 60.) then 386 386 itau=7 387 387 endif … … 390 390 391 391 ! update MISR histograms and summary metrics - roj 5/2005 392 if (sunlit(j) ==1) then392 if (sunlit(j).eq.1) then 393 393 394 394 !if cloudy added by roj 5/2005 395 if( box_MISR_ztop(j,ibox) ==0) then395 if( box_MISR_ztop(j,ibox).eq.0) then 396 396 397 397 ! no cloud detected 398 398 iMISR_ztop=0 399 399 400 elseif( box_MISR_ztop(j,ibox) ==-1) then400 elseif( box_MISR_ztop(j,ibox).eq.-1) then 401 401 402 402 ! cloud can be detected but too thin to get CTH … … 416 416 do loop=2,n_MISR_CTH 417 417 418 if ( box_MISR_ztop(j,ibox) >418 if ( box_MISR_ztop(j,ibox) .gt. 419 419 & 1000*MISR_CTH_boundaries(loop+1) ) then 420 420 … … 466 466 enddo ! ibox - loop over subcolumns 467 467 468 if( MISR_cldarea(j) >0.) then468 if( MISR_cldarea(j) .gt. 0.) then 469 469 MISR_mean_ztop(j)= MISR_mean_ztop(j) / MISR_cldarea(j) ! roj 5/2006 470 470 endif -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/array_lib.F90
r5082 r5095 45 45 46 46 ! ----- INPUTS ----- 47 real (kind=8), dimension(:), intent(in) :: list48 real (kind=8), intent(in) :: val47 real*8, dimension(:), intent(in) :: list 48 real*8, intent(in) :: val 49 49 integer, intent(in), optional :: sort 50 50 51 51 ! ----- OUTPUTS ----- 52 integer (kind=4):: infind53 real (kind=8), intent(out), optional :: dist52 integer*4 :: infind 53 real*8, intent(out), optional :: dist 54 54 55 55 ! ----- INTERNAL ----- 56 real (kind=8), dimension(size(list)) :: lists57 integer (kind=4):: nlist, result, tmp(1), sort_list58 integer (kind=4), dimension(size(list)) :: mask, idx56 real*8, dimension(size(list)) :: lists 57 integer*4 :: nlist, result, tmp(1), sort_list 58 integer*4, dimension(size(list)) :: mask, idx 59 59 60 60 if (present(sort)) then … … 121 121 122 122 ! ----- INPUTS ----- 123 real (kind=8), dimension(:), intent(in) :: yarr, xarr, xxarr124 real (kind=8), intent(in) :: tol123 real*8, dimension(:), intent(in) :: yarr, xarr, xxarr 124 real*8, intent(in) :: tol 125 125 126 126 ! ----- OUTPUTS ----- 127 real (kind=8), dimension(size(xxarr)), intent(out) :: yyarr127 real*8, dimension(size(xxarr)), intent(out) :: yyarr 128 128 129 129 ! ----- INTERNAL ----- 130 real (kind=8), dimension(size(xarr)) :: ysort, xsort131 integer (kind=4), dimension(size(xarr)) :: ist132 integer (kind=4):: nx, nxx, i, iloc133 real (kind=8):: d, m130 real*8, dimension(size(xarr)) :: ysort, xsort 131 integer*4, dimension(size(xarr)) :: ist 132 integer*4 :: nx, nxx, i, iloc 133 real*8 :: d, m 134 134 135 135 nx = size(xarr) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/atmos_lib.F90
r5082 r5095 43 43 44 44 ! ----- OUTPUTS ----- 45 real (kind=8), intent(out), dimension(ndat) :: &45 real*8, intent(out), dimension(ndat) :: & 46 46 hgt, & ! height (m) 47 47 prs, & ! pressure (hPa) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/calc_Re.F90
r5082 r5095 40 40 ! ----- INPUTS ----- 41 41 42 real (kind=8), intent(in) :: Q,Np,rho_a42 real*8, intent(in) :: Q,Np,rho_a 43 43 44 44 integer, intent(in):: dtype 45 real (kind=8), intent(in) :: dmin,dmax,rho_c,p1,p2,p346 47 real (kind=8), intent(inout) :: apm,bpm45 real*8, intent(in) :: dmin,dmax,rho_c,p1,p2,p3 46 47 real*8, intent(inout) :: apm,bpm 48 48 49 49 ! ----- OUTPUTS ----- 50 50 51 real (kind=8), intent(out) :: Re51 real*8, intent(out) :: Re 52 52 53 53 ! ----- INTERNAL ----- 54 54 55 55 integer :: local_dtype 56 real (kind=8):: local_p3,local_Np57 58 real (kind=8):: pi, &56 real*8 :: local_p3,local_Np 57 58 real*8 :: pi, & 59 59 N0,D0,vu,dm,ld, & ! gamma, exponential variables 60 60 rg,log_sigma_g 61 61 62 real (kind=8):: tmp1,tmp262 real*8 :: tmp1,tmp2 63 63 64 64 pi = acos(-1.0) … … 72 72 ! Exponential is same as modified gamma with vu =1 73 73 ! if Np is specified then we will just treat as modified gamma 74 if(dtype ==2 .and. Np>0) then74 if(dtype.eq.2 .and. Np>0) then 75 75 local_dtype=1; 76 76 local_p3=1; … … 119 119 120 120 121 if( Np ==0 .and. p2+1 > 1E-8) then ! use default value for MEAN diameter as first default121 if( Np.eq.0 .and. p2+1 > 1E-8) then ! use default value for MEAN diameter as first default 122 122 123 123 dm = p2 ! by definition, should have units of microns … … 126 126 else ! use value of Np 127 127 128 if(Np ==0) then128 if(Np.eq.0) then 129 129 130 130 if( abs(p1+1) > 1E-8 ) then ! use default number concentration … … 233 233 234 234 ! get rg ... 235 if( Np ==0 .and. (abs(p2+1) > 1E-8) ) then ! use default value of rg235 if( Np.eq.0 .and. (abs(p2+1) > 1E-8) ) then ! use default value of rg 236 236 237 237 rg = p2 -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/cosp_output_write_mod.F90
r5093 r5095 185 185 do k=1,PARASOL_NREFL 186 186 do ip=1, Npoints 187 if (stlidar%cldlayer(ip,4) >0.01.and.stlidar%parasolrefl(ip,k)/=missing_val) then187 if (stlidar%cldlayer(ip,4).gt.0.01.and.stlidar%parasolrefl(ip,k).ne.missing_val) then 188 188 parasolcrefl(ip,k)=(stlidar%parasolrefl(ip,k)-0.03*(1.-stlidar%cldlayer(ip,4)))/ & 189 189 stlidar%cldlayer(ip,4) … … 456 456 CHARACTER(LEN=20) :: typeecrit 457 457 458 ! ug On r écupère le type écrit de la structure:459 ! Assez moche, à refaire si meilleure méthode...458 ! ug On récupère le type écrit de la structure: 459 ! Assez moche, Ã| refaire si meilleure méthode... 460 460 IF (INDEX(var%cosp_typeecrit(iff), "once") > 0) THEN 461 461 typeecrit = 'once' … … 523 523 524 524 ! Axe vertical 525 IF (nvertsave ==nvertp(iff)) THEN525 IF (nvertsave.eq.nvertp(iff)) THEN 526 526 klevs=PARASOL_NREFL 527 527 nam_axvert="sza" 528 ELSE IF (nvertsave ==nvertisccp(iff)) THEN528 ELSE IF (nvertsave.eq.nvertisccp(iff)) THEN 529 529 klevs=7 530 530 nam_axvert="pressure2" 531 ELSE IF (nvertsave ==nvertcol(iff)) THEN531 ELSE IF (nvertsave.eq.nvertcol(iff)) THEN 532 532 klevs=Ncolout 533 533 nam_axvert="column" 534 ELSE IF (nvertsave ==nverttemp(iff)) THEN534 ELSE IF (nvertsave.eq.nverttemp(iff)) THEN 535 535 klevs=LIDAR_NTEMP 536 536 nam_axvert="temp" 537 ELSE IF (nvertsave ==nvertmisr(iff)) THEN537 ELSE IF (nvertsave.eq.nvertmisr(iff)) THEN 538 538 klevs=MISR_N_CTH 539 539 nam_axvert="cth16" 540 ELSE IF (nvertsave ==nvertReffIce(iff)) THEN540 ELSE IF (nvertsave.eq.nvertReffIce(iff)) THEN 541 541 klevs= numMODISReffIceBins 542 542 nam_axvert="ReffIce" 543 ELSE IF (nvertsave ==nvertReffLiq(iff)) THEN543 ELSE IF (nvertsave.eq.nvertReffLiq(iff)) THEN 544 544 klevs= numMODISReffLiqBins 545 545 nam_axvert="ReffLiq" … … 558 558 END IF 559 559 560 ! ug On r écupère le type écrit de la structure:561 ! Assez moche, à refaire si meilleure méthode...560 ! ug On récupère le type écrit de la structure: 561 ! Assez moche, Ã| refaire si meilleure méthode... 562 562 IF (INDEX(var%cosp_typeecrit(iff), "once") > 0) THEN 563 563 typeecrit = 'once' … … 628 628 IF (prt_level >= 9) WRITE(lunout,*)'Begin histrwrite2d ',var%name 629 629 630 ! On regarde si on est dans la phase de d éfinition ou d'écriture:630 ! On regarde si on est dans la phase de définition ou d'écriture: 631 631 IF(.NOT.cosp_varsdefined) THEN 632 632 !$OMP MASTER 633 !Si phase de d éfinition.... on définit633 !Si phase de définition.... on définit 634 634 CALL conf_cospoutputs(var%name,var%cles) 635 635 DO iff=1, 3 … … 640 640 !$OMP END MASTER 641 641 ELSE 642 !Et sinon on.... écrit642 !Et sinon on.... écrit 643 643 IF (SIZE(field)/=klon) & 644 644 CALL abort_physic('iophy::histwrite2d_cosp','Field first DIMENSION not equal to klon',1) … … 725 725 nom=var%name 726 726 END IF 727 ! On regarde si on est dans la phase de d éfinition ou d'écriture:727 ! On regarde si on est dans la phase de définition ou d'écriture: 728 728 IF(.NOT.cosp_varsdefined) THEN 729 !Si phase de d éfinition.... on définit729 !Si phase de définition.... on définit 730 730 !$OMP MASTER 731 731 CALL conf_cospoutputs(var%name,var%cles) … … 737 737 !$OMP END MASTER 738 738 ELSE 739 !Et sinon on.... écrit739 !Et sinon on.... écrit 740 740 IF (SIZE(field,1)/=klon) & 741 741 CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1) … … 809 809 810 810 IF(cosp_varsdefined) THEN 811 !Et sinon on.... écrit811 !Et sinon on.... écrit 812 812 IF (SIZE(field,1)/=klon) & 813 813 CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/dsd.F90
r5082 r5095 60 60 integer, intent(in) :: nsizes 61 61 integer, intent(in) :: dtype 62 real (kind=8), intent(in) :: Q,Re_,Np,D(nsizes)63 real (kind=8), intent(in) :: rho_a,tk,dmin,dmax,rho_c,p1,p2,p364 65 real (kind=8), intent(inout) :: apm,bpm62 real*8, intent(in) :: Q,Re_,Np,D(nsizes) 63 real*8, intent(in) :: rho_a,tk,dmin,dmax,rho_c,p1,p2,p3 64 65 real*8, intent(inout) :: apm,bpm 66 66 67 67 ! ----- OUTPUTS ----- 68 68 69 real (kind=8), intent(out) :: N(nsizes)69 real*8, intent(out) :: N(nsizes) 70 70 71 71 ! ----- INTERNAL ----- 72 72 73 real (kind=8):: fc(nsizes)74 75 real (kind=8):: &73 real*8 :: fc(nsizes) 74 75 real*8 :: & 76 76 N0,D0,vu,local_np,dm,ld, & ! gamma, exponential variables 77 77 dmin_mm,dmax_mm,ahp,bhp, & ! power law variables … … 79 79 rho_e ! particle density (kg m^-3) 80 80 81 real (kind=8):: tmp1, tmp282 real (kind=8):: pi,rc,tc83 real (kind=8):: Re81 real*8 :: tmp1, tmp2 82 real*8 :: pi,rc,tc 83 real*8 :: Re 84 84 85 85 integer k,lidx,uidx … … 352 352 log_sigma_g = p3 353 353 tmp2 = (bpm*log_sigma_g)**2. 354 if(Re <=0) then354 if(Re.le.0) then 355 355 rg = p2 356 356 else -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/format_input.F90
r5082 r5095 40 40 41 41 ! ----- INPUTS ----- 42 real (kind=8), dimension(:,:), intent(in) :: &42 real*8, dimension(:,:), intent(in) :: & 43 43 hgt_matrix,env_hgt_matrix,env_t_matrix,env_p_matrix,env_rh_matrix 44 44 45 45 ! ----- OUTPUTS ----- 46 real (kind=8), dimension(:,:), intent(out) :: &46 real*8, dimension(:,:), intent(out) :: & 47 47 t_matrix,p_matrix,rh_matrix 48 48 … … 97 97 98 98 ! ----- OUTPUTS ----- 99 real (kind=8), dimension(:,:), intent(inout) :: &99 real*8, dimension(:,:), intent(inout) :: & 100 100 hgt_matrix,p_matrix,t_matrix,rh_matrix 101 real (kind=8), dimension(:,:,:), intent(inout) :: &101 real*8, dimension(:,:,:), intent(inout) :: & 102 102 hm_matrix 103 103 logical, intent(out) :: hgt_reversed -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/gases.F90
r5082 r5095 27 27 nbands_o2 = 48 ,& 28 28 nbands_h2o = 30 29 real (kind=8), intent(in) :: PRES_mb, T, RH, f30 real (kind=8):: gases, th, e, p, sumo, gm0, a0, ap, term1, term2, term3, &29 real*8, intent(in) :: PRES_mb, T, RH, f 30 real*8 :: gases, th, e, p, sumo, gm0, a0, ap, term1, term2, term3, & 31 31 bf, be, term4, npp 32 real (kind=8), dimension(nbands_o2) :: v0, a1, a2, a3, a4, a5, a633 real (kind=8), dimension(nbands_h2o) :: v1, b1, b2, b334 real (kind=8):: e_th,one_th,pth3,eth35,aux1,aux2,aux3,aux435 real (kind=8):: gm,delt,x,y,gm236 real (kind=8):: fpp_o2,fpp_h2o,s_o2,s_h2o32 real*8, dimension(nbands_o2) :: v0, a1, a2, a3, a4, a5, a6 33 real*8, dimension(nbands_h2o) :: v1, b1, b2, b3 34 real*8 :: e_th,one_th,pth3,eth35,aux1,aux2,aux3,aux4 35 real*8 :: gm,delt,x,y,gm2 36 real*8 :: fpp_o2,fpp_h2o,s_o2,s_h2o 37 37 integer :: i 38 38 -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/icarus.F
r5086 r5095 293 293 ncolprint=0 294 294 295 if ( debug /=0 ) then295 if ( debug.ne.0 ) then 296 296 j=1 297 297 write(6,'(a10)') 'j=' … … 347 347 ! ---------------------------------------------------! 348 348 349 if (ncolprint /=0) then349 if (ncolprint.ne.0) then 350 350 do j=1,npoints,1000 351 351 write(6,'(a10)') 'j=' … … 354 354 endif 355 355 356 if (top_height == 1 .or. top_height == 3) then356 if (top_height .eq. 1 .or. top_height .eq. 3) then 357 357 358 358 do j=1,npoints … … 364 364 enddo 365 365 366 do ilev=1,nlev366 do 12 ilev=1,nlev 367 367 do j=1,npoints 368 if (pfull(j,ilev) <40000. .and.369 & pfull(j,ilev) >5000. .and.370 & at(j,ilev) <attropmin(j)) then368 if (pfull(j,ilev) .lt. 40000. .and. 369 & pfull(j,ilev) .gt. 5000. .and. 370 & at(j,ilev) .lt. attropmin(j)) then 371 371 ptrop(j) = pfull(j,ilev) 372 372 attropmin(j) = at(j,ilev) … … 375 375 end if 376 376 enddo 377 END DO 378 379 do ilev=1,nlev377 12 continue 378 379 do 13 ilev=1,nlev 380 380 do j=1,npoints 381 if (at(j,ilev) >atmax(j) .and.382 & ilev >=itrop(j)) atmax(j)=at(j,ilev)383 enddo 384 END DO 381 if (at(j,ilev) .gt. atmax(j) .and. 382 & ilev .ge. itrop(j)) atmax(j)=at(j,ilev) 383 enddo 384 13 continue 385 385 386 386 end if 387 387 388 388 389 if (top_height == 1 .or. top_height ==3) then389 if (top_height .eq. 1 .or. top_height .eq. 3) then 390 390 do j=1,npoints 391 391 meantb(j) = 0. 392 392 meantbclr(j) = 0. 393 END DO393 end do 394 394 else 395 395 do j=1,npoints 396 396 meantb(j) = output_missing_value 397 397 meantbclr(j) = output_missing_value 398 END DO398 end do 399 399 end if 400 400 … … 408 408 rangevec(j)=0 409 409 410 if (cc(j,ilev) < 0. .or. cc(j,ilev) >1.) then410 if (cc(j,ilev) .lt. 0. .or. cc(j,ilev) .gt. 1.) then 411 411 ! error = cloud fraction less than zero 412 412 ! error = cloud fraction greater than 1 … … 414 414 endif 415 415 416 if (conv(j,ilev) < 0. .or. conv(j,ilev) >1.) then416 if (conv(j,ilev) .lt. 0. .or. conv(j,ilev) .gt. 1.) then 417 417 ! ' error = convective cloud fraction less than zero' 418 418 ! ' error = convective cloud fraction greater than 1' … … 420 420 endif 421 421 422 if (dtau_s(j,ilev) <0.) then422 if (dtau_s(j,ilev) .lt. 0.) then 423 423 ! ' error = stratiform cloud opt. depth less than zero' 424 424 rangevec(j)=rangevec(j)+4 425 425 endif 426 426 427 if (dtau_c(j,ilev) <0.) then427 if (dtau_c(j,ilev) .lt. 0.) then 428 428 ! ' error = convective cloud opt. depth less than zero' 429 429 rangevec(j)=rangevec(j)+8 430 430 endif 431 431 432 if (dem_s(j,ilev) < 0. .or. dem_s(j,ilev) >1.) then432 if (dem_s(j,ilev) .lt. 0. .or. dem_s(j,ilev) .gt. 1.) then 433 433 ! ' error = stratiform cloud emissivity less than zero' 434 434 ! ' error = stratiform cloud emissivity greater than 1' … … 436 436 endif 437 437 438 if (dem_c(j,ilev) < 0. .or. dem_c(j,ilev) >1.) then438 if (dem_c(j,ilev) .lt. 0. .or. dem_c(j,ilev) .gt. 1.) then 439 439 ! ' error = convective cloud emissivity less than zero' 440 440 ! ' error = convective cloud emissivity greater than 1' … … 448 448 enddo 449 449 450 if (rangeerror /=0) then450 if (rangeerror.ne.0) then 451 451 write (6,*) 'Input variable out of range' 452 452 write (6,*) 'rangevec:' … … 466 466 467 467 !initialize tau and albedocld to zero 468 do ibox=1,ncol468 do 15 ibox=1,ncol 469 469 do j=1,npoints 470 470 tau(j,ibox)=0. … … 474 474 box_cloudy(j,ibox)=.false. 475 475 enddo 476 END DO 476 15 continue 477 477 478 478 !compute total cloud optical depth for each column … … 481 481 do ibox=1,ncol 482 482 do j=1,npoints 483 if (frac_out(j,ibox,ilev) ==1) then483 if (frac_out(j,ibox,ilev).eq.1) then 484 484 tau(j,ibox)=tau(j,ibox) 485 485 & + dtau_s(j,ilev) 486 486 endif 487 if (frac_out(j,ibox,ilev) ==2) then487 if (frac_out(j,ibox,ilev).eq.2) then 488 488 tau(j,ibox)=tau(j,ibox) 489 489 & + dtau_c(j,ilev) … … 492 492 enddo ! ibox 493 493 enddo ! ilev 494 if (ncolprint /=0) then494 if (ncolprint.ne.0) then 495 495 496 496 do j=1,npoints ,1000 … … 521 521 ! sky versions of these quantities. 522 522 523 if (top_height == 1 .or. top_height ==3) then523 if (top_height .eq. 1 .or. top_height .eq. 3) then 524 524 525 525 … … 539 539 pstd = 1.013250E+06 540 540 t0 = 296. 541 if (ncolprint /= 0)541 if (ncolprint .ne. 0) 542 542 & write(6,*) 'ilev pw (kg/m2) tauwv(j) dem_wv' 543 do ilev=1,nlev543 do 125 ilev=1,nlev 544 544 do j=1,npoints 545 545 !press and dpress are dyne/cm2 = Pascals *10 … … 559 559 dem_wv(j,ilev) = 1. - exp( -1. * tauwv(j)) 560 560 enddo 561 if (ncolprint /=0) then561 if (ncolprint .ne. 0) then 562 562 do j=1,npoints ,1000 563 563 write(6,'(a10)') 'j=' … … 568 568 enddo 569 569 endif 570 END DO 570 125 continue 571 571 572 572 !initialize variables … … 598 598 599 599 enddo 600 if (ncolprint /=0) then600 if (ncolprint.ne.0) then 601 601 do j=1,npoints ,1000 602 602 write(6,'(a10)') 'j=' … … 627 627 enddo 628 628 629 if (ncolprint /=0) then629 if (ncolprint.ne.0) then 630 630 do j=1,npoints ,1000 631 631 write(6,'(a10)') 'j=' … … 649 649 650 650 651 if (ncolprint /=0) then651 if (ncolprint.ne.0) then 652 652 653 653 do j=1,npoints ,1000 … … 683 683 684 684 ! emissivity for point in this layer 685 if (frac_out(j,ibox,ilev) ==1) then685 if (frac_out(j,ibox,ilev).eq.1) then 686 686 dem(j,ibox)= 1. - 687 687 & ( (1. - dem_wv(j,ilev)) * (1. - dem_s(j,ilev)) ) 688 else if (frac_out(j,ibox,ilev) ==2) then688 else if (frac_out(j,ibox,ilev).eq.2) then 689 689 dem(j,ibox)= 1. - 690 690 & ( (1. - dem_wv(j,ilev)) * (1. - dem_c(j,ilev)) ) … … 710 710 enddo ! ibox 711 711 712 if (ncolprint /=0) then712 if (ncolprint.ne.0) then 713 713 do j=1,npoints,1000 714 714 write (6,'(a)') 'ilev:' … … 740 740 bb(j)=1/( exp(1307.27/skt(j)) - 1. ) 741 741 !bb(j)=5.67e-8*skt(j)**4 742 END DO742 end do 743 743 744 744 do ibox=1,ncol … … 751 751 & * trans_layers_above(j,ibox) 752 752 753 END DO754 END DO753 end do 754 end do 755 755 756 756 !calculate mean infrared brightness temperature … … 758 758 do j=1,npoints 759 759 meantb(j) = meantb(j)+1307.27/(log(1.+(1./fluxtop(j,ibox)))) 760 END DO761 END DO760 end do 761 end do 762 762 do j=1, npoints 763 763 meantb(j) = meantb(j) / real(ncol) 764 END DO765 766 if (ncolprint /=0) then764 end do 765 766 if (ncolprint.ne.0) then 767 767 768 768 do j=1,npoints ,1000 … … 784 784 write (6,'(8f7.2)') (meantb(j),ibox=1,ncolprint) 785 785 786 END DO786 end do 787 787 endif 788 788 … … 819 819 enddo 820 820 821 if (top_height ==1) then821 if (top_height .eq. 1) then 822 822 do j=1,npoints 823 if (transmax(j) > 0.001 .and.824 & transmax(j) <=0.9999999) then823 if (transmax(j) .gt. 0.001 .and. 824 & transmax(j) .le. 0.9999999) then 825 825 fluxtopinit(j) = fluxtop(j,ibox) 826 826 tauir(j) = tau(j,ibox) *rec2p13 … … 829 829 do icycle=1,2 830 830 do j=1,npoints 831 if (tau(j,ibox) > (tauchk )) then832 if (transmax(j) > 0.001 .and.833 & transmax(j) <=0.9999999) then831 if (tau(j,ibox) .gt. (tauchk )) then 832 if (transmax(j) .gt. 0.001 .and. 833 & transmax(j) .le. 0.9999999) then 834 834 emcld(j,ibox) = 1. - exp(-1. * tauir(j) ) 835 835 fluxtop(j,ibox) = fluxtopinit(j) - … … 839 839 tb(j,ibox)= 1307.27 840 840 & / (log(1. + (1./fluxtop(j,ibox)))) 841 if (tb(j,ibox) >260.) then841 if (tb(j,ibox) .gt. 260.) then 842 842 tauir(j) = tau(j,ibox) / 2.56 843 843 end if … … 850 850 851 851 do j=1,npoints 852 if (tau(j,ibox) > (tauchk )) then852 if (tau(j,ibox) .gt. (tauchk )) then 853 853 !cloudy box 854 854 !NOTE: tb is the cloud-top temperature not infrared brightness temperature 855 855 !at this point in the code 856 856 tb(j,ibox)= 1307.27/ (log(1. + (1./fluxtop(j,ibox)))) 857 if (top_height ==1.and.tauir(j)<taumin(j)) then857 if (top_height.eq.1.and.tauir(j).lt.taumin(j)) then 858 858 tb(j,ibox) = attrop(j) - 5. 859 859 tau(j,ibox) = 2.13*taumin(j) … … 866 866 enddo ! ibox 867 867 868 if (ncolprint /=0) then868 if (ncolprint.ne.0) then 869 869 870 870 do j=1,npoints,1000 … … 925 925 926 926 !compute cloud top pressure 927 do ibox=1,ncol927 do 30 ibox=1,ncol 928 928 !segregate according to optical thickness 929 if (top_height == 1 .or. top_height == 3) then929 if (top_height .eq. 1 .or. top_height .eq. 3) then 930 930 !find level whose temperature 931 931 !most closely matches brightness temperature … … 933 933 nmatch(j)=0 934 934 enddo 935 do k1=1,nlev-1936 if (top_height_direction ==2) then935 do 29 k1=1,nlev-1 936 if (top_height_direction .eq. 2) then 937 937 ilev = nlev - k1 938 938 else … … 941 941 !cdir nodep 942 942 do j=1,npoints 943 if (ilev >=itrop(j)) then944 if ((at(j,ilev) >= tb(j,ibox) .and.945 & at(j,ilev+1) <=tb(j,ibox)) .or.946 & (at(j,ilev) <= tb(j,ibox) .and.947 & at(j,ilev+1) >= tb(j,ibox))) then943 if (ilev .ge. itrop(j)) then 944 if ((at(j,ilev) .ge. tb(j,ibox) .and. 945 & at(j,ilev+1) .le. tb(j,ibox)) .or. 946 & (at(j,ilev) .le. tb(j,ibox) .and. 947 & at(j,ilev+1) .ge. tb(j,ibox))) then 948 948 nmatch(j)=nmatch(j)+1 949 949 match(j,nmatch(j))=ilev … … 951 951 end if 952 952 enddo 953 END DO 953 29 continue 954 954 955 955 do j=1,npoints 956 if (nmatch(j) >=1) then956 if (nmatch(j) .ge. 1) then 957 957 k1 = match(j,nmatch(j)) 958 958 k2 = k1 + 1 … … 962 962 logp=logp1+(logp2-logp1)*abs(tb(j,ibox)-at(j,k1))/atd 963 963 ptop(j,ibox) = exp(logp) 964 if(abs(pfull(j,k1)-ptop(j,ibox)) <964 if(abs(pfull(j,k1)-ptop(j,ibox)) .lt. 965 965 & abs(pfull(j,k2)-ptop(j,ibox))) then 966 966 levmatch(j,ibox)=k1 … … 969 969 end if 970 970 else 971 if (tb(j,ibox) <=attrop(j)) then971 if (tb(j,ibox) .le. attrop(j)) then 972 972 ptop(j,ibox)=ptrop(j) 973 973 levmatch(j,ibox)=itrop(j) 974 974 end if 975 if (tb(j,ibox) >=atmax(j)) then975 if (tb(j,ibox) .ge. atmax(j)) then 976 976 ptop(j,ibox)=pfull(j,nlev) 977 977 levmatch(j,ibox)=nlev … … 987 987 do ilev=1,nlev 988 988 do j=1,npoints 989 if ((ptop(j,ibox) ==0. )990 & .and.(frac_out(j,ibox,ilev) /=0)) then989 if ((ptop(j,ibox) .eq. 0. ) 990 & .and.(frac_out(j,ibox,ilev) .ne. 0)) then 991 991 ptop(j,ibox)=phalf(j,ilev) 992 992 levmatch(j,ibox)=ilev 993 993 end if 994 END DO995 END DO994 end do 995 end do 996 996 end if 997 997 998 998 do j=1,npoints 999 if (tau(j,ibox) <=(tauchk )) then999 if (tau(j,ibox) .le. (tauchk )) then 1000 1000 ptop(j,ibox)=0. 1001 1001 levmatch(j,ibox)=0 … … 1003 1003 enddo 1004 1004 1005 END DO 1005 30 continue 1006 1006 1007 1007 ! … … 1032 1032 1033 1033 !reset frequencies 1034 do ilev=1,71034 do 38 ilev=1,7 1035 1035 do 38 ilev2=1,7 1036 1036 do j=1,npoints ! 1037 if (sunlit(j) ==1 .or. top_height == 3) then1037 if (sunlit(j).eq.1 .or. top_height .eq. 3) then 1038 1038 fq_isccp(j,ilev,ilev2)= 0. 1039 1039 else … … 1042 1042 enddo 1043 1043 38 continue 1044 END DO1045 1044 1046 1045 !reset variables need for averaging cloud properties 1047 1046 do j=1,npoints 1048 if (sunlit(j) ==1 .or. top_height == 3) then1047 if (sunlit(j).eq.1 .or. top_height .eq. 3) then 1049 1048 totalcldarea(j) = 0. 1050 1049 meanalbedocld(j) = 0. … … 1061 1060 boxarea = 1./real(ncol) 1062 1061 1063 do ibox=1,ncol1062 do 39 ibox=1,ncol 1064 1063 do j=1,npoints 1065 1064 1066 if (tau(j,ibox) >(tauchk )1067 & .and. ptop(j,ibox) >0.) then1065 if (tau(j,ibox) .gt. (tauchk ) 1066 & .and. ptop(j,ibox) .gt. 0.) then 1068 1067 box_cloudy(j,ibox)=.true. 1069 1068 endif … … 1071 1070 if (box_cloudy(j,ibox)) then 1072 1071 1073 if (sunlit(j) ==1 .or. top_height ==3) then1072 if (sunlit(j).eq.1 .or. top_height .eq. 3) then 1074 1073 1075 1074 boxtau(j,ibox) = tau(j,ibox) 1076 1075 1077 if (tau(j,ibox) >=isccp_taumin) then1076 if (tau(j,ibox) .ge. isccp_taumin) then 1078 1077 totalcldarea(j) = totalcldarea(j) + boxarea 1079 1078 … … 1092 1091 endif 1093 1092 1094 if (sunlit(j) ==1 .or. top_height == 3) then1093 if (sunlit(j).eq.1 .or. top_height .eq. 3) then 1095 1094 1096 1095 if (box_cloudy(j,ibox)) then … … 1102 1101 boxptop(j,ibox) = ptop(j,ibox) 1103 1102 1104 if (tau(j,ibox) >=isccp_taumin) then1103 if (tau(j,ibox) .ge. isccp_taumin) then 1105 1104 meanptop(j) = meanptop(j) + ptop(j,ibox)*boxarea 1106 1105 end if … … 1111 1110 1112 1111 !determine optical depth category 1113 if (tau(j,ibox) <isccp_taumin) then1112 if (tau(j,ibox) .lt. isccp_taumin) then 1114 1113 itau(j)=1 1115 else if (tau(j,ibox) >=isccp_taumin1114 else if (tau(j,ibox) .ge. isccp_taumin 1116 1115 & 1117 & .and. tau(j,ibox) <1.3) then1116 & .and. tau(j,ibox) .lt. 1.3) then 1118 1117 itau(j)=2 1119 else if (tau(j,ibox) >= 1.31120 & .and. tau(j,ibox) <3.6) then1118 else if (tau(j,ibox) .ge. 1.3 1119 & .and. tau(j,ibox) .lt. 3.6) then 1121 1120 itau(j)=3 1122 else if (tau(j,ibox) >= 3.61123 & .and. tau(j,ibox) <9.4) then1121 else if (tau(j,ibox) .ge. 3.6 1122 & .and. tau(j,ibox) .lt. 9.4) then 1124 1123 itau(j)=4 1125 else if (tau(j,ibox) >= 9.41126 & .and. tau(j,ibox) <23.) then1124 else if (tau(j,ibox) .ge. 9.4 1125 & .and. tau(j,ibox) .lt. 23.) then 1127 1126 itau(j)=5 1128 else if (tau(j,ibox) >= 23.1129 & .and. tau(j,ibox) <60.) then1127 else if (tau(j,ibox) .ge. 23. 1128 & .and. tau(j,ibox) .lt. 60.) then 1130 1129 itau(j)=6 1131 else if (tau(j,ibox) >=60.) then1130 else if (tau(j,ibox) .ge. 60.) then 1132 1131 itau(j)=7 1133 1132 end if 1134 1133 1135 1134 !determine cloud top pressure category 1136 if ( ptop(j,ibox) > 0.1137 & .and.ptop(j,ibox) <180.) then1135 if ( ptop(j,ibox) .gt. 0. 1136 & .and.ptop(j,ibox) .lt. 180.) then 1138 1137 ipres(j)=1 1139 else if(ptop(j,ibox) >=180.1140 & .and.ptop(j,ibox) <310.) then1138 else if(ptop(j,ibox) .ge. 180. 1139 & .and.ptop(j,ibox) .lt. 310.) then 1141 1140 ipres(j)=2 1142 else if(ptop(j,ibox) >=310.1143 & .and.ptop(j,ibox) <440.) then1141 else if(ptop(j,ibox) .ge. 310. 1142 & .and.ptop(j,ibox) .lt. 440.) then 1144 1143 ipres(j)=3 1145 else if(ptop(j,ibox) >=440.1146 & .and.ptop(j,ibox) <560.) then1144 else if(ptop(j,ibox) .ge. 440. 1145 & .and.ptop(j,ibox) .lt. 560.) then 1147 1146 ipres(j)=4 1148 else if(ptop(j,ibox) >=560.1149 & .and.ptop(j,ibox) <680.) then1147 else if(ptop(j,ibox) .ge. 560. 1148 & .and.ptop(j,ibox) .lt. 680.) then 1150 1149 ipres(j)=5 1151 else if(ptop(j,ibox) >=680.1152 & .and.ptop(j,ibox) <800.) then1150 else if(ptop(j,ibox) .ge. 680. 1151 & .and.ptop(j,ibox) .lt. 800.) then 1153 1152 ipres(j)=6 1154 else if(ptop(j,ibox) >=800.) then1153 else if(ptop(j,ibox) .ge. 800.) then 1155 1154 ipres(j)=7 1156 1155 end if 1157 1156 1158 1157 !update frequencies 1159 if(ipres(j) > 0.and.itau(j) >0) then1158 if(ipres(j) .gt. 0.and.itau(j) .gt. 0) then 1160 1159 fq_isccp(j,itau(j),ipres(j))= 1161 1160 & fq_isccp(j,itau(j),ipres(j))+ boxarea … … 1167 1166 1168 1167 enddo ! j 1169 END DO 1168 39 continue 1170 1169 1171 1170 !compute mean cloud properties 1172 1171 do j=1,npoints 1173 if (totalcldarea(j) >0.) then1172 if (totalcldarea(j) .gt. 0.) then 1174 1173 ! code above guarantees that totalcldarea > 0 1175 1174 ! only if sunlit .eq. 1 .or. top_height = 3 … … 1194 1193 ! OPTIONAL PRINTOUT OF DATA TO CHECK PROGRAM 1195 1194 ! 1196 if (debugcol /=0) then1195 if (debugcol.ne.0) then 1197 1196 ! 1198 1197 do j=1,npoints,debugcol … … 1208 1207 do ibox=1,ncol 1209 1208 acc(ilev,ibox)=frac_out(j,ibox,ilev)*2 1210 if (levmatch(j,ibox) == ilev)1209 if (levmatch(j,ibox) .eq. ilev) 1211 1210 & acc(ilev,ibox)=acc(ilev,ibox)+1 1212 1211 enddo … … 1228 1227 & (cchar_realtops(acc(ilev,ibox)+1),ilev=1,nlev) 1229 1228 & ,(cchar(acc(ilev,ibox)+1),ilev=1,nlev) 1230 END DO1229 end do 1231 1230 close(9) 1232 1231 1233 if (ncolprint /=0) then1232 if (ncolprint.ne.0) then 1234 1233 write(6,'(a1)') ' ' 1235 1234 write(6,'(a2,1X,5(a7,1X),a50)') -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/lidar_simulator.F90
r5093 r5095 247 247 !------------------------------------------------------------ 248 248 249 if ( npart /=4 ) then249 if ( npart .ne. 4 ) then 250 250 print *,'Error in lidar_simulator, npart should be 4, not',npart 251 251 stop … … 267 267 polpart(INDX_LSLIQ,5) = 0.0626 268 268 !* LS Ice coefficients: 269 if (ice_type ==0) then269 if (ice_type.eq.0) then 270 270 polpart(INDX_LSICE,1) = -1.0176e-8 271 271 polpart(INDX_LSICE,2) = 1.7615e-6 … … 275 275 endif 276 276 !* LS Ice NS coefficients: 277 if (ice_type ==1) then277 if (ice_type.eq.1) then 278 278 polpart(INDX_LSICE,1) = 1.3615e-8 279 279 polpart(INDX_LSICE,2) = -2.04206e-6 … … 289 289 polpart(INDX_CVLIQ,5) = 0.0626 290 290 !* CONV Ice coefficients: 291 if (ice_type ==0) then291 if (ice_type.eq.0) then 292 292 polpart(INDX_CVICE,1) = -1.0176e-8 293 293 polpart(INDX_CVICE,2) = 1.7615e-6 … … 296 296 polpart(INDX_CVICE,5) = 0.0460 297 297 endif 298 if (ice_type ==1) then298 if (ice_type.eq.1) then 299 299 polpart(INDX_CVICE,1) = 1.3615e-8 300 300 polpart(INDX_CVICE,2) = -2.04206e-6 … … 342 342 ! polynomes kp_lidar derived from Mie theory: 343 343 do i = 1, npart 344 where ( rad_part(:,:,i) >0.0)344 where ( rad_part(:,:,i).gt.0.0) 345 345 kp_part(:,:,i) = & 346 346 polpart(i,1)*(rad_part(:,:,i)*1e6)**4 & … … 362 362 ! alpha of particles in each subcolumn: 363 363 do i = 1, npart 364 where ( rad_part(:,:,i) >0.0)364 where ( rad_part(:,:,i).gt.0.0) 365 365 alpha_part(:,:,i) = 3.0/4.0 * Qscat & 366 366 * rhoair(:,:) * qpart(:,:,i) & … … 378 378 ! opt. thick of each layer 379 379 tau_mol(:,1:nlev) = alpha_mol(:,1:nlev) & 380 *(zheight(:,2:nlev+1)-zheight(:,1:nlev))380 & *(zheight(:,2:nlev+1)-zheight(:,1:nlev)) 381 381 ! opt. thick from TOA 382 382 DO k = nlev-1, 1, -1 … … 390 390 ! opt. thick of each layer 391 391 tau_part(:,:,i) = tau_part(:,:,i) & 392 * (zheight(:,2:nlev+1)-zheight(:,1:nlev) )392 & * (zheight(:,2:nlev+1)-zheight(:,1:nlev) ) 393 393 ! opt. thick from TOA 394 394 DO k = nlev-1, 1, -1 … … 400 400 ! Upper layer 401 401 pmol(:,nlev) = beta_mol(:,nlev) / (2.*tau_mol(:,nlev)) & 402 * (1.-exp(-2.0*tau_mol(:,nlev)))402 & * (1.-exp(-2.0*tau_mol(:,nlev))) 403 403 ! Other layers 404 404 DO k= nlev-1, 1, -1 405 405 tau_mol_lay(:) = tau_mol(:,k)-tau_mol(:,k+1) ! opt. thick. of layer k 406 WHERE (tau_mol_lay(:) >0.)406 WHERE (tau_mol_lay(:).GT.0.) 407 407 pmol(:,k) = beta_mol(:,k) * EXP(-2.0*tau_mol(:,k+1)) / (2.*tau_mol_lay(:)) & 408 * (1.-exp(-2.0*tau_mol_lay(:)))408 & * (1.-exp(-2.0*tau_mol_lay(:))) 409 409 ELSEWHERE 410 410 ! This must never happend, but just in case, to avoid div. by 0 … … 429 429 ! Upper layer 430 430 pnorm(:,nlev) = betatot(:,nlev) / (2.*tautot(:,nlev)) & 431 * (1.-exp(-2.0*tautot(:,nlev)))431 & * (1.-exp(-2.0*tautot(:,nlev))) 432 432 433 433 ! Other layers 434 434 DO k= nlev-1, 1, -1 435 435 tautot_lay(:) = tautot(:,k)-tautot(:,k+1) ! optical thickness of layer k 436 WHERE (tautot_lay(:) >0.)436 WHERE (tautot_lay(:).GT.0.) 437 437 pnorm(:,k) = betatot(:,k) * EXP(-2.0*tautot(:,k+1)) / (2.*tautot_lay(:)) & 438 * (1.-EXP(-2.0*tautot_lay(:)))438 & * (1.-EXP(-2.0*tautot_lay(:))) 439 439 ELSEWHERE 440 440 ! This must never happend, but just in case, to avoid div. by 0 … … 468 468 ! Upper layer 469 469 pnorm_ice(:,nlev) = betatot_ice(:,nlev) / (2.*tautot_ice(:,nlev)) & 470 * (1.-exp(-2.0*tautot_ice(:,nlev)))470 & * (1.-exp(-2.0*tautot_ice(:,nlev))) 471 471 472 472 DO k= nlev-1, 1, -1 473 473 tautot_lay_ice(:) = tautot_ice(:,k)-tautot_ice(:,k+1) 474 WHERE (tautot_lay_ice(:) >0.)474 WHERE (tautot_lay_ice(:).GT.0.) 475 475 pnorm_ice(:,k)=betatot_ice(:,k)*EXP(-2.0*tautot_ice(:,k+1))/(2.*tautot_lay_ice(:)) & 476 * (1.-EXP(-2.0*tautot_lay_ice(:)))476 & * (1.-EXP(-2.0*tautot_lay_ice(:))) 477 477 ELSEWHERE 478 478 pnorm_ice(:,k)=betatot_ice(:,k)*EXP(-2.0*tautot_ice(:,k+1)) … … 483 483 ! Upper layer 484 484 pnorm_liq(:,nlev) = betatot_liq(:,nlev) / (2.*tautot_liq(:,nlev)) & 485 * (1.-exp(-2.0*tautot_liq(:,nlev)))485 & * (1.-exp(-2.0*tautot_liq(:,nlev))) 486 486 487 487 DO k= nlev-1, 1, -1 488 488 tautot_lay_liq(:) = tautot_liq(:,k)-tautot_liq(:,k+1) 489 WHERE (tautot_lay_liq(:) >0.)489 WHERE (tautot_lay_liq(:).GT.0.) 490 490 pnorm_liq(:,k)=betatot_liq(:,k)*EXP(-2.0*tautot_liq(:,k+1))/(2.*tautot_lay_liq(:)) & 491 * (1.-EXP(-2.0*tautot_lay_liq(:)))491 & * (1.-EXP(-2.0*tautot_lay_liq(:))) 492 492 ELSEWHERE 493 493 pnorm_liq(:,k)=betatot_liq(:,k)*EXP(-2.0*tautot_liq(:,k+1)) … … 510 510 ! Upper layer 511 511 beta_perp_ice(:,nlev) = pnorm_perp_ice(:,nlev) * (2.*tautot_ice(:,nlev)) & 512 / (1.-exp(-2.0*tautot_ice(:,nlev)))512 & / (1.-exp(-2.0*tautot_ice(:,nlev))) 513 513 514 514 DO k= nlev-1, 1, -1 515 515 tautot_lay_ice(:) = tautot_ice(:,k)-tautot_ice(:,k+1) 516 WHERE (tautot_lay_ice(:) >0.)516 WHERE (tautot_lay_ice(:).GT.0.) 517 517 beta_perp_ice(:,k) = pnorm_perp_ice(:,k)/ EXP(-2.0*tautot_ice(:,k+1)) * (2.*tautot_lay_ice(:)) & 518 / (1.-exp(-2.0*tautot_lay_ice(:)))518 & / (1.-exp(-2.0*tautot_lay_ice(:))) 519 519 520 520 ELSEWHERE … … 526 526 ! Upper layer 527 527 beta_perp_liq(:,nlev) = pnorm_perp_liq(:,nlev) * (2.*tautot_liq(:,nlev)) & 528 / (1.-exp(-2.0*tautot_liq(:,nlev)))528 & / (1.-exp(-2.0*tautot_liq(:,nlev))) 529 529 530 530 DO k= nlev-1, 1, -1 531 531 tautot_lay_liq(:) = tautot_liq(:,k)-tautot_liq(:,k+1) 532 WHERE (tautot_lay_liq(:) >0.)532 WHERE (tautot_lay_liq(:).GT.0.) 533 533 beta_perp_liq(:,k) = pnorm_perp_liq(:,k)/ max(seuil,EXP(-2.0*tautot_liq(:,k+1))) & 534 * (2.*tautot_lay_liq(:)) / (1.-exp(-2.0*tautot_lay_liq(:)))534 & * (2.*tautot_lay_liq(:)) / (1.-exp(-2.0*tautot_lay_liq(:))) 535 535 536 536 ELSEWHERE … … 547 547 ! Computation of the total perpendicular lidar signal (ATBperp for liq+ice) 548 548 ! Upper layer 549 WHERE(tautot(:,nlev) >0)549 WHERE(tautot(:,nlev).GT.0) 550 550 pnorm_perp_tot(:,nlev) = & 551 551 (beta_perp_ice(:,nlev)+beta_perp_liq(:,nlev)-(beta_mol(:,nlev)/(1+1/0.0284))) / (2.*tautot(:,nlev)) & 552 * (1.-exp(-2.0*tautot(:,nlev)))552 & * (1.-exp(-2.0*tautot(:,nlev))) 553 553 ELSEWHERE 554 554 pnorm_perp_tot(:,nlev) = 0. … … 563 563 ! We remove one contribution using 564 564 ! Betaperp=beta_mol(:,k)/(1+1/0.0284)) [bodhaine et al. 1999] in the following equations: 565 WHERE (pnorm(:,k) ==0)565 WHERE (pnorm(:,k).eq.0) 566 566 pnorm_perp_tot(:,k)=0. 567 567 ELSEWHERE 568 WHERE (tautot_lay(:) >0.)568 WHERE (tautot_lay(:).GT.0.) 569 569 pnorm_perp_tot(:,k) = & 570 570 (beta_perp_ice(:,k)+beta_perp_liq(:,k)-(beta_mol(:,k)/(1+1/0.0284))) * & 571 571 EXP(-2.0*tautot(:,k+1)) / (2.*tautot_lay(:)) & 572 * (1.-EXP(-2.0*tautot_lay(:)))572 & * (1.-EXP(-2.0*tautot_lay(:))) 573 573 ELSEWHERE 574 574 ! This must never happen, but just in case, to avoid div. by 0 … … 690 690 ! Lum_norm=f(tetaS,tau_cloud) derived from adding-doubling calculations 691 691 ! valid ONLY ABOVE OCEAN (albedo_sfce=5%) 692 ! valid only in one viewing direction (theta_v=30 °, phi_s-phi_v=320°)692 ! valid only in one viewing direction (theta_v=30�, phi_s-phi_v=320�) 693 693 ! based on adding-doubling radiative transfer computation 694 694 ! for tau values (0 to 100) and for tetas values (0 to 80) 695 695 ! for 2 scattering phase functions: liquid spherical, ice non spherical 696 696 697 IF ( nrefl >ntetas ) THEN697 IF ( nrefl.GT. ntetas ) THEN 698 698 PRINT *,'Error in lidar_simulator, nrefl should be less then ',ntetas,' not',nrefl 699 699 STOP … … 711 711 ! 712 712 ! relative fraction of the opt. thick due to liquid or ice clouds 713 WHERE (tautot_S(:) >0.)713 WHERE (tautot_S(:) .GT. 0.) 714 714 frac_taucol_liq(:) = tautot_S_liq(:) / tautot_S(:) 715 715 frac_taucol_ice(:) = tautot_S_ice(:) / tautot_S(:) … … 733 733 DO it=1,ntetas 734 734 DO ny=1,nbtau-1 735 WHERE (tautot_S(:) >=tau(ny).AND.tautot_S(:)<=tau(ny+1))735 WHERE (tautot_S(:).GE.tau(ny).AND.tautot_S(:).LE.tau(ny+1)) 736 736 rlumA_mod(:,it) = aA(it,ny)*tautot_S(:) + bA(it,ny) 737 737 rlumB_mod(:,it) = aB(it,ny)*tautot_S(:) + bB(it,ny) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/m_mrgrnk.F90
r5081 r5095 33 33 IRNGT (1) = 1 34 34 Return 35 Case Default 36 Continue 35 37 End Select 36 38 ! … … 231 233 IRNGT (1) = 1 232 234 Return 235 Case Default 236 Continue 233 237 End Select 234 238 ! -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/math_lib.F90
r5086 r5095 34 34 35 35 ! ----- INPUTS ----- 36 real (kind=8), intent(in) :: x36 real*8, intent(in) :: x 37 37 38 38 ! ----- OUTPUTS ----- 39 real (kind=8):: gamma39 real*8 :: gamma 40 40 41 41 ! ----- INTERNAL ----- 42 real (kind=8):: pi,ga,z,r,gr43 real (kind=8):: g(26)42 real*8 :: pi,ga,z,r,gr 43 real*8 :: g(26) 44 44 integer :: k,m1,m 45 45 … … 124 124 125 125 ! ----- INPUTS ----- 126 real (kind=8), intent(in), dimension(:) :: f,s126 real*8, intent(in), dimension(:) :: f,s 127 127 integer, intent(in) :: i1, i2 128 128 129 129 ! ---- OUTPUTS ----- 130 real (kind=8) :: path_integral130 real*8 :: path_integral 131 131 132 132 ! ----- INTERNAL ----- 133 real (kind=8):: sumo, deltah, val134 integer (kind=4):: nelm, j135 integer (kind=4), dimension(i2-i1+1) :: idx136 real (kind=8), dimension(i2-i1+1) :: f_rev, s_rev133 real*8 :: sumo, deltah, val 134 integer*4 :: nelm, j 135 integer*4, dimension(i2-i1+1) :: idx 136 real*8, dimension(i2-i1+1) :: f_rev, s_rev 137 137 138 138 nelm = i2-i1+1 … … 273 273 exit 274 274 end if 275 END DO275 end do 276 276 277 277 if (lerror) then … … 316 316 end if 317 317 ilo = ilo + 1 318 END DO318 end do 319 319 320 320 ilo = max ( 2, ilo ) … … 326 326 end if 327 327 ihi = ihi - 1 328 END DO328 end do 329 329 330 330 ihi = min ( ihi, ntab - 1 ) … … 374 374 syl = x2 375 375 376 END DO376 end do 377 377 378 378 result = sum1 & -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/mod_cosp.F90
r5082 r5095 179 179 minp = minval(gbx%psfc) 180 180 maxp = maxval(gbx%psfc) 181 if (Npoints >1) seed=int((gbx%psfc-minp)/(maxp-minp)*100000) + 1181 if (Npoints .gt. 1) seed=int((gbx%psfc-minp)/(maxp-minp)*100000) + 1 182 182 ! Below it's how it was done in the original implementation of the ISCCP simulator. 183 183 ! The one above is better for offline data, when you may have packed data … … 414 414 if (sgx%frac_out (j,i,Nlevels+1-k) == I_LSC) frac_ls(j,k)=frac_ls(j,k)+1. 415 415 if (sgx%frac_out (j,i,Nlevels+1-k) == I_CVC) frac_cv(j,k)=frac_cv(j,k)+1. 416 if (sgx%prec_frac(j,i,Nlevels+1-k) ==1) prec_ls(j,k)=prec_ls(j,k)+1.417 if (sgx%prec_frac(j,i,Nlevels+1-k) ==2) prec_cv(j,k)=prec_cv(j,k)+1.418 if (sgx%prec_frac(j,i,Nlevels+1-k) ==3) then416 if (sgx%prec_frac(j,i,Nlevels+1-k) .eq. 1) prec_ls(j,k)=prec_ls(j,k)+1. 417 if (sgx%prec_frac(j,i,Nlevels+1-k) .eq. 2) prec_cv(j,k)=prec_cv(j,k)+1. 418 if (sgx%prec_frac(j,i,Nlevels+1-k) .eq. 3) then 419 419 prec_cv(j,k)=prec_cv(j,k)+1. 420 420 prec_ls(j,k)=prec_ls(j,k)+1. … … 501 501 do j=1,Npoints 502 502 !--------- Clouds ------- 503 if (frac_ls(j,k) /=0.) then503 if (frac_ls(j,k) .ne. 0.) then 504 504 sghydro%mr_hydro(j,:,k,I_LSCLIQ) = sghydro%mr_hydro(j,:,k,I_LSCLIQ)/frac_ls(j,k) 505 505 sghydro%mr_hydro(j,:,k,I_LSCICE) = sghydro%mr_hydro(j,:,k,I_LSCICE)/frac_ls(j,k) 506 506 endif 507 if (frac_cv(j,k) /=0.) then507 if (frac_cv(j,k) .ne. 0.) then 508 508 sghydro%mr_hydro(j,:,k,I_CVCLIQ) = sghydro%mr_hydro(j,:,k,I_CVCLIQ)/frac_cv(j,k) 509 509 sghydro%mr_hydro(j,:,k,I_CVCICE) = sghydro%mr_hydro(j,:,k,I_CVCICE)/frac_cv(j,k) … … 511 511 !--------- Precip ------- 512 512 if (gbx%use_precipitation_fluxes) then 513 if (prec_ls(j,k) /=0.) then513 if (prec_ls(j,k) .ne. 0.) then 514 514 gbx%rain_ls(j,k) = gbx%rain_ls(j,k)/prec_ls(j,k) 515 515 gbx%snow_ls(j,k) = gbx%snow_ls(j,k)/prec_ls(j,k) 516 516 gbx%grpl_ls(j,k) = gbx%grpl_ls(j,k)/prec_ls(j,k) 517 517 endif 518 if (prec_cv(j,k) /=0.) then518 if (prec_cv(j,k) .ne. 0.) then 519 519 gbx%rain_cv(j,k) = gbx%rain_cv(j,k)/prec_cv(j,k) 520 520 gbx%snow_cv(j,k) = gbx%snow_cv(j,k)/prec_cv(j,k) 521 521 endif 522 522 else 523 if (prec_ls(j,k) /=0.) then523 if (prec_ls(j,k) .ne. 0.) then 524 524 sghydro%mr_hydro(j,:,k,I_LSRAIN) = sghydro%mr_hydro(j,:,k,I_LSRAIN)/prec_ls(j,k) 525 525 sghydro%mr_hydro(j,:,k,I_LSSNOW) = sghydro%mr_hydro(j,:,k,I_LSSNOW)/prec_ls(j,k) 526 526 sghydro%mr_hydro(j,:,k,I_LSGRPL) = sghydro%mr_hydro(j,:,k,I_LSGRPL)/prec_ls(j,k) 527 527 endif 528 if (prec_cv(j,k) /=0.) then528 if (prec_cv(j,k) .ne. 0.) then 529 529 sghydro%mr_hydro(j,:,k,I_CVRAIN) = sghydro%mr_hydro(j,:,k,I_CVRAIN)/prec_cv(j,k) 530 530 sghydro%mr_hydro(j,:,k,I_CVSNOW) = sghydro%mr_hydro(j,:,k,I_CVSNOW)/prec_cv(j,k) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/mod_cosp_modis_simulator.F90
r5086 r5095 176 176 opticalThickness(i, j, k) = 0. 177 177 end if 178 END DO179 END DO180 END DO178 end do 179 end do 180 end do 181 181 182 182 ! … … 197 197 do i = 1, nSunlit 198 198 if(subCols%frac_out(sunlit(i), j, k) == I_CVC) opticalThickness(i, j, k) = gridBox%dtau_c(sunlit(i), k) 199 END DO200 END DO201 END DO199 end do 200 end do 201 end do 202 202 203 203 ! … … 220 220 retrievedPhase(i, :), retrievedCloudTopPressure(i, :), & 221 221 retrievedTau(i, :), retrievedSize(i, :)) 222 END DO222 end do 223 223 224 224 ! DJS2015: Call L3 modis simulator used by cospv2.0 -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/mod_cosp_radar.F90
r5082 r5095 53 53 54 54 real undef 55 real (kind=8), dimension(nprof,ngate), intent(in) :: hgt_matrix, p_matrix, &55 real*8, dimension(nprof,ngate), intent(in) :: hgt_matrix, p_matrix, & 56 56 t_matrix,rh_matrix 57 real (kind=8), dimension(hp%nhclass,nprof,ngate), intent(in) :: hm_matrix58 real (kind=8), dimension(hp%nhclass,nprof,ngate), intent(inout) :: re_matrix59 real (kind=8), dimension(hp%nhclass,nprof,ngate), intent(inout) :: Np_matrix57 real*8, dimension(hp%nhclass,nprof,ngate), intent(in) :: hm_matrix 58 real*8, dimension(hp%nhclass,nprof,ngate), intent(inout) :: re_matrix 59 real*8, dimension(hp%nhclass,nprof,ngate), intent(inout) :: Np_matrix 60 60 61 61 ! ----- OUTPUTS ----- 62 real (kind=8), dimension(nprof,ngate), intent(out) :: Ze_non,Ze_ray, &62 real*8, dimension(nprof,ngate), intent(out) :: Ze_non,Ze_ray, & 63 63 g_to_vol,dBZe,a_to_vol 64 64 ! ----- OPTIONAL ----- 65 real (kind=8), optional, dimension(nprof,ngate) :: &65 real*8, optional, dimension(nprof,ngate) :: & 66 66 g_to_vol_in,g_to_vol_out 67 67 end subroutine radar_simulator … … 86 86 nsizes ! num of discrete drop sizes 87 87 88 real (kind=8), dimension(:,:), allocatable :: &88 real*8, dimension(:,:), allocatable :: & 89 89 g_to_vol ! integrated atten due to gases, r>v (dB) 90 90 91 real (kind=8), dimension(:,:), allocatable :: &91 real*8, dimension(:,:), allocatable :: & 92 92 Ze_non, & ! radar reflectivity withOUT attenuation (dBZ) 93 93 Ze_ray, & ! Rayleigh reflectivity (dBZ) … … 100 100 rh_matrix !relative humidity (%) 101 101 102 real (kind=8), dimension(:,:,:), allocatable :: &102 real*8, dimension(:,:,:), allocatable :: & 103 103 hm_matrix, & ! hydrometeor mixing ratio (g kg^-1) 104 104 re_matrix, & ! effective radius (microns). Optional. 0 ==> use Np_matrix or defaults -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/mod_cosp_types.F90
r5082 r5095 1110 1110 1111 1111 1112 if(y%Nhydro /=N_HYDRO) then1112 if(y%Nhydro.ne.N_HYDRO) then 1113 1113 1114 1114 write(*,*) 'Number of hydrometeor input to subroutine', & -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/mod_llnl_stats.F90
r5082 r5095 119 119 do j=Nlevels,1,-1 !top->surf 120 120 sc_ratio = beta_tot(pr,i,j)/beta_mol(pr,j) 121 if ((sc_ratio <= s_att) .and. (flag_sat ==0)) flag_sat = j122 if (Ze_tot(pr,i,j) <-30.) then !radar can't detect cloud123 if ( (sc_ratio > s_cld) .or. (flag_sat ==j) ) then !lidar sense cloud121 if ((sc_ratio .le. s_att) .and. (flag_sat .eq. 0)) flag_sat = j 122 if (Ze_tot(pr,i,j) .lt. -30.) then !radar can't detect cloud 123 if ( (sc_ratio .gt. s_cld) .or. (flag_sat .eq. j) ) then !lidar sense cloud 124 124 lidar_only_freq_cloud(pr,j)=lidar_only_freq_cloud(pr,j)+1. !top->surf 125 125 flag_cld=1 … … 129 129 endif 130 130 enddo !levels 131 if (flag_cld ==1) tcc(pr)=tcc(pr)+1.131 if (flag_cld .eq. 1) tcc(pr)=tcc(pr)+1. 132 132 enddo !columns 133 133 enddo !points -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/mod_lmd_ipsl_stats.F90
r5082 r5095 148 148 do ic = 1, ncol 149 149 pnorm_c = pnorm(:,ic,:) 150 where ((pnorm_c <xmax) .and. (pmol<xmax) .and. (pmol>0.0 ))150 where ((pnorm_c.lt.xmax) .and. (pmol.lt.xmax) .and. (pmol.gt. 0.0 )) 151 151 x3d_c = pnorm_c/pmol 152 152 elsewhere … … 247 247 ! c 0- Initializations 248 248 ! c ------------------------------------------------------- 249 if ( Nbins <6) return249 if ( Nbins .lt. 6) return 250 250 251 251 srbval(1) = S_att … … 275 275 do i = 1, Npoints 276 276 if (x(i,k,j) /= undef) then 277 if ((x(i,k,j) >srbval_ext(ib-1)).and.(x(i,k,j)<=srbval_ext(ib))) &277 if ((x(i,k,j).gt.srbval_ext(ib-1)).and.(x(i,k,j).le.srbval_ext(ib))) & 278 278 cfad(i,ib,j) = cfad(i,ib,j) + 1.0 279 279 else … … 285 285 enddo 286 286 287 where (cfad /=undef) cfad = cfad / float(Ncolumns)287 where (cfad .ne. undef) cfad = cfad / float(Ncolumns) 288 288 289 289 ! c ------------------------------------------------------- … … 373 373 ! --------------------------------------------------------------- 374 374 375 if ( Ncat /=4 ) then375 if ( Ncat .ne. 4 ) then 376 376 print *,'Error in lmd_ipsl_stats.cosp_cldfrac, Ncat must be 4, not',Ncat 377 377 stop … … 423 423 424 424 ! cloud detection at subgrid-scale: 425 where ( (x(:,:,k) >S_cld) .and. (x(:,:,k)/=undef) )425 where ( (x(:,:,k).gt.S_cld) .and. (x(:,:,k).ne. undef) ) 426 426 cldy(:,:,k)=1.0 427 427 elsewhere … … 430 430 431 431 ! number of usefull sub-columns: 432 where ( (x(:,:,k) >S_att) .and. (x(:,:,k)/=undef) )432 where ( (x(:,:,k).gt.S_att) .and. (x(:,:,k).ne. undef) ) 433 433 srok(:,:,k)=1.0 434 434 elsewhere … … 513 513 ! Computation of the cloud fraction as a function of the temperature 514 514 ! instead of height, for ice,liquid and all clouds 515 if(srok(ip,ic,k) >0.)then515 if(srok(ip,ic,k).gt.0.)then 516 516 do itemp=1,Ntemp 517 if( (tmp(ip,k) >=tempmod(itemp)).and.(tmp(ip,k)<tempmod(itemp+1)) )then517 if( (tmp(ip,k).ge.tempmod(itemp)).and.(tmp(ip,k).lt.tempmod(itemp+1)) )then 518 518 lidarcldtempind(ip,itemp)=lidarcldtempind(ip,itemp)+1. 519 519 endif … … 521 521 endif 522 522 523 if(cldy(ip,ic,k) ==1.)then523 if(cldy(ip,ic,k).eq.1.)then 524 524 do itemp=1,Ntemp 525 if( (tmp(ip,k) >=tempmod(itemp)).and.(tmp(ip,k)<tempmod(itemp+1)) )then525 if( (tmp(ip,k).ge.tempmod(itemp)).and.(tmp(ip,k).lt.tempmod(itemp+1)) )then 526 526 lidarcldtemp(ip,itemp,1)=lidarcldtemp(ip,itemp,1)+1. 527 527 endif … … 532 532 iz=1 533 533 p1 = pplay(ip,k) 534 if ( p1 >0. .and. p1<(440.*100.)) then ! high clouds534 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high clouds 535 535 iz=3 536 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid clouds536 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid clouds 537 537 iz=2 538 538 endif … … 554 554 ! -- grid-box 3D cloud fraction 555 555 556 where ( nsub(:,:) >0.0 )556 where ( nsub(:,:).gt.0.0 ) 557 557 lidarcld(:,:) = lidarcld(:,:)/nsub(:,:) 558 558 elsewhere … … 573 573 enddo 574 574 enddo 575 where ( nsublayer(:,:) >0.0 )575 where ( nsublayer(:,:).gt.0.0 ) 576 576 cldlayer(:,:) = cldlayer(:,:)/nsublayer(:,:) 577 577 elsewhere … … 593 593 594 594 ! Avoid zero values 595 if( (cldy(i,ncol,nlev) ==1.) .and. (ATBperp(i,ncol,nlev)>0.) )then595 if( (cldy(i,ncol,nlev).eq.1.) .and. (ATBperp(i,ncol,nlev).gt.0.) )then 596 596 ! Computation of the ATBperp along the phase discrimination line 597 597 ATBperp_tmp = (ATB(i,ncol,nlev)**5)*alpha50 + (ATB(i,ncol,nlev)**4)*beta50 + & … … 604 604 !____________________________________________________________________________________________________ 605 605 ! 606 if( (ATBperp(i,ncol,nlev)-ATBperp_tmp) >=0. )then ! Ice clouds606 if( (ATBperp(i,ncol,nlev)-ATBperp_tmp).ge.0. )then ! Ice clouds 607 607 ! ICE with temperature above 273,15°K = Liquid (false ice) 608 if(tmp(i,nlev) >273.15)then ! Temperature above 273,15 K608 if(tmp(i,nlev).gt.273.15)then ! Temperature above 273,15 K 609 609 ! Liquid: False ice corrected by the temperature to Liquid 610 610 lidarcldphase(i,nlev,2)=lidarcldphase(i,nlev,2)+1. ! false ice detection ==> added to Liquid … … 613 613 ! to classify the phase cloud 614 614 cldlayphase(i,ncol,4,2) = 1. ! tot cloud 615 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud615 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 616 616 cldlayphase(i,ncol,3,2) = 1. 617 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud617 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 618 618 cldlayphase(i,ncol,2,2) = 1. 619 619 else ! low cloud … … 621 621 endif 622 622 cldlayphase(i,ncol,4,5) = 1. ! tot cloud 623 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud623 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 624 624 cldlayphase(i,ncol,3,5) = 1. 625 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud625 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 626 626 cldlayphase(i,ncol,2,5) = 1. 627 627 else ! low cloud … … 634 634 tmpi(i,ncol,nlev)=tmp(i,nlev) 635 635 cldlayphase(i,ncol,4,1) = 1. ! tot cloud 636 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud636 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 637 637 cldlayphase(i,ncol,3,1) = 1. 638 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud638 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 639 639 cldlayphase(i,ncol,2,1) = 1. 640 640 else ! low cloud … … 651 651 else ! Liquid clouds 652 652 ! Liquid with temperature above 231,15°K 653 if(tmp(i,nlev) >231.15)then653 if(tmp(i,nlev).gt.231.15)then 654 654 lidarcldphase(i,nlev,2)=lidarcldphase(i,nlev,2)+1. 655 655 tmpl(i,ncol,nlev)=tmp(i,nlev) 656 656 cldlayphase(i,ncol,4,2) = 1. ! tot cloud 657 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud657 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 658 658 cldlayphase(i,ncol,3,2) = 1. 659 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud659 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 660 660 cldlayphase(i,ncol,2,2) = 1. 661 661 else ! low cloud … … 670 670 ! to classify the phase cloud 671 671 cldlayphase(i,ncol,4,4) = 1. ! tot cloud 672 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud672 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 673 673 cldlayphase(i,ncol,3,4) = 1. 674 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud674 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 675 675 cldlayphase(i,ncol,2,4) = 1. 676 676 else ! low cloud … … 678 678 endif 679 679 cldlayphase(i,ncol,4,1) = 1. ! tot cloud 680 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud680 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 681 681 cldlayphase(i,ncol,3,1) = 1. 682 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud682 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 683 683 cldlayphase(i,ncol,2,1) = 1. 684 684 else ! low cloud … … 702 702 p1 = pplay(i,nlev) 703 703 704 if( (cldy(i,ncol,nlev) ==1.) .and. (ATBperp(i,ncol,nlev)>0.) )then704 if( (cldy(i,ncol,nlev).eq.1.) .and. (ATBperp(i,ncol,nlev).gt.0.) )then 705 705 ! Phase discrimination line : ATBperp = ATB^5*alpha50 + ATB^4*beta50 + ATB^3*gamma50 + ATB^2*delta50 706 706 ! + ATB*epsilon50 + zeta50 … … 715 715 ! 716 716 ! ICE with temperature above 273,15°K = Liquid (false ice) 717 if( (ATBperp(i,ncol,nlev)-ATBperp_tmp) >=0. )then ! Ice clouds718 if(tmp(i,nlev) >273.15)then717 if( (ATBperp(i,ncol,nlev)-ATBperp_tmp).ge.0. )then ! Ice clouds 718 if(tmp(i,nlev).gt.273.15)then 719 719 lidarcldphase(i,nlev,2)=lidarcldphase(i,nlev,2)+1. ! false ice ==> liq 720 720 tmpl(i,ncol,nlev)=tmp(i,nlev) … … 722 722 723 723 cldlayphase(i,ncol,4,2) = 1. ! tot cloud 724 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud724 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 725 725 cldlayphase(i,ncol,3,2) = 1. 726 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud726 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 727 727 cldlayphase(i,ncol,2,2) = 1. 728 728 else ! low cloud … … 731 731 732 732 cldlayphase(i,ncol,4,5) = 1. ! tot cloud 733 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud733 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 734 734 cldlayphase(i,ncol,3,5) = 1. 735 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud735 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 736 736 cldlayphase(i,ncol,2,5) = 1. 737 737 else ! low cloud … … 745 745 746 746 cldlayphase(i,ncol,4,1) = 1. ! tot cloud 747 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud747 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 748 748 cldlayphase(i,ncol,3,1) = 1. 749 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud749 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 750 750 cldlayphase(i,ncol,2,1) = 1. 751 751 else ! low cloud … … 762 762 else 763 763 ! Liquid with temperature above 231,15°K 764 if(tmp(i,nlev) >231.15)then764 if(tmp(i,nlev).gt.231.15)then 765 765 lidarcldphase(i,nlev,2)=lidarcldphase(i,nlev,2)+1. 766 766 tmpl(i,ncol,nlev)=tmp(i,nlev) 767 767 768 768 cldlayphase(i,ncol,4,2) = 1. ! tot cloud 769 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud769 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 770 770 cldlayphase(i,ncol,3,2) = 1. 771 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud771 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 772 772 cldlayphase(i,ncol,2,2) = 1. 773 773 else ! low cloud … … 782 782 783 783 cldlayphase(i,ncol,4,4) = 1. ! tot cloud 784 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud784 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 785 785 cldlayphase(i,ncol,3,4) = 1. 786 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud786 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 787 787 cldlayphase(i,ncol,2,4) = 1. 788 788 else ! low cloud … … 791 791 792 792 cldlayphase(i,ncol,4,1) = 1. ! tot cloud 793 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud793 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 794 794 cldlayphase(i,ncol,3,1) = 1. 795 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud795 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 796 796 cldlayphase(i,ncol,2,1) = 1. 797 797 else ! low cloud … … 805 805 806 806 ! Find the level of the highest cloud with SR>30 807 if(x(i,ncol,nlev) >S_cld_att)then ! SR > 30.807 if(x(i,ncol,nlev).gt.S_cld_att)then ! SR > 30. 808 808 toplvlsat=nlev-1 809 809 goto 99 … … 821 821 !____________________________________________________________________________________________________ 822 822 ! 823 if(toplvlsat /=0)then823 if(toplvlsat.ne.0)then 824 824 do nlev=toplvlsat,1,-1 825 825 p1 = pplay(i,nlev) 826 if(cldy(i,ncol,nlev) ==1.)then826 if(cldy(i,ncol,nlev).eq.1.)then 827 827 lidarcldphase(i,nlev,3)=lidarcldphase(i,nlev,3)+1. 828 828 tmpu(i,ncol,nlev)=tmp(i,nlev) 829 829 830 830 cldlayphase(i,ncol,4,3) = 1. ! tot cloud 831 if ( p1 >0. .and. p1<(440.*100.)) then ! high cloud831 if ( p1.gt.0. .and. p1.lt.(440.*100.)) then ! high cloud 832 832 cldlayphase(i,ncol,3,3) = 1. 833 else if(p1 >=(440.*100.) .and. p1<(680.*100.)) then ! mid cloud833 else if(p1.ge.(440.*100.) .and. p1.lt.(680.*100.)) then ! mid cloud 834 834 cldlayphase(i,ncol,2,3) = 1. 835 835 else ! low cloud … … 857 857 ! of the occurrences 858 858 lidarcldphasetmp(:,:)=lidarcldphase(:,:,1)+lidarcldphase(:,:,2); 859 WHERE (lidarcldphasetmp(:,:) >0.)859 WHERE (lidarcldphasetmp(:,:).gt. 0.) 860 860 lidarcldphase(:,:,6)=lidarcldphase(:,:,1)/lidarcldphasetmp(:,:) 861 861 ELSEWHERE … … 864 864 865 865 ! Compute Phase 3D Cloud Fraction 866 WHERE ( nsub(:,:) >0.0 )866 WHERE ( nsub(:,:).gt.0.0 ) 867 867 lidarcldphase(:,:,1)=lidarcldphase(:,:,1)/nsub(:,:) 868 868 lidarcldphase(:,:,2)=lidarcldphase(:,:,2)/nsub(:,:) … … 899 899 ! Compute the Ice percentage in cloud = ice/(ice+liq) 900 900 cldlayerphasetmp(:,:)=cldlayerphase(:,:,1)+cldlayerphase(:,:,2) 901 WHERE (cldlayerphasetmp(:,:) >0.)901 WHERE (cldlayerphasetmp(:,:).gt. 0.) 902 902 cldlayerphase(:,:,6)=cldlayerphase(:,:,1)/cldlayerphasetmp(:,:) 903 903 ELSEWHERE … … 906 906 907 907 do i=1,Nphase-1 908 WHERE ( cldlayerphasesum(:,:) >0.0 )908 WHERE ( cldlayerphasesum(:,:).gt.0.0 ) 909 909 cldlayerphase(:,:,i) = (cldlayerphase(:,:,i)/cldlayerphasesum(:,:)) * cldlayer(:,:) 910 910 ENDWHERE … … 917 917 checkcldlayerphase2=0. 918 918 919 if (cldlayerphasesum(i,iz) >0.0 )then919 if (cldlayerphasesum(i,iz).gt.0.0 )then 920 920 do ic=1,Nphase-3 921 921 checkcldlayerphase=checkcldlayerphase+cldlayerphase(i,iz,ic) 922 922 enddo 923 923 checkcldlayerphase2=cldlayer(i,iz)-checkcldlayerphase 924 if( (checkcldlayerphase2 >0.01).or.(checkcldlayerphase2<-0.01) ) print *, checkcldlayerphase,cldlayer(i,iz)924 if( (checkcldlayerphase2.gt.0.01).or.(checkcldlayerphase2.lt.-0.01) ) print *, checkcldlayerphase,cldlayer(i,iz) 925 925 926 926 endif … … 930 930 931 931 do i=1,Nphase-1 932 WHERE ( nsublayer(:,:) ==0.0 )932 WHERE ( nsublayer(:,:).eq.0.0 ) 933 933 cldlayerphase(:,:,i) = undef 934 934 ENDWHERE … … 942 942 do i=1,Npoints 943 943 do itemp=1,Ntemp 944 if(tmpi(i,ncol,nlev) >0.)then945 if( (tmpi(i,ncol,nlev) >=tempmod(itemp)).and.(tmpi(i,ncol,nlev)<tempmod(itemp+1)) )then944 if(tmpi(i,ncol,nlev).gt.0.)then 945 if( (tmpi(i,ncol,nlev).ge.tempmod(itemp)).and.(tmpi(i,ncol,nlev).lt.tempmod(itemp+1)) )then 946 946 lidarcldtemp(i,itemp,2)=lidarcldtemp(i,itemp,2)+1. 947 947 endif 948 elseif(tmpl(i,ncol,nlev) >0.)then949 if( (tmpl(i,ncol,nlev) >=tempmod(itemp)).and.(tmpl(i,ncol,nlev)<tempmod(itemp+1)) )then948 elseif(tmpl(i,ncol,nlev).gt.0.)then 949 if( (tmpl(i,ncol,nlev).ge.tempmod(itemp)).and.(tmpl(i,ncol,nlev).lt.tempmod(itemp+1)) )then 950 950 lidarcldtemp(i,itemp,3)=lidarcldtemp(i,itemp,3)+1. 951 951 endif 952 elseif(tmpu(i,ncol,nlev) >0.)then953 if( (tmpu(i,ncol,nlev) >=tempmod(itemp)).and.(tmpu(i,ncol,nlev)<tempmod(itemp+1)) )then952 elseif(tmpu(i,ncol,nlev).gt.0.)then 953 if( (tmpu(i,ncol,nlev).ge.tempmod(itemp)).and.(tmpu(i,ncol,nlev).lt.tempmod(itemp+1)) )then 954 954 lidarcldtemp(i,itemp,4)=lidarcldtemp(i,itemp,4)+1. 955 955 endif … … 965 965 checktemp=lidarcldtemp(i,itemp,2)+lidarcldtemp(i,itemp,3)+lidarcldtemp(i,itemp,4) 966 966 967 if(checktemp /=lidarcldtemp(i,itemp,1))then967 if(checktemp.NE.lidarcldtemp(i,itemp,1))then 968 968 print *, i,itemp 969 969 print *, lidarcldtemp(i,itemp,1:4) … … 984 984 985 985 do i=1,4 986 WHERE(lidarcldtempind(:,:) >0.)986 WHERE(lidarcldtempind(:,:).gt.0.) 987 987 lidarcldtemp(:,:,i) = lidarcldtemp(:,:,i)/lidarcldtempind(:,:) 988 988 ELSEWHERE … … 1046 1046 do k=1,Nlevels 1047 1047 ! Cloud detection at subgrid-scale: 1048 where ( (x(:,:,k) > S_cld) .and. (x(:,:,k) /=undef) )1048 where ( (x(:,:,k) .gt. S_cld) .and. (x(:,:,k) .ne. undef) ) 1049 1049 cldy(:,:,k)=1.0 1050 1050 elsewhere … … 1052 1052 endwhere 1053 1053 ! Fully attenuated layer detection at subgrid-scale: 1054 where ( (x(:,:,k) > 0.0) .and. (x(:,:,k) < S_att_opaq) .and. (x(:,:,k) /=undef) )1054 where ( (x(:,:,k) .gt. 0.0) .and. (x(:,:,k) .lt. S_att_opaq) .and. (x(:,:,k) .ne. undef) ) 1055 1055 cldyopaq(:,:,k)=1.0 1056 1056 elsewhere … … 1059 1059 1060 1060 ! Number of useful sub-column layers: 1061 where ( (x(:,:,k) > S_att) .and. (x(:,:,k) /=undef) )1061 where ( (x(:,:,k) .gt. S_att) .and. (x(:,:,k) .ne. undef) ) 1062 1062 srok(:,:,k)=1.0 1063 1063 elsewhere … … 1065 1065 endwhere 1066 1066 ! Number of useful sub-columns layers for z_opaque 3D fraction: 1067 where ( (x(:,:,k) > 0.0) .and. (x(:,:,k) /=undef) )1067 where ( (x(:,:,k) .gt. 0.0) .and. (x(:,:,k) .ne. undef) ) 1068 1068 srokopaq(:,:,k)=1.0 1069 1069 elsewhere … … 1098 1098 1099 1099 ! Declaring non-opaque cloudy profiles as thin cloud profiles 1100 if ( (cldlay(ip,ic,4) == 1.0) .and. (cldlay(ip,ic,1) ==0.0) ) then1100 if ( (cldlay(ip,ic,4) .eq. 1.0) .and. (cldlay(ip,ic,1) .eq. 0.0) ) then 1101 1101 cldlay(ip,ic,2) = 1.0 1102 1102 endif … … 1105 1105 1106 1106 ! Opaque cloud profiles 1107 if ( cldlay(ip,ic,1) ==1.0 ) then1107 if ( cldlay(ip,ic,1) .eq. 1.0 ) then 1108 1108 zopac = 0.0 1109 1109 do k=2,Nlevels 1110 1110 ! Declaring opaque cloud fraction and z_opaque altitude for 3D and 2D variables 1111 if ( (cldy(ip,ic,k) == 1.0) .and. (zopac ==0.0) ) then1111 if ( (cldy(ip,ic,k) .eq. 1.0) .and. (zopac .eq. 0.0) ) then 1112 1112 lidarcldtype(ip,k-1,3) = lidarcldtype(ip,k-1,3) + 1.0 1113 1113 cldlay(ip,ic,3) = vgrid_z(k-1) !z_opaque altitude … … 1115 1115 zopac = 1.0 1116 1116 endif 1117 if ( cldy(ip,ic,k) ==1.0 ) then1117 if ( cldy(ip,ic,k) .eq. 1.0 ) then 1118 1118 lidarcldtype(ip,k,1) = lidarcldtype(ip,k,1) + 1.0 1119 1119 endif … … 1122 1122 1123 1123 ! Thin cloud profiles 1124 if ( cldlay(ip,ic,2) ==1.0 ) then1124 if ( cldlay(ip,ic,2) .eq. 1.0 ) then 1125 1125 do k=1,Nlevels 1126 1126 ! Declaring thin cloud fraction for 3D variable 1127 if ( cldy(ip,ic,k) ==1.0 ) then1127 if ( cldy(ip,ic,k) .eq. 1.0 ) then 1128 1128 lidarcldtype(ip,k,2) = lidarcldtype(ip,k,2) + 1.0 1129 1129 endif … … 1135 1135 1136 1136 ! 3D cloud types fraction (opaque=1 and thin=2) 1137 where ( nsub(:,:) >0.0 )1137 where ( nsub(:,:) .gt. 0.0 ) 1138 1138 lidarcldtype(:,:,1) = lidarcldtype(:,:,1)/nsub(:,:) 1139 1139 lidarcldtype(:,:,2) = lidarcldtype(:,:,2)/nsub(:,:) … … 1143 1143 endwhere 1144 1144 ! 3D z_opaque fraction (=3) 1145 where ( nsubopaq(:,:) >0.0 )1145 where ( nsubopaq(:,:) .gt. 0.0 ) 1146 1146 lidarcldtype(:,:,3) = lidarcldtype(:,:,3)/nsubopaq(:,:) 1147 1147 elsewhere … … 1152 1152 do ip = 1, Npoints 1153 1153 do k = Nlevels-1, 1, -1 1154 if ( lidarcldtype(ip,k,3) /=undef ) then1154 if ( lidarcldtype(ip,k,3) .ne. undef ) then 1155 1155 lidarcldtype(ip,k,4) = lidarcldtype(ip,k+1,4) + lidarcldtype(ip,k,3) 1156 1156 endif 1157 1157 enddo 1158 1158 enddo 1159 where ( nsubopaq(:,:) ==0.0 )1159 where ( nsubopaq(:,:) .eq. 0.0 ) 1160 1160 lidarcldtype(:,:,4) = undef 1161 1161 endwhere … … 1169 1169 enddo 1170 1170 enddo 1171 where (nsublayer(:,:) >0.0)1171 where (nsublayer(:,:) .gt. 0.0) 1172 1172 cldtype(:,:) = cldtype(:,:)/nsublayer(:,:) 1173 1173 elsewhere -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/mod_modis_sim.F90
r5086 r5095 331 331 retrievedTau(i) = R_UNDEF 332 332 end if 333 END DO333 end do 334 334 where((retrievedSize(:) < 0.).and.(retrievedSize(:) /= R_UNDEF)) retrievedSize(:) = 1.0e-06*re_fill 335 335 … … 666 666 do ij=2,nbin1+1 667 667 do ik=2,nbin2+1 668 jointHist(ij-1,ik-1)=count(var1 >= bin1(ij-1) .and. var1 <bin1(ij) .and. &669 var2 >= bin2(ik-1) .and. var2 < bin2(ik))668 jointHist(ij-1,ik-1)=count(var1 .ge. bin1(ij-1) .and. var1 .lt. bin1(ij) .and. & 669 var2 .ge. bin2(ik-1) .and. var2 .lt. bin2(ik)) 670 670 enddo 671 671 enddo … … 802 802 tauMask(:, :, i) = .false. 803 803 end where 804 END DO804 end do 805 805 806 806 do i = 1, numPressureHistogramBins … … 811 811 pressureMask(:, :, i) = .false. 812 812 end where 813 END DO813 end do 814 814 815 815 do i = 1, numPressureHistogramBins … … 817 817 Optical_Thickness_vs_Cloud_Top_Pressure(:, j, i) = & 818 818 real(count(tauMask(:, :, j) .and. pressureMask(:, :, i), dim = 2)) / real(nSubcols) 819 END DO820 END DO819 end do 820 end do 821 821 822 822 end subroutine modis_L3_simulator … … 851 851 end if 852 852 if(totalTau >= tauLimit) exit 853 END DO853 end do 854 854 cloud_top_pressure = totalProduct/totalTau 855 855 end function cloud_top_pressure … … 877 877 end if 878 878 if(totalTau >= tauLimit) exit 879 END DO879 end do 880 880 weight_by_extinction = totalProduct/totalTau 881 881 end function weight_by_extinction … … 1114 1114 do i = 1, size(cloudIndicies) 1115 1115 call two_stream(tau(cloudIndicies(i)), g(cloudIndicies(i)), w0(cloudIndicies(i)), Refl(i), Trans(i)) 1116 END DO1116 end do 1117 1117 1118 1118 call adding_doubling(Refl(:), Trans(:), Refl_tot, Trans_tot) … … 1292 1292 Refl_cumulative(i) = Refl_cumulative(i-1) + Refl(i)*(Tran_cumulative(i-1)**2)/(1 - Refl_cumulative(i-1) * Refl(i)) 1293 1293 Tran_cumulative(i) = (Tran_cumulative(i-1)*Tran(i)) / (1 - Refl_cumulative(i-1) * Refl(i)) 1294 END DO1294 end do 1295 1295 1296 1296 Refl_tot = Refl_cumulative(size(Refl)) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/optics_lib.F90
r5086 r5095 38 38 39 39 ! ----- INPUTS ----- 40 real (kind=8), intent(in) :: freq,tk40 real*8, intent(in) :: freq,tk 41 41 42 42 ! ----- OUTPUTS ----- 43 real (kind=8), intent(out) :: n_r, n_i43 real*8, intent(out) :: n_r, n_i 44 44 45 45 ! ----- INTERNAL ----- 46 real (kind=8)ld,es,ei,a,ls,sg,tm1,cos1,sin147 real (kind=8)e_r,e_i48 real (kind=8)pi49 real (kind=8)tc50 complex (kind=8)e_comp, sq46 real*8 ld,es,ei,a,ls,sg,tm1,cos1,sin1 47 real*8 e_r,e_i 48 real*8 pi 49 real*8 tc 50 complex*16 e_comp, sq 51 51 52 52 tc = tk - 273.15 … … 102 102 103 103 ! ----- INPUTS ----- 104 real (kind=8), intent(in) :: freq, t104 real*8, intent(in) :: freq, t 105 105 106 106 ! ----- OUTPUTS ----- 107 real (kind=8), intent(out) :: n_r,n_i107 real*8, intent(out) :: n_r,n_i 108 108 109 109 ! Parameters: 110 integer (kind=2):: i,lt1,lt2,nwl,nwlt110 integer*2 :: i,lt1,lt2,nwl,nwlt 111 111 parameter(nwl=468,nwlt=62) 112 112 113 real (kind=8):: alam,cutice,pi,t1,t2,wlmax,wlmin, &113 real*8 :: alam,cutice,pi,t1,t2,wlmax,wlmin, & 114 114 x,x1,x2,y,y1,y2,ylo,yhi,tk 115 115 116 real (kind=8):: &116 real*8 :: & 117 117 tabim(nwl),tabimt(nwlt,4),tabre(nwl),tabret(nwlt,4),temref(4), & 118 118 wl(nwl),wlt(nwlt) … … 519 519 520 520 ! // region from 0.045 microns to 167.0 microns - no temperature depend 521 do i=2,nwl 522 if(alam < wl(i)) continue 523 enddo 521 524 x1=log(wl(i-1)) 522 525 x2=log(wl(i)) … … 536 539 if(tk > temref(1)) tk=temref(1) 537 540 if(tk < temref(4)) tk=temref(4) 538 do i=2,4539 if(tk >=temref(i)) go to 12540 END DO541 do 11 i=2,4 542 if(tk.ge.temref(i)) go to 12 543 11 continue 541 544 12 lt1=i 542 545 lt2=i-1 543 do i=2,nwlt544 if(alam <=wlt(i)) go to 14545 END DO546 do 13 i=2,nwlt 547 if(alam.le.wlt(i)) go to 14 548 13 continue 546 549 14 x1=log(wlt(i-1)) 547 550 x2=log(wlt(i)) … … 583 586 Subroutine MieInt(Dx, SCm, Inp, Dqv, Dqxt, Dqsc, Dbsc, Dg, Xs1, Xs2, DPh, Error) 584 587 585 Integer (kind=2)Imaxx588 Integer * 2 Imaxx 586 589 Parameter (Imaxx = 12000) 587 Real (kind=4)RIMax ! largest real part of refractive index590 Real * 4 RIMax ! largest real part of refractive index 588 591 Parameter (RIMax = 2.5) 589 Real (kind=4)IRIMax ! largest imaginary part of refractive index592 Real * 4 IRIMax ! largest imaginary part of refractive index 590 593 Parameter (IRIMax = -2) 591 Integer (kind=2)Itermax594 Integer * 2 Itermax 592 595 Parameter (Itermax = 12000 * 2.5) 593 596 ! must be large enough to cope with the 594 597 ! largest possible nmx = x * abs(scm) + 15 595 598 ! or nmx = Dx + 4.05*Dx**(1./3.) + 2.0 596 Integer (kind=2)Imaxnp599 Integer * 2 Imaxnp 597 600 Parameter (Imaxnp = 10000) ! Change this as required 598 601 ! INPUT 599 Real (kind=8)Dx600 Complex (kind=8)SCm601 Integer (kind=4)Inp602 Real (kind=8)Dqv(Inp)602 Real * 8 Dx 603 Complex * 16 SCm 604 Integer * 4 Inp 605 Real * 8 Dqv(Inp) 603 606 ! OUTPUT 604 Complex (kind=8)Xs1(InP)605 Complex (kind=8)Xs2(InP)606 Real (kind=8)Dqxt607 Real (kind=8)Dqsc608 Real (kind=8)Dg609 Real (kind=8)Dbsc610 Real (kind=8)DPh(InP)611 Integer (kind=4)Error607 Complex * 16 Xs1(InP) 608 Complex * 16 Xs2(InP) 609 Real * 8 Dqxt 610 Real * 8 Dqsc 611 Real * 8 Dg 612 Real * 8 Dbsc 613 Real * 8 DPh(InP) 614 Integer * 4 Error 612 615 ! LOCAL 613 Integer (kind=2)I614 Integer (kind=2)NStop615 Integer (kind=2)NmX616 Integer (kind=4)N ! N*N > 32767 ie N > 181617 Integer (kind=4)Inp2618 Real (kind=8)Chi,Chi0,Chi1619 Real (kind=8)APsi,APsi0,APsi1620 Real (kind=8)Pi0(Imaxnp)621 Real (kind=8)Pi1(Imaxnp)622 Real (kind=8)Taun(Imaxnp)623 Real (kind=8)Psi,Psi0,Psi1624 Complex (kind=4)Ir625 Complex (kind=8)Cm626 Complex (kind=8)A,ANM1,APB627 Complex (kind=8)B,BNM1,AMB628 Complex (kind=8)D(Itermax)629 Complex (kind=8)Sp(Imaxnp)630 Complex (kind=8)Sm(Imaxnp)631 Complex (kind=8)Xi,Xi0,Xi1632 Complex (kind=8)Y616 Integer * 2 I 617 Integer * 2 NStop 618 Integer * 2 NmX 619 Integer * 4 N ! N*N > 32767 ie N > 181 620 Integer * 4 Inp2 621 Real * 8 Chi,Chi0,Chi1 622 Real * 8 APsi,APsi0,APsi1 623 Real * 8 Pi0(Imaxnp) 624 Real * 8 Pi1(Imaxnp) 625 Real * 8 Taun(Imaxnp) 626 Real * 8 Psi,Psi0,Psi1 627 Complex * 8 Ir 628 Complex * 16 Cm 629 Complex * 16 A,ANM1,APB 630 Complex * 16 B,BNM1,AMB 631 Complex * 16 D(Itermax) 632 Complex * 16 Sp(Imaxnp) 633 Complex * 16 Sm(Imaxnp) 634 Complex * 16 Xi,Xi0,Xi1 635 Complex * 16 Y 633 636 ! ACCELERATOR VARIABLES 634 Integer (kind=2)Tnp1635 Integer (kind=2)Tnm1636 Real (kind=8)Dn637 Real (kind=8)Rnx638 Real (kind=8)S(Imaxnp)639 Real (kind=8)T(Imaxnp)640 Real (kind=8)Turbo641 Real (kind=8)A2642 Complex (kind=8)A1637 Integer * 2 Tnp1 638 Integer * 2 Tnm1 639 Real * 8 Dn 640 Real * 8 Rnx 641 Real * 8 S(Imaxnp) 642 Real * 8 T(Imaxnp) 643 Real * 8 Turbo 644 Real * 8 A2 645 Complex * 16 A1 643 646 644 If ((Dx >Imaxx) .Or. (InP>ImaxNP)) Then647 If ((Dx.Gt.Imaxx) .Or. (InP.Gt.ImaxNP)) Then 645 648 Error = 1 646 649 Return … … 649 652 Ir = 1 / Cm 650 653 Y = Dx * Cm 651 If (Dx <0.02) Then654 If (Dx.Lt.0.02) Then 652 655 NStop = 2 653 656 Else 654 If (Dx <=8.0) Then657 If (Dx.Le.8.0) Then 655 658 NStop = Dx + 4.00*Dx**(1./3.) + 2.0 656 659 Else 657 If (Dx <4200.0) Then660 If (Dx.Lt. 4200.0) Then 658 661 NStop = Dx + 4.05*Dx**(1./3.) + 2.0 659 662 Else … … 663 666 End If 664 667 NmX = Max(Real(NStop),Real(Abs(Y))) + 15. 665 If (Nmx >Itermax) then668 If (Nmx .gt. Itermax) then 666 669 Error = 1 667 670 Return … … 706 709 Dqxt = Tnp1 * Dble(A + B) + Dqxt 707 710 Dqsc = Tnp1 * (A*Conjg(A) + B*Conjg(B)) + Dqsc 708 If (N >1) then711 If (N.Gt.1) then 709 712 Dg = Dg + (dN*dN - 1) * Dble(ANM1*Conjg(A) + BNM1 * Conjg(B)) / dN + TNM1 * Dble(ANM1*Conjg(BNM1)) / (dN*dN - dN) 710 713 End If … … 714 717 AMB = A2 * (A - B) 715 718 Do I = 1,Inp2 716 If (I >Inp) Then719 If (I.GT.Inp) Then 717 720 S(I) = -Pi1(I) 718 721 Else … … 733 736 Xi1 = Dcmplx(APsi1,Chi1) 734 737 End Do 735 If (Dg >0) Dg = 2 * Dg / Dqsc738 If (Dg .GT.0) Dg = 2 * Dg / Dqsc 736 739 Dqsc = 2 * Dqsc / Dx**2 737 740 Dqxt = 2 * Dqxt / Dx**2 -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/pf_to_mr.F
r5082 r5095 107 107 mx_rain_cv(j,ibox,ilev)=0. 108 108 mx_snow_cv(j,ibox,ilev)=0. 109 if ((prec_frac(j,ibox,ilev) ==1.) .or.110 & (prec_frac(j,ibox,ilev) == 3.)) then109 if ((prec_frac(j,ibox,ilev) .eq. 1.) .or. 110 & (prec_frac(j,ibox,ilev) .eq. 3.)) then 111 111 mx_rain_ls(j,ibox,ilev)= 112 112 & (term4r_ls**(1./(1.+br/4.)))/rho … … 116 116 & (term4g_ls**(1./(1.+bg/4.)))/rho 117 117 endif 118 if ((prec_frac(j,ibox,ilev) ==2.) .or.119 & (prec_frac(j,ibox,ilev) == 3.)) then118 if ((prec_frac(j,ibox,ilev) .eq. 2.) .or. 119 & (prec_frac(j,ibox,ilev) .eq. 3.)) then 120 120 mx_rain_cv(j,ibox,ilev)= 121 121 & (term4r_cv**(1./(1.+br/4.)))/rho -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/phys_cosp.F90
r5082 r5095 193 193 cfg%Lrttov_sim,cfg%Lstats 194 194 195 if (overlaplmdz /=overlap) then195 if (overlaplmdz.ne.overlap) then 196 196 print*,'Attention overlaplmdz different de overlap lu dans namelist ' 197 197 endif … … 201 201 202 202 !!! Ici on modifie les cles logiques pour les outputs selon les champs actives dans les .xml 203 if ((itap >1).and.(first_write))then203 if ((itap.gt.1).and.(first_write))then 204 204 205 205 IF (using_xios) call read_xiosfieldactive(cfg) … … 268 268 269 269 do ip = 1, Npoints 270 if (fracTerLic(ip) >=0.5) then270 if (fracTerLic(ip).ge.0.5) then 271 271 gbx%land(ip) = 1. 272 272 else -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/prec_scops.F
r5082 r5095 55 55 56 56 cv_col = 0.05*ncol 57 if (cv_col ==0) cv_col=157 if (cv_col .eq. 0) cv_col=1 58 58 59 59 do ilev=1,nlev … … 72 72 flag_cv=0 73 73 do ilev=1,nlev 74 if (frac_out(j,ibox,ilev) == 1) then74 if (frac_out(j,ibox,ilev) .eq. 1) then 75 75 flag_ls=1 76 76 endif 77 if (frac_out(j,ibox,ilev) == 2) then77 if (frac_out(j,ibox,ilev) .eq. 2) then 78 78 flag_cv=1 79 79 endif 80 80 enddo !loop over nlev 81 if (flag_ls ==1) then81 if (flag_ls .eq. 1) then 82 82 frac_out_ls(j,ibox)=1 83 83 endif 84 if (flag_cv ==1) then84 if (flag_cv .eq. 1) then 85 85 frac_out_cv(j,ibox)=1 86 86 endif … … 93 93 flag_cv=0 94 94 95 if (ls_p_rate(j,1) > 0.) then95 if (ls_p_rate(j,1) .gt. 0.) then 96 96 do ibox=1,ncol ! possibility ONE 97 if (frac_out(j,ibox,1) == 1) then97 if (frac_out(j,ibox,1) .eq. 1) then 98 98 prec_frac(j,ibox,1) = 1 99 99 flag_ls=1 100 100 endif 101 101 enddo ! loop over ncol 102 if (flag_ls ==0) then ! possibility THREE102 if (flag_ls .eq. 0) then ! possibility THREE 103 103 do ibox=1,ncol 104 if (frac_out(j,ibox,2) == 1) then104 if (frac_out(j,ibox,2) .eq. 1) then 105 105 prec_frac(j,ibox,1) = 1 106 106 flag_ls=1 … … 108 108 enddo ! loop over ncol 109 109 endif 110 if (flag_ls ==0) then ! possibility Four111 do ibox=1,ncol 112 if (frac_out_ls(j,ibox) == 1) then110 if (flag_ls .eq. 0) then ! possibility Four 111 do ibox=1,ncol 112 if (frac_out_ls(j,ibox) .eq. 1) then 113 113 prec_frac(j,ibox,1) = 1 114 114 flag_ls=1 … … 116 116 enddo ! loop over ncol 117 117 endif 118 if (flag_ls ==0) then ! possibility Five118 if (flag_ls .eq. 0) then ! possibility Five 119 119 do ibox=1,ncol 120 120 ! prec_frac(j,1:ncol,1) = 1 … … 125 125 ! There is large scale precipitation 126 126 127 if (cv_p_rate(j,1) > 0.) then127 if (cv_p_rate(j,1) .gt. 0.) then 128 128 do ibox=1,ncol ! possibility ONE 129 if (frac_out(j,ibox,1) == 2) then130 if (prec_frac(j,ibox,1) ==0) then129 if (frac_out(j,ibox,1) .eq. 2) then 130 if (prec_frac(j,ibox,1) .eq. 0) then 131 131 prec_frac(j,ibox,1) = 2 132 132 else … … 136 136 endif 137 137 enddo ! loop over ncol 138 if (flag_cv ==0) then ! possibility THREE139 do ibox=1,ncol 140 if (frac_out(j,ibox,2) == 2) then141 if (prec_frac(j,ibox,1) ==0) then138 if (flag_cv .eq. 0) then ! possibility THREE 139 do ibox=1,ncol 140 if (frac_out(j,ibox,2) .eq. 2) then 141 if (prec_frac(j,ibox,1) .eq. 0) then 142 142 prec_frac(j,ibox,1) = 2 143 143 else … … 148 148 enddo ! loop over ncol 149 149 endif 150 if (flag_cv ==0) then ! possibility Four151 do ibox=1,ncol 152 if (frac_out_cv(j,ibox) == 1) then153 if (prec_frac(j,ibox,1) ==0) then150 if (flag_cv .eq. 0) then ! possibility Four 151 do ibox=1,ncol 152 if (frac_out_cv(j,ibox) .eq. 1) then 153 if (prec_frac(j,ibox,1) .eq. 0) then 154 154 prec_frac(j,ibox,1) = 2 155 155 else … … 160 160 enddo ! loop over ncol 161 161 endif 162 if (flag_cv ==0) then ! possibility Five162 if (flag_cv .eq. 0) then ! possibility Five 163 163 do ibox=1,cv_col 164 if (prec_frac(j,ibox,1) ==0) then164 if (prec_frac(j,ibox,1) .eq. 0) then 165 165 prec_frac(j,ibox,1) = 2 166 166 else … … 183 183 flag_cv=0 184 184 185 if (ls_p_rate(j,ilev) > 0.) then185 if (ls_p_rate(j,ilev) .gt. 0.) then 186 186 do ibox=1,ncol ! possibility ONE&TWO 187 if ((frac_out(j,ibox,ilev) == 1) .or.188 & ((prec_frac(j,ibox,ilev-1) == 1)189 & .or. (prec_frac(j,ibox,ilev-1) == 3))) then187 if ((frac_out(j,ibox,ilev) .eq. 1) .or. 188 & ((prec_frac(j,ibox,ilev-1) .eq. 1) 189 & .or. (prec_frac(j,ibox,ilev-1) .eq. 3))) then 190 190 prec_frac(j,ibox,ilev) = 1 191 191 flag_ls=1 192 192 endif 193 193 enddo ! loop over ncol 194 if ((flag_ls == 0) .and. (ilev <nlev)) then ! possibility THREE195 do ibox=1,ncol 196 if (frac_out(j,ibox,ilev+1) == 1) then194 if ((flag_ls .eq. 0) .and. (ilev .lt. nlev)) then ! possibility THREE 195 do ibox=1,ncol 196 if (frac_out(j,ibox,ilev+1) .eq. 1) then 197 197 prec_frac(j,ibox,ilev) = 1 198 198 flag_ls=1 … … 200 200 enddo ! loop over ncol 201 201 endif 202 if (flag_ls ==0) then ! possibility Four203 do ibox=1,ncol 204 if (frac_out_ls(j,ibox) == 1) then202 if (flag_ls .eq. 0) then ! possibility Four 203 do ibox=1,ncol 204 if (frac_out_ls(j,ibox) .eq. 1) then 205 205 prec_frac(j,ibox,ilev) = 1 206 206 flag_ls=1 … … 208 208 enddo ! loop over ncol 209 209 endif 210 if (flag_ls ==0) then ! possibility Five210 if (flag_ls .eq. 0) then ! possibility Five 211 211 do ibox=1,ncol 212 212 ! prec_frac(j,1:ncol,ilev) = 1 … … 216 216 endif ! There is large scale precipitation 217 217 218 if (cv_p_rate(j,ilev) > 0.) then218 if (cv_p_rate(j,ilev) .gt. 0.) then 219 219 do ibox=1,ncol ! possibility ONE&TWO 220 if ((frac_out(j,ibox,ilev) == 2) .or.221 & ((prec_frac(j,ibox,ilev-1) == 2)222 & .or. (prec_frac(j,ibox,ilev-1) == 3))) then223 if (prec_frac(j,ibox,ilev) ==0) then220 if ((frac_out(j,ibox,ilev) .eq. 2) .or. 221 & ((prec_frac(j,ibox,ilev-1) .eq. 2) 222 & .or. (prec_frac(j,ibox,ilev-1) .eq. 3))) then 223 if (prec_frac(j,ibox,ilev) .eq. 0) then 224 224 prec_frac(j,ibox,ilev) = 2 225 225 else … … 229 229 endif 230 230 enddo ! loop over ncol 231 if ((flag_cv == 0) .and. (ilev <nlev)) then ! possibility THREE232 do ibox=1,ncol 233 if (frac_out(j,ibox,ilev+1) == 2) then234 if (prec_frac(j,ibox,ilev) ==0) then231 if ((flag_cv .eq. 0) .and. (ilev .lt. nlev)) then ! possibility THREE 232 do ibox=1,ncol 233 if (frac_out(j,ibox,ilev+1) .eq. 2) then 234 if (prec_frac(j,ibox,ilev) .eq. 0) then 235 235 prec_frac(j,ibox,ilev) = 2 236 236 else … … 241 241 enddo ! loop over ncol 242 242 endif 243 if (flag_cv ==0) then ! possibility Four244 do ibox=1,ncol 245 if (frac_out_cv(j,ibox) == 1) then246 if (prec_frac(j,ibox,ilev) ==0) then243 if (flag_cv .eq. 0) then ! possibility Four 244 do ibox=1,ncol 245 if (frac_out_cv(j,ibox) .eq. 1) then 246 if (prec_frac(j,ibox,ilev) .eq. 0) then 247 247 prec_frac(j,ibox,ilev) = 2 248 248 else … … 253 253 enddo ! loop over ncol 254 254 endif 255 if (flag_cv == 0) then ! possibility Five255 if (flag_cv .eq. 0) then ! possibility Five 256 256 do ibox=1,cv_col 257 if (prec_frac(j,ibox,ilev) ==0) then257 if (prec_frac(j,ibox,ilev) .eq. 0) then 258 258 prec_frac(j,ibox,ilev) = 2 259 259 else -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/predict_mom07.F90
r5082 r5095 7 7 implicit none 8 8 9 real (kind=8):: a1,a2,a3,b1,b2,b3,c1,c2,c310 real (kind=8):: m2,tc,n,m,a_,b_,c_,A,B,C,n29 real*8 :: a1,a2,a3,b1,b2,b3,c1,c2,c3 10 real*8 :: m2,tc,n,m,a_,b_,c_,A,B,C,n2 11 11 12 12 a1= 13.6078 … … 30 30 31 31 ! predict m from m2 and tc 32 if(m2 /=-9999) then32 if(m2.ne.-9999) then 33 33 m=A*exp(B*tc)*m2**C 34 34 endif 35 35 ! get m2 if mass-dimension relationship not proportional to D**2 36 if(m2 ==-9999) then36 if(m2.eq.-9999) then 37 37 m2=(m/(A*exp(B*tc)))**(1.0/C) 38 38 endif -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/radar_simulator.F90
r5082 r5095 91 91 92 92 real undef 93 real (kind=8), dimension(nprof,ngate), intent(in) :: &93 real*8, dimension(nprof,ngate), intent(in) :: & 94 94 hgt_matrix, p_matrix,t_matrix,rh_matrix 95 95 96 real (kind=8), dimension(hp%nhclass,nprof,ngate), intent(in) :: hm_matrix97 real (kind=8), dimension(hp%nhclass,nprof,ngate), intent(inout) :: re_matrix98 real (kind=8), dimension(hp%nhclass,nprof,ngate), intent(inout) :: Np_matrix96 real*8, dimension(hp%nhclass,nprof,ngate), intent(in) :: hm_matrix 97 real*8, dimension(hp%nhclass,nprof,ngate), intent(inout) :: re_matrix 98 real*8, dimension(hp%nhclass,nprof,ngate), intent(inout) :: Np_matrix 99 99 100 100 ! ----- OUTPUTS ----- 101 real (kind=8), dimension(nprof,ngate), intent(out) :: Ze_non,Ze_ray, &101 real*8, dimension(nprof,ngate), intent(out) :: Ze_non,Ze_ray, & 102 102 g_to_vol,dBZe,a_to_vol 103 103 104 104 ! ----- OPTIONAL ----- 105 real (kind=8), optional, dimension(nprof,ngate) :: &105 real*8, optional, dimension(nprof,ngate) :: & 106 106 g_to_vol_in,g_to_vol_out ! integrated atten due to gases, r>v (dB). This allows to output and then input 107 107 ! the same gaseous absorption in different calls. Optional to allow compatibility … … 112 112 113 113 real, parameter :: one_third = 1.0/3.0 114 real (kind=8):: t_kelvin114 real*8 :: t_kelvin 115 115 integer :: & 116 116 phase, & ! 0=liquid, 1=ice … … 118 118 119 119 logical :: hydro ! true=hydrometeor in vol, false=none 120 real (kind=8):: &120 real*8 :: & 121 121 rho_a, & ! air density (kg m^-3) 122 122 gases ! function: 2-way gas atten (dB/km) 123 123 124 real (kind=8), dimension(:), allocatable :: &124 real*8, dimension(:), allocatable :: & 125 125 Di, Deq, & ! discrete drop sizes (um) 126 126 Ni, & ! discrete concentrations (cm^-3 um^-1) 127 127 rhoi ! discrete densities (kg m^-3) 128 128 129 real (kind=8), dimension(nprof, ngate) :: &129 real*8, dimension(nprof, ngate) :: & 130 130 z_vol, & ! effective reflectivity factor (mm^6/m^3) 131 131 z_ray, & ! reflectivity factor, Rayleigh only (mm^6/m^3) … … 135 135 136 136 integer,parameter :: KR8 = selected_real_kind(15,300) 137 real (kind=8), parameter :: xx = -1.0_KR8138 real (kind=8), dimension(:), allocatable :: xxa139 real (kind=8):: kr, ze, zr, pi, scale_factor, tc, Re, ld, tmp1, ze2, kr2, apm, bpm140 real (kind=8):: half_a_atten_current,half_a_atten_above141 real (kind=8):: half_g_atten_current,half_g_atten_above142 integer (kind=4):: tp, i, j, k, pr, itt, iff143 144 real (kind=8)step,base, Np145 integer (kind=4)iRe_type,n,max_bin137 real*8, parameter :: xx = -1.0_KR8 138 real*8, dimension(:), allocatable :: xxa 139 real*8 :: kr, ze, zr, pi, scale_factor, tc, Re, ld, tmp1, ze2, kr2, apm, bpm 140 real*8 :: half_a_atten_current,half_a_atten_above 141 real*8 :: half_g_atten_current,half_g_atten_above 142 integer*4 :: tp, i, j, k, pr, itt, iff 143 144 real*8 step,base, Np 145 integer*4 iRe_type,n,max_bin 146 146 147 147 integer start_gate,end_gate,d_gate … … 207 207 itt = infind(hp%mt_tti,t_kelvin) 208 208 endif 209 if (re_matrix(tp,pr,k) ==0) then209 if (re_matrix(tp,pr,k).eq.0) then 210 210 call calc_Re(hm_matrix(tp,pr,k),Np_matrix(tp,pr,k),rho_a, & 211 211 hp%dtype(tp),hp%dmin(tp),hp%dmax(tp),hp%apm(tp),hp%bpm(tp), & … … 221 221 222 222 iRe_type=1 223 if(Re >0) then223 if(Re.gt.0) then 224 224 ! determine index in to scale LUT 225 225 ! … … 232 232 base=hp%base_list(n+1) 233 233 iRe_type=Re/step 234 if (iRe_type <1) iRe_type=1234 if (iRe_type.lt.1) iRe_type=1 235 235 236 236 Re=step*(iRe_type+0.5) ! set value of Re to closest value allowed in LUT. … … 238 238 239 239 ! make sure iRe_type is within bounds 240 if (iRe_type >=nRe_types) then240 if (iRe_type.ge.nRe_types) then 241 241 ! write(*,*) 'Warning: size of Re exceed value permitted ', & 242 242 ! 'in Look-Up Table (LUT). Will calculate. ' -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/radar_simulator_init.F90
r5082 r5095 74 74 ! ----- INTERNAL ----- 75 75 integer :: i,j 76 real (kind=8):: delt, deltp76 real*8 :: delt, deltp 77 77 78 78 ! -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/radar_simulator_types.F90
r5082 r5095 12 12 integer, parameter :: & 13 13 nd = 85 ! number of discrete particles used in construction DSDs 14 real (kind=8), parameter :: &14 real*8, parameter :: & 15 15 dmin = 0.1 ,& ! min size of discrete particle 16 16 dmax = 10000. ! max size of discrete particle … … 36 36 37 37 ! variables used to store hydrometeor "default" properties 38 real (kind=8), dimension(maxhclass) :: p1,p2,p3,dmin,dmax,apm,bpm,rho38 real*8, dimension(maxhclass) :: p1,p2,p3,dmin,dmax,apm,bpm,rho 39 39 integer, dimension(maxhclass) :: dtype,col,cp,phase 40 40 41 41 ! Radar properties 42 real (kind=8):: freq,k242 real*8 :: freq,k2 43 43 integer :: nhclass ! number of hydrometeor classes in use 44 44 integer :: use_gas_abs, do_ray … … 56 56 logical, dimension(maxhclass,nRe_types) :: N_scale_flag 57 57 logical, dimension(maxhclass,mt_ntt,nRe_types) :: Z_scale_flag,Z_scale_added_flag 58 real (kind=8), dimension(maxhclass,mt_ntt,nRe_types) :: Ze_scaled,Zr_scaled,kr_scaled59 real (kind=8), dimension(maxhclass,nd,nRe_types) :: fc, rho_eff58 real*8, dimension(maxhclass,mt_ntt,nRe_types) :: Ze_scaled,Zr_scaled,kr_scaled 59 real*8, dimension(maxhclass,nd,nRe_types) :: fc, rho_eff 60 60 61 61 ! used to determine Re index 62 real (kind=8):: step_list(Re_MAX_BIN),base_list(Re_MAX_BIN)62 real*8 :: step_list(Re_MAX_BIN),base_list(Re_MAX_BIN) 63 63 64 64 ! used to determine temperature index 65 real (kind=8):: &65 real*8 :: & 66 66 mt_ttl(cnt_liq), & ! liquid temperatures (K) 67 67 mt_tti(cnt_ice) ! ice temperatures (K) 68 68 69 real (kind=8):: D(nd) ! set of discrete diameters used to represent DSDs69 real*8 :: D(nd) ! set of discrete diameters used to represent DSDs 70 70 71 71 end type class_param -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/scops.F
r5086 r5095 133 133 enddo 134 134 135 if (ncolprint /=0) then135 if (ncolprint.ne.0) then 136 136 write (6,'(a)') 'frac_out_pp_rev:' 137 137 do j=1,npoints,1000 … … 145 145 write (6,'(I3)') ncol 146 146 endif 147 if (ncolprint /=0) then147 if (ncolprint.ne.0) then 148 148 write (6,'(a)') 'last_frac_pp:' 149 149 do j=1,npoints,1000 … … 161 161 162 162 !loop over vertical levels 163 DO ilev = 1,nlev163 DO 200 ilev = 1,nlev 164 164 165 165 ! Initialise threshold 166 166 167 IF (ilev ==1) then167 IF (ilev.eq.1) then 168 168 ! If max overlap 169 IF (overlap ==1) then169 IF (overlap.eq.1) then 170 170 ! select pixels spread evenly 171 171 ! across the gridbox … … 187 187 enddo 188 188 ENDIF 189 IF (ncolprint /=0) then189 IF (ncolprint.ne.0) then 190 190 write (6,'(a)') 'threshold_nsf2:' 191 191 do j=1,npoints,1000 … … 197 197 ENDIF 198 198 199 IF (ncolprint /=0) then199 IF (ncolprint.ne.0) then 200 200 write (6,'(a)') 'ilev:' 201 201 write (6,'(I2)') ilev … … 206 206 ! All versions 207 207 do j=1,npoints 208 if (boxpos(j,ibox) <=conv(j,ilev)) then208 if (boxpos(j,ibox).le.conv(j,ilev)) then 209 209 maxocc(j,ibox) = 1 210 210 else … … 214 214 215 215 ! Max overlap 216 if (overlap ==1) then216 if (overlap.eq.1) then 217 217 do j=1,npoints 218 218 threshold_min(j,ibox)=conv(j,ilev) … … 222 222 223 223 ! Random overlap 224 if (overlap ==2) then224 if (overlap.eq.2) then 225 225 do j=1,npoints 226 226 threshold_min(j,ibox)=conv(j,ilev) … … 230 230 231 231 ! Max/Random overlap 232 if (overlap ==3) then232 if (overlap.eq.3) then 233 233 do j=1,npoints 234 234 threshold_min(j,ibox)=max(conv(j,ilev), 235 235 & min(tca(j,ilev-1),tca(j,ilev))) 236 236 if (threshold(j,ibox) 237 & <min(tca(j,ilev-1),tca(j,ilev))238 & .and.(threshold(j,ibox) >conv(j,ilev))) then237 & .lt.min(tca(j,ilev-1),tca(j,ilev)) 238 & .and.(threshold(j,ibox).gt.conv(j,ilev))) then 239 239 maxosc(j,ibox)= 1 240 240 else … … 276 276 DO ibox=1,ncol 277 277 do j=1,npoints 278 if (tca(j,ilev) >threshold(j,ibox)) then278 if (tca(j,ilev).gt.threshold(j,ibox)) then 279 279 frac_out(j,ibox,ilev)=1 280 280 else … … 289 289 DO ibox=1,ncol 290 290 do j=1,npoints 291 if (threshold(j,ibox) <=conv(j,ilev)) then291 if (threshold(j,ibox).le.conv(j,ilev)) then 292 292 ! = 2 IF threshold le conv(j) 293 293 frac_out(j,ibox,ilev) = 2 … … 302 302 ! from last level next time round 303 303 304 if (ncolprint /=0) then304 if (ncolprint.ne.0) then 305 305 306 306 do j=1,npoints ,1000 … … 331 331 endif 332 332 333 END DO!loop over nlev333 200 CONTINUE !loop over nlev 334 334 335 335 -
LMDZ6/branches/Amaury_dev/libf/phylmd/cosp/zeff.F90
r5086 r5095 35 35 integer, intent(in) :: ice, xr 36 36 integer, intent(in) :: nsizes 37 real (kind=8), intent(in) :: freq,D(nsizes),N(nsizes),tt,qe(nsizes), &37 real*8, intent(in) :: freq,D(nsizes),N(nsizes),tt,qe(nsizes), & 38 38 qs(nsizes), rho_e(nsizes) 39 real (kind=8), intent(inout) :: k239 real*8, intent(inout) :: k2 40 40 41 41 ! ----- OUTPUTS ----- 42 real (kind=8), intent(out) :: z_eff,z_ray,kr42 real*8, intent(out) :: z_eff,z_ray,kr 43 43 44 44 ! ----- INTERNAL ----- 45 45 integer :: & 46 46 correct_for_rho ! correct for density flag 47 real (kind=8), dimension(nsizes) :: &47 real*8, dimension(nsizes) :: & 48 48 D0, & ! D in (m) 49 49 N0, & ! N in m^-3 m^-1 … … 53 53 rho_ice, & ! bulk density ice (kg m^-3) 54 54 f ! ice fraction 55 real (kind=8), dimension(nsizes) :: xtemp56 real (kind=8):: &55 real*8, dimension(nsizes) :: xtemp 56 real*8 :: & 57 57 wl, & ! wavelength (m) 58 58 cr ! kr(dB/km) = cr * kr(1/km) 59 complex (kind=8):: &59 complex*16 :: & 60 60 m ! complex index of refraction of bulk form 61 complex (kind=8), dimension(nsizes) :: &61 complex*16, dimension(nsizes) :: & 62 62 m0 ! complex index of refraction 63 63 64 integer (kind=4):: i,one65 real (kind=8):: pi66 real (kind=8):: eta_sum, eta_mie, const, z0_eff, z0_ray, k_sum, &64 integer*4 :: i,one 65 real*8 :: pi 66 real*8 :: eta_sum, eta_mie, const, z0_eff, z0_ray, k_sum, & 67 67 n_r, n_i, dqv(1), dqsc, dg, dph(1) 68 integer (kind=4):: err69 complex (kind=8):: Xs1(1), Xs2(1)68 integer*4 :: err 69 complex*16 :: Xs1(1), Xs2(1) 70 70 71 71 one=1 … … 113 113 call mieint(sizep(i), m0(i), one, dqv, qext(i), dqsc, qbsca(i), & 114 114 dg, xs1, xs2, dph, err) 115 END DO115 end do 116 116 117 117 else
Note: See TracChangeset
for help on using the changeset viewer.