Changeset 2840
- Timestamp:
- Mar 30, 2017, 6:28:00 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/phylmd/readaerosol_interp.F90
r2523 r2840 162 162 NULLIFY(pt_ap) 163 163 NULLIFY(pt_b) 164 END 164 ENDIF 165 165 166 166 !**************************************************************************************** … … 187 187 filename='aerosols' 188 188 type='annuel' 189 END 189 ENDIF 190 190 ELSE IF (aer_type == 'mix2') THEN 191 191 ! Special case using a mix of decenal sulfate file and natrual aerosols … … 196 196 filename='aerosols' 197 197 type='preind' 198 END 198 ENDIF 199 199 ELSE IF (aer_type == 'mix3') THEN 200 200 ! Special case using a mix of annual sulfate file and natrual aerosols … … 205 205 filename='aerosols' 206 206 type='preind' 207 END 207 ENDIF 208 208 ELSE 209 209 CALL abort_physic('readaerosol_interp', 'this aer_type not supported',1) 210 END 210 ENDIF 211 211 212 212 CALL readaerosol(name_aero(id_aero), type, filename, iyr, klev_src, pt_ap, pt_b, pt_tmp, & … … 215 215 ALLOCATE(var_year(klon, klev_src, 12, naero_spc), stat=ierr) 216 216 IF (ierr /= 0) CALL abort_physic('readaerosol_interp', 'pb in allocation 5',1) 217 END 217 ENDIF 218 218 var_year(:,:,:,id_aero) = pt_tmp(:,:,:) 219 219 … … 229 229 WRITE(lunout,*) 'Aerosol : ', name_aero(id_aero) 230 230 CALL abort_physic('readaerosol_interp','Differnt vertical axes in aerosol forcing files',1) 231 END 231 ENDIF 232 232 233 233 IF (.NOT. ALLOCATED(pi_var_year)) THEN 234 234 ALLOCATE(pi_var_year(klon, klev_src, 12, naero_spc), stat=ierr) 235 235 IF (ierr /= 0) CALL abort_physic('readaerosol_interp', 'pb in allocation 6',1) 236 END 236 ENDIF 237 237 pi_var_year(:,:,:,id_aero) = pt_tmp(:,:,:) 238 238 … … 244 244 CALL writefield_phy('load_year_src',load_year(:,:,id_aero),1) 245 245 CALL writefield_phy('pi_load_year_src',pi_load_year(:,:,id_aero),1) 246 END 246 ENDIF 247 247 248 248 ! Pointer no more useful, deallocate. … … 258 258 WRITE(lunout,*) 'Warning! All forcing files for the same aerosol must have the same structure' 259 259 CALL abort_physic('readaerosol_interp', 'The aerosol files have not the same format',1) 260 END 260 ENDIF 261 261 262 262 IF (klev /= klev_src) THEN 263 263 WRITE(lunout,*) 'Old format of aerosol file do not allowed vertical interpolation' 264 264 CALL abort_physic('readaerosol_interp', 'Old aerosol file not possible',1) 265 END 265 ENDIF 266 266 267 267 ELSE 268 268 vert_interp = .TRUE. 269 END 269 ENDIF 270 270 271 271 ! Calendar initialisation … … 286 286 endif 287 287 288 END 288 ENDIF ! IF ( (first .OR. iday==0) .AND. lnewday ) THEN 289 289 290 290 !**************************************************************************************** … … 309 309 ! the month is january, thus the month before december 310 310 im2=12 311 END 311 ENDIF 312 312 ELSE 313 313 ! the second half of the month … … 319 319 im2=1 320 320 ENDIF 321 END 321 ENDIF 322 322 ELSE IF (nbr_tsteps == 14) then 323 323 im = im + 1 … … 332 332 day1 = month_mid(im) 333 333 day2 = month_mid(im2) 334 END 334 ENDIF 335 335 ELSE 336 336 CALL abort_physic('readaerosol_interp', 'number of months undefined',1) … … 358 358 pi_var_year(i,k,im2,id_aero) - (jDay-day2)/(day1-day2) * & 359 359 (pi_var_year(i,k,im2,id_aero) - pi_var_year(i,k,im,id_aero)) 360 END 361 END 360 ENDDO 361 ENDDO 362 362 363 363 ! Time interpolation for pressure at surface, still on vertical source grid … … 370 370 pi_psurf_year(i,im2,id_aero) - (jDay-day2)/(day1-day2) * & 371 371 (pi_psurf_year(i,im2,id_aero) - pi_psurf_year(i,im,id_aero)) 372 END 372 ENDDO 373 373 374 374 ! Time interpolation for the load, still on vertical source grid … … 381 381 pi_load_year(i,im2,id_aero) - (jDay-day2)/(day1-day2) * & 382 382 (pi_load_year(i,im2,id_aero) - pi_load_year(i,im,id_aero)) 383 END 383 ENDDO 384 384 385 385 !**************************************************************************************** … … 397 397 DO i = 1, klon 398 398 pplay_src(i,k)= pt_ap(k) + pt_b(k)*psurf_day(i) 399 END 400 END 399 ENDDO 400 ENDDO 401 401 402 402 IF (debug) THEN … … 406 406 CALL writefield_phy('day_src',tmp1,klev_src) 407 407 CALL writefield_phy('pi_day_src',tmp2,klev_src) 408 END 408 ENDIF 409 409 410 410 ! b) vertical interpolation on pressure leveles … … 422 422 DO i = 1, klon 423 423 delp(i,k) = paprs(i,k) - paprs (i,k+1) 424 END 425 END 424 ENDDO 425 ENDDO 426 426 427 427 ! Find the mass load in the actual pillar, on target grid … … 431 431 zrho = pplay(i,k)/t_seri(i,k)/RD ! [kg/m3] 432 432 volm = var_day(i,k,id_aero)*1.E-9/zrho ! [kg/kg] 433 load_tgt(i) = load_tgt(i) + 1/RG * volm *delp(i,k)434 END 435 END 433 load_tgt(i) = load_tgt(i) + volm *delp(i,k)/RG 434 ENDDO 435 ENDDO 436 436 437 437 ! Adjust, uniform 438 438 DO k = 1, klev 439 439 DO i = 1, klon 440 var_day(i,k,id_aero) = var_day(i,k,id_aero)*load_src(i)/ load_tgt(i)441 END 442 END 440 var_day(i,k,id_aero) = var_day(i,k,id_aero)*load_src(i)/max(1.e-30,load_tgt(i)) 441 ENDDO 442 ENDDO 443 443 444 444 IF (debug) THEN … … 448 448 zrho = pplay(i,k)/t_seri(i,k)/RD ! [kg/m3] 449 449 volm = var_day(i,k,id_aero)*1.E-9/zrho ! [kg/kg] 450 load_tgt_test(i) = load_tgt_test(i) + 1/RG * volm*delp(i,k)451 END 452 END 450 load_tgt_test(i) = load_tgt_test(i) + volm*delp(i,k)/RG 451 ENDDO 452 ENDDO 453 453 454 454 CALL writefield_phy('day_tgt2',var_day(:,:,id_aero),klev) … … 456 456 CALL writefield_phy('load_tgt_test',load_tgt_test(:),1) 457 457 CALL writefield_phy('load_src',load_src(:),1) 458 END 458 ENDIF 459 459 460 460 ! - Interpolate variable tmp2 (source grid) to pi_var_day (target grid) … … 464 464 DO i = 1, klon 465 465 pplay_src(i,k)= pt_ap(k) + pt_b(k)*pi_psurf_day(i) 466 END 467 END 466 ENDDO 467 ENDDO 468 468 469 469 IF (debug) THEN 470 470 CALL writefield_phy('pi_psurf_day_src',pi_psurf_day(:),1) 471 471 CALL writefield_phy('pi_pplay_src',pplay_src(:,:),klev_src) 472 END 472 ENDIF 473 473 474 474 ! b) vertical interpolation on pressure leveles … … 488 488 zrho = pplay(i,k)/t_seri(i,k)/RD ! [kg/m3] 489 489 volm = pi_var_day(i,k,id_aero)*1.E-9/zrho ! [kg/kg] 490 load_tgt(i) = load_tgt(i) + 1/RG * volm * delp(i,k)491 END 492 END 490 load_tgt(i) = load_tgt(i) + volm*delp(i,k)/RG 491 ENDDO 492 ENDDO 493 493 494 494 DO k = 1, klev 495 495 DO i = 1, klon 496 pi_var_day(i,k,id_aero) = pi_var_day(i,k,id_aero)*pi_load_src(i)/ load_tgt(i)497 END 498 END 496 pi_var_day(i,k,id_aero) = pi_var_day(i,k,id_aero)*pi_load_src(i)/max(1.e-30,load_tgt(i)) 497 ENDDO 498 ENDDO 499 499 500 500 IF (debug) THEN … … 504 504 zrho = pplay(i,k)/t_seri(i,k)/RD ! [kg/m3] 505 505 volm = pi_var_day(i,k,id_aero)*1.E-9/zrho ! [kg/kg] 506 load_tgt_test(i) = load_tgt_test(i) + 1/RG * volm * delp(i,k)507 END 508 END 506 load_tgt_test(i) = load_tgt_test(i) + volm*delp(i,k)/RG 507 ENDDO 508 ENDDO 509 509 CALL writefield_phy('pi_day_tgt2',pi_var_day(:,:,id_aero),klev) 510 510 CALL writefield_phy('pi_load_tgt',load_tgt(:),1) 511 511 CALL writefield_phy('pi_load_tgt_test',load_tgt_test(:),1) 512 512 CALL writefield_phy('pi_load_src',pi_load_src(:),1) 513 END 513 ENDIF 514 514 515 515 … … 519 519 pi_var_day(:,:,id_aero) = tmp2(:,:) 520 520 521 END 521 ENDIF ! vert_interp 522 522 523 523 … … 539 539 trim(name_aero(id_aero)),'(i,k,im)=', & 540 540 var_year(i,k,im2,id_aero) - var_year(i,k,im,id_aero) 541 END 541 ENDIF 542 542 WRITE(lunout,*) 'stop for aerosol : ',name_aero(id_aero) 543 543 WRITE(lunout,*) 'day1, day2, jDay = ', day1, day2, jDay 544 544 CALL abort_physic('readaerosol_interp','Error in interpolation 1',1) 545 END 546 END 547 END 548 END 545 ENDIF 546 ENDDO 547 ENDDO 548 ENDIF 549 549 550 550 IF (MINVAL(pi_var_day(:,:,id_aero)) < 0. ) THEN … … 558 558 trim(name_aero(id_aero)),'(i,k,im)=', & 559 559 pi_var_year(i,k,im2,id_aero) - pi_var_year(i,k,im,id_aero) 560 END 560 ENDIF 561 561 562 562 WRITE(lunout,*) 'stop for aerosol : ',name_aero(id_aero) 563 563 CALL abort_physic('readaerosol_interp','Error in interpolation 2',1) 564 END 565 END 566 END 567 END 568 569 END 564 ENDIF 565 ENDDO 566 ENDDO 567 ENDIF 568 569 ENDIF ! lnewday 570 570 571 571 !****************************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.