Changeset 728 for trunk/LMDZ.GENERIC/libf
- Timestamp:
- Jul 18, 2012, 10:54:57 AM (12 years ago)
- Location:
- trunk/LMDZ.GENERIC/libf/phystd
- Files:
-
- 3 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/libf/phystd/aeropacity.F90
r726 r728 80 80 REAL tauh2so4tmp(ngridmx) ! Temporary h2so4 opacity used before scaling 81 81 ! BENJAMIN MODIFS 82 real CLFtot ,CLF1,CLF282 real CLFtot 83 83 real totcloudfrac(ngridmx) 84 84 logical clearsky … … 145 145 !================================================================== 146 146 147 147 if (iaero_co2.ne.0) then 148 148 iaer=iaero_co2 149 149 ! 1. Initialization 150 aerosol( :,:,iaer)=0.0150 aerosol(1:ngridmx,1:nlayermx,iaer)=0.0 151 151 ! 2. Opacity calculation 152 152 if (aerofixco2.or.(i_co2ice.eq.0)) then ! CO2 ice cloud prescribed 153 do ig=1, ngrid 154 do l=1,nlayer 155 aerosol(ig,l,iaer)=1.e-9 156 end do 157 !aerosol(ig,12,iaer)=4.0 ! single cloud layer option 158 end do 153 aerosol(1:ngridmx,1:nlayermx,iaer)=1.e-9 154 !aerosol(1:ngridmx,12,iaer)=4.0 ! single cloud layer option 159 155 else 160 156 DO ig=1, ngrid … … 179 175 ENDDO 180 176 end if ! if fixed or varying 181 177 end if ! if CO2 aerosols 182 178 !================================================================== 183 179 ! Water ice / liquid 184 180 !================================================================== 185 181 186 182 if (iaero_h2o.ne.0) then 187 183 iaer=iaero_h2o 188 184 ! 1. Initialization 189 aerosol( :,:,iaer)=0.0185 aerosol(1:ngridmx,1:nlayermx,iaer)=0.0 190 186 ! 2. Opacity calculation 191 187 if (aerofixh2o.or.(i_h2oice.eq.0).or.clearsky) then 192 do ig=1,ngrid ! to stop the rad tran bug 193 do l=1,nlayer 194 aerosol(ig,l,iaer) =1.e-9 195 end do 196 end do 188 aerosol(1:ngridmx,1:nlayermx,iaer) =1.e-9 197 189 198 190 ! put cloud at cloudlvl … … 228 220 229 221 else 222 230 223 do ig=1, ngrid 231 224 do l=1,nlayer-1 ! to stop the rad tran bug 232 225 233 if(CLFvarying)then 234 CLF1 = max(cloudfrac(ig,l),0.01) 235 CLFtot = max(totcloudfrac(ig),0.01) 236 CLF2 = CLF1/CLFtot 237 CLF2 = min(1.,CLF2) 238 else 239 CLF1=1.0 240 CLF2=CLFfixval 241 endif 242 243 aerosol0 = & 226 aerosol(ig,l,iaer) = & !modification by BC 244 227 ( 0.75 * QREFvis3d(ig,l,iaer) / & 245 228 ( rho_ice * reffrad(ig,l,iaer) ) ) * & 246 229 ! pq(ig,l,i_h2oice) * & !JL I dropped the +1e-9 here to have the same 247 !( pplev(ig,l) - pplev(ig,l+1) ) / g / &! opacity in the clearsky=true and the248 ! CLF1! clear=false/pq=0 case230 !( pplev(ig,l) - pplev(ig,l+1) ) / g ! opacity in the clearsky=true and the 231 ! clear=false/pq=0 case 249 232 ( pq(ig,l,i_h2oice) + 1.E-9 ) * & ! Doing this makes the code unstable, so I have restored it (RW) 250 ( pplev(ig,l) - pplev(ig,l+1) ) / g / & 251 CLF1 252 253 aerosol(ig,l,iaer) = -log(1 - CLF2 + CLF2*exp(-aerosol0)) 254 ! why no division in exponential? 255 ! because its already done in aerosol0 256 257 aerosol(ig,l,iaer) = max(aerosol(ig,l,iaer),1.e-9) 258 aerosol(ig,l,iaer) = min(aerosol(ig,l,iaer),aerosol0) 259 233 ( pplev(ig,l) - pplev(ig,l+1) ) / g 234 260 235 enddo 261 236 enddo 262 end if 263 end if ! End if h2o aerosol 237 238 if(CLFvarying)then 239 call totalcloudfrac(cloudfrac,totcloudfrac,pplev,pq,aerosol(1:ngridmx,1:nlayermx,iaer)) 240 do ig=1, ngrid 241 do l=1,nlayer-1 ! to stop the rad tran bug 242 CLFtot = max(totcloudfrac(ig),0.01) 243 aerosol(ig,l,iaer)=aerosol(ig,l,iaer)/CLFtot 244 aerosol(ig,l,iaer) = max(aerosol(ig,l,iaer),1.e-9) 245 enddo 246 enddo 247 else 248 do ig=1, ngrid 249 do l=1,nlayer-1 ! to stop the rad tran bug 250 CLFtot = CLFfixval 251 aerosol(ig,l,iaer)=aerosol(ig,l,iaer)/CLFtot 252 aerosol(ig,l,iaer) = max(aerosol(ig,l,iaer),1.e-9) 253 enddo 254 enddo 255 end if!(CLFvarying) 256 endif !(aerofixed.or.(i_h2oice.eq.0).or.clearsky) 257 258 end if ! End if h2o aerosol 264 259 265 260 !================================================================== 266 261 ! Dust 267 262 !================================================================== 268 263 if (iaero_dust.ne.0) then 269 264 iaer=iaero_dust 270 271 265 ! 1. Initialization 272 aerosol(:,:,iaer)=0.0266 aerosol(1:ngridmx,1:nlayermx,iaer)=0.0 273 267 274 268 topdust=30.0 ! km (used to be 10.0 km) LK 275 269 276 270 ! 2. Opacity calculation … … 314 308 ENDDO 315 309 ENDDO 316 310 end if ! If dust aerosol 317 311 318 312 !================================================================== … … 321 315 ! added by LK 322 316 if (iaero_h2so4.ne.0) then 323 317 iaer=iaero_h2so4 324 318 325 319 ! 1. Initialization 326 aerosol(:,:,iaer)=0.0320 aerosol(1:ngridmx,1:nlayermx,iaer)=0.0 327 321 328 322 … … 330 324 331 325 ! expfactor=0. 332 333 334 ! Typical mixing ratio profile335 336 337 326 DO l=1,nlayer-1 327 DO ig=1,ngrid 328 ! Typical mixing ratio profile 329 330 zp=(preff/pplay(ig,l))**(70./30) !emulating topdust 331 expfactor=max(exp(0.007*(1.-max(zp,1.))),1.e-3) 338 332 339 333 ! Vertical scaling function 340 aerosol(ig,l,iaer)= (pplev(ig,l)-pplev(ig,l+1)) & 341 *expfactor 342 343 344 ENDDO 345 ENDDO 346 tauh2so4tmp(1:ngrid)=0. 347 DO l=1,nlayer 348 DO ig=1,ngrid 349 tauh2so4tmp(ig) = tauh2so4tmp(ig) & 350 + aerosol(ig,l,iaer) 351 ENDDO 352 ENDDO 353 DO l=1,nlayer-1 354 DO ig=1,ngrid 355 aerosol(ig,l,iaer) = max(1E-20, & 334 aerosol(ig,l,iaer)= (pplev(ig,l)-pplev(ig,l+1))*expfactor 335 336 ENDDO 337 ENDDO 338 tauh2so4tmp(1:ngrid)=0. 339 DO l=1,nlayer 340 DO ig=1,ngrid 341 tauh2so4tmp(ig) = tauh2so4tmp(ig) + aerosol(ig,l,iaer) 342 ENDDO 343 ENDDO 344 DO l=1,nlayer-1 345 DO ig=1,ngrid 346 aerosol(ig,l,iaer) = max(1E-20, & 356 347 1 & 357 348 * pplev(ig,1) / preff & … … 359 350 / tauh2so4tmp(ig)) 360 351 361 ENDDO362 352 ENDDO 353 ENDDO 363 354 364 355 ! 1/700. is assuming a "sulfurtau" of 1 -
trunk/LMDZ.GENERIC/libf/phystd/aerosol_mod.F90
r726 r728 5 5 ! aerosol indexes: these are initialized in iniaerosol.F and should be 0 if the 6 6 ! corresponding aerosol was not activated in callphys.def 7 integer :: iaero_co28 integer :: iaero_h2o9 integer :: iaero_dust10 integer :: iaero_h2so47 integer, save :: iaero_co2 8 integer, save :: iaero_h2o 9 integer, save :: iaero_dust 10 integer, save :: iaero_h2so4 11 11 12 12 !================================================================== -
trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90
r726 r728 14 14 use ioipsl_getincom 15 15 use gases_h 16 use radii_mod, only : su_aer_radii,co2_reffrad,h2o_reffrad,dust_reffrad,h2so4_reffrad 16 17 use aerosol_mod 17 18 … … 74 75 75 76 REAL reffrad(ngrid,nlayer,naerkind) 76 REAL nueffrad(ngrid,nlayer,naerkind)77 REAL, SAVE :: nueffrad(ngridmx,nlayermx,naerkind) 77 78 78 79 ! OUTPUT … … 171 172 real pqtest(ngridmx,nlayer,nq) 172 173 173 ! are particle radii fixed?174 logical, save :: radfixed175 174 real maxrad, minrad 176 177 ! Local water cloud optical properties 178 real, parameter :: rad_froid=35.0e-6 179 real, parameter :: rad_chaud=10.0e-6 180 real, parameter :: coef_chaud=0.13 181 real, parameter :: coef_froid=0.09 182 real zfice 183 175 184 176 real CBRT 185 177 external CBRT … … 201 193 qsiaer(:,:,:)=0.0 202 194 giaer(:,:,:) =0.0 203 radfixed=.false.204 195 205 196 if(firstcall) then 206 if(kastprof)then207 radfixed=.true.208 endif209 197 210 198 call system('rm -f surf_vals_long.out') … … 212 200 !-------------------------------------------------- 213 201 ! Effective radius and variance of the aerosols 214 215 216 ! these values will change once the microphysics gets to work 217 ! UNLESS tracer=.false., in which case we should be working with 218 ! a fixed aerosol layer, and be able to define reffrad in a 219 ! .def file. To be improved! 220 ! Generalization of aerosols added by LK 221 do iaer = 1,naerkind 222 if (iaer.eq.iaero_co2) then ! active CO2 aerosols 223 do l=1,nlayer 224 do ig=1,ngrid 225 reffrad(ig,l,iaer) = 1.e-4 226 nueffrad(ig,l,iaer) = 0.1 227 enddo 228 enddo 229 endif 230 if (iaer.eq.iaero_h2o) then ! active H2O aerosols 231 do l=1,nlayer 232 do ig=1,ngrid 233 reffrad(ig,l,iaer) = 1.e-5 234 nueffrad(ig,l,iaer) = 0.1 235 enddo 236 enddo 237 endif 238 if(iaer.eq.iaero_dust)then ! active dust 239 do l=1,nlayer 240 do ig=1,ngrid 241 reffrad(ig,l,iaer) = 1.e-5 242 nueffrad(ig,l,iaer) = 0.1 243 enddo 244 enddo 245 endif 246 if(iaer.eq.iaero_h2so4)then ! Active h2so4 aerosols 247 do l=1,nlayer 248 do ig=1,ngrid 249 reffrad(ig,l,iaer) = 1.e-6 250 nueffrad(ig,l,iaer) = 0.1 251 enddo 252 enddo 253 endif 254 enddo 255 202 if(naerkind.gt.4)then 203 print*,'Code not general enough to deal with naerkind > 4 yet.' 204 call abort 205 endif 206 call su_aer_radii(reffrad,nueffrad) 207 208 209 210 !-------------------------------------------------- 211 ! set up correlated k 256 212 print*, "callcorrk: Correlated-k data base folder:",trim(datadir) 257 213 call getin("corrkdir",corrkdir) … … 305 261 ! Initialization on every call 306 262 307 do l=1,nlayer 308 do ig=1,ngrid 309 do iaer=1,naerkind 310 nueffrad(ig,l,iaer) = 0.1 ! stays at 0.1 311 enddo 312 enddo 313 enddo 314 315 263 !-------------------------------------------------- 264 ! Effective radius and variance of the aerosols 316 265 do iaer=1,naerkind 317 266 318 if(iaer.eq.iaero_co2)then 319 if(radfixed)then 320 do l=1,nlayer 321 do ig=1,ngrid 322 reffrad(ig,l,iaer) = 5.e-5 ! CO2 ice 323 enddo 324 enddo 325 print*,'CO2 ice particle size =',reffrad(1,1,iaer)/1.e-6,'um' 326 else 327 maxrad=0.0 328 !averad=0.0 329 minrad=1.0 330 do l=1,nlayer 331 332 !masse = (pplev(ig,l) - pplev(ig,l+1))/g 333 334 do ig=1,ngrid 335 if(tracer.and.igcm_co2_ice.gt.0)then 336 337 if(igcm_co2_ice.lt.1)then 338 print*,'Tracers but no CO2 ice still' 339 print*,'seems to be a problem...' 340 print*,'Aborting in callcorrk.' 341 stop 342 endif 343 reffrad(ig,l,iaer) = CBRT( 3*pq(ig,l,igcm_co2_ice)/ & 344 (4*Nmix_co2*pi*rho_co2) ) 345 endif 346 reffrad(ig,l,iaer) = max(reffrad(ig,l,iaer),1.e-6) 347 reffrad(ig,l,iaer) = min(reffrad(ig,l,iaer),500.e-6) 348 !averad = averad + reffrad(ig,l,iaer)*area(ig) 349 maxrad = max(reffrad(ig,l,iaer),maxrad) 350 minrad = min(reffrad(ig,l,iaer),minrad) 351 enddo 352 enddo 353 if(igcm_co2_ice.gt.0)then 354 print*,'Max. CO2 ice particle size = ',maxrad/1.e-6,' um' 355 print*,'Min. CO2 ice particle size = ',minrad/1.e-6,' um' 356 endif 357 endif 358 endif 359 360 361 if(iaer.eq.iaero_h2o)then 362 if(radfixed) then 363 do l=1,nlayer 364 do ig=1,ngrid 365 !reffrad(ig,l,iaer) = 2.e-5 ! H2O ice 366 reffrad(ig,l,iaer) = rad_chaud ! H2O ice 367 368 zfice = 1.0 - (pt(ig,l)-T_h2O_ice_clouds) / (T_h2O_ice_liq-T_h2O_ice_clouds) 369 zfice = MIN(MAX(zfice,0.0),1.0) 370 reffrad(ig,l,2)= rad_chaud * (1.-zfice) + rad_froid * zfice 371 nueffrad(ig,l,2) = coef_chaud * (1.-zfice) + coef_froid * zfice 372 enddo 373 enddo 374 print*,'H2O ice particle size=',reffrad(1,1,iaer)/1.e-6,'um' 375 else 376 if(water)then 377 maxrad=0.0 378 minrad=1.0 379 do l=1,nlayer 380 do ig=1,ngrid 381 reffrad(ig,l,iaer) = CBRT( 3*pq(ig,l,igcm_h2o_ice)/ & 382 (4*Nmix_h2o*pi*rho_ice) ) 383 reffrad(ig,l,iaer) = max(reffrad(ig,l,iaer),1.e-6) 384 reffrad(ig,l,iaer) = min(reffrad(ig,l,iaer),100.e-6) 385 386 maxrad = max(reffrad(ig,l,iaer),maxrad) 387 minrad = min(reffrad(ig,l,iaer),minrad) 388 enddo 389 enddo 390 print*,'Max. H2O ice particle size = ',maxrad/1.e-6,' um' 391 print*,'Min. H2O ice particle size = ',minrad/1.e-6,' um' 392 endif 393 endif 394 endif 395 267 if ((iaer.eq.iaero_co2).and.tracer.and.(igcm_co2_ice.gt.0)) then ! treat condensed co2 particles. 268 call co2_reffrad(pq,reffrad) 269 print*,'Max. CO2 ice particle size = ',maxval(reffrad(1:ngridmx,1:nlayermx,iaer))/1.e-6,' um' 270 print*,'Min. CO2 ice particle size = ',minval(reffrad(1:ngridmx,1:nlayermx,iaer))/1.e-6,' um' 271 end if 272 if ((iaer.eq.iaero_h2o).and.water) then ! treat condensed water particles. to be generalized for other aerosols 273 call h2o_reffrad(pq,pt,reffrad,nueffrad) 274 print*,'Max. H2O cloud particle size = ',maxval(reffrad(1:ngridmx,1:nlayermx,iaer))/1.e-6,' um' 275 print*,'Min. H2O cloud particle size = ',minval(reffrad(1:ngridmx,1:nlayermx,iaer))/1.e-6,' um' 276 endif 396 277 if(iaer.eq.iaero_dust)then 397 do l=1,nlayer 398 do ig=1,ngrid 399 reffrad(ig,l,iaer) = 2.e-6 ! dust 400 enddo 401 enddo 278 call dust_reffrad(reffrad) 402 279 print*,'Dust particle size = ',reffrad(1,1,iaer)/1.e-6,' um' 403 280 endif 404 405 281 if(iaer.eq.iaero_h2so4)then 406 do l=1,nlayer 407 do ig=1,ngrid 408 reffrad(ig,l,iaer) = 1.e-6 ! h2so4 409 enddo 410 enddo 282 call h2so4_reffrad(reffrad) 411 283 print*,'H2SO4 particle size =',reffrad(1,1,iaer)/1.e-6,' um' 412 284 endif 413 enddo ! do iaer=1,naerkind 414 ! added by LK 285 end do !iaer=1,naerkind 415 286 416 287 … … 641 512 if(.not.kastprof)then 642 513 ! IMPORTANT: Now convert from kg/kg to mol/mol 643 do k=1,L_LEVELS644 qvar(k) = qvar(k)/epsi645 end do514 do k=1,L_LEVELS 515 qvar(k) = qvar(k)/(epsi+qvar(k)*(1.-epsi)) 516 end do 646 517 end if 647 518 … … 764 635 print*,'Maximum temperature is outside the radiative' 765 636 print*,'transfer kmatrix bounds, exiting.' 766 !print*,'WARNING, OVERRIDING FOR TEST' 767 call abort 637 print*,'level,grid,T',k,ig,tlevrad(k) 638 print*,'WARNING, OVERRIDING FOR TEST' 639 !call abort 640 tlevrad(k)=tgasmax 768 641 endif 769 642 enddo -
trunk/LMDZ.GENERIC/libf/phystd/callkeys.h
r726 r728 9 9 & , enertest & 10 10 & , callgasvis,Continuum,H2Ocont_simple,graybody & 11 & , Nmix_co2, Nmix_h2o & 12 & , dusttau & 13 & , meanOLR & 14 & , specOLR & 15 & , kastprof & 16 & , noradsurf & 17 & , Tstrat & 18 & , newtonian & 19 & , check_cpp_match & 20 & , force_cpp & 21 & , tau_relax & 22 & , testradtimes & 11 & , Nmix_co2, radfixed, dusttau & 12 & , meanOLR, specOLR & 13 & , kastprof, noradsurf, Tstrat & 14 & , newtonian, tau_relax, testradtimes & 15 & , check_cpp_match, force_cpp & 23 16 & , rayleigh & 24 & , stelbbody & 25 & , stelTbb & 17 & , stelbbody, stelTbb & 26 18 & , tplanet & 27 & , startype & 28 & , Fat1AU & 19 & , startype, Fat1AU & 29 20 & , nearco2cond & 30 & , tracer & 31 & , varactive & 32 & , varfixed & 33 & , satval & 21 & , tracer, mass_redistrib, varactive, varfixed, satval & 34 22 & , sedimentation,water,watercond,waterrain & 35 & , rainthreshold &36 23 & , aeroco2,aeroh2o,aeroh2so4 & 37 24 & , aerofixco2,aerofixh2o & 38 & , hydrology & 39 & , sourceevol & 40 & , icetstep & 41 & , albedosnow & 42 & , maxicethick & 43 & , Tsaldiff & 44 & , CLFfixval & 45 & , CLFvarying & 25 & , hydrology, sourceevol, icetstep, albedosnow & 26 & , maxicethick, Tsaldiff & 27 & , CLFfixval, CLFvarying & 46 28 & , n2mixratio & 47 29 & , co2supsat & … … 69 51 logical nearco2cond 70 52 logical tracer 53 logical mass_redistrib 71 54 logical varactive 72 55 logical varfixed 56 logical radfixed 73 57 logical sedimentation 74 58 logical water,watercond,waterrain … … 87 71 real topdustref 88 72 real Nmix_co2 89 real Nmix_h2o90 73 real dusttau 91 74 real Fat1AU … … 94 77 real tplanet 95 78 real satval 96 real rainthreshold97 79 real CLFfixval 98 80 real n2mixratio -
trunk/LMDZ.GENERIC/libf/phystd/condense_cloud.F90
r586 r728 8 8 use radinc_h, only : naerkind 9 9 use gases_h 10 use radii_mod, only : co2_reffrad 11 use aerosol_mod, only : iaero_co2 10 12 11 13 implicit none … … 146 148 character(len=3) :: gasname 147 149 148 real reffradmin, reffradmax149 150 150 real ppco2 151 151 … … 157 157 call zerophys(ngridmx*nlayermx*nqmx,zq) 158 158 call zerophys(ngridmx*nlayermx,zt) 159 160 !reffradmin=1.e-7161 !reffradmax=5.e-4162 !reffradmin=0.5e-7163 !reffradmax=0.1e-3 ! FF data164 reffradmin=0.1e-5165 reffradmax=0.1e-3 ! JB data166 ! improve this in the future...167 159 168 160 ! Initialisation … … 319 311 ! Gravitational sedimentation 320 312 321 ! sedimentation computed from radius computed from q 322 ! assuming that the ice is splitted in Nmix particle 313 ! sedimentation computed from radius computed from q in module radii_mod 314 call co2_reffrad(zq,reffrad) 315 323 316 do ilay=1,nlayer 324 317 do ig=1, ngrid 325 318 326 reff = CBRT( 3*zq(ig,ilay,i_co2ice)/( 4*Nmix_co2*pi*rho_co2 )) 327 328 ! there should be a more elegant way of doing this... 329 if(reff.lt.1.e-16) reff=1.e-16 330 331 ! update reffrad for radiative transfer 332 if(reff.lt.reffradmin)then 333 reffrad(ig,ilay,1)=reffradmin 334 !print*,'reff below optical limit' 335 elseif(reff.gt.reffradmax)then 336 reffrad(ig,ilay,1)=reffradmax 337 !print*,'reff above optical limit' 338 else 339 reffrad(ig,ilay,1)=reff 340 endif 319 reff = reffrad(ig,ilay,iaero_co2) 341 320 342 321 call stokes & -
trunk/LMDZ.GENERIC/libf/phystd/inifis.F
r726 r728 132 132 write(*,*) " tracer = ",tracer 133 133 134 write(*,*) "Run with or without atm mass update ", 135 & " due to tracer evaporation/condensation?" 136 mass_redistrib=.false. ! default value 137 call getin("mass_redistrib",mass_redistrib) 138 write(*,*) " mass_redistrib = ",mass_redistrib 139 134 140 write(*,*) "Diurnal cycle ?" 135 141 write(*,*) "(if diurnal=false, diurnal averaged solar heating)" … … 377 383 write(*,*)" CLFfixval = ",CLFfixval 378 384 379 write(*,*)"Number mixing ratio of CO2 ice particles:" 380 Nmix_co2=100000. ! default value 385 write(*,*)"fixed radii for Cloud particles?" 386 radfixed=.false. ! default value 387 call getin("radfixed",radfixed) 388 write(*,*)" radfixed = ",radfixed 389 390 if(kastprof)then 391 radfixed=.true. 392 endif 393 394 write(*,*)"Number mixing ratio of CO2 ice particles:" 395 Nmix_co2=1.e6 ! default value 381 396 call getin("Nmix_co2",Nmix_co2) 382 397 write(*,*)" Nmix_co2 = ",Nmix_co2 383 384 write(*,*)"Number mixing ratio of H2O ice particles:"385 Nmix_h2o=10000000. ! default value386 call getin("Nmix_h2o",Nmix_h2o)387 write(*,*)" Nmix_h2o = ",Nmix_h2o388 398 389 399 ! write(*,*)"Number of radiatively active aerosols:" … … 499 509 call getin("waterrain",waterrain) 500 510 write(*,*) " waterrain = ",waterrain 501 502 write(*,*) "Precipitation threshold ?"503 rainthreshold=0.011 ! default value (Emmanuel 1997)504 call getin("rainthreshold",rainthreshold)505 write(*,*) " rainthreshold = ",rainthreshold506 511 507 512 write(*,*) "Include surface hydrology ?" -
trunk/LMDZ.GENERIC/libf/phystd/moistadj.F90
r650 r728 1 subroutine moistadj( t, pq, pplev, pplay, dtmana,dqmana, ptimestep, rneb)2 3 use watercommon_h, only: T_h2O_ice_liq, RLVTT, RCPD 1 subroutine moistadj(pt, pq, pdq, pplev, pplay, pdtmana, pdqmana, ptimestep, rneb) 2 3 use watercommon_h, only: T_h2O_ice_liq, RLVTT, RCPD, Psat_water, Lcpdqsat_water 4 4 5 5 implicit none … … 24 24 #include "comcstfi.h" 25 25 26 ! Pre-arguments (for universal model)27 realpq(ngridmx,nlayermx,nqmx) ! tracer (kg/kg)26 REAL pt(ngridmx,nlayermx) ! temperature (K) 27 REAL pq(ngridmx,nlayermx,nqmx) ! tracer (kg/kg) 28 28 REAL pdq(ngridmx,nlayermx,nqmx) 29 29 30 real dqmana(ngridmx,nlayermx,nqmx)! tendency of tracers (kg/kg.s-1)31 REAL dtmana(ngridmx,nlayermx)! temperature increment32 33 ! Arguments34 REAL t(ngridmx,nlayermx)! temperature (K)35 REAL q(ngridmx,nlayermx)! humidite specifique (kg/kg)30 REAL pdqmana(ngridmx,nlayermx,nqmx) ! tendency of tracers (kg/kg.s-1) 31 REAL pdtmana(ngridmx,nlayermx) ! temperature increment 32 33 ! local variables 34 REAL zt(ngridmx,nlayermx) ! temperature (K) 35 REAL zq(ngridmx,nlayermx) ! humidite specifique (kg/kg) 36 36 REAL pplev(ngridmx,nlayermx+1) ! pression a inter-couche (Pa) 37 37 REAL pplay(ngridmx,nlayermx) ! pression au milieu de couche (Pa) … … 49 49 50 50 ! Local variables 51 INTEGER i, k, iq 51 INTEGER i, k, iq, nn 52 INTEGER, PARAMETER :: niter = 6 52 53 INTEGER k1, k1p, k2, k2p 53 54 LOGICAL itest(ngridmx) … … 55 56 REAL cp_new_t(nlayermx) 56 57 REAL cp_delta_t(nlayermx) 57 REAL new_qb(nlayermx)58 58 REAL v_cptj(nlayermx), v_cptjk1, v_ssig 59 REAL v_cptt(ngridmx,nlayermx), v_p, v_t 60 REAL v_qs(ngridmx,nlayermx), v_qsd(ngridmx,nlayermx)59 REAL v_cptt(ngridmx,nlayermx), v_p, v_t, zpsat 60 REAL zqs(ngridmx,nlayermx), zdqs(ngridmx,nlayermx) 61 61 REAL zq1(ngridmx), zq2(ngridmx) 62 62 REAL gamcpdz(ngridmx,2:nlayermx) … … 94 94 95 95 ! GCM -----> subroutine variables 96 DO k = 1, nlayermx 97 DO i = 1, ngridmx 98 99 q(i,k) = pq(i,k,i_h2o) 100 101 if(q(i,k).lt.0.)then 102 q(i,k)=0.0 96 zq(1:ngridmx,1:nlayermx) = pq(1:ngridmx,1:nlayermx,i_h2o)+ pdq(1:ngridmx,1:nlayermx,i_h2o)*ptimestep 97 zt(1:ngridmx,1:nlayermx) = pt(1:ngridmx,1:nlayermx) 98 pdqmana(1:ngridmx,1:nlayermx,1:nqmx)=0.0 99 100 DO k = 1, nlayermx 101 DO i = 1, ngridmx 102 if(zq(i,k).lt.0.)then 103 zq(i,k)=0.0 103 104 endif 104 DO iq = 1, nqmx 105 dqmana(i,k,iq)=0.0 106 ENDDO 107 ENDDO 108 ENDDO 109 110 DO k = 1, nlayermx 111 DO i = 1, ngridmx 112 local_q(i,k) = q(i,k) 113 local_t(i,k) = t(i,k) 114 rneb(i,k) = 0.0 115 d_ql(i,k) = 0.0 116 d_t(i,k) = 0.0 117 d_q(i,k) = 0.0 118 ENDDO 119 new_qb(k)=0.0 120 ENDDO 105 ENDDO 106 ENDDO 107 108 local_q(1:ngridmx,1:nlayermx) = zq(1:ngridmx,1:nlayermx) 109 local_t(1:ngridmx,1:nlayermx) = zt(1:ngridmx,1:nlayermx) 110 rneb(1:ngridmx,1:nlayermx) = 0.0 111 d_ql(1:ngridmx,1:nlayermx) = 0.0 112 d_t(1:ngridmx,1:nlayermx) = 0.0 113 d_q(1:ngridmx,1:nlayermx) = 0.0 121 114 122 115 ! Calculate v_cptt … … 124 117 DO i = 1, ngridmx 125 118 v_cptt(i,k) = RCPD * local_t(i,k) 126 v_t = local_t(i,k)119 v_t = MAX(local_t(i,k),15.) 127 120 v_p = pplay(i,k) 128 121 129 call watersat(v_t,v_p,v_qs(i,k))130 call watersat_grad(v_t,v_qs(i,k),v_qsd(i,k))122 call Psat_water(v_t,v_p,zpsat,zqs(i,k)) 123 call Lcpdqsat_water(v_t,v_p,zpsat,zqs(i,k),zdqs(i,k)) 131 124 ENDDO 132 125 ENDDO 133 134 ! TEST: RH DIAGNOSTIC135 ! DO k = 1, nlayermx136 ! DO i = 1, ngridmx137 ! v_t = local_t(i,k)138 ! IF (v_t.LT.T_h2O_ice_liq) THEN139 ! print*,'RHs=',q(i,k) / v_qs(i,k)140 ! ELSE141 ! print*,'RHl=',q(i,k) / v_qs(i,k)142 ! ENDIF143 ! ENDDO144 ! ENDDO145 126 146 127 ! Calculate Gamma * Cp * dz: (gamma is the critical gradient) … … 149 130 zdp = pplev(i,k)-pplev(i,k+1) 150 131 zdpm = pplev(i,k-1)-pplev(i,k) 151 ! gamcpdz(i,k) = ( ( RD/RCPD /(zdpm+zdp) * 152 gamcpdz(i,k) = ( ( R/RCPD /(zdpm+zdp) * & 153 (v_cptt(i,k-1)*zdpm + v_cptt(i,k)*zdp) & 154 +RLVTT /(zdpm+zdp) * & 155 (v_qs(i,k-1)*zdpm + v_qs(i,k)*zdp) & 156 )* (pplay(i,k-1)-pplay(i,k)) / pplev(i,k) ) & 157 / (1.0+(v_qsd(i,k-1)*zdpm+ & 158 v_qsd(i,k)*zdp)/(zdpm+zdp) ) 132 gamcpdz(i,k) = ( ( R/RCPD /(zdpm+zdp) * (v_cptt(i,k-1)*zdpm + v_cptt(i,k)*zdp) & 133 + RLVTT /(zdpm+zdp) * (zqs(i,k-1)*zdpm + zqs(i,k)*zdp) ) & 134 * (pplay(i,k-1)-pplay(i,k)) / pplev(i,k) ) & 135 / (1.0+ (zdqs(i,k-1)*zdpm + zdqs(i,k)*zdp)/(zdpm+zdp) ) 159 136 ENDDO 160 137 ENDDO … … 174 151 IF (k2 .GT. nlayermx) GOTO 9999 175 152 zflo = v_cptt(i,k2-1) - v_cptt(i,k2) - gamcpdz(i,k2) 176 zsat=(local_q(i,k2-1)- v_qs(i,k2-1))*(pplev(i,k2-1)-pplev(i,k2)) &177 +(local_q(i,k2)- v_qs(i,k2))*(pplev(i,k2)-pplev(i,k2+1))153 zsat=(local_q(i,k2-1)-zqs(i,k2-1))*(pplev(i,k2-1)-pplev(i,k2)) & 154 +(local_q(i,k2)-zqs(i,k2))*(pplev(i,k2)-pplev(i,k2+1)) 178 155 179 156 IF ( zflo.LE.0.0 .OR. zsat.LE.0.0 ) GOTO 810 … … 184 161 IF (k2 .EQ. nlayermx) GOTO 821 185 162 k2p = k2 + 1 186 zsat=zsat+(pplev(i,k2p)-pplev(i,k2p+1))*(local_q(i,k2p)- v_qs(i,k2p))163 zsat=zsat+(pplev(i,k2p)-pplev(i,k2p+1))*(local_q(i,k2p)-zqs(i,k2p)) 187 164 zflo = v_cptt(i,k2p-1) - v_cptt(i,k2p) - gamcpdz(i,k2p) 188 165 … … 194 171 !------------------------------------------------------ local adjustment 195 172 830 CONTINUE ! actual adjustment 173 Do nn=1,niter 196 174 v_cptj(k1) = 0.0 197 175 zdp = pplev(i,k1)-pplev(i,k1+1) 198 v_cptjk1 = ( (1.0+v_qsd(i,k1))*(v_cptt(i,k1)+v_cptj(k1)) & 199 + RLVTT*(local_q(i,k1)-v_qs(i,k1)) ) * zdp 200 v_ssig = zdp * (1.0+v_qsd(i,k1)) 176 v_cptjk1 = ( (1.0+zdqs(i,k1))*(v_cptt(i,k1)+v_cptj(k1)) + RLVTT*(local_q(i,k1)-zqs(i,k1)) ) * zdp 177 v_ssig = zdp * (1.0+zdqs(i,k1)) 201 178 202 179 k1p = k1 + 1 … … 204 181 zdp = pplev(i,k)-pplev(i,k+1) 205 182 v_cptj(k) = v_cptj(k-1) + gamcpdz(i,k) 206 v_cptjk1 = v_cptjk1 + zdp & 207 * ( (1.0+v_qsd(i, k))*(v_cptt(i,k)+v_cptj(k)) & 208 + RLVTT*(local_q(i,k)-v_qs(i,k)) ) 209 v_ssig = v_ssig + zdp *(1.0+v_qsd(i,k)) 183 v_cptjk1 = v_cptjk1 + zdp * ( (1.0+zdqs(i, k))*(v_cptt(i,k)+v_cptj(k)) + RLVTT*(local_q(i,k)-zqs(i,k)) ) 184 v_ssig = v_ssig + zdp *(1.0+zdqs(i,k)) 210 185 ENDDO 211 186 … … 215 190 cp_new_t(k) = v_cptjk1/v_ssig - v_cptj(k) 216 191 cp_delta_t(k) = cp_new_t(k) - v_cptt(i,k) 217 new_qb(k) = v_qs(i,k) + v_qsd(i,k)*cp_delta_t(k)/RLVTT218 local_q(i,k) = new_qb(k)192 v_cptt(i,k)=cp_new_t(k) 193 local_q(i,k) = zqs(i,k) + zdqs(i,k)*cp_delta_t(k)/RLVTT 219 194 local_t(i,k) = cp_new_t(k) / RCPD 220 195 221 ! print*,'v_qs in loop=',v_qs 222 ! print*,'v_qsd in loop=',v_qsd 223 ! print*,'new_qb in loop=',new_qb 224 ! print*,'cp_delta_t in loop=',cp_delta_t 225 ENDDO 196 v_t = MAX(local_t(i,k),15.) 197 v_p = pplay(i,k) 198 199 call Psat_water(v_t,v_p,zpsat,zqs(i,k)) 200 call Lcpdqsat_water(v_t,v_p,zpsat,zqs(i,k),zdqs(i,k)) 201 202 203 204 ! print*,'i,k,zqs,cpdT=',i,k,zqs(i,k),cp_delta_t(k) 205 ENDDO 206 Enddo ! nn=1,niter 226 207 227 208 … … 230 211 ! -- the layer about to be adjusted 231 212 232 DO k = k1, k2 233 v_cptt(i,k) = RCPD * local_t(i,k) 234 v_t = local_t(i,k) 235 v_p = pplay(i,k) 236 237 ! IF (v_t.LT.t_coup) THEN 238 ! v_qs(i,k) = qsats(v_t) / v_p 239 ! v_qsd(i,k) = dqsats(v_t,v_qs(i,k)) 240 ! ELSE 241 ! v_qs(i,k) = qsatl(v_t) / v_p 242 ! v_qsd(i,k) = dqsatl(v_t,v_qs(i,k)) 243 ! ENDIF 244 245 call watersat(v_t,v_p,v_qs(i,k)) 246 call watersat_grad(v_t,v_qs(i,k),v_qsd(i,k)) 247 248 ENDDO 213 ! DO k = k1, k2 214 ! v_cptt(i,k) = RCPD * local_t(i,k) 215 ! v_t = local_t(i,k) 216 ! v_p = pplay(i,k) 217 ! 218 ! call Psat_water(v_t,v_p,zpsat,zqs(i,k)) 219 ! call Lcpdqsat_water(v_t,v_p,zpsat,zqs(i,k),zdqs(i,k)) 220 ! ENDDO 221 249 222 DO k = 2, nlayermx 250 223 zdpm = pplev(i,k-1) - pplev(i,k) 251 224 zdp = pplev(i,k) - pplev(i,k+1) 252 ! gamcpdz(i,k) = ( ( RD/RCPD /(zdpm+zdp) * 253 gamcpdz(i,k) = ( ( R/RCPD /(zdpm+zdp) * & 254 (v_cptt(i,k-1)*zdpm+v_cptt(i,k)*zdp) & 255 +RLVTT /(zdpm+zdp) * & 256 (v_qs(i,k-1)*zdpm+v_qs(i,k)*zdp) & 257 )* (pplay(i,k-1)-pplay(i,k)) / pplev(i,k) ) & 258 / (1.0+(v_qsd(i,k-1)*zdpm+v_qsd(i,k)*zdp) & 259 /(zdpm+zdp) ) 225 gamcpdz(i,k) = ( ( R/RCPD /(zdpm+zdp) * (v_cptt(i,k-1)*zdpm + v_cptt(i,k)*zdp) & 226 + RLVTT /(zdpm+zdp) * (zqs(i,k-1)*zdpm + zqs(i,k)*zdp) ) & 227 * (pplay(i,k-1)-pplay(i,k)) / pplev(i,k) ) & 228 / (1.0+ (zdqs(i,k-1)*zdpm + zdqs(i,k)*zdp)/(zdpm+zdp) ) 260 229 ENDDO 261 230 … … 264 233 IF (k1 .EQ. 1) GOTO 841 ! yes we have! 265 234 zflo = v_cptt(i,k1-1) - v_cptt(i,k1) - gamcpdz(i,k1) 266 zsat=(local_q(i,k1-1)- v_qs(i,k1-1))*(pplev(i,k1-1)-pplev(i,k1)) &267 + (local_q(i,k1)- v_qs(i,k1))*(pplev(i,k1)-pplev(i,k1+1))235 zsat=(local_q(i,k1-1)-zqs(i,k1-1))*(pplev(i,k1-1)-pplev(i,k1)) & 236 + (local_q(i,k1)-zqs(i,k1))*(pplev(i,k1)-pplev(i,k1+1)) 268 237 IF (zflo.LE.0.0 .OR. zsat.LE.0.0) GOTO 841 ! yes we have! 269 238 … … 271 240 k1 = k1 - 1 272 241 IF (k1 .EQ. 1) GOTO 830 ! GOTO 820 (a tester, Z.X.Li, mars 1995) 273 zsat = zsat + (local_q(i,k1-1)- v_qs(i,k1-1)) &242 zsat = zsat + (local_q(i,k1-1)-zqs(i,k1-1)) & 274 243 *(pplev(i,k1-1)-pplev(i,k1)) 275 244 zflo = v_cptt(i,k1-1) - v_cptt(i,k1) - gamcpdz(i,k1) … … 299 268 DO i = 1, ngridmx 300 269 IF (itest(i)) THEN 301 delta_q(i,k) = local_q(i,k) - q(i,k)270 delta_q(i,k) = local_q(i,k) - zq(i,k) 302 271 IF (delta_q(i,k).LT.0.) rneb(i,k) = 1.0 303 272 ENDIF … … 327 296 DO i = 1, ngridmx 328 297 IF (itest(i)) THEN 329 IF (zq2(i).NE.0.0) & 330 d_ql(i,k) = - MIN(0.0,delta_q(i,k))*zq1(i)/zq2(i) 298 IF (zq2(i).NE.0.0) d_ql(i,k) = - MIN(0.0,delta_q(i,k))*zq1(i)/zq2(i) 331 299 ENDIF 332 300 ENDDO … … 343 311 DO k = 1, nlayermx 344 312 DO i = 1, ngridmx 345 d_t(i,k) = local_t(i,k) - t(i,k)346 d_q(i,k) = local_q(i,k) - q(i,k)313 d_t(i,k) = local_t(i,k) - zt(i,k) 314 d_q(i,k) = local_q(i,k) - zq(i,k) 347 315 ENDDO 348 316 ENDDO … … 352 320 DO i = 1, ngridmx 353 321 354 dtmana(i,k) = d_t(i,k)/ptimestep355 dqmana(i,k,i_h2o) = d_q(i,k)/ptimestep356 dqmana(i,k,i_ice) = d_ql(i,k)/ptimestep322 pdtmana(i,k) = d_t(i,k)/ptimestep 323 pdqmana(i,k,i_h2o) = d_q(i,k)/ptimestep 324 pdqmana(i,k,i_ice) = d_ql(i,k)/ptimestep 357 325 358 326 ENDDO 359 327 ENDDO 360 328 361 ! print*,'IN MANABE:'362 ! print*,'pplev=',pplev363 ! print*,'t=',t364 ! print*,'d_t=',d_t365 ! print*,'d_q=',d_q366 ! print*,'local_q=',local_q367 ! print*,'q=',q368 ! print*,'v_qs(i,k)=',v_qs369 ! print*,'v_qsd(i,k)=',v_qsd370 ! print*,'cp_delta_t(k)=',cp_delta_t371 372 ! print*,'d_ql=',d_ql373 ! print*,'delta_q=',delta_q374 ! print*,'zq1=',zq1375 ! print*,'zq2=',zq2376 !! print*,'i_h2o=',i_h2o377 ! print*,'i_ice=',i_ice378 !379 ! print*,'IN MANABE:'380 ! print*,'d_q=',d_q381 ! print*,'d_ql=',d_ql382 ! print*,'dtmana=',d_t383 ! stop384 ! print*,'gamcpdz at end=',gamcpdz385 ! stop386 387 ! Some conservation diagnostics...388 ! dEtot=0.0389 ! dL1tot=0.0390 ! dL2tot=0.0391 ! dqtot=0.0392 ! masse=0.0393 ! DO k = 1, nlayermx394 ! DO i = 1, ngridmx395 !396 ! masse = (pplev(i,k) - pplev(i,k+1))/g397 !398 ! dEtot = dEtot + cpp*d_t(i,k)*masse399 ! dL1tot = dL1tot + RLVTT*d_ql(i,k)*masse400 ! dL2tot = dL2tot + RLVTT*d_q(i,k)*masse ! is this line necessary?401 !402 ! dqtot = dqtot + (d_q(i,k) + d_ql(i,k))*masse403 !404 ! ENDDO405 ! ENDDO406 407 ! print*,'In manabe energy change=',dEtot408 ! print*,'In manabe condense energy change 1 =',dL1tot409 ! print*,'In manabe condense energy change 2 =',dL2tot410 ! print*,'In manabe water change=',dqtot411 329 412 330 RETURN -
trunk/LMDZ.GENERIC/libf/phystd/phyetat0.F
r699 r728 11 11 #include "dimensions.h" 12 12 #include "dimphys.h" 13 !#include "comgeomfi.h"13 #include "comgeomfi.h" 14 14 #include "surfdat.h" 15 15 #include "planete.h" … … 111 111 . p_omeg,p_g,p_cpp,p_mugaz,p_daysec,time) 112 112 c 113 c Read latitudes (coordinates): No need, these are provided by the dynamics 114 c 115 ! ierr=nf90_inq_varid(nid,"latitude",nvarid) 116 ! IF (ierr.NE.nf90_noerr) THEN 117 ! PRINT*, 'phyetat0: Le champ <latitude> est absent' 118 ! write(*,*)trim(nf90_strerror(ierr)) 119 ! CALL abort 120 ! ENDIF 121 ! ierr=nf90_get_var(nid,nvarid,lati) 122 ! IF (ierr.NE.nf90_noerr) THEN 123 ! PRINT*, 'phyetat0: Lecture echouee pour <latitude>' 124 ! write(*,*)trim(nf90_strerror(ierr)) 125 ! CALL abort 126 ! ENDIF 127 c 128 c read longitudes (coordinates): No need, these are provided by the dynamics 129 c 130 ! ierr=nf90_inq_varid(nid,"longitude",nvarid) 131 ! IF (ierr.NE.nf90_noerr) THEN 132 ! PRINT*, 'phyetat0: Le champ <longitude> est absent' 133 ! write(*,*)trim(nf90_strerror(ierr)) 134 ! CALL abort 135 ! ENDIF 136 ! ierr=nf90_get_var(nid,nvarid,long) 137 ! IF (ierr.NE.nf90_noerr) THEN 138 ! PRINT*, 'phyetat0: Lecture echouee pour <longitude>' 139 ! write(*,*)trim(nf90_strerror(ierr)) 140 ! CALL abort 141 ! ENDIF 142 c 143 c Read areas of meshes: No need, these are provided by the dynamics 144 c 145 ! ierr=nf90_inq_varid(nid,"area",nvarid) 146 ! IF (ierr.NE.nf90_noerr) THEN 147 ! PRINT*, 'phyetat0: Le champ <area> est absent' 148 ! write(*,*)trim(nf90_strerror(ierr)) 149 ! CALL abort 150 ! ENDIF 151 ! ierr=nf90_get_var(nid,nvarid,area) 152 ! IF (ierr.NE.nf90_noerr) THEN 153 ! PRINT*, 'phyetat0: Lecture echouee pour <area>' 154 ! write(*,*)trim(nf90_strerror(ierr)) 155 ! CALL abort 156 ! ENDIF 157 ! xmin = 1.0E+20 158 ! xmax = -1.0E+20 159 ! xmin = MINVAL(area) 160 ! xmax = MAXVAL(area) 161 ! PRINT*,'Aires des mailles <area>:', xmin, xmax 113 c Lecture des latitudes (coordonnees): 114 c 115 ierr = NF_INQ_VARID (nid, "latitude", nvarid) 116 IF (ierr.NE.NF_NOERR) THEN 117 PRINT*, 'phyetat0: Le champ <latitude> est absent' 118 CALL abort 119 ENDIF 120 #ifdef NC_DOUBLE 121 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, lati) 122 #else 123 ierr = NF_GET_VAR_REAL(nid, nvarid, lati) 124 #endif 125 IF (ierr.NE.NF_NOERR) THEN 126 PRINT*, 'phyetat0: Lecture echouee pour <latitude>' 127 CALL abort 128 ENDIF 129 c 130 c Lecture des longitudes (coordonnees): 131 c 132 ierr = NF_INQ_VARID (nid, "longitude", nvarid) 133 IF (ierr.NE.NF_NOERR) THEN 134 PRINT*, 'phyetat0: Le champ <longitude> est absent' 135 CALL abort 136 ENDIF 137 #ifdef NC_DOUBLE 138 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, long) 139 #else 140 ierr = NF_GET_VAR_REAL(nid, nvarid, long) 141 #endif 142 IF (ierr.NE.NF_NOERR) THEN 143 PRINT*, 'phyetat0: Lecture echouee pour <longitude>' 144 CALL abort 145 ENDIF 146 c 147 c Lecture des aires des mailles: 148 c 149 ierr = NF_INQ_VARID (nid, "area", nvarid) 150 IF (ierr.NE.NF_NOERR) THEN 151 PRINT*, 'phyetat0: Le champ <area> est absent' 152 CALL abort 153 ENDIF 154 #ifdef NC_DOUBLE 155 ierr = NF_GET_VAR_DOUBLE(nid, nvarid, area) 156 #else 157 ierr = NF_GET_VAR_REAL(nid, nvarid, area) 158 #endif 159 IF (ierr.NE.NF_NOERR) THEN 160 PRINT*, 'phyetat0: Lecture echouee pour <area>' 161 CALL abort 162 ENDIF 163 xmin = 1.0E+20 164 xmax = -1.0E+20 165 xmin = MINVAL(area) 166 xmax = MAXVAL(area) 167 PRINT*,'Aires des mailles <area>:', xmin, xmax 162 168 c 163 169 c Lecture du geopotentiel au sol: -
trunk/LMDZ.GENERIC/libf/phystd/physiq.F90
r726 r728 8 8 9 9 use radinc_h, only : L_NSPECTI,L_NSPECTV,naerkind 10 use watercommon_h, only : RLVTT 10 use watercommon_h, only : RLVTT, Psat_water 11 11 use gases_h 12 12 use radcommon_h, only: sigma 13 use radii_mod, only: h2o_reffrad, co2_reffrad 13 14 use aerosol_mod 14 15 implicit none … … 191 192 192 193 character*80 fichier 193 integer l,ig,ierr,iq,i , tapphys,nw194 integer l,ig,ierr,iq,iaer 194 195 195 196 real fluxsurf_lw(ngridmx) ! incident LW (IR) surface flux (W.m-2) … … 213 214 real zzlev(ngridmx,nlayermx+1) ! altitude at layer boundaries 214 215 real latvl1,lonvl1 ! Viking Lander 1 point (for diagnostic) 215 216 real,save :: reffrad(ngridmx,nlayermx,naerkind) ! aerosol effective radius (m)217 216 218 217 ! Tendencies due to various processes: … … 231 230 real zdhadj(ngridmx,nlayermx) ! (K/s) 232 231 real zdtgw(ngridmx,nlayermx) ! (K/s) 232 real zdtmr(ngridmx,nlayermx) 233 233 real zdugw(ngridmx,nlayermx),zdvgw(ngridmx,nlayermx) ! (m.s-2) 234 234 real zdtc(ngridmx,nlayermx),zdtsurfc(ngridmx) 235 235 real zdvc(ngridmx,nlayermx),zduc(ngridmx,nlayermx) 236 real zdumr(ngridmx,nlayermx),zdvmr(ngridmx,nlayermx) 237 real zdtsurfmr(ngridmx) 238 239 real zdmassmr(ngridmx,nlayermx),zdpsrfmr(ngridmx) 236 240 237 241 real zdqdif(ngridmx,nlayermx,nqmx), zdqsdif(ngridmx,nqmx) 242 real zdqevap(ngridmx,nlayermx) 238 243 real zdqsed(ngridmx,nlayermx,nqmx), zdqssed(ngridmx,nqmx) 239 244 real zdqdev(ngridmx,nlayermx,nqmx), zdqsdev(ngridmx,nqmx) 240 245 real zdqadj(ngridmx,nlayermx,nqmx) 241 246 real zdqc(ngridmx,nlayermx,nqmx) 247 real zdqmr(ngridmx,nlayermx,nqmx),zdqsurfmr(ngridmx,nqmx) 242 248 real zdqlscale(ngridmx,nlayermx,nqmx) 243 249 real zdqslscale(ngridmx,nqmx) … … 329 335 real qevap(ngridmx,nlayermx,nqmx) 330 336 real tevap(ngridmx,nlayermx) 331 real dqevap (ngridmx,nlayermx)332 real dtevap (ngridmx,nlayermx)337 real dqevap1(ngridmx,nlayermx) 338 real dtevap1(ngridmx,nlayermx) 333 339 334 340 ! included by BC for hydrology … … 343 349 344 350 ! included by RW for RH diagnostic 345 real qsat(ngridmx,nlayermx), RH(ngridmx,nlayermx), H2Omaxcol(ngridmx) 351 real qsat(ngridmx,nlayermx), RH(ngridmx,nlayermx), H2Omaxcol(ngridmx),psat_tmp 346 352 347 353 ! included by RW for hydrology … … 366 372 367 373 ! included by BC for cloud fraction computations 368 real cloudfrac(ngridmx,nlayermx)369 real totcloudfrac(ngridmx)374 real,save :: cloudfrac(ngridmx,nlayermx) 375 real,save :: totcloudfrac(ngridmx) 370 376 371 377 ! included by RW for vdifc water conservation test … … 389 395 390 396 ! included by RW for variable H2O particle sizes 397 real,save :: reffrad(ngridmx,nlayermx,naerkind) ! aerosol effective radius (m) 398 real :: reffrad1(ngridmx,nlayermx,naerkind) ! for clearsky call to callcorrk 399 real,save :: nueffrad(ngridmx,nlayermx,naerkind) ! aerosol effective radius variance 400 real :: reffh2oliq(ngridmx,nlayermx) ! liquid water particles effective radius (m) 401 real :: reffh2oice(ngridmx,nlayermx) ! water ice particles effective radius (m) 391 402 real reffH2O(ngridmx,nlayermx) 392 403 real reffcol(ngridmx,naerkind) 393 404 394 405 ! included by RW for sourceevol 395 real ice_initial(ngridmx)!, isoil406 real, save :: ice_initial(ngridmx)!, isoil 396 407 real delta_ice,ice_tot 397 real ice_min(ngridmx) 398 save ice_min 399 save ice_initial 400 408 real, save :: ice_min(ngridmx) 409 401 410 integer num_run 402 logical ice_update 403 save ice_update 404 411 logical,save :: ice_update 412 405 413 !======================================================================= 406 414 … … 457 465 call iniorbit(apoastr,periastr,year_day,peri_day,obliquit) 458 466 459 do ig=1,ngrid 460 albedo(ig)=albedo0(ig) 461 enddo 467 albedo(:)=albedo0(:) 462 468 463 469 if(tlocked)then … … 473 479 else 474 480 print*,'WARNING! Thermal conduction in the soil turned off' 475 do ig=1,ngrid 476 capcal(ig)=1.e6 477 fluxgrd(ig)=0. 478 if(noradsurf)then 479 fluxgrd(ig)=10.0 480 endif 481 enddo 481 capcal(:)=1.e6 482 fluxgrd(:)=0. 483 if(noradsurf)then 484 fluxgrd(:)=10.0 485 endif 482 486 print*,'Flux from ground = ',fluxgrd,' W m^-2' 483 487 endif … … 502 506 ! define surface as continent or ocean 503 507 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 rnat(:)=1 504 509 do ig=1,ngridmx 505 rnat(ig)=1506 507 510 ! if(iceball.or.oceanball.or.(inertiedat(ig,1).gt.1.E4))then 508 511 if(inertiedat(ig,1).gt.1.E4)then … … 517 520 ! initialise surface history variable 518 521 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 do ig=1,ngridmx 520 do iq=1,nqmx 521 qsurf_hist(ig,iq)=qsurf(ig,iq) 522 enddo 523 enddo 522 qsurf_hist(:,:)=qsurf(:,:) 524 523 525 524 ! initialise variable for dynamical heating diagnostic … … 556 555 endif 557 556 558 do ig=1,ngrid 559 !already done above (JL12) 560 ! qsurf_hist(ig,igcm_h2o_vap) = qsurf(ig,igcm_h2o_vap) 561 if(ice_update)then 562 ice_initial(ig)=qsurf(ig,igcm_h2o_ice) 563 endif 564 enddo 557 if(ice_update)then 558 ice_initial(:)=qsurf(:,igcm_h2o_ice) 559 endif 565 560 566 561 endif … … 585 580 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 586 581 587 pdu(:,:) = 0.0 588 pdv(:,:) = 0.0 589 ! if ( (.not.nearco2cond).and.(.not.firstcall) ) then 582 pdu(1:ngridmx,1:nlayermx) = 0.0 583 pdv(1:ngridmx,1:nlayermx) = 0.0 590 584 if ( .not.nearco2cond ) then 591 pdt( :,:) = 0.0592 endif ! this was the source of an evil bug...593 pdq( :,:,:)= 0.0594 pdpsrf( :)= 0.0595 zflubid( :)= 0.0596 zdtsurf( :)= 0.0597 dqsurf( :,:)= 0.0585 pdt(1:ngridmx,1:nlayermx) = 0.0 586 endif 587 pdq(1:ngridmx,1:nlayermx,1:nqmx) = 0.0 588 pdpsrf(1:ngridmx) = 0.0 589 zflubid(1:ngridmx) = 0.0 590 zdtsurf(1:ngridmx) = 0.0 591 dqsurf(1:ngridmx,1:nqmx)= 0.0 598 592 599 593 zday=pday+ptime ! compute time, in sols (and fraction thereof) … … 610 604 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 611 605 612 do l=1,nlayer 613 do ig=1,ngrid 614 zzlay(ig,l)=pphi(ig,l)/g 615 enddo 616 enddo 617 do ig=1,ngrid 618 zzlev(ig,1)=0. 619 zzlev(ig,nlayer+1)=1.e7 ! dummy top of last layer above 10000 km... 620 enddo 606 zzlay(1:ngridmx,1:nlayermx)=pphi(1:ngridmx,1:nlayermx)/g 607 608 zzlev(1:ngridmx,1)=0. 609 zzlev(1:ngridmx,nlayer+1)=1.e7 ! dummy top of last layer above 10000 km... 610 621 611 do l=2,nlayer 622 612 do ig=1,ngrid … … 631 621 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 632 622 633 634 623 do l=1,nlayer 635 624 do ig=1,ngrid … … 657 646 ztim3=-COS(declin)*SIN(2.*pi*(zday/year_day) - zls*nres) 658 647 659 648 call stelang(ngrid,sinlon,coslon,sinlat,coslat, & 660 649 ztim1,ztim2,ztim3,mu0,fract) 661 650 … … 707 696 zdtlw1,zdtsw1,fluxsurf_lw1,fluxsurf_sw1,fluxtop_lw1, & 708 697 fluxabs_sw1,fluxtop_dn,OLR_nu1,OSR_nu1, & 709 reffrad ,tau_col1,cloudfrac,totcloudfrac, &698 reffrad1,tau_col1,cloudfrac,totcloudfrac, & 710 699 clearsky,firstcall,lastcall) 711 700 clearsky = .false. ! just in case. … … 722 711 tau_col(ig) = ntf*tau_col1(ig) + tf*tau_col(ig) 723 712 724 do l=1,nlayer 725 zdtlw(ig,l) = ntf*zdtlw1(ig,l) + tf*zdtlw(ig,l) 726 zdtsw(ig,l) = ntf*zdtsw1(ig,l) + tf*zdtsw(ig,l) 727 enddo 728 729 do nw=1,L_NSPECTV 730 OSR_nu(ig,nw) = ntf*OSR_nu1(ig,nw) + tf*OSR_nu(ig,nw) 731 enddo 732 do nw=1,L_NSPECTI 733 OLR_nu(ig,nw) = ntf*OLR_nu1(ig,nw) + tf*OLR_nu(ig,nw) 734 enddo 713 zdtlw(ig,1:nlayermx) = ntf*zdtlw1(ig,1:nlayermx) + tf*zdtlw(ig,1:nlayermx) 714 zdtsw(ig,1:nlayermx) = ntf*zdtsw1(ig,1:nlayermx) + tf*zdtsw(ig,1:nlayermx) 715 716 OSR_nu(ig,1:L_NSPECTV) = ntf*OSR_nu1(ig,1:L_NSPECTV) + tf*OSR_nu(ig,1:L_NSPECTV) 717 OLR_nu(ig,1:L_NSPECTV) = ntf*OLR_nu1(ig,1:L_NSPECTV) + tf*OLR_nu(ig,1:L_NSPECTV) 735 718 736 719 enddo … … 740 723 ! Radiative flux from the sky absorbed by the surface (W.m-2) 741 724 GSR=0.0 742 do ig=1,ngrid 743 fluxrad_sky(ig)=emis(ig)*fluxsurf_lw(ig) & 744 +fluxsurf_sw(ig)*(1.-albedo(ig)) 745 746 if(noradsurf)then ! no lower surface; SW flux just disappears 747 GSR = GSR + fluxsurf_sw(ig)*area(ig) 748 fluxrad_sky(ig)=emis(ig)*fluxsurf_lw(ig) 749 endif 750 751 enddo 752 if(noradsurf)then 753 print*,'SW lost in deep atmosphere = ',GSR/totarea,' W m^-2' 725 fluxrad_sky(1:ngridmx)=emis(1:ngridmx)*fluxsurf_lw(1:ngridmx)+fluxsurf_sw(1:ngridmx)*(1.-albedo(1:ngridmx)) 726 727 if(noradsurf)then ! no lower surface; SW flux just disappears 728 GSR = SUM(fluxsurf_sw(1:ngridmx)*area(1:ngridmx))/totarea 729 fluxrad_sky(1:ngridmx)=emis(1:ngridmx)*fluxsurf_lw(1:ngridmx) 730 print*,'SW lost in deep atmosphere = ',GSR,' W m^-2' 754 731 endif 755 732 756 733 ! Net atmospheric radiative heating rate (K.s-1) 757 do l=1,nlayer 758 do ig=1,ngrid 759 dtrad(ig,l)=zdtsw(ig,l)+zdtlw(ig,l) 760 enddo 761 enddo 762 734 dtrad(1:ngridmx,1:nlayermx)=zdtsw(1:ngridmx,1:nlayermx)+zdtlw(1:ngridmx,1:nlayermx) 763 735 764 736 elseif(newtonian)then … … 768 740 call newtrelax(mu0,sinlat,zpopsk,pt,pplay,pplev,dtrad,firstcall) 769 741 770 do ig=1,ngrid 771 zdtsurf(ig) = +(pt(ig,1)-tsurf(ig))/ptimestep 772 enddo 742 zdtsurf(1:ngridmx) = +(pt(1:ngridmx,1)-tsurf(1:ngridmx))/ptimestep 773 743 ! e.g. surface becomes proxy for 1st atmospheric layer ? 774 744 … … 777 747 ! c) Atmosphere has no radiative effect 778 748 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 779 do ig=1,ngrid 780 fluxtop_dn(ig) = fract(ig)*mu0(ig)*Fat1AU/dist_star**2 781 if(ngrid.eq.1)then ! / by 4 globally in 1D case... 782 fluxtop_dn(1) = fract(1)*Fat1AU/dist_star**2/2.0 783 endif 784 fluxsurf_sw(ig) = fluxtop_dn(ig) 785 fluxrad_sky(ig) = fluxtop_dn(ig)*(1.-albedo(ig)) 786 fluxtop_lw(ig) = emis(ig)*sigma*tsurf(ig)**4 787 enddo ! radiation skips the atmosphere entirely 788 789 do l=1,nlayer 790 do ig=1,ngrid 791 dtrad(ig,l)=0.0 792 enddo 793 enddo ! hence no atmospheric radiative heating 749 fluxtop_dn(1:ngridmx) = fract(1:ngridmx)*mu0(1:ngridmx)*Fat1AU/dist_star**2 750 if(ngrid.eq.1)then ! / by 4 globally in 1D case... 751 fluxtop_dn(1) = fract(1)*Fat1AU/dist_star**2/2.0 752 endif 753 fluxsurf_sw(1:ngridmx) = fluxtop_dn(1:ngridmx) 754 fluxrad_sky(1:ngridmx) = fluxtop_dn(1:ngridmx)*(1.-albedo(1:ngridmx)) 755 fluxtop_lw(1:ngridmx) = emis(1:ngridmx)*sigma*tsurf(1:ngridmx)**4 756 ! radiation skips the atmosphere entirely 757 758 759 dtrad(1:ngridmx,1:nlayermx)=0.0 760 ! hence no atmospheric radiative heating 794 761 795 762 endif ! if corrk … … 801 768 ! ------------------------------------------ 802 769 803 do ig=1,ngrid 804 zplanck(ig)=tsurf(ig)*tsurf(ig) 805 zplanck(ig)=emis(ig)*sigma*zplanck(ig)*zplanck(ig) 806 fluxrad(ig)=fluxrad_sky(ig)-zplanck(ig) 807 enddo 808 809 do l=1,nlayer 810 do ig=1,ngrid 811 pdt(ig,l)=pdt(ig,l)+dtrad(ig,l) 812 enddo 813 enddo 770 zplanck(1:ngridmx)=tsurf(1:ngridmx)*tsurf(1:ngridmx) 771 zplanck(1:ngridmx)=emis(1:ngridmx)*sigma*zplanck(1:ngridmx)*zplanck(1:ngridmx) 772 fluxrad(1:ngridmx)=fluxrad_sky(1:ngridmx)-zplanck(1:ngridmx) 773 pdt(1:ngridmx,1:nlayermx)=pdt(1:ngridmx,1:nlayermx)+dtrad(1:ngridmx,1:nlayermx) 814 774 815 775 !------------------------- … … 840 800 if (calldifv) then 841 801 842 do ig=1,ngrid 843 zflubid(ig)=fluxrad(ig)+fluxgrd(ig) 844 enddo 845 846 zdum1(:,:)=0.0 847 zdum2(:,:)=0.0 802 zflubid(1:ngridmx)=fluxrad(1:ngridmx)+fluxgrd(1:ngridmx) 803 804 zdum1(1:ngridmx,1:nlayermx)=0.0 805 zdum2(1:ngridmx,1:nlayermx)=0.0 848 806 849 807 … … 857 815 zdum1,zdum2,pdt,pdq,zflubid, & 858 816 zdudif,zdvdif,zdtdif,zdtsdif, & 859 sensibFlux,q2,zdqdif,zdq sdif,lastcall)817 sensibFlux,q2,zdqdif,zdqevap,zdqsdif,lastcall) 860 818 861 819 else 862 820 863 do l=1,nlayer 864 do ig=1,ngrid 865 zdh(ig,l)=pdt(ig,l)/zpopsk(ig,l) 866 enddo 867 enddo 821 zdh(1:ngridmx,1:nlayermx)=pdt(1:ngridmx,1:nlayermx)/zpopsk(1:ngridmx,1:nlayermx) 868 822 869 823 call vdifc(ngrid,nlayer,nq,rnat,zpopsk, & … … 875 829 sensibFlux,q2,zdqdif,zdqsdif,lastcall) 876 830 877 do l=1,nlayer 878 do ig=1,ngrid 879 zdtdif(ig,l)=zdhdif(ig,l)*zpopsk(ig,l) ! for diagnostic only 880 enddo 881 enddo 831 zdtdif(1:ngridmx,1:nlayermx)=zdhdif(1:ngridmx,1:nlayermx)*zpopsk(1:ngridmx,1:nlayermx) ! for diagnostic only 832 zdqevap(1:ngridmx,1:nlayermx)=0. 882 833 883 834 end if !turbdiff 884 835 885 do l=1,nlayer 886 do ig=1,ngrid 887 pdv(ig,l)=pdv(ig,l)+zdvdif(ig,l) 888 pdu(ig,l)=pdu(ig,l)+zdudif(ig,l) 889 pdt(ig,l)=pdt(ig,l)+zdtdif(ig,l) 890 enddo 891 enddo 892 893 do ig=1,ngrid 894 zdtsurf(ig)=zdtsurf(ig)+zdtsdif(ig) 895 enddo 896 836 pdv(1:ngridmx,1:nlayermx)=pdv(1:ngridmx,1:nlayermx)+zdvdif(1:ngridmx,1:nlayermx) 837 pdu(1:ngridmx,1:nlayermx)=pdu(1:ngridmx,1:nlayermx)+zdudif(1:ngridmx,1:nlayermx) 838 pdt(1:ngridmx,1:nlayermx)=pdt(1:ngridmx,1:nlayermx)+zdtdif(1:ngridmx,1:nlayermx) 839 zdtsurf(1:ngridmx)=zdtsurf(1:ngridmx)+zdtsdif(1:ngridmx) 897 840 if (tracer) then 898 do iq=1, nq 899 do l=1,nlayer 900 do ig=1,ngrid 901 pdq(ig,l,iq)=pdq(ig,l,iq)+ zdqdif(ig,l,iq) 902 enddo 903 enddo 904 enddo 905 do iq=1, nq 906 do ig=1,ngrid 907 dqsurf(ig,iq)=dqsurf(ig,iq) + zdqsdif(ig,iq) 908 enddo 909 enddo 910 841 pdq(1:ngridmx,1:nlayermx,1:nqmx)=pdq(1:ngridmx,1:nlayermx,1:nqmx)+ zdqdif(1:ngridmx,1:nlayermx,1:nqmx) 842 dqsurf(1:ngridmx,1:nqmx)=dqsurf(1:ngridmx,1:nqmx) + zdqsdif(1:ngridmx,1:nqmx) 911 843 end if ! of if (tracer) 912 844 … … 965 897 if(.not.newtonian)then 966 898 967 do ig=1,ngrid 968 zdtsurf(ig) = zdtsurf(ig) + (fluxrad(ig) + fluxgrd(ig))/capcal(ig) 969 enddo 899 zdtsurf(1:ngridmx) = zdtsurf(1:ngridmx) + (fluxrad(1:ngridmx) + fluxgrd(1:ngridmx))/capcal(1:ngridmx) 970 900 971 901 endif … … 980 910 if(calladj) then 981 911 982 do l=1,nlayer 983 do ig=1,ngrid 984 zdh(ig,l) = pdt(ig,l)/zpopsk(ig,l) 985 enddo 986 enddo 987 zduadj(:,:)=0.0 988 zdvadj(:,:)=0.0 989 zdhadj(:,:)=0.0 912 zdh(1:ngridmx,1:nlayermx) = pdt(1:ngridmx,1:nlayermx)/zpopsk(1:ngridmx,1:nlayermx) 913 zduadj(1:ngridmx,1:nlayermx)=0.0 914 zdvadj(1:ngridmx,1:nlayermx)=0.0 915 zdhadj(1:ngridmx,1:nlayermx)=0.0 990 916 991 917 … … 997 923 zdqadj) 998 924 999 do l=1,nlayer 1000 do ig=1,ngrid 1001 pdu(ig,l) = pdu(ig,l) + zduadj(ig,l) 1002 pdv(ig,l) = pdv(ig,l) + zdvadj(ig,l) 1003 pdt(ig,l) = pdt(ig,l) + zdhadj(ig,l)*zpopsk(ig,l) 1004 zdtadj(ig,l) = zdhadj(ig,l)*zpopsk(ig,l) ! for diagnostic only 1005 enddo 1006 enddo 1007 925 pdu(1:ngridmx,1:nlayermx) = pdu(1:ngridmx,1:nlayermx) + zduadj(1:ngridmx,1:nlayermx) 926 pdv(1:ngridmx,1:nlayermx) = pdv(1:ngridmx,1:nlayermx) + zdvadj(1:ngridmx,1:nlayermx) 927 pdt(1:ngridmx,1:nlayermx) = pdt(1:ngridmx,1:nlayermx) + zdhadj(1:ngridmx,1:nlayermx)*zpopsk(1:ngridmx,1:nlayermx) 928 zdtadj(1:ngridmx,1:nlayermx) = zdhadj(1:ngridmx,1:nlayermx)*zpopsk(1:ngridmx,1:nlayermx) ! for diagnostic only 929 1008 930 if(tracer) then 1009 do iq=1, nq 1010 do l=1,nlayer 1011 do ig=1,ngrid 1012 pdq(ig,l,iq) = pdq(ig,l,iq) + zdqadj(ig,l,iq) 1013 enddo 1014 enddo 1015 enddo 931 pdq(1:ngridmx,1:nlayermx,1:nqmx) = pdq(1:ngridmx,1:nlayermx,1:nqmx) + zdqadj(1:ngridmx,1:nlayermx,1:nqmx) 1016 932 end if 1017 933 … … 1061 977 zdqc,reffrad) 1062 978 1063 do l=1,nlayer 1064 do ig=1,ngrid 1065 pdt(ig,l)=pdt(ig,l)+zdtc(ig,l) 1066 pdv(ig,l)=pdv(ig,l)+zdvc(ig,l) 1067 pdu(ig,l)=pdu(ig,l)+zduc(ig,l) 1068 enddo 1069 enddo 1070 do ig=1,ngrid 1071 zdtsurf(ig) = zdtsurf(ig) + zdtsurfc(ig) 1072 enddo 1073 1074 do iq=1,nq ! should use new notation here ! 1075 do l=1,nlayer 1076 do ig=1,ngrid 1077 pdq(ig,l,iq)=pdq(ig,l,iq)+ zdqc(ig,l,iq) 1078 enddo 1079 enddo 1080 enddo 979 980 pdt(1:ngridmx,1:nlayermx)=pdt(1:ngridmx,1:nlayermx)+zdtc(1:ngridmx,1:nlayermx) 981 pdv(1:ngridmx,1:nlayermx)=pdv(1:ngridmx,1:nlayermx)+zdvc(1:ngridmx,1:nlayermx) 982 pdu(1:ngridmx,1:nlayermx)=pdu(1:ngridmx,1:nlayermx)+zduc(1:ngridmx,1:nlayermx) 983 zdtsurf(1:ngridmx) = zdtsurf(1:ngridmx) + zdtsurfc(1:ngridmx) 984 985 pdq(1:ngridmx,1:nlayermx,1:nqmx)=pdq(1:ngridmx,1:nlayermx,1:nqmx)+ zdqc(1:ngridmx,1:nlayermx,1:nqmx) 1081 986 ! Note: we do not add surface co2ice tendency 1082 987 ! because qsurf(:,igcm_co2_ice) is updated in condens_co2cloud … … 1108 1013 ! Water ice condensation in the atmosphere 1109 1014 ! ---------------------------------------- 1110 if(watercond)then 1111 1112 if(RLVTT.gt.1.e-8)then 1113 1015 if(watercond.and.(RLVTT.gt.1.e-8))then 1016 1017 ! ---------------- 1018 ! Moist convection 1019 ! ---------------- 1114 1020 ! Re-evaporate cloud water/ice 1115 call evap(ptimestep,pt,pq,pdq,pdt,dqevap,dtevap,qevap,tevap) 1116 DO l = 1, nlayer 1117 DO ig = 1, ngrid 1118 pdq(ig,l,igcm_h2o_vap) = pdq(ig,l,igcm_h2o_vap)+dqevap(ig,l) 1119 pdq(ig,l,igcm_h2o_ice) = pdq(ig,l,igcm_h2o_ice)-dqevap(ig,l) 1120 pdt(ig,l) = pdt(ig,l)+dtevap(ig,l) 1121 enddo 1122 enddo 1123 1124 call moistadj(pt,qevap,pplev,pplay,dtmoist,dqmoist,ptimestep,rneb_man) 1125 do l=1,nlayer 1126 do ig=1,ngrid 1127 pdq(ig,l,igcm_h2o_vap) = pdq(ig,l,igcm_h2o_vap)+dqmoist(ig,l,igcm_h2o_vap) 1128 pdq(ig,l,igcm_h2o_ice) = pdq(ig,l,igcm_h2o_ice)+dqmoist(ig,l,igcm_h2o_ice) 1129 pdt(ig,l) = pdt(ig,l)+dtmoist(ig,l) 1130 enddo 1131 enddo 1021 ! dqevap1(1:ngridmx,1:nlayermx)=0. 1022 ! dtevap1(1:ngridmx,1:nlayermx)=0. 1023 ! call evap(ptimestep,pt,pq,pdq,pdt,dqevap1,dtevap1,qevap,tevap) 1024 1025 dqmoist(1:ngridmx,1:nlayermx,1:nqmx)=0. 1026 dtmoist(1:ngridmx,1:nlayermx)=0. 1027 1028 call moistadj(pt,pq,pdq,pplev,pplay,dtmoist,dqmoist,ptimestep,rneb_man) 1029 1030 pdq(1:ngridmx,1:nlayermx,igcm_h2o_vap) = pdq(1:ngridmx,1:nlayermx,igcm_h2o_vap) & 1031 +dqmoist(1:ngridmx,1:nlayermx,igcm_h2o_vap) 1032 pdq(1:ngridmx,1:nlayermx,igcm_h2o_ice) =pdq(1:ngridmx,1:nlayermx,igcm_h2o_ice) & 1033 +dqmoist(1:ngridmx,1:nlayermx,igcm_h2o_ice) 1034 pdt(1:ngridmx,1:nlayermx) = pdt(1:ngridmx,1:nlayermx)+dtmoist(1:ngridmx,1:nlayermx) 1035 1036 ! do l=1,nlayermx 1037 ! do ig=1,ngridmx 1038 ! if(isnan(dqmoist(ig,l,igcm_h2o_ice))) print*,'Nan in dqmoist ice, abort,ig,l',ig,l 1039 ! if(isnan(dqmoist(ig,l,igcm_h2o_vap))) print*,'Nan in dqmoist vap, abort,ig,l',ig,l 1040 ! if(isnan(dtmoist(ig,l))) print*,'Nan in dtmoist, abort,ig,l',ig,l 1041 ! if(isnan(dqmoist(ig,l,igcm_h2o_ice)).or.isnan(dqmoist(ig,l,igcm_h2o_vap)).or.isnan(dtmoist(ig,l))) STOP 1042 ! enddo 1043 ! enddo 1044 ! print*,'after moist',dqmoist(185,1,igcm_h2o_ice),dqmoist(185,1,igcm_h2o_vap),dtmoist(185,1)*86400. 1132 1045 1133 1046 !------------------------- 1134 1047 ! test energy conservation 1135 1048 if(enertest)then 1136 dEtot=cpp*SUM(massarea(:,:)* (dtmoist(:,:)+dtevap(:,:)))/totarea1049 dEtot=cpp*SUM(massarea(:,:)*dtmoist(:,:))/totarea 1137 1050 do ig = 1, ngrid 1138 madjdE(ig) = cpp*SUM(mass(:,:)* (dtmoist(:,:)+dtevap(:,:)))1051 madjdE(ig) = cpp*SUM(mass(:,:)*dtmoist(:,:)) 1139 1052 enddo 1140 1053 print*,'In moistadj atmospheric energy change =',dEtot,' W m-2' 1054 print*,'In moistadj MAX atmospheric energy change =',MAXVAL(pdt(:,:))*86400.,'K/day' 1141 1055 1142 1056 ! test energy conservation … … 1146 1060 endif 1147 1061 !------------------------- 1148 1149 1150 endif1151 1062 1152 1063 1153 ! Re-evaporate cloud water/ice 1154 call evap(ptimestep,pt,pq,pdq,pdt,dqevap,dtevap,qevap,tevap) 1155 do l = 1, nlayer 1156 do ig = 1, ngrid 1157 pdq(ig,l,igcm_h2o_vap) = pdq(ig,l,igcm_h2o_vap)+dqevap(ig,l) 1158 pdq(ig,l,igcm_h2o_ice) = pdq(ig,l,igcm_h2o_ice)-dqevap(ig,l) 1159 pdt(ig,l) = pdt(ig,l)+dtevap(ig,l) 1160 enddo 1161 enddo ! note: we use qevap but not tevap in largescale/moistadj 1162 ! otherwise is a big mess 1163 1164 call largescale(ptimestep,pplev,pplay,pt,qevap, & ! a bug was here! 1165 pdt,dtlscale,dqvaplscale,dqcldlscale,rneb_lsc,reffH2O) 1166 do l=1,nlayer 1167 do ig=1,ngrid 1168 pdq(ig,l,igcm_h2o_vap) = pdq(ig,l,igcm_h2o_vap)+dqvaplscale(ig,l) 1169 pdq(ig,l,igcm_h2o_ice) = pdq(ig,l,igcm_h2o_ice)+dqcldlscale(ig,l) 1170 pdt(ig,l) = pdt(ig,l)+dtlscale(ig,l) 1171 1172 if(aeroh2o.and.(.not.aerofixh2o)) then 1173 reffrad(ig,l,iaero_h2o)=reffH2O(ig,l) 1174 endif 1175 1176 enddo 1177 enddo 1064 ! -------------------------------- 1065 ! Large scale condensation/evaporation 1066 ! -------------------------------- 1067 1068 call largescale(ptimestep,pplev,pplay,pt,pq,pdt,pdq,dtlscale,dqvaplscale,dqcldlscale,rneb_lsc) 1069 1070 pdt(1:ngridmx,1:nlayermx) = pdt(1:ngridmx,1:nlayermx)+dtlscale(1:ngridmx,1:nlayermx) 1071 pdq(1:ngridmx,1:nlayermx,igcm_h2o_vap) = pdq(1:ngridmx,1:nlayermx,igcm_h2o_vap)+dqvaplscale(1:ngridmx,1:nlayermx) 1072 pdq(1:ngridmx,1:nlayermx,igcm_h2o_ice) = pdq(1:ngridmx,1:nlayermx,igcm_h2o_ice)+dqcldlscale(1:ngridmx,1:nlayermx) 1178 1073 1179 1074 !------------------------- 1180 1075 ! test energy conservation 1181 1076 if(enertest)then 1182 dEtot=cpp*SUM(massarea(:,:)*(dtmoist(:,:)+dtevap(:,:)))/totarea1183 1077 do ig = 1, ngrid 1184 madjdE(ig) = cpp*SUM(mass(:,:)*(dtmoist(:,:)+dtevap(:,:)))1078 lscaledE(ig) = cpp*SUM(mass(:,:)*dtlscale(:,:)) 1185 1079 enddo 1186 print*,'In moistadj atmospheric energy change =',dEtot,' W m-2' 1187 1188 ! test energy conservation 1189 dWtot = SUM(massarea(:,:)*dqmoist(:,:,igcm_h2o_vap))*ptimestep/totarea 1190 dWtot = dWtot + SUM(massarea(:,:)*dqmoist(:,:,igcm_h2o_ice))*ptimestep/totarea 1191 print*,'In moistadj atmospheric water change =',dWtot,' kg m-2' 1080 dEtot=cpp*SUM(massarea(:,:)*(dtlscale(:,:)))/totarea 1081 if(isnan(dEtot)) then 1082 print*,'Nan in largescale, abort' 1083 STOP 1084 endif 1085 print*,'In largescale atmospheric energy change =',dEtot,' W m-2' 1086 1087 ! test water conservation 1088 dWtot = SUM(massarea(:,:)*dqvaplscale(:,:))*ptimestep/totarea 1089 dWtot = dWtot + SUM(massarea(:,:)*dqcldlscale(:,:))*ptimestep/totarea 1090 print*,'In largescale atmospheric water change =',dWtot,' kg m-2' 1192 1091 endif 1193 1092 !------------------------- … … 1200 1099 enddo 1201 1100 1202 ! compute total cloud fraction in column 1203 call totalcloudfrac(cloudfrac,totcloudfrac) 1204 1205 endif ! of if (watercondense) 1101 endif ! of if (watercondense) 1206 1102 1207 1103 … … 1209 1105 ! Water ice / liquid precipitation 1210 1106 ! -------------------------------- 1211 if(waterrain)then1212 1213 zdqrain(:,:,:) = 0.01214 zdqsrain(:) = 0.01215 zdqssnow(:) = 0.01216 1217 call rain(ptimestep,pplev,pplay,pt,pdt,pq,pdq, &1107 if(waterrain)then 1108 1109 zdqrain(1:ngridmx,1:nlayermx,1:nqmx) = 0.0 1110 zdqsrain(1:ngridmx) = 0.0 1111 zdqssnow(1:ngridmx) = 0.0 1112 1113 call rain(ptimestep,pplev,pplay,pt,pdt,pq,pdq, & 1218 1114 zdtrain,zdqrain,zdqsrain,zdqssnow,cloudfrac) 1219 1115 1220 do l=1,nlayer 1221 do ig=1,ngrid 1222 pdq(ig,l,igcm_h2o_vap) = pdq(ig,l,igcm_h2o_vap)+zdqrain(ig,l,igcm_h2o_vap) 1223 pdq(ig,l,igcm_h2o_ice) = pdq(ig,l,igcm_h2o_ice)+zdqrain(ig,l,igcm_h2o_ice) 1224 pdt(ig,l) = pdt(ig,l)+zdtrain(ig,l) 1225 enddo 1226 enddo 1227 1228 do ig=1,ngrid 1229 dqsurf(ig,igcm_h2o_vap) = dqsurf(ig,igcm_h2o_vap)+zdqsrain(ig) ! a bug was here 1230 dqsurf(ig,igcm_h2o_ice) = dqsurf(ig,igcm_h2o_ice)+zdqssnow(ig) 1231 rainout(ig) = zdqsrain(ig)+zdqssnow(ig) ! diagnostic 1232 enddo 1233 1116 pdq(1:ngridmx,1:nlayermx,igcm_h2o_vap) = pdq(1:ngridmx,1:nlayermx,igcm_h2o_vap) & 1117 +zdqrain(1:ngridmx,1:nlayermx,igcm_h2o_vap) 1118 pdq(1:ngridmx,1:nlayermx,igcm_h2o_ice) = pdq(1:ngridmx,1:nlayermx,igcm_h2o_ice) & 1119 +zdqrain(1:ngridmx,1:nlayermx,igcm_h2o_ice) 1120 pdt(1:ngridmx,1:nlayermx) = pdt(1:ngridmx,1:nlayermx)+zdtrain(1:ngridmx,1:nlayermx) 1121 dqsurf(1:ngridmx,igcm_h2o_vap) = dqsurf(1:ngridmx,igcm_h2o_vap)+zdqsrain(1:ngridmx) ! a bug was here 1122 dqsurf(1:ngridmx,igcm_h2o_ice) = dqsurf(1:ngridmx,igcm_h2o_ice)+zdqssnow(1:ngridmx) 1123 rainout(1:ngridmx) = zdqsrain(1:ngridmx)+zdqssnow(1:ngridmx) ! diagnostic 1234 1124 1235 1125 … … 1242 1132 dItot = dItot + SUM(area(:)*zdqssnow(:))/totarea*RLVTT/cpp 1243 1133 dVtot = SUM(massarea(:,:)*zdqrain(:,:,igcm_h2o_vap))*ptimestep/totarea 1244 dVtot = d Itot + SUM(area(:)*zdqsrain(:))/totarea*RLVTT/cpp1134 dVtot = dVtot + SUM(area(:)*zdqsrain(:))/totarea*RLVTT/cpp 1245 1135 dEtot = dItot + dVtot 1246 1136 print*,'In rain dItot =',dItot,' W m-2' … … 1258 1148 !------------------------- 1259 1149 1260 end if ! of if (waterrain)1261 end if ! of if (water)1150 end if ! of if (waterrain) 1151 end if ! of if (water) 1262 1152 1263 1153 … … 1268 1158 ! ------------- 1269 1159 if (sedimentation) then 1270 zdqsed( :,:,:) = 0.01271 zdqssed( :,:) = 0.01160 zdqsed(1:ngridmx,1:nlayermx,1:nqmx) = 0.0 1161 zdqssed(1:ngridmx,1:nqmx) = 0.0 1272 1162 1273 1163 … … 1297 1187 !------------------------- 1298 1188 1299 do iq=1,nq 1300 ! for now, we only allow H2O ice to sediment 1189 ! for now, we only allow H2O ice to sediment 1301 1190 ! and as in rain.F90, whether it falls as rain or snow depends 1302 1191 ! only on the surface temperature 1303 do ig=1,ngrid 1304 do l=1,nlayer 1305 pdq(ig,l,iq) = pdq(ig,l,iq) + zdqsed(ig,l,iq) 1306 enddo 1307 dqsurf(ig,iq) = dqsurf(ig,iq) + zdqssed(ig,iq) 1308 enddo 1309 enddo 1192 pdq(1:ngridmx,1:nlayermx,1:nqmx) = pdq(1:ngridmx,1:nlayermx,1:nqmx) + zdqsed(1:ngridmx,1:nlayermx,1:nqmx) 1193 dqsurf(1:ngridmx,1:nqmx) = dqsurf(1:ngridmx,1:nqmx) + zdqssed(1:ngridmx,1:nqmx) 1310 1194 1311 1195 !------------------------- … … 1326 1210 ! --------- 1327 1211 1212 ! ----------------------------------- 1213 ! Updating atm mass and tracer budget 1214 ! ----------------------------------- 1215 1216 if(mass_redistrib) then 1217 1218 zdmassmr(1:ngridmx,1:nlayermx) = mass(1:ngridmx,1:nlayermx) * & 1219 ( zdqevap(1:ngridmx,1:nlayermx) & 1220 + zdqrain(1:ngridmx,1:nlayermx,igcm_h2o_vap) & 1221 + dqmoist(1:ngridmx,1:nlayermx,igcm_h2o_vap) & 1222 + dqvaplscale(1:ngridmx,1:nlayermx) ) 1223 1224 1225 call writediagfi(ngridmx,"mass_evap","mass gain"," ",3,zdmassmr) 1226 call writediagfi(ngridmx,"mass","mass"," ",3,mass) 1227 1228 call mass_redistribution(ngrid,nlayer,nq,ptimestep, & 1229 rnat,capcal,pplay,pplev,pt,tsurf,pq,qsurf, & 1230 pu,pv,pdt,zdtsurf,pdq,pdu,pdv,zdmassmr, & 1231 zdtmr,zdtsurfmr,zdpsrfmr,zdumr,zdvmr,zdqmr,zdqsurfmr) 1232 1233 1234 pdq(1:ngridmx,1:nlayermx,1:nqmx) = pdq(1:ngridmx,1:nlayermx,1:nqmx) + zdqmr(1:ngridmx,1:nlayermx,1:nqmx) 1235 dqsurf(1:ngridmx,1:nqmx) = dqsurf(1:ngridmx,1:nqmx) + zdqsurfmr(1:ngridmx,1:nqmx) 1236 pdt(1:ngridmx,1:nlayermx) = pdt(1:ngridmx,1:nlayermx) + zdtmr(1:ngridmx,1:nlayermx) 1237 pdu(1:ngridmx,1:nlayermx) = pdu(1:ngridmx,1:nlayermx) + zdumr(1:ngridmx,1:nlayermx) 1238 pdv(1:ngridmx,1:nlayermx) = pdv(1:ngridmx,1:nlayermx) + zdvmr(1:ngridmx,1:nlayermx) 1239 pdpsrf(1:ngridmx) = pdpsrf(1:ngridmx) + zdpsrfmr(1:ngridmx) 1240 zdtsurf(1:ngridmx) = zdtsurf(1:ngridmx) + zdtsurfmr(1:ngridmx) 1241 1242 ! print*,'after mass redistrib, q=',pq(211,1:nlayermx,igcm_h2o_vap)+ptimestep*pdq(211,1:nlayermx,igcm_h2o_vap) 1243 endif 1244 1245 1246 1328 1247 ! --------------------------------- 1329 1248 ! Updating tracer budget on surface … … 1336 1255 ! note: for now, also changes albedo in the subroutine 1337 1256 1338 do ig=1,ngrid 1339 zdtsurf(ig) = zdtsurf(ig) + zdtsurf_hyd(ig) 1340 do iq=1,nq 1341 qsurf(ig,iq) = qsurf(ig,iq)+ptimestep*dqs_hyd(ig,iq) 1342 enddo 1343 enddo 1257 zdtsurf(1:ngridmx) = zdtsurf(1:ngridmx) + zdtsurf_hyd(1:ngridmx) 1258 qsurf(1:ngridmx,1:nqmx) = qsurf(1:ngridmx,1:nqmx) + ptimestep*dqs_hyd(1:ngridmx,1:nqmx) 1344 1259 ! when hydrology is used, other dqsurf tendencies are all added to dqs_hyd inside 1345 1260 … … 1365 1280 ELSE ! of if (hydrology) 1366 1281 1367 do iq=1,nq 1368 do ig=1,ngrid 1369 qsurf(ig,iq)=qsurf(ig,iq)+ptimestep*dqsurf(ig,iq) 1370 enddo 1371 enddo 1282 qsurf(1:ngridmx,1:nqmx)=qsurf(1:ngridmx,1:nqmx)+ptimestep*dqsurf(1:ngridmx,1:nqmx) 1372 1283 1373 1284 END IF ! of if (hydrology) … … 1380 1291 1381 1292 if(ice_update)then 1382 do ig = 1, ngrid 1383 ice_min(ig)=min(ice_min(ig),qsurf(ig,igcm_h2o_ice)) 1384 enddo 1293 ice_min(1:ngridmx)=min(ice_min(1:ngridmx),qsurf(1:ngridmx,igcm_h2o_ice)) 1385 1294 endif 1386 1295 … … 1393 1302 1394 1303 ! Increment surface temperature 1395 do ig=1,ngrid 1396 tsurf(ig)=tsurf(ig)+ptimestep*zdtsurf(ig) 1397 enddo 1304 tsurf(1:ngridmx)=tsurf(1:ngridmx)+ptimestep*zdtsurf(1:ngridmx) 1398 1305 1399 1306 ! Compute soil temperatures and subsurface heat flux … … 1406 1313 ! test energy conservation 1407 1314 if(enertest)then 1408 dEtots=0.0 1409 do ig = 1, ngrid 1410 dEtots = dEtots + capcal(ig)*zdtsurf(ig)*area(ig) 1411 enddo 1412 dEtots=dEtots/totarea 1315 dEtots = SUM(area(:)*capcal(:)*zdtsurf(:))/totarea 1413 1316 print*,'Surface energy change =',dEtots,' W m-2' 1414 1317 endif … … 1425 1328 1426 1329 ! temperature, zonal and meridional wind 1427 do l=1,nlayer 1428 do ig=1,ngrid 1429 zt(ig,l) = pt(ig,l) + pdt(ig,l)*ptimestep 1430 zu(ig,l) = pu(ig,l) + pdu(ig,l)*ptimestep 1431 zv(ig,l) = pv(ig,l) + pdv(ig,l)*ptimestep 1432 1433 ! diagnostic 1434 zdtdyn(ig,l) = ztprevious(ig,l)-pt(ig,l) 1435 ztprevious(ig,l) = zt(ig,l) 1436 enddo 1330 zt(1:ngridmx,1:nlayermx) = pt(1:ngridmx,1:nlayermx) + pdt(1:ngridmx,1:nlayermx)*ptimestep 1331 zu(1:ngridmx,1:nlayermx) = pu(1:ngridmx,1:nlayermx) + pdu(1:ngridmx,1:nlayermx)*ptimestep 1332 zv(1:ngridmx,1:nlayermx) = pv(1:ngridmx,1:nlayermx) + pdv(1:ngridmx,1:nlayermx)*ptimestep 1333 1334 ! diagnostic 1335 zdtdyn(1:ngridmx,1:nlayermx) = pt(1:ngridmx,1:nlayermx)-ztprevious(1:ngridmx,1:nlayermx) 1336 ztprevious(1:ngridmx,1:nlayermx) = zt(1:ngridmx,1:nlayermx) 1337 1338 if(firstcall)then 1339 zdtdyn(1:ngridmx,1:nlayermx)=0.0 1340 endif 1341 1342 ! dynamical heating diagnostic 1343 do ig=1,ngrid 1344 fluxdyn(ig)= SUM(zdtdyn(ig,:) *mass(ig,:))*cpp/ptimestep 1437 1345 enddo 1438 1346 1439 if(firstcall)then1440 zdtdyn(:,:)=0.01441 endif1442 1443 ! dynamical heating diagnostic1444 fluxdyn(:)=0.1445 do ig=1,ngrid1446 do l=1,nlayer1447 fluxdyn(ig)=fluxdyn(ig) - (zdtdyn(ig,l)/ptimestep) &1448 *(pplev(ig,l)-pplev(ig,l+1))*cpp/g1449 enddo1450 enddo1451 1452 1347 ! tracers 1453 do iq=1, nq 1454 do l=1,nlayer 1455 do ig=1,ngrid 1456 zq(ig,l,iq) = pq(ig,l,iq) + pdq(ig,l,iq)*ptimestep 1457 enddo 1458 enddo 1459 enddo 1348 zq(1:ngridmx,1:nlayermx,1:nqmx) = pq(1:ngridmx,1:nlayermx,1:nqmx) + pdq(1:ngridmx,1:nlayermx,1:nqmx)*ptimestep 1460 1349 1461 1350 ! surface pressure 1462 do ig=1,ngrid 1463 ps(ig) = pplev(ig,1) + pdpsrf(ig)*ptimestep 1464 enddo 1351 ps(1:ngridmx) = pplev(1:ngridmx,1) + pdpsrf(1:ngridmx)*ptimestep 1465 1352 1466 1353 ! pressure 1467 1354 do l=1,nlayer 1468 do ig=1,ngrid 1469 zplev(ig,l) = pplev(ig,l)/pplev(ig,1)*ps(ig) 1470 zplay(ig,l) = pplay(ig,l)/pplev(ig,1)*ps(ig) 1471 enddo 1355 zplev(1:ngridmx,l) = pplev(1:ngridmx,l)/pplev(1:ngridmx,1)*ps(:) 1356 zplay(1:ngridmx,l) = pplay(1:ngridmx,l)/pplev(1:ngridmx,1)*ps(1:ngridmx) 1472 1357 enddo 1473 1358 … … 1558 1443 ! --------------------------------------------------------- 1559 1444 if(tracer)then 1560 qcol( :,:)=0.01445 qcol(1:ngridmx,1:nqmx)=0.0 1561 1446 do iq=1,nq 1562 do ig=1,ngrid 1563 do l=1,nlayer 1564 qcol(ig,iq) = qcol(ig,iq) + zq(ig,l,iq) * & 1565 (pplev(ig,l) - pplev(ig,l+1)) / g 1566 enddo 1447 do ig=1,ngridmx 1448 qcol(ig,iq) = SUM( zq(ig,1:nlayermx,iq) * mass(ig,1:nlayermx)) 1449 enddo 1450 enddo 1451 1452 ! Generalised for arbitrary aerosols now. (LK) 1453 reffcol(1:ngridmx,1:naerkind)=0.0 1454 if(co2cond.and.(iaero_co2.ne.0))then 1455 call co2_reffrad(zq,reffrad) 1456 do ig=1,ngridmx 1457 reffcol(ig,iaero_co2) = SUM(zq(ig,1:nlayermx,igcm_co2_ice)*reffrad(ig,1:nlayermx,iaero_co2)*mass(ig,1:nlayermx)) 1567 1458 enddo 1568 enddo 1569 1570 ! Generalised for arbitrary aerosols now. (LK) 1571 reffcol(:,:)=0.0 1572 do ig=1,ngrid 1573 do l=1,nlayer 1574 if(co2cond.and.(iaero_co2.ne.0)) then 1575 reffcol(ig,iaero_co2) = reffcol(ig,iaero_co2) + zq(ig,l,igcm_co2_ice) * & 1576 reffrad(ig,l,iaero_co2) * & 1577 (pplev(ig,l) - pplev(ig,l+1)) / g 1578 endif 1579 if(water.and.(iaero_h2o.ne.0)) then 1580 reffcol(ig,iaero_h2o) = reffcol(ig,iaero_h2o) + zq(ig,l,igcm_h2o_ice) * & 1581 reffrad(ig,l,iaero_h2o) * & 1582 (pplev(ig,l) - pplev(ig,l+1)) / g 1583 endif 1459 endif 1460 if(water.and.(iaero_h2o.ne.0))then 1461 call h2o_reffrad(zq,zt,reffrad,nueffrad) 1462 do ig=1,ngridmx 1463 reffcol(ig,iaero_h2o) = SUM(zq(ig,1:nlayermx,igcm_h2o_ice)*reffrad(ig,1:nlayermx,iaero_h2o)*mass(ig,1:nlayermx)) 1584 1464 enddo 1585 end do1465 endif 1586 1466 1587 1467 endif … … 1622 1502 do l = 1, nlayer 1623 1503 do ig = 1, ngrid 1624 call watersat(pt(ig,l),pplay(ig,l),qsat(ig,l)) 1504 ! call watersat(pt(ig,l),pplay(ig,l),qsat(ig,l)) 1505 call Psat_water(zt(ig,l),pplay(ig,l),psat_tmp,qsat(ig,l)) 1506 1625 1507 RH(ig,l) = zq(ig,l,igcm_h2o_vap) / qsat(ig,l) 1626 1508 enddo … … 1629 1511 ! compute maximum possible H2O column amount (100% saturation) 1630 1512 do ig=1,ngrid 1631 H2Omaxcol(ig)=0.0 1632 do l=1,nlayer 1633 H2Omaxcol(ig) = H2Omaxcol(ig) + qsat(ig,l) * & 1634 (pplev(ig,l) - pplev(ig,l+1))/g 1635 enddo 1513 H2Omaxcol(ig) = SUM( qsat(ig,:) * mass(ig,:)) 1636 1514 enddo 1637 1515 … … 1662 1540 1663 1541 ! add multiple years of evolution 1664 qsurf_hist(ig,igcm_h2o_ice) = & 1665 !qsurf_hist(ig,igcm_h2o_ice) + delta_ice*100.0 1666 qsurf_hist(ig,igcm_h2o_ice) + delta_ice*icetstep 1542 qsurf_hist(ig,igcm_h2o_ice) = qsurf_hist(ig,igcm_h2o_ice) + delta_ice*icetstep 1667 1543 1668 1544 ! if ice has gone -ve, set to zero 1669 1545 if(qsurf_hist(ig,igcm_h2o_ice).lt.0.0)then 1670 1546 qsurf_hist(ig,igcm_h2o_ice) = 0.0 1671 !qsurf_hist(ig,igcm_h2o_vap) = 0.01672 1547 endif 1673 1548 … … 1675 1550 if(ice_min(ig).lt.0.01)then 1676 1551 qsurf_hist(ig,igcm_h2o_ice) = 0.0 1677 !qsurf_hist(ig,igcm_h2o_vap) = 0.01678 1552 endif 1679 1553 … … 1681 1555 1682 1556 ! enforce ice conservation 1683 ice_tot=0.0 1684 do ig = 1, ngrid 1685 ice_tot = ice_tot + qsurf_hist(ig,igcm_h2o_ice)*area(ig) 1686 enddo 1687 do ig = 1, ngrid 1688 qsurf_hist(ig,igcm_h2o_ice) = qsurf_hist(ig,igcm_h2o_ice)*(icesrf/ice_tot) 1689 enddo 1557 ice_tot= SUM(qsurf_hist(:,igcm_h2o_ice)*area(:) ) 1558 qsurf_hist(:,igcm_h2o_ice) = qsurf_hist(:,igcm_h2o_ice)*(icesrf/ice_tot) 1690 1559 1691 1560 endif … … 1803 1672 call writediagfi(ngrid,"madjdE","heat from moistadj","W m-2",2,madjdE) 1804 1673 call writediagfi(ngridmx,"RH","relative humidity"," ",3,RH) 1674 call writediagfi(ngridmx,"qsatatm","atm qsat"," ",3,qsat) 1805 1675 call writediagfi(ngridmx,"h2o_max_col","maximum H2O column amount","kg.m^-2",2,H2Omaxcol) 1806 1676 endif … … 1818 1688 1819 1689 ! Output aerosols 1820 if (igcm_co2_ice.ne.0.and.iaero_co2.ne.0) & 1821 call writediagfi(ngridmx,'CO2ice_reff','CO2ice_reff','m',3, & 1822 reffrad(1,1,iaero_co2)) 1823 if (igcm_h2o_ice.ne.0.and.iaero_h2o.ne.0) & 1824 call writediagfi(ngridmx,'H2Oice_reff','H2Oice_reff','m',3, & 1825 reffrad(1,1,iaero_h2o)) 1826 if (igcm_co2_ice.ne.0.and.iaero_co2.ne.0) & 1827 call writediagfi(ngridmx,'CO2ice_reffcol','CO2ice_reffcol', & 1828 'um kg m^-2',2,reffcol(1,iaero_co2)) 1829 if (igcm_h2o_ice.ne.0.and.iaero_h2o.ne.0) & 1830 call writediagfi(ngridmx,'H2Oice_reffcol','H2Oice_reffcol', & 1831 'um kg m^-2',2,reffcol(1,iaero_h2o)) 1690 if (igcm_co2_ice.ne.0.and.iaero_co2.ne.0) & 1691 call writediagfi(ngridmx,'CO2ice_reff','CO2ice_reff','m',3,reffrad(1,1,iaero_co2)) 1692 if (igcm_h2o_ice.ne.0.and.iaero_h2o.ne.0) & 1693 call writediagfi(ngridmx,'H2Oice_reff','H2Oice_reff','m',3,reffrad(:,:,iaero_h2o)) 1694 if (igcm_co2_ice.ne.0.and.iaero_co2.ne.0) & 1695 call writediagfi(ngridmx,'CO2ice_reffcol','CO2ice_reffcol','um kg m^-2',2,reffcol(1,iaero_co2)) 1696 if (igcm_h2o_ice.ne.0.and.iaero_h2o.ne.0) & 1697 call writediagfi(ngridmx,'H2Oice_reffcol','H2Oice_reffcol','um kg m^-2',2,reffcol(1,iaero_h2o)) 1832 1698 1833 1699 ! Output tracers … … 1843 1709 1844 1710 if(watercond.or.CLFvarying)then 1845 !call writediagfi(ngrid,"rneb_man","H2O cloud fraction (conv)"," ",3,rneb_man)1846 !call writediagfi(ngrid,"rneb_lsc","H2O cloud fraction (large scale)"," ",3,rneb_lsc)1847 !call writediagfi(ngrid,"CLF","H2O cloud fraction"," ",3,cloudfrac)1711 call writediagfi(ngrid,"rneb_man","H2O cloud fraction (conv)"," ",3,rneb_man) 1712 call writediagfi(ngrid,"rneb_lsc","H2O cloud fraction (large scale)"," ",3,rneb_lsc) 1713 call writediagfi(ngrid,"CLF","H2O cloud fraction"," ",3,cloudfrac) 1848 1714 call writediagfi(ngrid,"CLFt","H2O column cloud fraction"," ",2,totcloudfrac) 1849 1715 endif … … 1877 1743 ! output spectrum 1878 1744 if(specOLR.and.corrk)then 1879 1880 1745 call writediagspecIR(ngrid,"OLR3D","OLR(lon,lat,band)","W/m^2/cm^-1",3,OLR_nu) 1746 call writediagspecVI(ngrid,"OSR3D","OSR(lon,lat,band)","W/m^2/cm^-1",3,OSR_nu) 1881 1747 endif 1882 1748 -
trunk/LMDZ.GENERIC/libf/phystd/radinc_h.F90
r726 r728 51 51 ! can in princple be anything: currently it's H2O. 52 52 ! 53 ! NAERKIND The number of radiatively active species54 ! (set in scatterers.h ; built when compiling with makegcm -s #)53 ! NAERKIND The number of radiatively active aerosol types 54 ! 55 55 ! NSIZEMAX The maximum number of aerosol particle sizes 56 56 ! … … 76 76 ! equivalent temperatures are 1/NTfac of these values 77 77 integer, parameter :: NTstar = 500 78 integer, parameter :: NTstop = 9000 ! new default for all non hot Jupiter runs78 integer, parameter :: NTstop = 15000 ! new default for all non hot Jupiter runs 79 79 real*8, parameter :: NTfac = 1.0D+1 80 80 !integer, parameter :: NTstar = 1000 -
trunk/LMDZ.GENERIC/libf/phystd/rain.F90
r650 r728 2 2 3 3 4 use watercommon_h, only: T_h2O_ice_liq,T_h2O_ice_clouds, RLVTT, RCPD, RCPV, RV, RVTMP2 5 4 ! to use 'getin' 5 use ioipsl_getincom 6 use watercommon_h, only: T_h2O_ice_liq,T_h2O_ice_clouds, RLVTT, RCPD, RCPV, RV, RVTMP2,Psat_water,Tsat_water,rhowater 7 use radii_mod, only: h2o_cloudrad 6 8 implicit none 7 9 … … 15 17 ! ------- 16 18 ! Adapted from the LMDTERRE code by R. Wordsworth (2009) 19 ! Added rain vaporization in case of T>Tsat 17 20 ! Original author Z. X. Li (1993) 18 21 ! … … 51 54 PARAMETER (seuil_neb=0.001) 52 55 53 REAL,PARAMETER :: cl=2.0e-4 ! Precipitation threshold 54 REAL,PARAMETER :: ct=1./1800. ! Precipitation rate 56 INTEGER,save :: precip_scheme ! id number for precipitaion scheme 57 ! for simple scheme (precip_scheme=1) 58 REAL,SAVE :: rainthreshold ! Precipitation threshold in simple scheme 59 ! for sundquist scheme (precip_scheme=2-3) 60 REAL,SAVE :: cloud_sat ! Precipitation threshold in non simple scheme 61 REAL,SAVE :: precip_timescale ! Precipitation timescale 62 ! for Boucher scheme (precip_scheme=4) 63 REAL,SAVE :: Cboucher ! Precipitation constant in Boucher 95 scheme 64 REAL,PARAMETER :: Kboucher=1.19E8 65 REAL,SAVE :: c1 55 66 56 67 INTEGER ninter 57 68 PARAMETER (ninter=5) 58 59 logical simple ! Use very simple Emanuel scheme?60 parameter(simple=.true.)61 69 62 70 logical evap_prec ! Does the rain evaporate? … … 68 76 real lconvert 69 77 70 ! for precipitation evaporation (old scheme)71 real eeff172 real eeff273 ! parameter (eeff1=0.95)74 ! parameter (eeff2=0.98)75 parameter (eeff1=0.5)76 parameter (eeff2=0.8)77 78 78 ! Local variables 79 79 INTEGER i, k, n 80 REAL zqs(ngridmx,nlayermx), zdelta, zcor80 REAL zqs(ngridmx,nlayermx),Tsat(ngridmx,nlayermx), zdelta, zcor 81 81 REAL zrfl(ngridmx), zrfln(ngridmx), zqev, zqevt 82 82 … … 85 85 REAL zchau(ngridmx),zfroi(ngridmx),zfrac(ngridmx),zneb(ngridmx) 86 86 87 real ttemp, ptemp 87 real reffh2oliq(ngridmx,nlayermx),reffh2oice(ngridmx,nlayermx) 88 89 real ttemp, ptemp, psat_tmp 88 90 real tnext(ngridmx,nlayermx) 89 91 … … 115 117 PRINT*, 'in rain.F, ninter=', ninter 116 118 PRINT*, 'in rain.F, evap_prec=', evap_prec 119 120 write(*,*) "Precipitation scheme to use?" 121 precip_scheme=1 ! default value 122 call getin("precip_scheme",precip_scheme) 123 write(*,*) " precip_scheme = ",precip_scheme 124 125 if (precip_scheme.eq.1) then 126 write(*,*) "rainthreshold in simple scheme?" 127 rainthreshold=0. ! default value 128 call getin("rainthreshold",rainthreshold) 129 write(*,*) " rainthreshold = ",rainthreshold 130 131 else if (precip_scheme.eq.2.or.precip_scheme.eq.3) then 132 write(*,*) "cloud water saturation level in non simple scheme?" 133 cloud_sat=2.6e-4 ! default value 134 call getin("cloud_sat",cloud_sat) 135 write(*,*) " cloud_sat = ",cloud_sat 136 write(*,*) "precipitation timescale in non simple scheme?" 137 precip_timescale=3600. ! default value 138 call getin("precip_timescale",precip_timescale) 139 write(*,*) " precip_timescale = ",precip_timescale 140 141 else if (precip_scheme.eq.4) then 142 write(*,*) "multiplicative constant in Boucher 95 precip scheme" 143 Cboucher=1. ! default value 144 call getin("Cboucher",Cboucher) 145 write(*,*) " Cboucher = ",Cboucher 146 c1=1.00*1.097/rhowater*Cboucher*Kboucher 147 148 endif 117 149 118 150 firstcall = .false. … … 158 190 ttemp = zt(i,k) 159 191 ptemp = pplay(i,k) 160 call watersat(ttemp,ptemp,zqs(i,k)) 192 ! call watersat(ttemp,ptemp,zqs(i,k)) 193 call Psat_water(ttemp,ptemp,psat_tmp,zqs(i,k)) 194 call Tsat_water(ptemp,Tsat(i,k)) 161 195 ENDDO 162 196 ENDDO … … 180 214 IF (zrfl(i) .GT.0.) THEN 181 215 182 zqev = MAX (0.0, (zqs(i,k)-q(i,k)))/ptimestep! BC modif here 183 zqevt = 2.0e-5*(1.0-q(i,k)/zqs(i,k)) & 184 *sqrt(zrfl(i))*l2c(i,k)/pplay(i,k)*zt(i,k)*R ! BC modif here 185 zqevt = MAX (zqevt, 0.0) 186 zqev = MIN (zqev, zqevt) 187 zqev = MAX (zqev, 0.0) 188 zrfln(i) = zrfl(i) - zqev 189 zrfln(i) = max(zrfln(i),0.0) 190 191 !zqev = MAX (0.0, (zqs(i,k)-q(i,k))*eeff1 ) 192 !zqevt = (zrfl(i)/l2c(i,k))*eeff2 193 !zqev = MIN (zqev, zqevt) 194 !zrfln(i) = zrfl(i) - zqev*l2c(i,k) 195 !zrfln(i) = zrfl(i) - 1.5e-5*(1.0-q(i,k)/zqs(i,k))*sqrt(zrfl(i)) 196 !zrfln(i) = min(zrfln(i),zrfl(i)) 197 ! this is what is actually written in the manual 198 199 d_q(i,k) = - (zrfln(i)-zrfl(i))/l2c(i,k)*ptimestep 200 !d_t(i,k) = d_q(i,k) * RLVTT/RCPD!/(1.0+RVTMP2*q(i,k)) ! double BC modif here 201 d_t(i,k) = - d_q(i,k) * RLVTT/RCPD ! was bugged! 202 203 zrfl(i) = zrfln(i) 216 if(zt(i,k).gt.Tsat(i,k))then 217 ! print*,'in rain',i,k,zrfl(i),zt(i,k),Tsat(i,k) 218 zqev=MIN((zt(i,k)-Tsat(i,k))*RCPD*l2c(i,k)/RLVTT,zrfl(i)) 219 zrfl(i)=MAX(zrfl(i)-zqev,0.) 220 d_q(i,k)=zqev/l2c(i,k) 221 d_t(i,k) = - d_q(i,k) * RLVTT/RCPD 222 ! print*,zqev,zrfl(i),d_q(i,k),d_t(i,k) 223 else 224 zqev = MAX (0.0, (zqs(i,k)-q(i,k)))/ptimestep! there is a bug here 225 zqevt= 2.0e-5*(1.0-q(i,k)/zqs(i,k)) & !default was 2.e-5 226 *sqrt(zrfl(i))*l2c(i,k)/pplay(i,k)*zt(i,k)*R ! BC modif here 227 zqevt = MAX (zqevt, 0.0) 228 zqev = MIN (zqev, zqevt) 229 zqev = MAX (zqev, 0.0) 230 zrfln(i)= zrfl(i) - zqev 231 zrfln(i)= max(zrfln(i),0.0) 232 233 d_q(i,k) = - (zrfln(i)-zrfl(i))/l2c(i,k)*ptimestep 234 !d_t(i,k) = d_q(i,k) * RLVTT/RCPD!/(1.0+RVTMP2*q(i,k)) ! double BC modif here 235 d_t(i,k) = - d_q(i,k) * RLVTT/RCPD ! was bugged! 236 zrfl(i) = zrfln(i) 237 end if 238 239 204 240 ENDIF 205 241 ENDDO … … 211 247 212 248 213 if( simple)then249 if(precip_scheme.eq.1)then 214 250 215 251 DO i = 1, ngridmx … … 234 270 ENDDO 235 271 236 else 237 272 elseif (precip_scheme.ge.2) then 273 238 274 DO i = 1, ngridmx 239 275 IF (rneb(i,k).GT.0.0) THEN … … 248 284 ENDDO 249 285 286 SELECT CASE(precip_scheme) 287 !precip scheme from Sundquist 78 288 CASE(2) 289 250 290 DO n = 1, ninter 251 291 DO i = 1, ngridmx 252 292 IF (rneb(i,k).GT.0.0) THEN 253 zchau(i) = (ct*ptimestep/FLOAT(ninter)) * zoliq(i) &254 * (1.0-EXP(-(zoliq(i)/zneb(i)/cl)**2)) * zfrac(i) 255 256 ! this is the ONLY place where zneb, ct and cl are used293 ! this is the ONLY place where zneb, precip_timescale and cloud_sat are used 294 295 zchau(i) = (ptimestep/(FLOAT(ninter)*precip_timescale)) * zoliq(i) & 296 * (1.0-EXP(-(zoliq(i)/zneb(i)/cloud_sat)**2)) * zfrac(i) 257 297 zrhol(i) = zrho(i) * zoliq(i) / zneb(i) 258 298 zfroi(i) = ptimestep/FLOAT(ninter)/zdz(i)*zoliq(i) & … … 268 308 ENDDO 269 309 ENDDO 310 311 !precip scheme modified from Sundquist 78 (in q**3) 312 CASE(3) 313 314 DO n = 1, ninter 315 DO i = 1, ngridmx 316 IF (rneb(i,k).GT.0.0) THEN 317 ! this is the ONLY place where zneb, precip_timescale and cloud_sat are used 318 319 zchau(i) = (ptimestep/(FLOAT(ninter)*precip_timescale*cloud_sat**2)) * (zoliq(i)/zneb(i))**3 320 zrhol(i) = zrho(i) * zoliq(i) / zneb(i) 321 zfroi(i) = ptimestep/FLOAT(ninter)/zdz(i)*zoliq(i) & 322 *fallv(zrhol(i)) * (1.0-zfrac(i)) ! zfroi behaves oddly... 323 ! * 0.1 * (1.0-zfrac(i)) 324 ztot(i) = zchau(i) + zfroi(i) 325 326 IF (zneb(i).EQ.seuil_neb) ztot(i) = 0.0 327 ztot(i) = MIN(MAX(ztot(i),0.0),zoliq(i)) 328 zoliq(i) = MAX(zoliq(i)-ztot(i), 0.0) 329 330 ENDIF 331 ENDDO 332 ENDDO 333 334 !precip scheme modified from Boucher 95 335 CASE(4) 336 337 !recalculate liquid water particle radii 338 call h2o_cloudrad(ql,reffh2oliq,reffh2oice) 339 340 DO n = 1, ninter 341 DO i = 1, ngridmx 342 IF (rneb(i,k).GT.0.0) THEN 343 ! this is the ONLY place where zneb and c1 are used 344 345 zchau(i) = ptimestep/FLOAT(ninter) *c1* zrho(i) & 346 *(zoliq(i)/zneb(i))**2*reffh2oliq(i,k)*zneb(i)* zfrac(i) 347 zrhol(i) = zrho(i) * zoliq(i) / zneb(i) 348 zfroi(i) = ptimestep/FLOAT(ninter)/zdz(i)*zoliq(i) & 349 *fallv(zrhol(i)) * (1.0-zfrac(i)) ! zfroi behaves oddly... 350 ! * 0.1 * (1.0-zfrac(i)) 351 ztot(i) = zchau(i) + zfroi(i) 352 353 IF (zneb(i).EQ.seuil_neb) ztot(i) = 0.0 354 ztot(i) = MIN(MAX(ztot(i),0.0),zoliq(i)) 355 zoliq(i) = MAX(zoliq(i)-ztot(i), 0.0) 356 357 ENDIF 358 ENDDO 359 ENDDO 360 361 END SELECT ! precip_scheme 270 362 271 363 ! Change in cloud density and surface H2O values … … 277 369 ENDDO 278 370 279 endif ! if simple 371 372 endif ! if precip_scheme=1 280 373 281 374 9999 continue -
trunk/LMDZ.GENERIC/libf/phystd/rcm1d.F
r726 r728 26 26 ! B. Charnay 27 27 ! A. Spiga 28 ! J. Leconte (2012) 28 29 ! 29 30 !================================================================== -
trunk/LMDZ.GENERIC/libf/phystd/su_watercycle.F90
r253 r728 1 1 subroutine su_watercycle 2 2 3 ! to use 'getin' 4 use ioipsl_getincom 3 5 use watercommon_h 4 6 implicit none 5 7 #include "comcstfi.h" 8 #include "callkeys.h" 6 9 7 10 … … 10 13 ! Purpose 11 14 ! ------- 12 ! Set up relevant constants and parameters for the water cycle 15 ! Set up relevant constants and parameters for the water cycle, and water cloud properties 13 16 ! 14 17 ! Authors 15 18 ! ------- 16 19 ! Robin Wordsworth (2010) 20 ! Jeremy Leconte (2012) 17 21 ! 18 22 !================================================================== -
trunk/LMDZ.GENERIC/libf/phystd/totalcloudfrac.F90
r253 r728 1 subroutine totalcloudfrac(rneb,totalrneb )1 subroutine totalcloudfrac(rneb,totalrneb,pplev,pq,tau) 2 2 3 use watercommon_h 3 4 implicit none 4 5 … … 22 23 #include "comgeomfi.h" 23 24 #include "comdiurn.h" 25 #include "callkeys.h" 26 24 27 25 28 real rneb(ngridmx,nlayermx) ! cloud fraction 29 real pplev(ngridmx,nlayermx+1) 30 real pq(ngridmx,nlayermx,nqmx) 31 real tau(ngridmx,nlayermx) 32 26 33 real totalrneb(ngridmx) ! total cloud fraction 27 28 integer recovery 29 parameter(recovery=1) 34 real, dimension(nlayermx+1) :: masse 35 integer, parameter :: recovery=7 36 integer ltau_max 37 real massetot 30 38 31 39 ! hypothesis behind recovery. value: … … 33 41 ! 2 = maximal recovery 34 42 ! 3 = minimal recovery 35 36 43 ! 4 = fixed recovery 44 ! 5 = recovery on the thicker layer 37 45 ! Local variables 38 46 integer ig, l 39 real clear 47 real clear,tau_min 48 real, parameter :: tau_c=0.1 !threshold of optical depth for the calculation of total cloud fraction 49 real rneb2(nlayermx) 50 40 51 41 52 do ig=1,ngridmx … … 51 62 elseif (recovery.eq.2) then 52 63 totalrneb(ig) = rneb(ig,1) 53 do l=2, nlayermx64 do l=2,14 !nlayermx 54 65 totalrneb(ig) = max(rneb(ig,l),totalrneb(ig)) 55 66 enddo … … 60 71 totalrneb(ig) = min(rneb(ig,l),totalrneb(ig)) 61 72 enddo 62 endif ! (recovery=)63 73 74 elseif (recovery.eq.4) then 75 totalrneb(ig) = CLFfixval 76 77 elseif (recovery.eq.5) then 78 totalrneb(ig) = rneb(ig,1) 79 do l=1,nlayermx 80 masse(l)=pq(ig,l,igcm_h2o_ice)*(pplev(ig,l)-pplev(ig,l+1)) 81 enddo 82 ltau_max=maxloc(masse,dim=1) 83 totalrneb(ig) = rneb(ig,ltau_max) 84 85 elseif (recovery.eq.6) then 86 totalrneb(ig) = 0. 87 do l=1,nlayermx 88 masse(l)=pq(ig,l,igcm_h2o_ice)*(pplev(ig,l)-pplev(ig,l+1)) 89 masse(l)=max(masse(l),0.) 90 enddo 91 massetot=sum(masse,dim=1) 92 do l=1,nlayermx 93 totalrneb(ig) = totalrneb(ig)+rneb(ig,l)*masse(l)/massetot 94 enddo 95 96 elseif (recovery.eq.7) then 97 98 rneb2(:)=rneb(ig,1:nlayermx) 99 tau_min=MIN(tau_c,MAXVAL(tau(ig,1:nlayermx))/2.) 100 do l=1,nlayermx 101 if(tau(ig,l)<tau_min) rneb2(l)=0. 102 enddo 103 totalrneb(ig)=maxval(rneb2(1:nlayermx)) 104 105 endif ! (recovery=) 106 64 107 totalrneb(ig) = min(1.,totalrneb(ig)) 65 108 totalrneb(ig) = max(0.,totalrneb(ig)) -
trunk/LMDZ.GENERIC/libf/phystd/turbdiff.F90
r726 r728 5 5 pdufi,pdvfi,pdtfi,pdqfi,pfluxsrf, & 6 6 Pdudif,pdvdif,pdtdif,pdtsrf,sensibFlux,pq2, & 7 pdqdif,pdq sdif,lastcall)8 9 use watercommon_h, only : RLVTT, T_h2O_ice_liq, RCPD, mx_eau_sol 7 pdqdif,pdqevap,pdqsdif,lastcall) 8 9 use watercommon_h, only : RLVTT, T_h2O_ice_liq, RCPD, mx_eau_sol,Psat_water 10 10 use radcommon_h, only : sigma 11 11 … … 112 112 INTEGER iq 113 113 REAL zq(ngridmx,nlayermx,nqmx) 114 REAL zqnoevap(ngridmx,nlayermx) !special for water case to compute where evaporated water goes. 115 REAL pdqevap(ngridmx,nlayermx) !special for water case to compute where evaporated water goes. 116 REAL zdmassevap(ngridmx) 114 117 REAL rho(ngridmx) ! near-surface air density 115 REAL qsat(ngridmx) 118 REAL qsat(ngridmx),psat(ngridmx) 116 119 DATA firstcall/.true./ 117 120 REAL kmixmin … … 119 122 ! Variables added for implicit latent heat inclusion 120 123 ! -------------------------------------------------- 121 real dqsat(ngridmx), qsat_temp1, qsat_temp2 122 123 integer ivap, iliq, iliq_surf,iice_surf ! also make liq for clarity on surface... 124 save ivap, iliq, iliq_surf,iice_surf 124 real dqsat(ngridmx), qsat_temp1, qsat_temp2,psat_temp 125 126 integer, save :: ivap, iliq, iliq_surf,iice_surf ! also make liq for clarity on surface... 125 127 126 128 real, parameter :: karman=0.4 … … 203 205 ENDDO 204 206 ENDDO 207 if (water) then 208 DO ilev=1,nlay 209 DO ig=1,ngrid 210 zqnoevap(ig,ilev)=pq(ig,ilev,ivap) + pdqfi(ig,ilev,ivap)*ptimestep 211 ENDDO 212 ENDDO 213 Endif 205 214 end if 206 215 … … 246 255 end if 247 256 248 !JL12 change zkv at the surface by zcdv to calculate the surface momentum properly257 !JL12 change zkv at the surface by zcdv to calculate the surface momentum flux properly 249 258 DO ig=1,ngrid 250 259 zkv(ig,1)=zcdv(ig) … … 253 262 254 263 !JL12 calculate the flux coefficients (tables multiplied elements by elements) 255 zfluxv =zkv(:,1:nlay)*zb0264 zfluxv(1:ngridmx,1:nlayermx)=zkv(1:ngridmx,1:nlayermx)*zb0(1:ngridmx,1:nlayermx) 256 265 257 266 !----------------------------------------------------------------------- … … 344 353 zcdv(ig) = zcdv_true(ig)*sqrt(zu2) 345 354 zcdh(ig) = zcdh_true(ig)*sqrt(zu2) 346 zkh(ig,1)= zcdh(ig)355 zkh(ig,1)= zcdh(ig) 347 356 ENDDO 348 357 349 358 ! JL12 calculate the flux coefficients (tables multiplied elements by elements) 350 359 ! --------------------------------------------------------------- 351 zfluxq =zkh(:,1:nlay)*zb0!JL12 we save zfluxq which doesn't need the Exner factor352 zfluxt =zfluxq*zExner360 zfluxq(1:ngridmx,1:nlayermx)=zkh(1:ngridmx,1:nlayermx)*zb0(1:ngridmx,1:nlayermx) !JL12 we save zfluxq which doesn't need the Exner factor 361 zfluxt(1:ngridmx,1:nlayermx)=zfluxq(1:ngridmx,1:nlayermx)*zExner(1:ngridmx,1:nlayermx) 353 362 354 363 … … 502 511 503 512 ! Calculate the value of qsat at the surface (water) 504 call watersat(ptsrf(ig),pplev(ig,1),qsat(ig))505 call watersat(ptsrf(ig)-0.0001,pplev(ig,1),qsat_temp1)506 call watersat(ptsrf(ig)+0.0001,pplev(ig,1),qsat_temp2)513 call Psat_water(ptsrf(ig),pplev(ig,1),psat(ig),qsat(ig)) 514 call Psat_water(ptsrf(ig)-0.0001,pplev(ig,1),psat_temp,qsat_temp1) 515 call Psat_water(ptsrf(ig)+0.0001,pplev(ig,1),psat_temp,qsat_temp2) 507 516 dqsat(ig)=(qsat_temp2-qsat_temp1)/0.0002 508 517 ! calculate dQsat / dT by finite differences 509 518 ! we cannot use the updated temperature value yet... 510 519 ! if(qsat2(ig).gt.1.) then 520 ! qsat(ig)=1. 521 ! dqsat(ig)=0. 522 ! else 523 ! qsat(ig)=qsat2(ig) 524 ! endif 511 525 enddo 526 527 call writediagfi(ngrid,'qsatused','saturation mixing ratio at surface','',2,qsat) 528 call writediagfi(ngrid,'psat','saturation pressure at surface','',2,psat) 512 529 513 530 ! coefficients for q … … 632 649 endif ! if (water et iq=ivap) 633 650 end do ! of do iq=1,nq 634 endif ! traceur 651 652 if (water) then ! special case where we recompute water mixing without any evaporation. 653 ! The difference with the first calculation then tells us where evaporated water has gone 654 655 DO ig=1,ngrid 656 z1(ig)=1./(zmass(ig,nlay)+zfluxq(ig,nlay)) 657 zcq(ig,nlay)=zmass(ig,nlay)*zqnoevap(ig,nlay)*z1(ig) 658 zdq(ig,nlay)=zfluxq(ig,nlay)*z1(ig) 659 ENDDO 660 661 DO ilay=nlay-1,2,-1 662 DO ig=1,ngrid 663 z1(ig)=1./(zmass(ig,ilay)+zfluxq(ig,ilay)+zfluxq(ig,ilay+1)*(1.-zdq(ig,ilay+1))) 664 zcq(ig,ilay)=(zmass(ig,ilay)*zqnoevap(ig,ilay)+zfluxq(ig,ilay+1)*zcq(ig,ilay+1))*z1(ig) 665 zdq(ig,ilay)=zfluxq(ig,ilay)*z1(ig) 666 ENDDO 667 ENDDO 668 669 DO ig=1,ngrid 670 z1(ig)=1./(zmass(ig,1)+zfluxq(ig,2)*(1.-zdq(ig,2))) 671 zcq(ig,1)=(zmass(ig,1)*zqnoevap(ig,1)+zfluxq(ig,2)*zcq(ig,2))*z1(ig) 672 enddo 673 674 ! Starting upward calculations for simple tracer mixing (e.g., dust) 675 do ig=1,ngrid 676 zqnoevap(ig,1)=zcq(ig,1) 677 end do 678 679 do ilay=2,nlay 680 do ig=1,ngrid 681 zqnoevap(ig,ilay)=zcq(ig,ilay)+zdq(ig,ilay)*zqnoevap(ig,ilay-1) 682 end do 683 end do 684 685 endif ! if water 686 687 688 endif ! tracer 635 689 636 690 … … 659 713 enddo 660 714 enddo 715 if (water) then 716 do ilev = 1, nlay 717 do ig=1,ngrid 718 pdqevap(ig,ilev)=(zq(ig,ilev,ivap)-zqnoevap(ig,ilev))/ptimestep 719 enddo 720 enddo 721 do ig=1,ngrid 722 zdmassevap(ig)=SUM(pdqevap(ig,:)*zmass(ig,:))*ptimestep 723 end do 724 endif 661 725 endif 662 726 663 727 if(water)then 664 call writediagfi(ngrid,'beta','Dryness coefficient',' ',2,dryness) 728 call writediagfi(ngrid,'beta','Dryness coefficient',' ',2,dryness) 729 if (tracer) then 730 call writediagfi(ngrid,'dqevap','evaporated water vapor specific concentration','s-1',3,pdqevap) 731 call writediagfi(ngrid,'h2oevap','evaporated water vapor mass','kg/m2',2,zdmassevap) 732 endif 665 733 endif 666 734 -
trunk/LMDZ.GENERIC/libf/phystd/watercommon_h.F90
r650 r728 1 1 module watercommon_h 2 2 3 3 implicit none … … 11 11 real, parameter :: RLVTT = 2.257E+6 ! Latent heat of vaporization (J kg-1) 12 12 real, parameter :: RLSTT = 2.257E+6 ! 2.591E+6 in reality ! Latent heat of sublimation (J kg-1) 13 !real, parameter :: RLVTT = 0.014 !real, parameter :: RLSTT = 0.015 13 16 14 real, parameter :: RLFTT = 3.334E+5 ! Latent heat of fusion (J kg-1) ! entails an energy sink but better description of albedo 17 !real, parameter :: RLFTT = 0.018 15 real, parameter :: rhowater = 1.0E+3 ! mass of water (kg/m^3) 16 real, parameter :: rhowaterice = 9.2E+2 ! mass of water (kg/m^3) 19 17 real, parameter :: capcal_h2o_liq = 4181.3 ! specific heat capacity of liquid water J/kg/K 20 18 real, parameter :: mx_eau_sol = 150 ! mass of water (kg/m^2) 21 19 22 ! This was the old Martian latent heat version: 23 ! lw=(2834.3-0.28*(zt(ig,l)-To)-0.004*(zt(ig,l)-To)**2)*1.e+3 20 real, save :: epsi, RCPD, RCPV, RV, RVTMP2 21 22 contains 24 23 25 real, save :: epsi, RCPD, RCPV, RV, RVTMP2 24 25 !================================================================== 26 subroutine Psat_water(T,p,psat,qsat) 26 27 27 end module watercommon_h 28 implicit none 29 30 !================================================================== 31 ! Purpose 32 ! ------- 33 ! Compute the saturation vapor pressure and mass mixing ratio at saturation (kg/kg) 34 ! for a given pressure (Pa) and temperature (K) 35 ! Based on the Tetens formula from L.Li physical parametrization manual 36 ! 37 ! Authors 38 ! ------- 39 ! Jeremy Leconte (2012) 40 ! 41 !================================================================== 42 43 ! input 44 real, intent(in) :: T, p 45 46 ! output 47 real psat,qsat 48 49 ! JL12 variables for tetens formula 50 real,parameter :: Pref_solid_liquid=611.14 51 real,parameter :: Trefvaporization=35.86 52 real,parameter :: Trefsublimation=7.66 53 real,parameter :: r3vaporization=17.269 54 real,parameter :: r3sublimation=21.875 55 56 ! checked vs. old watersat data 14/05/2012 by JL. 57 58 if (T.lt.T_h2O_ice_liq) then ! solid / vapour 59 psat = Pref_solid_liquid*Exp(r3sublimation*(T-T_h2O_ice_liq)/(T-Trefsublimation)) 60 else ! liquid / vapour 61 psat = Pref_solid_liquid*Exp(r3vaporization*(T-T_h2O_ice_liq)/(T-Trefvaporization)) 62 endif 63 if(psat.gt.p) then 64 qsat=1. 65 else 66 qsat=epsi*psat/(p-(1.-epsi)*psat) 67 endif 68 return 69 end subroutine Psat_water 70 71 72 73 74 !================================================================== 75 subroutine Lcpdqsat_water(T,p,psat,qsat,dqsat) 76 77 implicit none 78 79 !================================================================== 80 ! Purpose 81 ! ------- 82 ! Compute L/cp*d (q_sat)/d T 83 ! for a given temperature (K)! 84 ! Based on the Tetens formula from L.Li physical parametrization manual 85 ! 86 ! Authors 87 ! ------- 88 ! Jeremy Leconte (2012) 89 ! 90 !================================================================== 91 92 ! input 93 real T, p, psat, qsat 94 95 ! output 96 real dqsat 97 98 ! JL12 variables for tetens formula 99 real,parameter :: Pref_solid_liquid=611.14 100 real,parameter :: Trefvaporization=35.86 101 real,parameter :: Trefsublimation=7.66 102 real,parameter :: r3vaporization=17.269 103 real,parameter :: r3sublimation=21.875 104 105 real :: dummy 106 107 if (psat.gt.p) then 108 dqsat=0. 109 return 110 endif 111 112 if (T.lt.T_h2O_ice_liq) then ! solid / vapour 113 dummy = r3sublimation*(T_h2O_ice_liq-Trefsublimation)/(T-Trefsublimation)**2 114 else ! liquid / vapour 115 dummy = r3vaporization*(T_h2O_ice_liq-Trefvaporization)/(T-Trefvaporization)**2 116 endif 117 118 dqsat=RLVTT/RCPD*qsat**2*(p/(epsi*psat))*dummy 119 return 120 end subroutine Lcpdqsat_water 121 122 123 124 125 !================================================================== 126 subroutine Tsat_water(p,Tsat) 127 128 implicit none 129 130 !================================================================== 131 ! Purpose 132 ! ------- 133 ! Compute the saturation temperature 134 ! for a given pressure (Pa) 135 ! Based on the Tetens formula from L.Li physical parametrization manual 136 ! 137 ! Authors 138 ! ------- 139 ! Jeremy Leconte (2012) 140 ! 141 !================================================================== 142 143 ! input 144 real p 145 146 ! output 147 real Tsat 148 149 ! JL12 variables for tetens formula 150 real,parameter :: Pref_solid_liquid=611.14 151 real,parameter :: Trefvaporization=35.86 152 real,parameter :: Trefsublimation=7.66 153 real,parameter :: r3vaporization=17.269 154 real,parameter :: r3sublimation=21.875 155 156 if (p.lt.Pref_solid_liquid) then ! solid / vapour 157 Tsat =(T_h2O_ice_liq*r3sublimation- Trefsublimation*Log(p/Pref_solid_liquid))/(r3sublimation-Log(p/Pref_solid_liquid)) 158 else ! liquid / vapour 159 Tsat =(T_h2O_ice_liq*r3vaporization- Trefvaporization*Log(p/Pref_solid_liquid))/(r3vaporization-Log(p/Pref_solid_liquid)) 160 endif 161 162 return 163 end subroutine Tsat_water 164 165 166 end module watercommon_h -
trunk/LMDZ.GENERIC/libf/phystd/watersat.F90
r650 r728 29 29 30 30 if (T.lt.T_h2O_ice_liq) then ! solid / vapour 31 qsat = 100.0 * epsi *10**(2.07023 - 0.00320991 &31 qsat = 100.0 * 10**(2.07023 - 0.00320991 & 32 32 * T - 2484.896 / T + 3.56654 * alog10(T)) 33 33 else ! liquid / vapour 34 qsat = 100.0 * epsi *10**(23.8319 - 2948.964 / T - 5.028 &34 qsat = 100.0 * 10**(23.8319 - 2948.964 / T - 5.028 & 35 35 * alog10(T) - 29810.16 * exp( -0.0699382 * T) & 36 36 + 25.21935 * exp(-2999.924/T)) 37 37 endif 38 qsat=qsat/p 39 38 ! qsat=epsi*qsat/p 39 if(qsat.gt.p) then 40 qsat=1. 41 else 42 qsat=epsi*qsat/(p-(1.-epsi)*qsat) 43 endif 40 44 return 41 45 end subroutine watersat
Note: See TracChangeset
for help on using the changeset viewer.