Changeset 5158 for LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2
- Timestamp:
- Aug 2, 2024, 2:12:03 PM (6 months ago)
- Location:
- LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/MISR_simulator.F90
r5099 r5158 78 78 box_MISR_ztop(1:npoints,1:ncol) = 0._wp 79 79 80 doj=1,npoints80 DO j=1,npoints 81 81 82 82 ! Estimate distribution of Model layer tops 83 83 dist_model_layertops(j,:)=0 84 doilev=1,nlev84 DO ilev=1,nlev 85 85 ! Define location of "layer top" 86 86 if(ilev.eq.1 .or. ilev.eq.nlev) then … … 93 93 ! *NOTE* the first MISR level is "no height" level 94 94 iMISR_ztop=2 95 doloop=2,numMISRHgtBins95 DO loop=2,numMISRHgtBins 96 96 if ( ztest .gt. 1000*misr_histHgt(loop+1) ) then 97 97 iMISR_ztop=loop+1 … … 103 103 104 104 ! For each GCM cell or horizontal model grid point 105 doibox=1,ncol105 DO ibox=1,ncol 106 106 ! Compute optical depth as a cummulative distribution in the vertical (nlev). 107 107 tauOUT(j,ibox)=sum(dtau(j,ibox,1:nlev)) 108 108 109 109 thres_crossed_MISR=0 110 doilev=1,nlev110 DO ilev=1,nlev 111 111 ! If there a cloud, start the counter and store this height 112 112 if(thres_crossed_MISR .eq. 0 .and. dtau(j,ibox,ilev) .gt. 0.) then … … 187 187 ! This setup assumes the columns represent a about a 1 to 4 km scale 188 188 ! it will need to be modified significantly, otherwise 189 ! 189 ! ! DS2015: Add loop over gridpoints and index accordingly. 190 190 ! if(ncol.eq.1) then 191 191 ! ! Adjust based on neightboring points. … … 214 214 215 215 ! Fill dark scenes 216 doj=1,numMISRHgtBins216 DO j=1,numMISRHgtBins 217 217 where(sunlit .ne. 1) dist_model_layertops(1:npoints,j) = R_UNDEF 218 218 enddo … … 254 254 tauWRK(1:npoints,1:ncol) = tau(1:npoints,1:ncol) 255 255 box_MISR_ztopWRK(1:npoints,1:ncol) = box_MISR_ztop(1:npoints,1:ncol) 256 doj=1,npoints256 DO j=1,npoints 257 257 258 258 ! Subcolumns that are cloudy(true) and not(false) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/cosp.F90
r5099 r5158 239 239 real(wp),dimension(:),pointer :: & 240 240 isccp_totalcldarea => null(), & ! The fraction of model grid box columns with cloud 241 241 ! somewhere in them. (%) 242 242 isccp_meantb => null(), & ! Mean all-sky 10.5 micron brightness temperature. (K) 243 243 isccp_meantbclr => null(), & ! Mean clear-sky 10.5 micron brightness temperature. (K) … … 837 837 allocate(parasolPix_refl(parasolIN%Npoints,parasolIN%Ncolumns,PARASOL_NREFL)) 838 838 ! Call simulator 839 doicol=1,parasolIN%Ncolumns839 DO icol=1,parasolIN%Ncolumns 840 840 call parasol_subcolumn(parasolIN%npoints, PARASOL_NREFL, & 841 841 parasolIN%tautot_S_liq(1:parasolIN%Npoints,icol), & … … 855 855 allocate(cloudsatDBZe(cloudsatIN%Npoints,cloudsatIN%Ncolumns,cloudsatIN%Nlevels), & 856 856 cloudsatZe_non(cloudsatIN%Npoints,cloudsatIN%Ncolumns,cloudsatIN%Nlevels)) 857 doicol=1,cloudsatIN%ncolumns857 DO icol=1,cloudsatIN%ncolumns 858 858 call quickbeam_subcolumn(cloudsatIN%rcfg,cloudsatIN%Npoints,cloudsatIN%Nlevels,& 859 859 cloudsatIN%hgt_matrix/1000._wp, & … … 876 876 modisRetrievedCloudTopPressure(modisIN%nSunlit,modisIN%nColumns)) 877 877 ! Call simulator 878 doi = 1, modisIN%nSunlit878 DO i = 1, modisIN%nSunlit 879 879 call modis_subcolumn(modisIN%Ncolumns,modisIN%Nlevels,modisIN%pres(i,:), & 880 880 modisIN%tau(int(modisIN%sunlit(i)),:,:), & … … 1246 1246 ! cospgridIN%hgt_matrix, cospgridIN%hgt_matrix_half, & !PREC_BUG 1247 1247 cospgridIN%land(:), cospgridIN%surfelev(:), cospgridIN%at(:,cospIN%Nlevels), & !PREC_BUG 1248 1248 cospIN%fracPrecipIce, cospgridIN%hgt_matrix, cospgridIN%hgt_matrix_half, & !PREC_BUG 1249 1249 cospOUT%cloudsat_cfad_ze(ij:ik,:,:), cospOUT%cloudsat_precip_cover, & 1250 1250 cospOUT%cloudsat_pia) … … 1691 1691 ! Other grid requested. Constant vertical spacing with top at 20 km 1692 1692 if (.not. luseCSATvgrid) zstep = 20000._wp/Nvgrid 1693 doi=1,Nvgrid1693 DO i=1,Nvgrid 1694 1694 vgrid_zl(Nlvgrid-i+1) = (i-1)*zstep 1695 1695 vgrid_zu(Nlvgrid-i+1) = i*zstep -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/cosp_atlid_interface.F90
r5099 r5158 62 62 63 63 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 64 ! 64 ! END MODULE 65 65 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 66 66 END MODULE MOD_COSP_ATLID_INTERFACE -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/cosp_calipso_interface.F90
r5099 r5158 81 81 82 82 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 83 ! 83 ! END MODULE 84 84 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 85 85 END MODULE MOD_COSP_CALIPSO_INTERFACE -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/cosp_cloudsat_interface.F90
r5099 r5158 118 118 ! Set up Re bin "structure" for z_scaling 119 119 rcfg%base_list(1)=0 120 doj=1,Re_MAX_BIN120 DO j=1,Re_MAX_BIN 121 121 rcfg%step_list(j)=0.1_wp+0.1_wp*((j-1)**1.5) 122 122 if(rcfg%step_list(j)>Re_BIN_LENGTH) then … … 138 138 139 139 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 140 ! 140 ! END MODULE 141 141 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 142 142 END MODULE MOD_COSP_CLOUDSAT_INTERFACE -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/cosp_config.F90
r5099 r5158 180 180 1.0, 0.909013, 0.709554, 0.430405, 0.121567/), & 181 181 shape=(/PARASOL_NREFL,PARASOL_NTAU/)), & 182 ! LUT for ice particles 182 ! LUT for ice particles 183 183 rlumB = reshape(source=(/ 0.03, 0.03, 0.03, 0.03, 0.03, & 184 184 0.092170, 0.087082, 0.083325, 0.084935, 0.054157, & … … 422 422 vgrid_z_in = (/240.0, 720.0, 1200.0, 1680.0, 2160.0, 2640.0, 3120.0, 3600.0, & 423 423 4080.0, 4560.0, 5040.0, 5520.0, 6000.0, 6480.0, 6960.0, 7440.0, & 424 425 426 427 424 7920.0, 8400.0, 8880.0, 9360.0, 9840.0, 10320.0, 10800.0, & 425 11280.0, 11760.0, 12240.0, 12720.0, 13200.0, 13680.0, 14160.0, & 426 14640.0, 15120.0, 15600.0, 16080.0, 16560.0, 17040.0, 17520.0, & 427 18000.0, 18480.0, 18960.0/) 428 428 429 429 END MODULE MOD_COSP_CONFIG -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/cosp_grLidar532_interface.F90
r5099 r5158 58 58 59 59 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 60 ! 60 ! END MODULE 61 61 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 62 62 END MODULE MOD_COSP_GRLIDAR532_INTERFACE -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/cosp_isccp_interface.F90
r5099 r5158 67 67 68 68 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 69 ! 69 ! SUBROUTINE cosp_isccp_init 70 70 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 71 71 SUBROUTINE COSP_ISCCP_INIT(top_height,top_height_direction) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/cosp_misr_interface.F90
r5099 r5158 36 36 37 37 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 38 ! 38 ! TYPE misr_in 39 39 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 40 40 type misr_IN … … 56 56 57 57 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 58 ! 58 ! SUBROUTINE cosp_misr_init 59 59 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 60 60 SUBROUTINE COSP_MISR_INIT() … … 63 63 64 64 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 65 ! 65 ! END MODULE 66 66 ! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 67 67 END MODULE MOD_COSP_MISR_INTERFACE -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/cosp_optics.F90
r5099 r5158 71 71 72 72 varOUT(1:dim1,1:dim2,1:dim3) = 0._wp 73 doj=1,dim273 DO j=1,dim2 74 74 where(flag(:,j,:) .eq. 1) 75 75 varOUT(:,j,:) = varIN2 … … 135 135 136 136 137 doi=1,npoints137 DO i=1,npoints 138 138 where(cloudIce(i,:, :) <= 0.) 139 139 fracL(:, :) = 1._wp … … 170 170 w0(1:nPoints,1:nSubCols,1:nLevels) = 0._wp 171 171 172 doj =1,nPoints173 doi=1,nSubCols172 DO j =1,nPoints 173 DO i=1,nSubCols 174 174 water_g(1:nLevels) = get_g_nir( phaseIsLiquid, sizeLIQ(j,i,1:nLevels)) 175 175 water_w0(1:nLevels) = get_ssa_nir(phaseIsLiquid, sizeLIQ(j,i,1:nLevels)) … … 189 189 190 190 ! Compute the total optical thickness and the proportion due to liquid in each cell 191 doi=1,npoints191 DO i=1,npoints 192 192 where(tauLIQ(i,1:nSubCols,1:nLevels) + tauICE(i,1:nSubCols,1:nLevels) > 0.) 193 193 fracLIQ(i,1:nSubCols,1:nLevels) = tauLIQ(i,1:nSubCols,1:nLevels)/ & … … 358 358 ! Altitude at half pressure levels: 359 359 zheight(1:npoints,nlev+1) = 0._wp 360 dok=nlev,1,-1360 DO k=nlev,1,-1 361 361 zheight(1:npoints,k) = zheight(1:npoints,k+1) & 362 362 -(presf(1:npoints,k)-presf(1:npoints,k+1))/(rhoair(1:npoints,k)*grav) … … 392 392 ! ############################################################################## 393 393 ! Polynomials kp_lidar derived from Mie theory 394 doi = 1, npart394 DO i = 1, npart 395 395 where (rad_part(1:npoints,1:nlev,i) .gt. 0.0) 396 396 kp_part(1:npoints,1:nlev,i) = & … … 412 412 413 413 ! Loop over all subcolumns 414 doicol=1,ncolumns414 DO icol=1,ncolumns 415 415 ! ############################################################################## 416 416 ! Mixing ratio particles in each subcolum … … 425 425 ! ############################################################################## 426 426 ! Alpha of particles in each subcolumn: 427 doi = 1, npart427 DO i = 1, npart 428 428 where (rad_part(1:npoints,1:nlev,i) .gt. 0.0) 429 429 alpha_part(1:npoints,1:nlev,i) = 3._wp/4._wp * Qscat & … … 437 437 ! Optical thicknes 438 438 tau_part(1:npoints,1:nlev,1:npart) = rdiffm * alpha_part(1:npoints,1:nlev,1:npart) 439 doi = 1, npart439 DO i = 1, npart 440 440 ! Optical thickness of each layer (particles) 441 441 tau_part(1:npoints,1:nlev,i) = tau_part(1:npoints,1:nlev,i) & 442 442 & * (zheight(1:npoints,1:nlev)-zheight(1:npoints,2:nlev+1) ) 443 443 ! Optical thickness from TOA to layer k (particles) 444 dok=zi,zf,zinc444 DO k=zi,zf,zinc 445 445 tau_part(1:npoints,k,i) = tau_part(1:npoints,k,i) + tau_part(1:npoints,k+zoffset,i) 446 446 enddo -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/cosp_parasol_interface.F90
r5099 r5158 35 35 36 36 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 37 ! 37 ! TYPE cosp_parasol 38 38 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 39 39 TYPE PARASOL_SGX … … 63 63 END TYPE COSP_PARASOL 64 64 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 65 ! 65 ! TYPE parasol_in 66 66 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 67 67 TYPE parasol_IN … … 86 86 87 87 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 88 ! 88 ! END MODULE 89 89 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 90 90 end module MOD_COSP_PARASOL_INTERFACE -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/cosp_stats.F90
r5099 r5158 81 81 r = 0._wp 82 82 83 doi=1,Npoints83 DO i=1,Npoints 84 84 ! Calculate tops and bottoms of new and old grids 85 85 oldgrid_bot = zhalf(i,:) … … 88 88 l = 0 ! Index of level in the old grid 89 89 ! Loop over levels in the new grid 90 dok = 1,Nglevels90 DO k = 1,Nglevels 91 91 Nw = 0 ! Number of weigths 92 92 wt = 0._wp ! Sum of weights 93 93 ! Loop over levels in the old grid and accumulate total for weighted average 94 do94 DO 95 95 l = l + 1 96 96 w = 0.0 ! Initialise weight to 0 … … 119 119 Nw = Nw + 1 120 120 wt = wt + w 121 doj=1,Ncolumns121 DO j=1,Ncolumns 122 122 if (lunits) then 123 123 if (y(i,j,l) /= R_UNDEF) then … … 138 138 ! Calculate average in new grid 139 139 if (Nw > 0) then 140 doj=1,Ncolumns140 DO j=1,Ncolumns 141 141 r(i,j,k) = r(i,j,k)/wt 142 142 enddo … … 146 146 147 147 ! Set points under surface to R_UNDEF, and change to dBZ if necessary 148 dok=1,Nglevels149 doj=1,Ncolumns150 doi=1,Npoints148 DO k=1,Nglevels 149 DO j=1,Ncolumns 150 DO i=1,Npoints 151 151 if (newgrid_top(k) > zhalf(i,1)) then ! Level above model bottom level 152 152 if (lunits) then … … 202 202 radar_tcc = 0._wp 203 203 radar_tcc2 = 0._wp 204 dopr=1,Npoints205 doi=1,Ncolumns204 DO pr=1,Npoints 205 DO i=1,Ncolumns 206 206 flag_sat = 0 207 207 flag_cld = 0 … … 210 210 ! look for j_1km from bottom to top 211 211 j = 1 212 dowhile (Ze_tot(pr,i,j) .eq. R_GROUND)212 DO while (Ze_tot(pr,i,j) .eq. R_GROUND) 213 213 j = j+1 214 214 enddo 215 215 j_1km = j+1 !this is the vertical index of 1km above surface 216 216 217 doj=1,Nlevels217 DO j=1,Nlevels 218 218 sc_ratio = beta_tot(pr,i,j)/beta_mol(pr,j) 219 219 if ((sc_ratio .le. s_att) .and. (flag_sat .eq. 0)) flag_sat = j … … 266 266 integer :: ij 267 267 268 do ij=2,Nbins+1268 DO ij=2,Nbins+1 269 269 hist1D(ij-1) = count(var .ge. bins(ij-1) .and. var .lt. bins(ij)) 270 270 if (count(var .eq. R_GROUND) .ge. 1) hist1D(ij-1)=R_UNDEF … … 298 298 integer :: ij,ik 299 299 300 doij=2,nbin1+1301 doik=2,nbin2+1300 DO ij=2,nbin1+1 301 DO ik=2,nbin2+1 302 302 jointHist(ij-1,ik-1)=count(var1 .ge. bin1(ij-1) .and. var1 .lt. bin1(ij) .and. & 303 303 var2 .ge. bin2(ik-1) .and. var2 .lt. bin2(ik)) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/cosp_utils.F90
r5099 r5158 77 77 delta = (alpha_x + b_x + d_x - n_bx + 1._wp) 78 78 79 dok=1,Nlevels80 doj=1,Ncolumns81 doi=1,Npoints79 DO k=1,Nlevels 80 DO j=1,Ncolumns 81 DO i=1,Npoints 82 82 if ((prec_frac(i,j,k)==prec_type).or.(prec_frac(i,j,k)==3.)) then 83 83 rho = p(i,k)/(287.05_wp*T(i,k)) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/icarus.F90
r5099 r5158 135 135 136 136 if (debugcol.ne.0) then 137 doj=1,npoints,debugcol137 DO j=1,npoints,debugcol 138 138 139 139 ! Produce character output 140 doilev=1,nlev140 DO ilev=1,nlev 141 141 acc(ilev,1:ncol)=frac_out(j,1:ncol,ilev)*2 142 142 where(levmatch(j,1:ncol) .eq. ilev) acc(ilev,1:ncol)=acc(ilev,1:ncol)+1 … … 151 151 write(9,'(a1)') ' ' 152 152 153 doibox=1,ncol153 DO ibox=1,ncol 154 154 write(9,'(40(a1),1x,40(a1))') & 155 155 (cchar_realtops(acc(ilev,ibox)+1),ilev=1,nlev),& … … 231 231 itrop(1:npoints) = 1 232 232 233 doilev=1,nlev233 DO ilev=1,nlev 234 234 where(pfull(1:npoints,ilev) .lt. 40000. .and. & 235 235 pfull(1:npoints,ilev) .gt. 5000. .and. & … … 242 242 enddo 243 243 244 doilev=1,nlev244 DO ilev=1,nlev 245 245 atmax(1:npoints) = merge(at(1:npoints,ilev),atmax(1:npoints),& 246 246 at(1:npoints,ilev) .gt. atmax(1:npoints) .and. ilev .ge. itrop(1:npoints)) … … 256 256 ! at a wavenumber of 955 cm-1, or 10.47 microns 257 257 ! ############################################################################ 258 doilev=1,nlev258 DO ilev=1,nlev 259 259 press(1:npoints) = pfull(1:npoints,ilev)*10._wp 260 260 dpress(1:npoints) = (phalf(1:npoints,ilev+1)-phalf(1:npoints,ilev))*10 … … 273 273 fluxtop_clrsky(1:npoints) = 0._wp 274 274 trans_layers_above_clrsky(1:npoints) = 1._wp 275 doilev=1,nlev275 DO ilev=1,nlev 276 276 ! Black body emission at temperature of the layer 277 277 bb(1:npoints) = 1._wp / ( exp(1307.27_wp/at(1:npoints,ilev)) - 1._wp ) … … 300 300 fluxtop(1:npoints,1:ncol) = 0._wp 301 301 trans_layers_above(1:npoints,1:ncol) = 1._wp 302 doilev=1,nlev302 DO ilev=1,nlev 303 303 ! Black body emission at temperature of the layer 304 304 bb=1._wp/(exp(1307.27_wp/at(1:npoints,ilev)) - 1._wp) 305 305 306 doibox=1,ncol306 DO ibox=1,ncol 307 307 ! Emissivity 308 308 dem(1:npoints,ibox) = merge(dem_wv(1:npoints,ilev), & … … 320 320 ! Add in surface emission 321 321 bb(1:npoints)=1._wp/( exp(1307.27_wp/skt(1:npoints)) - 1._wp ) 322 doibox=1,ncol322 DO ibox=1,ncol 323 323 fluxtop(1:npoints,ibox) = fluxtop(1:npoints,ibox) + emsfc_lw*bb(1:npoints)*trans_layers_above(1:npoints,ibox) 324 324 end do … … 344 344 btcmin(1:npoints) = 1._wp / ( exp(1307.27_wp/(attrop(1:npoints)-5._wp)) - 1._wp ) 345 345 346 doibox=1,ncol346 DO ibox=1,ncol 347 347 transmax(1:npoints) = (fluxtop(1:npoints,ibox)-btcmin) /(fluxtop_clrsky(1:npoints)-btcmin(1:npoints)) 348 348 tauir(1:npoints) = tau(1:npoints,ibox)/2.13_wp 349 349 taumin(1:npoints) = -log(max(min(transmax(1:npoints),0.9999999_wp),0.001_wp)) 350 350 if (isccp_top_height .eq. 1) then 351 do j=1,npoints351 DO j=1,npoints 352 352 if (transmax(j) .gt. 0.001 .and. transmax(j) .le. 0.9999999) then 353 353 fluxtopinit(j) = fluxtop(j,ibox) … … 355 355 endif 356 356 enddo 357 doicycle=1,2358 do j=1,npoints357 DO icycle=1,2 358 DO j=1,npoints 359 359 if (tau(j,ibox) .gt. (tauchk)) then 360 360 if (transmax(j) .gt. 0.001 .and. transmax(j) .le. 0.9999999) then … … 397 397 ! pressure (isccp_top_height = 1 or 3) 398 398 ! #################################################################################### 399 doibox=1,ncol399 DO ibox=1,ncol 400 400 !segregate according to optical thickness 401 401 if (isccp_top_height .eq. 1 .or. isccp_top_height .eq. 3) then … … 403 403 ! Find level whose temperature most closely matches brightness temperature 404 404 nmatch(1:npoints)=0 405 dok1=1,nlev-1405 DO k1=1,nlev-1 406 406 ilev = merge(nlev-k1,k1,isccp_top_height_direction .eq. 2) 407 do j=1,npoints407 DO j=1,npoints 408 408 if (ilev .ge. itrop(j) .and. & 409 409 ((at(j,ilev) .ge. tb(j,ibox) .and. & … … 417 417 enddo 418 418 419 do j=1,npoints419 DO j=1,npoints 420 420 if (nmatch(j) .ge. 1) then 421 421 k1 = match(j,nmatch(j)) … … 440 440 else 441 441 ptop(1:npoints,ibox)=0. 442 doilev=1,nlev442 DO ilev=1,nlev 443 443 where((ptop(1:npoints,ibox) .eq. 0. ) .and.(frac_out(1:npoints,ibox,ilev) .ne. 0)) 444 444 ptop(1:npoints,ibox)=phalf(1:npoints,ilev) … … 458 458 boxtau(1:npoints,1:ncol) = output_missing_value 459 459 boxptop(1:npoints,1:ncol) = output_missing_value 460 doibox=1,ncol461 do j=1,npoints460 DO ibox=1,ncol 461 DO j=1,npoints 462 462 if (tau(j,ibox) .gt. (tauchk) .and. ptop(j,ibox) .gt. 0.) then 463 463 if (sunlit(j).eq.1 .or. isccp_top_height .eq. 3) then … … 532 532 ! Reset frequencies 533 533 !fq_isccp = spread(spread(merge(0._wp,output_missing_value,sunlit .eq. 1 .or. isccp_top_height .eq. 3),2,7),2,7) 534 doilev=1,7535 doilev2=1,7536 do j=1,npoints !534 DO ilev=1,7 535 DO ilev2=1,7 536 DO j=1,npoints ! 537 537 if (sunlit(j).eq.1 .or. isccp_top_height .eq. 3) then 538 538 fq_isccp(j,ilev,ilev2)= 0. 539 else 539 else 540 540 fq_isccp(j,ilev,ilev2)= output_missing_value 541 541 end if … … 559 559 560 560 ! Compute column quantities and joint-histogram 561 do j=1,npoints561 DO j=1,npoints 562 562 ! Subcolumns that are cloudy(true) and not(false) 563 563 box_cloudy2(1:ncol) = merge(.true.,.false.,boxtau(j,1:ncol) .gt. tauchk .and. boxptop(j,1:ncol) .gt. 0.) … … 633 633 634 634 varOUT(1:dim1,1:dim2,1:dim3) = 0._wp 635 doj=1,dim2635 DO j=1,dim2 636 636 where(flag(:,j,:) .eq. 1) 637 637 varOUT(:,j,:) = varIN2 -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/lidar_simulator.F90
r5099 r5158 175 175 ! PLANE PARRALLEL FIELDS 176 176 ! #################################################################################### 177 doicol=1,ncolumns177 DO icol=1,ncolumns 178 178 ! ################################################################################# 179 179 ! *) Total Backscatter signal … … 200 200 ! #################################################################################### 201 201 if (lphaseoptics) then 202 doicol=1,ncolumns202 DO icol=1,ncolumns 203 203 ! ################################################################################# 204 204 ! *) Ice/Liq Perpendicular Backscatter signal … … 206 206 ! Computation of ATBperp,ice/liq from ATBice/liq including the multiple scattering 207 207 ! contribution (Cesana and Chepfer 2013, JGR) 208 dok=1,nlev208 DO k=1,nlev 209 209 ! Ice particles 210 210 pnorm_perp_ice(1:npoints,icol,k) = Alpha * pnorm_ice(1:npoints,icol,k) … … 242 242 243 243 ! Other layers 244 dok=2,nlev244 DO k=2,nlev 245 245 ! Optical thickness of layer k 246 246 tautot_lay(1:npoints) = tautot(1:npoints,icol,k)-tautot(1:npoints,icol,k-1) … … 398 398 ! Compute LIDAR scattering ratio 399 399 if (use_vgrid) then 400 doic = 1, ncol400 DO ic = 1, ncol 401 401 pnorm_c = pnormFlip(:,ic,:) 402 402 where ((pnorm_c .lt. xmax) .and. (betamolFlip(:,1,:) .lt. xmax) .and. & … … 427 427 endif 428 428 else 429 doic = 1, ncol429 DO ic = 1, ncol 430 430 pnorm_c = pnorm(:,ic,:) 431 431 where ((pnorm_c.lt.xmax) .and. (pmol.lt.xmax) .and. (pmol.gt. 0.0 )) … … 458 458 if (ok_lidar_cfad) then 459 459 ! CFADs of subgrid-scale lidar scattering ratios 460 doi=1,Npoints461 doj=1,llm460 DO i=1,Npoints 461 DO j=1,llm 462 462 cfad2(i,:,j) = hist1D(ncol,x3d(i,:,j),SR_BINS,histBsct) 463 463 enddo … … 499 499 500 500 ! Other layers 501 dok=2,nlev501 DO k=2,nlev 502 502 tautot_lay(:) = tau(:,k)-tau(:,k-1) 503 503 WHERE (tautot_lay(:) .gt. 0.) … … 527 527 epsrealwp = epsilon(1._wp) 528 528 beta(:,1) = pnorm(:,1) * (2._wp*tau(:,1))/(1._wp-exp(-2._wp*tau(:,1))) 529 dok=2,nlev529 DO k=2,nlev 530 530 tautot_lay(:) = tau(:,k)-tau(:,k-1) 531 531 WHERE ( EXP(-2._wp*tau(:,k-1)) .gt. epsrealwp ) … … 569 569 zeta50 = -9.4776e-07_wp ! 570 570 571 571 ! Inputs 572 572 integer,intent(in) :: & 573 573 Npoints, & ! Number of gridpoints … … 576 576 Ncat, & ! Number of cloud layer types 577 577 Nphase ! Number of cloud layer phase types 578 578 ! [ice,liquid,undefined,false ice,false liquid,Percent of ice] 579 579 real(wp),intent(in) :: & 580 580 S_att, & ! … … 590 590 pplay ! Pressure 591 591 592 592 ! Outputs 593 593 real(wp),intent(out),dimension(Npoints,Ntemp,5) :: & 594 594 lidarcldtemp ! 3D Temperature 1=tot,2=ice,3=liq,4=undef,5=ice/ice+liq … … 625 625 626 626 ! #################################################################################### 627 ! 1) Initialize 627 ! 1) Initialize 628 628 ! #################################################################################### 629 629 lidarcld = 0._wp … … 648 648 ! 2) Cloud detection 649 649 ! #################################################################################### 650 dok=1,Nlevels650 DO k=1,Nlevels 651 651 ! Cloud detection at subgrid-scale: 652 652 where ((x(:,:,k) .gt. S_cld) .and. (x(:,:,k) .ne. undef) ) … … 671 671 cldlay = 0._wp 672 672 nsublay = 0._wp 673 dok=1,Nlevels674 doic = 1, Ncolumns675 doip = 1, Npoints673 DO k=1,Nlevels 674 DO ic = 1, Ncolumns 675 DO ip = 1, Npoints 676 676 677 677 ! Computation of the cloud fraction as a function of the temperature instead 678 678 ! of height, for ice,liquid and all clouds 679 679 if(srok(ip,ic,k).gt.0.)then 680 doitemp=1,Ntemp680 DO itemp=1,Ntemp 681 681 if( (tmp(ip,k).ge.tempmod(itemp)).and.(tmp(ip,k).lt.tempmod(itemp+1)) )then 682 682 lidarcldtempind(ip,itemp)=lidarcldtempind(ip,itemp)+1._wp … … 686 686 687 687 if(cldy(ip,ic,k).eq.1.)then 688 do itemp=1,Ntemp688 DO itemp=1,Ntemp 689 689 if( (tmp(ip,k) .ge. tempmod(itemp)).and.(tmp(ip,k) .lt. tempmod(itemp+1)) )then 690 690 lidarcldtemp(ip,itemp,1)=lidarcldtemp(ip,itemp,1)+1._wp … … 723 723 cldlayer = 0._wp 724 724 nsublayer = 0._wp 725 doiz = 1, Ncat726 doic = 1, Ncolumns725 DO iz = 1, Ncat 726 DO ic = 1, Ncolumns 727 727 cldlayer(:,iz) = cldlayer(:,iz) + cldlay(:,ic,iz) 728 728 nsublayer(:,iz) = nsublayer(:,iz) + nsublay(:,ic,iz) … … 742 742 ! 4.1) For Cloudy pixels with 8.16km < z < 19.2km 743 743 ! #################################################################################### 744 doncol=1,Ncolumns745 do i=1,Npoints746 donlev=1,23 ! from 19.2km until 8.16km744 DO ncol=1,Ncolumns 745 DO i=1,Npoints 746 DO nlev=1,23 ! from 19.2km until 8.16km 747 747 p1 = pplay(1,nlev) 748 748 … … 856 856 ! ############################################################################## 857 857 toplvlsat = 0 858 donlev=24,Nlevels! from 8.16km until 0km858 DO nlev=24,Nlevels! from 8.16km until 0km 859 859 p1 = pplay(i,nlev) 860 860 … … 979 979 ! ############################################################################## 980 980 if(toplvlsat.ne.0) then 981 donlev = toplvlsat,Nlevels981 DO nlev = toplvlsat,Nlevels 982 982 p1 = pplay(i,nlev) 983 983 if(cldy(i,ncol,nlev).eq.1.)then … … 1031 1031 1032 1032 ! Compute Phase low mid high cloud fractions 1033 doiz = 1, Ncat1034 doi=1,Nphase-31035 doic = 1, Ncolumns1033 DO iz = 1, Ncat 1034 DO i=1,Nphase-3 1035 DO ic = 1, Ncolumns 1036 1036 cldlayerphase(:,iz,i) = cldlayerphase(:,iz,i) + cldlayphase(:,ic,iz,i) 1037 1037 cldlayerphasesum(:,iz) = cldlayerphasesum(:,iz) + cldlayphase(:,ic,iz,i) … … 1039 1039 enddo 1040 1040 enddo 1041 doiz = 1, Ncat1042 doi=4,51043 doic = 1, Ncolumns1041 DO iz = 1, Ncat 1042 DO i=4,5 1043 DO ic = 1, Ncolumns 1044 1044 cldlayerphase(:,iz,i) = cldlayerphase(:,iz,i) + cldlayphase(:,ic,iz,i) 1045 1045 enddo … … 1055 1055 ENDWHERE 1056 1056 1057 doi=1,Nphase-11057 DO i=1,Nphase-1 1058 1058 WHERE ( cldlayerphasesum(:,:).gt.0.0 ) 1059 1059 cldlayerphase(:,:,i) = (cldlayerphase(:,:,i)/cldlayerphasesum(:,:)) * cldlayer(:,:) … … 1061 1061 enddo 1062 1062 1063 doi=1,Npoints1064 doiz=1,Ncat1063 DO i=1,Npoints 1064 DO iz=1,Ncat 1065 1065 checkcldlayerphase=0. 1066 1066 checkcldlayerphase2=0. 1067 1067 if (cldlayerphasesum(i,iz) .gt. 0.0 )then 1068 doic=1,Nphase-31068 DO ic=1,Nphase-3 1069 1069 checkcldlayerphase = checkcldlayerphase+cldlayerphase(i,iz,ic) 1070 1070 enddo … … 1075 1075 enddo 1076 1076 1077 doi=1,Nphase-11077 DO i=1,Nphase-1 1078 1078 WHERE (nsublayer(:,:) .eq. 0.0) 1079 1079 cldlayerphase(:,:,i) = undef … … 1082 1082 1083 1083 ! Compute Phase 3D as a function of temperature 1084 donlev=1,Nlevels1085 doncol=1,Ncolumns1086 doi=1,Npoints1087 doitemp=1,Ntemp1084 DO nlev=1,Nlevels 1085 DO ncol=1,Ncolumns 1086 DO i=1,Npoints 1087 DO itemp=1,Ntemp 1088 1088 if(tmpi(i,ncol,nlev).gt.0.)then 1089 1089 if((tmpi(i,ncol,nlev) .ge. tempmod(itemp)) .and. (tmpi(i,ncol,nlev) .lt. tempmod(itemp+1)) )then … … 1105 1105 1106 1106 ! Check temperature cloud fraction 1107 doi=1,Npoints1108 doitemp=1,Ntemp1107 DO i=1,Npoints 1108 DO itemp=1,Ntemp 1109 1109 checktemp=lidarcldtemp(i,itemp,2)+lidarcldtemp(i,itemp,3)+lidarcldtemp(i,itemp,4) 1110 1110 !if(checktemp .NE. lidarcldtemp(i,itemp,1))then … … 1124 1124 ENDWHERE 1125 1125 1126 doi=1,41126 DO i=1,4 1127 1127 WHERE(lidarcldtempind(:,:) .gt. 0.) 1128 1128 lidarcldtemp(:,:,i) = lidarcldtemp(:,:,i)/lidarcldtempind(:,:) … … 1191 1191 ! 2) Cloud detection 1192 1192 ! #################################################################################### 1193 dok=1,Nlevels1193 DO k=1,Nlevels 1194 1194 ! Cloud detection at subgrid-scale: 1195 1195 where ((x(:,:,k) .gt. S_cld) .and. (x(:,:,k) .ne. undef) ) … … 1210 1210 ! 3) Grid-box 3D cloud fraction and layered cloud fractions(ISCCP pressure categories) 1211 1211 ! #################################################################################### 1212 dok=1,Nlevels1213 doic = 1, Ncolumns1214 doip = 1, Npoints1212 DO k=1,Nlevels 1213 DO ic = 1, Ncolumns 1214 DO ip = 1, Npoints 1215 1215 1216 1216 iz=1 … … 1244 1244 cldlayer = 0._wp 1245 1245 nsublayer = 0._wp 1246 doiz = 1, Ncat1247 doic = 1, Ncolumns1246 DO iz = 1, Ncat 1247 DO ic = 1, Ncolumns 1248 1248 cldlayer(:,iz) = cldlayer(:,iz) + cldlay(:,ic,iz) 1249 1249 nsublayer(:,iz) = nsublayer(:,iz) + nsublay(:,ic,iz) … … 1272 1272 eta = 0.6_wp ! Multiple-scattering factor (Vaillant de Guelis et al. 2017a, AMT) 1273 1273 1274 1274 ! Inputs 1275 1275 integer,intent(in) :: & 1276 1276 Npoints, & ! Number of gridpoints … … 1291 1291 surfelev ! Surface Elevation (SE) 1292 1292 1293 1293 ! Outputs 1294 1294 real(wp),intent(out),dimension(Npoints,Nlevels,Ntype+1) :: & 1295 1295 lidarcldtype ! 3D OPAQ product fraction (opaque clouds, thin clouds, z_opaque, opacity) … … 1324 1324 1325 1325 ! #################################################################################### 1326 ! 1) Initialize 1326 ! 1) Initialize 1327 1327 ! #################################################################################### 1328 1328 cldtype(:,:) = 0._wp … … 1342 1342 ! 2) Cloud detection and Fully attenuated layer detection 1343 1343 ! #################################################################################### 1344 dok=1,Nlevels1344 DO k=1,Nlevels 1345 1345 ! Cloud detection at subgrid-scale: 1346 1346 where ( (x(:,:,k) .gt. S_cld) .and. (x(:,:,k) .ne. undef) ) … … 1375 1375 ! #################################################################################### 1376 1376 1377 dok=1,Nlevels1378 doic = 1, Ncolumns1379 doip = 1, Npoints1377 DO k=1,Nlevels 1378 DO ic = 1, Ncolumns 1379 DO ip = 1, Npoints 1380 1380 1381 1381 cldlay(ip,ic,1) = MAX(cldlay(ip,ic,1),cldyopaq(ip,ic,k)) ! Opaque cloud … … 1393 1393 1394 1394 ! OPAQ variables 1395 doic = 1, Ncolumns1396 doip = 1, Npoints1395 DO ic = 1, Ncolumns 1396 DO ip = 1, Npoints 1397 1397 1398 1398 ! Declaring non-opaque cloudy profiles as thin cloud profiles 1399 1400 1401 1399 if ( cldlay(ip,ic,4).gt. 0. .and. cldlay(ip,ic,1) .eq. 0. ) then 1400 cldlay(ip,ic,2) = 1._wp 1401 endif 1402 1402 1403 1403 ! Filling in 3D and 2D variables 1404 1404 1405 1405 ! Opaque cloud profiles 1406 1407 1408 1409 dok=1,Nlevels-11406 if ( cldlay(ip,ic,1) .eq. 1. ) then 1407 zopac = 0._wp 1408 z_top = 0._wp 1409 DO k=1,Nlevels-1 1410 1410 ! Declaring z_opaque altitude and opaque cloud fraction for 3D and 2D variables 1411 1411 ! From SFC-2-TOA ( actually from vgrid_z(SFC+1) = vgrid_z(Nlevels-1) ) 1412 1413 1414 1415 1416 1417 1418 1419 1420 1412 if ( cldy(ip,ic,Nlevels-k) .eq. 1. .and. zopac .eq. 0. ) then 1413 lidarcldtype(ip,Nlevels-k + 1,3) = lidarcldtype(ip,Nlevels-k + 1,3) + 1._wp 1414 cldlay(ip,ic,3) = vgrid_z(Nlevels-k+1) ! z_opaque altitude 1415 nsublay(ip,ic,3) = 1._wp 1416 zopac = Nlevels-k+1 ! z_opaque vertical index on vgrid_z 1417 endif 1418 if ( cldy(ip,ic,Nlevels-k) .eq. 1. ) then 1419 lidarcldtype(ip,Nlevels-k ,1) = lidarcldtype(ip,Nlevels-k ,1) + 1._wp 1420 z_top = Nlevels-k ! top cloud layer vertical index on vgrid_z 1421 1421 endif 1422 1422 enddo 1423 1423 ! Summing opaque cloud mean temperatures and altitudes 1424 1424 ! as defined in Vaillant de Guelis et al. 2017a, AMT … … 1432 1432 cldlay(ip,ic,1) = 0 1433 1433 endif 1434 1434 endif 1435 1435 1436 1436 ! Thin cloud profiles 1437 1438 1439 1440 1441 dok=1,Nlevels1437 if ( cldlay(ip,ic,2) .eq. 1. ) then 1438 topcloud = 0._wp 1439 z_top = 0._wp 1440 z_base = 0._wp 1441 DO k=1,Nlevels 1442 1442 ! Declaring thin cloud fraction for 3D variable 1443 1443 ! From TOA-2-SFC 1444 1444 if ( cldy(ip,ic,k) .eq. 1. .and. topcloud .eq. 1. ) then 1445 1445 lidarcldtype(ip,k,2) = lidarcldtype(ip,k,2) + 1._wp 1446 1446 z_base = k ! bottom cloud layer 1447 1447 endif 1448 1448 if ( cldy(ip,ic,k) .eq. 1. .and. topcloud .eq. 0. ) then 1449 1449 lidarcldtype(ip,k,2) = lidarcldtype(ip,k,2) + 1._wp 1450 1451 1450 z_top = k ! top cloud layer 1451 z_base = k ! bottom cloud layer 1452 1452 topcloud = 1._wp 1453 1454 1453 endif 1454 enddo 1455 1455 ! Computing mean emissivity using layers below the bottom cloud layer to the surface 1456 1457 1458 1459 dok=z_base+1,Nlevels1460 1461 1462 1456 srmean = 0._wp 1457 srcount = 0._wp 1458 cloudemis = 0._wp 1459 DO k=z_base+1,Nlevels 1460 if ( (x(ip,ic,k) .gt. S_att_opaq) .and. (x(ip,ic,k) .lt. 1.0) .and. (x(ip,ic,k) .ne. undef) ) then 1461 srmean = srmean + x(ip,ic,k) 1462 srcount = srcount + 1. 1463 1463 endif 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1464 enddo 1465 ! If clear sky layers exist below bottom cloud layer 1466 if ( srcount .gt. 0. ) then 1467 trans2 = srmean/srcount ! thin cloud transmittance**2 1468 tau_app = -(log(trans2))/2. ! apparent cloud optical depth 1469 tau_vis = tau_app/eta ! cloud visible optical depth (multiple scat.) 1470 tau_ir = tau_vis/2. ! approx. relation between visible and IR ODs 1471 cloudemis = 1. - exp(-tau_ir) ! no diffusion in IR considered : emis = 1-T 1472 count_emis(ip) = count_emis(ip) + 1. 1473 endif 1474 1474 ! Summing thin cloud mean temperatures and altitudes 1475 1475 ! as defined in Vaillant de Guelis et al. 2017a, AMT … … 1500 1500 ! 3D opacity fraction (=4) !Summing z_opaque fraction from TOA(k=1) to SFC(k=Nlevels) 1501 1501 lidarcldtype(:,1,4) = lidarcldtype(:,1,3) !top layer equal to 3D z_opaque fraction 1502 doip = 1, Npoints1503 dok = 2, Nlevels1502 DO ip = 1, Npoints 1503 DO k = 2, Nlevels 1504 1504 if ( (lidarcldtype(ip,k,3) .ne. undef) .and. (lidarcldtype(ip,k-1,4) .ne. undef) ) then 1505 lidarcldtype(ip,k,4) = lidarcldtype(ip,k,3) + lidarcldtype(ip,k-1,4) 1506 else 1507 lidarcldtype(ip,k,4) = undef 1508 endif 1509 enddo 1505 lidarcldtype(ip,k,4) = lidarcldtype(ip,k,3) + lidarcldtype(ip,k-1,4) 1506 else 1507 lidarcldtype(ip,k,4) = undef 1508 endif 1510 1509 enddo 1510 enddo 1511 1511 1512 1512 ! Layered cloud types (opaque, thin and z_opaque 2D variables) 1513 1513 1514 doiz = 1, Ntype1515 doic = 1, Ncolumns1514 DO iz = 1, Ntype 1515 DO ic = 1, Ncolumns 1516 1516 cldtype(:,iz) = cldtype(:,iz) + cldlay(:,ic,iz) 1517 1517 nsublayer(:,iz) = nsublayer(:,iz) + nsublay(:,ic,iz) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/lmdz_cosp_construct_destroy_mod.F90
r5099 r5158 15 15 numMODISReffIceBins,reffICE_binCenters, & 16 16 numMODISReffLiqBins, reffLIQ_binCenters, & 17 18 19 17 numISCCPTauBins,numISCCPPresBins, & 18 numMISRTauBins,numMISRHgtBins, & 19 numModisTauBins,numMODISPresBins 20 20 21 21 implicit none … … 297 297 type(cosp_optical_inputs),intent(inout) :: y 298 298 299 if (allocated(y%tau_067)) 300 if (allocated(y%emiss_11)) 301 if (allocated(y%frac_out)) 299 if (allocated(y%tau_067)) deallocate(y%tau_067) 300 if (allocated(y%emiss_11)) deallocate(y%emiss_11) 301 if (allocated(y%frac_out)) deallocate(y%frac_out) 302 302 if (allocated(y%beta_mol_calipso)) deallocate(y%beta_mol_calipso) 303 303 if (allocated(y%tau_mol_calipso)) deallocate(y%tau_mol_calipso) … … 308 308 if (allocated(y%tautot_ice_calipso)) deallocate(y%tautot_ice_calipso) 309 309 if (allocated(y%tautot_liq_calipso)) deallocate(y%tautot_liq_calipso) 310 if (allocated(y%tautot_S_liq)) 311 if (allocated(y%tautot_S_ice)) 312 if (allocated(y%z_vol_cloudsat)) 313 if (allocated(y%kr_vol_cloudsat)) 314 if (allocated(y%g_vol_cloudsat)) 315 if (allocated(y%asym)) 316 if (allocated(y%ss_alb)) 317 if (allocated(y%fracLiq)) 310 if (allocated(y%tautot_S_liq)) deallocate(y%tautot_S_liq) 311 if (allocated(y%tautot_S_ice)) deallocate(y%tautot_S_ice) 312 if (allocated(y%z_vol_cloudsat)) deallocate(y%z_vol_cloudsat) 313 if (allocated(y%kr_vol_cloudsat)) deallocate(y%kr_vol_cloudsat) 314 if (allocated(y%g_vol_cloudsat)) deallocate(y%g_vol_cloudsat) 315 if (allocated(y%asym)) deallocate(y%asym) 316 if (allocated(y%ss_alb)) deallocate(y%ss_alb) 317 if (allocated(y%fracLiq)) deallocate(y%fracLiq) 318 318 if (allocated(y%beta_mol_grLidar532)) deallocate(y%beta_mol_grLidar532) 319 319 if (allocated(y%betatot_grLidar532)) deallocate(y%betatot_grLidar532) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/lmdz_cosp_interface.F90
r5133 r5158 53 53 ! mr_ozone, !Concentration ozone (Kg/Kg) 54 54 ! dem_s !Cloud optical emissivity 55 ! dtau_s 56 ! emsfc_lw = 1. 55 ! dtau_s !Cloud optical thickness 56 ! emsfc_lw = 1. !Surface emissivity dans radlwsw.F90 57 57 58 58 … … 95 95 96 96 ! Local variables 97 character(len=64),PARAMETER 98 character(len=64),PARAMETER 99 100 integer, save 101 integer, save :: Ncolumns! Number of subcolumns in SCOPS102 integer, save :: Npoints! Number of gridpoints97 character(len=64),PARAMETER :: cosp_input_nl = 'cospv2_input_nl.txt' 98 character(len=64),PARAMETER :: cosp_output_nl = 'cospv2_output_nl.txt' 99 100 integer, save :: isccp_topheight, isccp_topheight_direction, overlap 101 integer, save :: Ncolumns ! Number of subcolumns in SCOPS 102 integer, save :: Npoints ! Number of gridpoints 103 103 !$OMP THREADPRIVATE(Npoints) 104 integer, save :: Nlevels! Number of model vertical levels105 integer :: Nptslmdz, Nlevlmdz! Nb de points issus de physiq.F106 integer, save :: Npoints_it ! Max number of gridpoints to be107 108 type(cosp_config), save :: cfg! Variable qui contient les cles109 110 111 104 integer, save :: Nlevels ! Number of model vertical levels 105 integer :: Nptslmdz, Nlevlmdz ! Nb de points issus de physiq.F 106 integer, save :: Npoints_it ! Max number of gridpoints to be 107 ! processed in one iteration 108 type(cosp_config), save :: cfg ! Variable qui contient les cles 109 ! logiques des simulateurs et des 110 ! diagnostics, definie dans: 111 ! lmdz_cosp_construct_destroy_mod 112 112 !$OMP THREADPRIVATE(cfg) 113 113 114 integer 115 real(wp), save 116 114 integer :: t0, t1, count_rate, count_max 115 real(wp), save :: cloudsat_radar_freq, cloudsat_k2, rttov_ZenAng, co2, & 116 ch4, n2o, co, emsfc_lw 117 117 !$OMP THREADPRIVATE(emsfc_lw) 118 118 119 integer, dimension(RTTOV_MAX_CHANNELS), save 119 integer, dimension(RTTOV_MAX_CHANNELS), save :: rttov_Channels 120 120 real(wp), dimension(RTTOV_MAX_CHANNELS), save :: rttov_Surfem 121 integer, save 122 123 124 integer, save 125 integer, save 126 127 logical, save 128 121 integer, save :: surface_radar, use_mie_tables, & 122 cloudsat_use_gas_abs, cloudsat_do_ray, & 123 melt_lay 124 integer, save :: lidar_ice_type 125 integer, save :: rttov_platform, rttov_satellite, & 126 rttov_Instrument, rttov_Nchannels 127 logical, save :: use_vgrid_in, csat_vgrid_in, & 128 use_precipitation_fluxes 129 129 130 130 ! Declaration necessaires pour les sorties IOIPSL 131 real:: ecrit_day, ecrit_hf, ecrit_mth, missing_val132 logical 131 REAL :: ecrit_day, ecrit_hf, ecrit_mth, missing_val 132 logical :: ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, ok_all_xml 133 133 logical, save :: debut_cosp=.true. 134 134 !$OMP THREADPRIVATE(debut_cosp) … … 142 142 143 143 !----------------------------- Input variables from LMDZ-GCM ------------------------------- 144 integer :: overlaplmdz ! overlap type: 1=max,145 146 real, dimension(Nptslmdz,Nlevlmdz) 147 mr_lsice, mr_ccliq, mr_ccice, fl_lsrain, &148 149 150 151 real, dimension(Nptslmdz,Nlevlmdz) 152 real, dimension(Nptslmdz) 153 154 real, dimension(Nptslmdz) 155 real, dimension(Nlevlmdz) 156 integer 157 real:: dtime, freq_cosp158 real, dimension(2) 144 integer :: overlaplmdz ! overlap type: 1=max, 145 ! 2=rand, 3=max/rand 146 real, dimension(Nptslmdz,Nlevlmdz) :: phi, p, ph, T, sh, rh, tca, cca, mr_lsliq, & 147 mr_lsice, mr_ccliq, mr_ccice, fl_lsrain, & 148 fl_lssnow, fl_ccrain, fl_ccsnow, fl_lsgrpl, & 149 zlev, zlev_half, mr_ozone, radliq, radice, & 150 dtau_s, dem_s, dtau_c, dem_c, ref_liq, ref_ice 151 real, dimension(Nptslmdz,Nlevlmdz) :: fl_lsrainI, fl_lssnowI, fl_ccrainI, fl_ccsnowI 152 real, dimension(Nptslmdz) :: lon, lat, skt, fracTerLic, u_wind, v_wind, & 153 phis, sunlit 154 real, dimension(Nptslmdz) :: land ! variables intermediaire pour masque TerLic 155 real, dimension(Nlevlmdz) :: presnivs 156 integer :: itap, k, ip 157 REAL :: dtime, freq_cosp 158 real, dimension(2) :: time_bnds 159 159 160 160 double precision :: d_dtime … … 169 169 logical :: & 170 170 Lsingle = .true., & ! True if using MMF_v3_single_moment CLOUDSAT 171 171 ! microphysical scheme (default) 172 172 Ldouble = .false. ! True if using MMF_v3.5_two_moment CLOUDSAT 173 174 type(size_distribution), save 173 ! microphysical scheme 174 type(size_distribution), save :: sd ! Hydrometeor description 175 175 !$OMP THREADPRIVATE(sd) 176 type(radar_cfg), save 176 type(radar_cfg), save :: rcfg_cloudsat ! Radar configuration 177 177 !$OMP THREADPRIVATE(rcfg_cloudsat) 178 real, dimension(Nptslmdz,Nlevlmdz,N_HYDRO) :: Reff 179 180 type(cosp_outputs) 181 type(cosp_optical_inputs) 182 183 type(cosp_column_inputs) 184 185 character(len=256), dimension(100) 186 character(len=64), save 178 real, dimension(Nptslmdz,Nlevlmdz,N_HYDRO) :: Reff ! Liquid and Ice particles 179 ! effective radius 180 type(cosp_outputs) :: cospOUT ! COSP simulator outputs 181 type(cosp_optical_inputs) :: cospIN ! COSP optical (or derived?) 182 ! fields needed by simulators 183 type(cosp_column_inputs) :: cospstateIN ! COSP model fields needed 184 ! by simulators 185 character(len=256), dimension(100) :: cosp_status 186 character(len=64), save :: cloudsat_micro_scheme 187 187 188 188 ! Indices to address arrays of LS and CONV hydrometeors … … 271 271 print*,' Cles des differents simulateurs cosp a itap :',itap 272 272 print*,'cfg%Lcloudsat, cfg%Lcalipso, cfg%LgrLidar532, cfg%Latlid, cfg%Lparasol, & 273 273 cfg%Lisccp, cfg%Lmisr, cfg%Lmodis, cfg%Lrttov', & 274 274 cfg%Lcloudsat, cfg%Lcalipso, cfg%LgrLidar532, cfg%Latlid, cfg%Lparasol, & 275 275 cfg%Lisccp, cfg%Lmisr, cfg%Lmodis, cfg%Lrttov … … 340 340 print*,' Cles des differents simulateurs cosp a itap :',itap 341 341 print*,'cfg%Lcloudsat, cfg%Lcalipso, cfg%LgrLidar532, cfg%Latlid, cfg%Lparasol, & 342 342 cfg%Lisccp, cfg%Lmisr, cfg%Lmodis, cfg%Lrttov', & 343 343 cfg%Lcloudsat, cfg%Lcalipso, cfg%LgrLidar532, cfg%Latlid, cfg%Lparasol, & 344 344 cfg%Lisccp, cfg%Lmisr, cfg%Lmodis, cfg%Lrttov 345 345 346 346 endif !(itap.gt.1).and.(first_write) … … 369 369 370 370 zlev_half(:,1) = phis(:)/9.81 371 dok = 2, Nlevels372 doip = 1, Npoints371 DO k = 2, Nlevels 372 DO ip = 1, Npoints 373 373 zlev_half(ip,k) = phi(ip,k)/9.81 + & 374 374 (phi(ip,k)-phi(ip,k-1))/9.81 * (ph(ip,k)-p(ip,k)) / (p(ip,k)-p(ip,k-1)) … … 383 383 384 384 ! 3) Masque terre/mer a partir de la variable fracTerLic 385 doip = 1, Npoints385 DO ip = 1, Npoints 386 386 if (fracTerLic(ip).ge.0.5) then 387 387 land(ip) = 1. … … 445 445 call construct_cospstateIN(Npoints,Nlevels,0,cospstateIN) 446 446 447 cospstateIN%lat 448 cospstateIN%lon = lon(1:Npoints)449 cospstateIN%at = t(1:Npoints,Nlevels:1:-1)450 cospstateIN%qv 451 cospstateIN%o3 = mr_ozone(1:Npoints,Nlevels:1:-1)452 cospstateIN%sunlit 453 cospstateIN%skt 454 cospstateIN%land 455 cospstateIN%surfelev 456 cospstateIN%pfull 457 cospstateIN%phalf(1:Npoints,1) 458 cospstateIN%phalf(1:Npoints,2:Nlevels+1) = ph(1:Npoints,Nlevels:1:-1)459 cospstateIN%hgt_matrix = zlev(1:Npoints,Nlevels:1:-1)460 cospstateIN%hgt_matrix_half(1:Npoints,Nlevels+1) 461 cospstateIN%hgt_matrix_half(1:Npoints,1:Nlevels) = zlev_half(1:Npoints,Nlevels:1:-1)447 cospstateIN%lat = lat(1:Npoints) 448 cospstateIN%lon = lon(1:Npoints) 449 cospstateIN%at = t(1:Npoints,Nlevels:1:-1) 450 cospstateIN%qv = sh(1:Npoints,Nlevels:1:-1) 451 cospstateIN%o3 = mr_ozone(1:Npoints,Nlevels:1:-1) 452 cospstateIN%sunlit = sunlit(1:Npoints) 453 cospstateIN%skt = skt(1:Npoints) 454 cospstateIN%land = land(1:Npoints) 455 cospstateIN%surfelev = zlev_half(1:Npoints,1) 456 cospstateIN%pfull = p(1:Npoints,Nlevels:1:-1) 457 cospstateIN%phalf(1:Npoints,1) = 0._wp 458 cospstateIN%phalf(1:Npoints,2:Nlevels+1) = ph(1:Npoints,Nlevels:1:-1) 459 cospstateIN%hgt_matrix = zlev(1:Npoints,Nlevels:1:-1) 460 cospstateIN%hgt_matrix_half(1:Npoints,Nlevels+1) = 0._wp 461 cospstateIN%hgt_matrix_half(1:Npoints,1:Nlevels) = zlev_half(1:Npoints,Nlevels:1:-1) 462 462 463 463 … … 483 483 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 484 484 485 call subsample_and_optics(cfg, Npoints, Nlevels, Ncolumns, N_HYDRO,overlap, 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 485 call subsample_and_optics(cfg, Npoints, Nlevels, Ncolumns, N_HYDRO,overlap, & 486 use_precipitation_fluxes, lidar_ice_type, sd, & 487 tca(1:Npoints,Nlevels:1:-1), cca(1:Npoints,Nlevels:1:-1), & 488 fl_lsrain(1:Npoints,Nlevels:1:-1), & 489 fl_lssnow(1:Npoints,Nlevels:1:-1), & 490 fl_lsgrpl(1:Npoints,Nlevels:1:-1), & 491 fl_ccrain(1:Npoints,Nlevels:1:-1), & 492 fl_ccsnow(1:Npoints,Nlevels:1:-1), & 493 mr_lsliq(1:Npoints,Nlevels:1:-1), & 494 mr_lsice(1:Npoints,Nlevels:1:-1), & 495 mr_ccliq(1:Npoints,Nlevels:1:-1), & 496 mr_ccice(1:Npoints,Nlevels:1:-1), & 497 Reff(1:Npoints,Nlevels:1:-1,:), & 498 dtau_c(1:Npoints,Nlevels:1:-1), & 499 dtau_s(1:Npoints,Nlevels:1:-1), & 500 dem_c(1:Npoints,Nlevels:1:-1), & 501 dem_s(1:Npoints,Nlevels:1:-1), cospstateIN, cospIN) 502 502 503 503 … … 531 531 ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, ok_all_xml, & 532 532 ecrit_mth, ecrit_day, ecrit_hf, use_vgrid_in, & 533 533 niv_sorties, vgrid_z_in, zlev(1,:)) 534 534 535 535 !$OMP END MASTER -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/lmdz_cosp_output_mod.F90
r5157 r5158 88 88 "clcalipsoliq", "CALIPSO Liq-Phase Cloud Fraction", "%", (/ ('', i=1, 3) /)) 89 89 TYPE(ctrl_outcosp), SAVE :: o_clcalipsoun = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), & 90 "clcalipsoun", "CALIPSO Undef-Phase Cloud Fraction", "%", (/ ('', i=1, 3) /)) 90 "clcalipsoun", "CALIPSO Undef-Phase Cloud Fraction", "%", (/ ('', i=1, 3) /)) 91 91 TYPE(ctrl_outcosp), SAVE :: o_clcalipsotmpice = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), & 92 92 "clcalipsotmpice", "CALIPSO Ice-Phase Cloud Fraction", "%", (/ ('', i=1, 3) /)) … … 109 109 "clcalipsothin", "CALIPSO Thin profile Cloud Fraction", "%", (/ ('', i=1, 3) /)) 110 110 TYPE(ctrl_outcosp), SAVE :: o_clcalipsozopaque = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), & 111 "clcalipsozopaque", "CALIPSO z_opaque Fraction", "%", (/ ('', i=1, 3) /)) 111 "clcalipsozopaque", "CALIPSO z_opaque Fraction", "%", (/ ('', i=1, 3) /)) 112 112 TYPE(ctrl_outcosp), SAVE :: o_clcalipsoopacity = ctrl_outcosp((/ .TRUE., .TRUE., .TRUE. /), & 113 113 "clcalipsoopacity", "CALIPSO opacity Fraction", "%", (/ ('', i=1, 3) /)) … … 311 311 ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, ok_all_xml, & 312 312 ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, Nlvgrid, vgrid_z_loc, & 313 313 vgrid_mz) 314 314 315 315 use mod_cosp_config, only : CLOUDSAT_DBZE_BINS, SR_BINS, CLOUDSAT_CFAD_ZE_MIN, PARASOL_NREFL, & … … 319 319 numMODISReffIceBins,reffICE_binCenters, & 320 320 numMODISReffLiqBins, reffLIQ_binCenters, pres_binCenters, & 321 321 cloudsat_binCenters, calipso_binCenters 322 322 323 323 USE iophy … … 335 335 real,dimension(Nlevlmdz) :: presnivs, vgrid_mz 336 336 real,dimension(Nlvgrid) :: vgrid_z_loc 337 real :: dtime, freq_cosp, ecrit_day, ecrit_hf, ecrit_mth337 REAL :: dtime, freq_cosp, ecrit_day, ecrit_hf, ecrit_mth 338 338 logical :: use_vgrid 339 339 logical :: ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, ok_all_xml … … 341 341 !!! Variables locales 342 342 integer :: idayref, iff, ii 343 real:: zjulian,zjulian_start343 REAL :: zjulian,zjulian_start 344 344 real(wp),dimension(Ncolumns) :: column_ax 345 345 CHARACTER(LEN=20), DIMENSION(3) :: chfreq = (/ '1day', '1d ', '3h ' /) … … 359 359 360 360 !! Definition valeurs axes 361 doii=1,Ncolumns361 DO ii=1,Ncolumns 362 362 column_ax(ii) = real(ii) 363 363 enddo -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/lmdz_cosp_output_write_mod.F90
r5157 r5158 46 46 !!! Variables d'entree 47 47 integer :: itap, Nlevlmdz, Ncolumns, Npoints, Nlvgrid 48 real:: freq_COSP, dtime, missing_val, missing_cosp48 REAL :: freq_COSP, dtime, missing_val, missing_cosp 49 49 type(cosp_config) :: cfg ! Control outputs 50 50 type(cosp_outputs) :: & … … 257 257 where(cospOUT%calipso_cfad_sr == R_UNDEF) cospOUT%calipso_cfad_sr = missing_val 258 258 259 doicl=1,SR_BINS260 dok=1,Nlvgrid261 doip=1,Npoints259 DO icl=1,SR_BINS 260 DO k=1,Nlvgrid 261 DO ip=1,Npoints 262 262 tmp_fi4da_cfadL(ip,k,icl)=cospOUT%calipso_cfad_sr(ip,icl,k) 263 263 enddo … … 312 312 if (cfg%LcfadLidarsr532gr) then 313 313 where(cospOUT%grLidar532_cfad_sr == R_UNDEF) cospOUT%grLidar532_cfad_sr = missing_val 314 doicl=1,SR_BINS315 dok=1,Nlvgrid316 doip=1,Npoints314 DO icl=1,SR_BINS 315 DO k=1,Nlvgrid 316 DO ip=1,Npoints 317 317 tmp_fi4da_cfadLgr(ip,k,icl)=cospOUT%grLidar532_cfad_sr(ip,icl,k) 318 318 enddo … … 360 360 if (cfg%LcfadLidarsr355) then 361 361 where(cospOUT%atlid_cfad_sr == R_UNDEF) cospOUT%atlid_cfad_sr = missing_val 362 doicl=1,SR_BINS363 dok=1,Nlvgrid364 doip=1,Npoints362 DO icl=1,SR_BINS 363 DO k=1,Nlvgrid 364 DO ip=1,Npoints 365 365 tmp_fi4da_cfadLatlid(ip,k,icl)=cospOUT%atlid_cfad_sr(ip,icl,k) 366 366 enddo … … 456 456 if (cfg%LcfadDbze94) then 457 457 where(cospOUT%cloudsat_cfad_ze == R_UNDEF) cospOUT%cloudsat_cfad_ze = missing_val 458 doicl=1,CLOUDSAT_DBZE_BINS459 dok=1,Nlvgrid460 doip=1,Npoints458 DO icl=1,CLOUDSAT_DBZE_BINS 459 DO k=1,Nlvgrid 460 DO ip=1,Npoints 461 461 tmp_fi4da_cfadR(ip,k,icl)=cospOUT%cloudsat_cfad_ze(ip,icl,k) 462 462 enddo … … 531 531 where(cospOUT%misr_cldarea == R_UNDEF) cospOUT%misr_cldarea = missing_val 532 532 533 doicl=1,numMISRHgtBins534 dok=1,Nlvgrid535 do ip=1,Npoints533 DO icl=1,numMISRHgtBins 534 DO k=1,Nlvgrid 535 DO ip=1,Npoints 536 536 tmp_fi4da_misr(ip,icl,k)=cospOUT%misr_fq(ip,k,icl) 537 537 enddo -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/lmdz_cosp_read_outputkeys.F90
r5133 r5158 29 29 Lcloudsat, & ! CLOUDSAT simulator on/off switch 30 30 Lcalipso, & ! CALIPSO simulator on/off switch 31 31 LgrLidar532, & ! GROUND LIDAR simulator on/off switch 32 32 Latlid, & ! ATLID simulator on/off switch 33 33 Lisccp, & ! ISCCP simulator on/off switch … … 161 161 integer :: i 162 162 163 doi=1,107163 DO i=1,107 164 164 cfg%out_list(i)='' 165 165 enddo … … 295 295 integer :: i 296 296 297 doi=1,107297 DO i=1,107 298 298 cfg%out_list(i)='' 299 299 enddo … … 490 490 Lptradarflag8,Lptradarflag9,Lradarpia 491 491 492 doi=1,107492 DO i=1,107 493 493 cfg%out_list(i)='' 494 494 enddo … … 1062 1062 IF (using_xios) THEN 1063 1063 1064 doi=1,1071064 DO i=1,107 1065 1065 cfg%out_list(i)='' 1066 1066 enddo -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/lmdz_cosp_subsample_and_optics_mod.F90
r5099 r5158 142 142 frac_cv(1:nPoints,1:nLevels) = 0._wp 143 143 prec_cv(1:nPoints,1:nLevels) = 0._wp 144 doj=1,nPoints145 dok=1,nLevels146 doi=1,nColumns144 DO j=1,nPoints 145 DO k=1,nLevels 146 DO i=1,nColumns 147 147 if (cospIN%frac_out(j,i,k) .eq. 1) frac_ls(j,k) = frac_ls(j,k)+1._wp 148 148 if (cospIN%frac_out(j,i,k) .eq. 2) frac_cv(j,k) = frac_cv(j,k)+1._wp … … 171 171 Reff(:,:,:,:) = 0._wp 172 172 Np(:,:,:,:) = 0._wp 173 dok=1,nColumns173 DO k=1,nColumns 174 174 ! Subcolumn cloud fraction 175 175 column_frac_out = cospIN%frac_out(:,k,:) … … 214 214 fl_ccrain(:,:) = 0._wp 215 215 fl_ccsnow(:,:) = 0._wp 216 dok=1,nLevels217 doj=1,nPoints216 DO k=1,nLevels 217 DO j=1,nPoints 218 218 ! In-cloud mixing ratios. 219 219 if (frac_ls(j,k) .ne. 0.) then … … 359 359 allocate(g_vol(nPoints,nLevels)) 360 360 g_vol(:,:)=0._wp 361 doi=1,nPoints362 doj=1,nLevels361 DO i=1,nPoints 362 DO j=1,nLevels 363 363 if (cospIN%rcfg_cloudsat%use_gas_abs == 1 .or. (cospIN%rcfg_cloudsat%use_gas_abs == 2 .and. j .eq. 1)) then 364 364 g_vol(i,j) = gases(cospstateIN%pfull(i,j), cospstateIN%at(i,j),cospstateIN%qv(i,j),cospIN%rcfg_cloudsat%freq) … … 371 371 allocate(fracPrecipIce(nPoints,nColumns,nLevels)) 372 372 fracPrecipIce(:,:,:) = 0._wp 373 dok=1,nColumns373 DO k=1,nColumns 374 374 call quickbeam_optics(sd, cospIN%rcfg_cloudsat, nPoints, nLevels, R_UNDEF, & 375 375 mr_hydro(:,k,:,1:nHydro)*1000._wp, Reff(:,k,:,1:nHydro)*1.e6_wp,& … … 406 406 407 407 ! For near-surface diagnostics, we only need the frozen fraction at one layer. 408 doi=1,nPoints !PREC_BUG409 408 DO i=1,nPoints !PREC_BUG 409 cospIN%fracPrecipIce(i,:) = fracPrecipIce_statGrid(i,:,cloudsat_preclvl_index(i)) !PREC_BUG 410 410 enddo !PREC_BUG 411 411 ! cospIN%fracPrecipIce(:,:) = fracPrecipIce_statGrid(:,:,cloudsat_preclvl) !!! ORIGINAL -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/math_lib.F90
r5099 r5158 96 96 else 97 97 sumo = 0._wp 98 doj=i1,i298 DO j=i1,i2 99 99 deltah = abs(s(i1+1)-s(i1)) 100 100 sumo = sumo + f(j)*deltah … … 204 204 end if 205 205 206 doi = 2, ntab206 DO i = 2, ntab 207 207 if ( xtab(i) <= xtab(i-1) ) then 208 208 lerror = .true. … … 239 239 ihi = ntab 240 240 241 doi = 1, ntab241 DO i = 1, ntab 242 242 if ( a <= xtab(i) ) then 243 243 exit … … 249 249 ilo = min ( ilo, ntab - 1 ) 250 250 251 doi = 1, ntab251 DO i = 1, ntab 252 252 if ( xtab(i) <= b ) then 253 253 exit … … 263 263 !ds sum1 = 0.0D+00 264 264 265 doi = ilo, ihi265 DO i = ilo, ihi 266 266 267 267 x1 = xtab(i-1) … … 371 371 ga=1._wp 372 372 m1=x-1 373 dok=2,m1373 DO k=2,m1 374 374 ga=ga*k 375 375 enddo … … 382 382 m=int(z) 383 383 r=1._wp 384 dok=1,m384 DO k=1,m 385 385 r=r*(z-k) 386 386 enddo … … 390 390 endif 391 391 gr=g(26) 392 dok=25,1,-1392 DO k=25,1,-1 393 393 gr=gr*z+g(k) 394 394 enddo -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/modis_simulator.F90
r5099 r5158 163 163 cloudMask = retrievedTau(1:nSubCols) >= min_OpticalThickness 164 164 165 doi = 1, nSubCols165 DO i = 1, nSubCols 166 166 if(cloudMask(i)) then 167 167 ! ################################################################################## … … 380 380 reffIceWRK(1:nPoints,1:nSubCols) = merge(particle_size,R_UNDEF,iceCloudMask) 381 381 reffLiqWRK(1:nPoints,1:nSubCols) = merge(particle_size,R_UNDEF,waterCloudMask) 382 doj=1,nPoints382 DO j=1,nPoints 383 383 384 384 ! Fill clear and optically thin subcolumns with fill … … 439 439 ! layers and use the trapezoidal rule. 440 440 totalTau = 0._wp; totalProduct = 0._wp 441 doi = 2, size(tauIncrement)441 DO i = 2, size(tauIncrement) 442 442 if(totalTau + tauIncrement(i) > tauLimit) then 443 443 deltaX = tauLimit - totalTau … … 479 479 ! Find the extinction-weighted value of f(tau), assuming constant f within each layer 480 480 totalTau = 0._wp; totalProduct = 0._wp 481 doi = 1, size(tauIncrement)481 DO i = 1, size(tauIncrement) 482 482 if(totalTau + tauIncrement(i) > tauLimit) then 483 483 deltaX = tauLimit - totalTau … … 712 712 cloudMask(1:nLevels) = tau(1:nLevels) > 0. 713 713 cloudIndicies = pack((/ (i, i = 1, nLevels) /), mask = cloudMask) 714 doi = 1, size(cloudIndicies)714 DO i = 1, size(cloudIndicies) 715 715 call two_stream(tau(cloudIndicies(i)), g(cloudIndicies(i)), w0(cloudIndicies(i)), Refl(i), Trans(i)) 716 716 end do … … 892 892 Tran_cumulative(1) = Tran(1) 893 893 894 doi=2, npts894 DO i=2, npts 895 895 ! place (add) previous combined layer(s) reflectance on top of layer i, w/black surface (or ignoring surface): 896 896 Refl_cumulative(i) = Refl_cumulative(i-1) + Refl(i)*(Tran_cumulative(i-1)**2)/(1._wp - Refl_cumulative(i-1) * Refl(i)) -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/optics_lib.F90
r5099 r5158 539 539 if (alam < cutice) then 540 540 ! Region from 0.045 microns to 167.0 microns - no temperature depend 541 doi=2,nwl541 DO i=2,nwl 542 542 if(alam < wl(i)) continue 543 543 enddo … … 557 557 if(tk > temref(1)) tk=temref(1) 558 558 if(tk < temref(4)) tk=temref(4) 559 doi=2,4559 DO i=2,4 560 560 if(tk.ge.temref(i)) go to 12 561 561 enddo 562 562 12 lt1 = i 563 563 lt2 = i-1 564 doi=2,nwlt564 DO i=2,nwlt 565 565 if(alam.le.wlt(i)) go to 14 566 566 enddo -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/parasol.F90
r5099 r5158 159 159 ! Compute grid-box averaged Parasol reflectances 160 160 parasolrefl(:,:) = 0._wp 161 dok = 1, nrefl162 doic = 1, ncol161 DO k = 1, nrefl 162 DO ic = 1, ncol 163 163 parasolrefl(:,k) = parasolrefl(:,k) + refl(:,ic,k) 164 164 enddo 165 165 enddo 166 166 167 dok = 1, nrefl167 DO k = 1, nrefl 168 168 parasolrefl(:,k) = parasolrefl(:,k) / float(ncol) 169 169 ! if land=1 -> parasolrefl=R_UNDEF -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/prec_scops.F90
r5099 r5158 66 66 if (cv_col .eq. 0) cv_col=1 67 67 68 doilev=1,nlev69 doibox=1,ncol70 do j=1,npoints68 DO ilev=1,nlev 69 DO ibox=1,ncol 70 DO j=1,npoints 71 71 prec_frac(j,ibox,ilev) = 0 72 72 enddo … … 74 74 enddo 75 75 76 doj=1,npoints77 doibox=1,ncol76 DO j=1,npoints 77 DO ibox=1,ncol 78 78 frac_out_ls(j,ibox)=0 79 79 frac_out_cv(j,ibox)=0 80 80 flag_ls=0 81 81 flag_cv=0 82 doilev=1,nlev82 DO ilev=1,nlev 83 83 if (frac_out(j,ibox,ilev) .eq. 1) then 84 84 flag_ls=1 … … 98 98 99 99 ! initialize the top layer 100 doj=1,npoints100 DO j=1,npoints 101 101 flag_ls=0 102 102 flag_cv=0 103 103 104 104 if (ls_p_rate(j,1) .gt. 0.) then 105 doibox=1,ncol ! possibility ONE105 DO ibox=1,ncol ! possibility ONE 106 106 if (frac_out(j,ibox,1) .eq. 1) then 107 107 prec_frac(j,ibox,1) = 1 … … 110 110 enddo ! loop over ncol 111 111 if (flag_ls .eq. 0) then ! possibility THREE 112 doibox=1,ncol112 DO ibox=1,ncol 113 113 if (frac_out(j,ibox,2) .eq. 1) then 114 114 prec_frac(j,ibox,1) = 1 … … 118 118 endif 119 119 if (flag_ls .eq. 0) then ! possibility Four 120 doibox=1,ncol120 DO ibox=1,ncol 121 121 if (frac_out_ls(j,ibox) .eq. 1) then 122 122 prec_frac(j,ibox,1) = 1 … … 126 126 endif 127 127 if (flag_ls .eq. 0) then ! possibility Five 128 doibox=1,ncol128 DO ibox=1,ncol 129 129 ! prec_frac(j,1:ncol,1) = 1 130 130 prec_frac(j,ibox,1) = 1 … … 135 135 136 136 if (cv_p_rate(j,1) .gt. 0.) then 137 doibox=1,ncol ! possibility ONE137 DO ibox=1,ncol ! possibility ONE 138 138 if (frac_out(j,ibox,1) .eq. 2) then 139 139 if (prec_frac(j,ibox,1) .eq. 0) then … … 146 146 enddo ! loop over ncol 147 147 if (flag_cv .eq. 0) then ! possibility THREE 148 doibox=1,ncol148 DO ibox=1,ncol 149 149 if (frac_out(j,ibox,2) .eq. 2) then 150 150 if (prec_frac(j,ibox,1) .eq. 0) then … … 158 158 endif 159 159 if (flag_cv .eq. 0) then ! possibility Four 160 doibox=1,ncol160 DO ibox=1,ncol 161 161 if (frac_out_cv(j,ibox) .eq. 1) then 162 162 if (prec_frac(j,ibox,1) .eq. 0) then … … 170 170 endif 171 171 if (flag_cv .eq. 0) then ! possibility Five 172 doibox=1,cv_col172 DO ibox=1,cv_col 173 173 if (prec_frac(j,ibox,1) .eq. 0) then 174 174 prec_frac(j,ibox,1) = 2 … … 187 187 188 188 ! working on the levels from top to surface 189 doilev=2,nlev190 doj=1,npoints189 DO ilev=2,nlev 190 DO j=1,npoints 191 191 flag_ls=0 192 192 flag_cv=0 193 193 194 194 if (ls_p_rate(j,ilev) .gt. 0.) then 195 doibox=1,ncol ! possibility ONE&TWO195 DO ibox=1,ncol ! possibility ONE&TWO 196 196 if ((frac_out(j,ibox,ilev) .eq. 1) .or. ((prec_frac(j,ibox,ilev-1) .eq. 1) & 197 197 .or. (prec_frac(j,ibox,ilev-1) .eq. 3))) then … … 201 201 enddo ! loop over ncol 202 202 if ((flag_ls .eq. 0) .and. (ilev .lt. nlev)) then ! possibility THREE 203 doibox=1,ncol203 DO ibox=1,ncol 204 204 if (frac_out(j,ibox,ilev+1) .eq. 1) then 205 205 prec_frac(j,ibox,ilev) = 1 … … 209 209 endif 210 210 if (flag_ls .eq. 0) then ! possibility Four 211 doibox=1,ncol211 DO ibox=1,ncol 212 212 if (frac_out_ls(j,ibox) .eq. 1) then 213 213 prec_frac(j,ibox,ilev) = 1 … … 217 217 endif 218 218 if (flag_ls .eq. 0) then ! possibility Five 219 doibox=1,ncol219 DO ibox=1,ncol 220 220 ! prec_frac(j,1:ncol,ilev) = 1 221 221 prec_frac(j,ibox,ilev) = 1 … … 225 225 226 226 if (cv_p_rate(j,ilev) .gt. 0.) then 227 doibox=1,ncol ! possibility ONE&TWO227 DO ibox=1,ncol ! possibility ONE&TWO 228 228 if ((frac_out(j,ibox,ilev) .eq. 2) .or. ((prec_frac(j,ibox,ilev-1) .eq. 2) & 229 229 .or. (prec_frac(j,ibox,ilev-1) .eq. 3))) then … … 237 237 enddo ! loop over ncol 238 238 if ((flag_cv .eq. 0) .and. (ilev .lt. nlev)) then ! possibility THREE 239 doibox=1,ncol239 DO ibox=1,ncol 240 240 if (frac_out(j,ibox,ilev+1) .eq. 2) then 241 241 if (prec_frac(j,ibox,ilev) .eq. 0) then … … 249 249 endif 250 250 if (flag_cv .eq. 0) then ! possibility Four 251 doibox=1,ncol251 DO ibox=1,ncol 252 252 if (frac_out_cv(j,ibox) .eq. 1) then 253 253 if (prec_frac(j,ibox,ilev) .eq. 0) then … … 261 261 endif 262 262 if (flag_cv .eq. 0) then ! possibility Five 263 doibox=1,cv_col263 DO ibox=1,cv_col 264 264 if (prec_frac(j,ibox,ilev) .eq. 0) then 265 265 prec_frac(j,ibox,ilev) = 2 -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/quickbeam.F90
r5099 r5158 150 150 d_gate = -1 151 151 endif 152 dok=start_gate,end_gate,d_gate152 DO k=start_gate,end_gate,d_gate 153 153 ! Loop over each profile (nprof) 154 dopr=1,nprof154 DO pr=1,nprof 155 155 ! Attenuation due to hydrometeors between radar and volume 156 156 … … 284 284 285 285 ! Effective reflectivity histogram 286 doi=1,Npoints287 doj=1,llm286 DO i=1,Npoints 287 DO j=1,llm 288 288 cfad_ze(i,:,j) = hist1D(Ncolumns,Ze_toti(i,:,j),DBZE_BINS,cloudsat_histRef) 289 289 enddo … … 301 301 else 302 302 ! Effective reflectivity histogram 303 doi=1,Npoints304 doj=1,llm303 DO i=1,Npoints 304 DO j=1,llm 305 305 cfad_ze(i,:,j) = hist1D(Ncolumns,Ze_tot(i,:,j),DBZE_BINS,cloudsat_histRef) 306 306 enddo … … 395 395 ! SUBCOLUMN processing 396 396 ! ###################################################################################### 397 doi=1, Npoints397 DO i=1, Npoints 398 398 399 399 cloudsat_preclvl = cloudsat_preclvl_index(i) !PREC_BUG 400 400 ! print*, 'i, surfelev(i), cloudsat_preclvl : ', i, surfelev(i), cloudsat_preclvl !PREC_BUG 401 401 402 dopr=1,Ncolumns402 DO pr=1,Ncolumns 403 403 ! 1) Compute the PIA in all profiles containing hydrometeors 404 404 if ( (Ze_non_out(i,pr,cloudsat_preclvl).gt.-100) .and. (Ze_out(i,pr,cloudsat_preclvl).gt.-100) ) then … … 523 523 524 524 ! Aggregate subcolumns 525 doi=1,Npoints525 DO i=1,Npoints 526 526 ! Gridmean precipitation fraction for each precipitation type 527 dok=1,nCloudsatPrecipClass527 DO k=1,nCloudsatPrecipClass 528 528 if (any(cloudsat_pflag(i,:) .eq. k-1)) then 529 529 cloudsat_precip_cover(i,k) = count(cloudsat_pflag(i,:) .eq. k-1) … … 571 571 trim(rcfg%scale_LUT_file_name) // '_radar_Z_scale_LUT.dat' 572 572 573 doi=1,maxhclass574 doj=1,mt_ntt575 dok=1,nRe_types573 DO i=1,maxhclass 574 DO j=1,mt_ntt 575 DO k=1,nRe_types 576 576 ind = i+(j-1)*maxhclass+(k-1)*(nRe_types*mt_ntt) 577 577 read(12,rec=ind) rcfg%Z_scale_flag(i,j,k), & … … 607 607 trim(rcfg%scale_LUT_file_name) // '_radar_Z_scale_LUT.dat' 608 608 609 doi=1,maxhclass610 doj=1,mt_ntt611 dok=1,nRe_types609 DO i=1,maxhclass 610 DO j=1,mt_ntt 611 DO k=1,nRe_types 612 612 ind = i+(j-1)*maxhclass+(k-1)*(nRe_types*mt_ntt) 613 613 if(.not.LUT_file_exists .or. rcfg%Z_scale_added_flag(i,j,k)) then -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/quickbeam_optics.F90
r5099 r5158 71 71 mt_ttl = (/ ((j-1)*5-60 + 273.15, j = 1, cnt_liq) /) 72 72 D(1) = dmin 73 doj=2,nd73 DO j=2,nd 74 74 D(j) = D(j-1)*exp((log(dmax)-log(dmin))/(nd-1)) 75 75 enddo … … 140 140 kr_vol = 0._wp 141 141 142 dok=1,ngate ! Loop over each profile (nprof)143 dopr=1,nprof142 DO k=1,ngate ! Loop over each profile (nprof) 143 DO pr=1,nprof 144 144 ! Determine if hydrometeor(s) present in volume 145 145 hydro = .false. 146 doj=1,rcfg%nhclass146 DO j=1,rcfg%nhclass 147 147 if ((hm_matrix(pr,k,j) > 1E-12) .and. (sd%dtype(j) > 0)) then 148 148 hydro = .true. … … 157 157 158 158 ! Loop over hydrometeor type 159 dotp=1,rcfg%nhclass159 DO tp=1,rcfg%nhclass 160 160 Re_internal = re_matrix(pr,k,tp) 161 161 … … 342 342 343 343 where(kr_vol(:,:) <= EPSILON(kr_vol)) 344 ! Volume is hydrometeor-free 344 ! Volume is hydrometeor-free 345 345 !z_vol(:,:) = undef 346 346 z_ray(:,:) = undef … … 794 794 lidx = infind(D,dmin) 795 795 uidx = infind(D,dmax) 796 dok=lidx,uidx796 DO k=lidx,uidx 797 797 N(k) = (ahp*(D(k)*1E-3)**bhp) * 1E-12 798 798 enddo … … 980 980 sizep = (pi*D0)/wl 981 981 dqv(1) = 0._wp 982 doi=1,nsizes982 DO i=1,nsizes 983 983 call mieint(sizep(i), m0(i), one, dqv, qext(i), dqsc, qbsca(i), & 984 984 dg, xs1, xs2, dph, err) … … 1183 1183 sumo = 0._wp 1184 1184 aux1 = 1.1_wp*e_th 1185 doi=1,nbands_o21185 DO i=1,nbands_o2 1186 1186 aux2 = f/v0(i) 1187 1187 aux3 = v0(i)-f … … 1207 1207 sumo = 0._wp 1208 1208 aux1 = 4.8_wp*e_th 1209 doi=1,nbands_h2o1209 DO i=1,nbands_h2o 1210 1210 aux2 = f/v1(i) 1211 1211 aux3 = v1(i)-f -
LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/scops.F90
r5099 r5158 94 94 if (ncolprint.ne.0) then 95 95 write (6,'(a)') 'frac_out_pp_rev:' 96 doj=1,npoints,100096 DO j=1,npoints,1000 97 97 write(6,'(a10)') 'j=' 98 98 write(6,'(8I10)') j … … 104 104 if (ncolprint.ne.0) then 105 105 write (6,'(a)') 'last_frac_pp:' 106 doj=1,npoints,1000106 DO j=1,npoints,1000 107 107 write(6,'(a10)') 'j=' 108 108 write(6,'(8I10)') j … … 139 139 IF (ncolprint.ne.0) then 140 140 write (6,'(a)') 'threshold_nsf2:' 141 doj=1,npoints,1000141 DO j=1,npoints,1000 142 142 write(6,'(a10)') 'j=' 143 143 write(6,'(8I10)') j … … 156 156 !maxocc(1:npoints,ibox) = merge(1,0,boxpos(1:npoints,ibox) .le. conv(1:npoints,ilev)) 157 157 !maxocc(1:npoints,ibox) = merge(1,0, conv(1:npoints,ilev) .gt. boxpos(1:npoints,ibox)) 158 doj=1,npoints158 DO j=1,npoints 159 159 if (boxpos(j,ibox).le.conv(j,ilev)) then 160 160 maxocc(j,ibox) = 1 … … 214 214 ! Set last_frac to tca at this level, so as to be tca from last level next time round 215 215 if (ncolprint.ne.0) then 216 doj=1,npoints ,1000216 DO j=1,npoints ,1000 217 217 write(6,'(a10)') 'j=' 218 218 write(6,'(8I10)') j
Note: See TracChangeset
for help on using the changeset viewer.