Changeset 3004 for palm/trunk/SOURCE/turbulence_closure_mod.f90
- Timestamp:
- Apr 27, 2018 12:33:25 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/turbulence_closure_mod.f90
r2938 r3004 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Further allocation checks implemented 28 ! 29 ! 2938 2018-03-27 15:52:42Z suehring 27 30 ! Further todo's 28 31 ! … … 510 513 511 514 CASE ( 'diss' ) 512 DO i = nxlg, nxrg 513 DO j = nysg, nyng 514 DO k = nzb, nzt+1 515 diss_av(k,j,i) = diss_av(k,j,i) + diss(k,j,i) 515 IF ( ALLOCATED( diss_av ) ) THEN 516 DO i = nxlg, nxrg 517 DO j = nysg, nyng 518 DO k = nzb, nzt+1 519 diss_av(k,j,i) = diss_av(k,j,i) + diss(k,j,i) 520 ENDDO 516 521 ENDDO 517 522 ENDDO 518 END DO523 ENDIF 519 524 520 525 CASE ( 'kh' ) 521 DO i = nxlg, nxrg 522 DO j = nysg, nyng 523 DO k = nzb, nzt+1 524 kh_av(k,j,i) = kh_av(k,j,i) + kh(k,j,i) 526 IF ( ALLOCATED( kh_av ) ) THEN 527 DO i = nxlg, nxrg 528 DO j = nysg, nyng 529 DO k = nzb, nzt+1 530 kh_av(k,j,i) = kh_av(k,j,i) + kh(k,j,i) 531 ENDDO 525 532 ENDDO 526 533 ENDDO 527 END DO534 ENDIF 528 535 529 536 CASE ( 'km' ) 530 DO i = nxlg, nxrg 531 DO j = nysg, nyng 532 DO k = nzb, nzt+1 533 km_av(k,j,i) = km_av(k,j,i) + km(k,j,i) 537 IF ( ALLOCATED( km_av ) ) THEN 538 DO i = nxlg, nxrg 539 DO j = nysg, nyng 540 DO k = nzb, nzt+1 541 km_av(k,j,i) = km_av(k,j,i) + km(k,j,i) 542 ENDDO 534 543 ENDDO 535 544 ENDDO 536 END DO545 ENDIF 537 546 538 547 CASE DEFAULT … … 546 555 547 556 CASE ( 'diss' ) 548 DO i = nxlg, nxrg 549 DO j = nysg, nyng 550 DO k = nzb, nzt+1 551 diss_av(k,j,i) = diss_av(k,j,i) & 552 / REAL( average_count_3d, KIND=wp ) 557 IF ( ALLOCATED( diss_av ) ) THEN 558 DO i = nxlg, nxrg 559 DO j = nysg, nyng 560 DO k = nzb, nzt+1 561 diss_av(k,j,i) = diss_av(k,j,i) & 562 / REAL( average_count_3d, KIND=wp ) 563 ENDDO 553 564 ENDDO 554 565 ENDDO 555 END DO566 ENDIF 556 567 557 568 CASE ( 'kh' ) 558 DO i = nxlg, nxrg 559 DO j = nysg, nyng 560 DO k = nzb, nzt+1 561 kh_av(k,j,i) = kh_av(k,j,i) & 562 / REAL( average_count_3d, KIND=wp ) 569 IF ( ALLOCATED( kh_av ) ) THEN 570 DO i = nxlg, nxrg 571 DO j = nysg, nyng 572 DO k = nzb, nzt+1 573 kh_av(k,j,i) = kh_av(k,j,i) & 574 / REAL( average_count_3d, KIND=wp ) 575 ENDDO 563 576 ENDDO 564 577 ENDDO 565 END DO578 ENDIF 566 579 567 580 CASE ( 'km' ) 568 DO i = nxlg, nxrg 569 DO j = nysg, nyng 570 DO k = nzb, nzt+1 571 km_av(k,j,i) = km_av(k,j,i) & 572 / REAL( average_count_3d, KIND=wp ) 581 IF ( ALLOCATED( km_av ) ) THEN 582 DO i = nxlg, nxrg 583 DO j = nysg, nyng 584 DO k = nzb, nzt+1 585 km_av(k,j,i) = km_av(k,j,i) & 586 / REAL( average_count_3d, KIND=wp ) 587 ENDDO 573 588 ENDDO 574 589 ENDDO 575 END DO590 ENDIF 576 591 577 592 END SELECT … … 608 623 LOGICAL :: found !< 609 624 LOGICAL :: two_d !< flag parameter that indicates 2D variables (horizontal cross sections) 625 626 REAL(wp) :: fill_value = -999.0_wp !< value for the _FillValue attribute 610 627 611 628 REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb:nzt+1) :: local_pf !< local … … 627 644 ENDDO 628 645 ELSE 646 IF ( .NOT. ALLOCATED( diss_av ) ) THEN 647 ALLOCATE( diss_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 648 diss_av = REAL( fill_value, KIND = wp ) 649 ENDIF 629 650 DO i = nxl, nxr 630 651 DO j = nys, nyn … … 648 669 ENDDO 649 670 ELSE 671 IF ( .NOT. ALLOCATED( diss_av ) ) THEN 672 ALLOCATE( diss_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 673 diss_av = REAL( fill_value, KIND = wp ) 674 ENDIF 650 675 DO i = nxl, nxr 651 676 DO j = nys, nyn … … 669 694 ENDDO 670 695 ELSE 696 IF ( .NOT. ALLOCATED( diss_av ) ) THEN 697 ALLOCATE( diss_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 698 diss_av = REAL( fill_value, KIND = wp ) 699 ENDIF 671 700 DO i = nxl, nxr 672 701 DO j = nys, nyn … … 710 739 711 740 LOGICAL :: found !< 741 742 REAL(wp) :: fill_value = -999.0_wp !< value for the _FillValue attribute 712 743 713 744 REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb:nzt+1) :: local_pf !< local … … 731 762 ENDDO 732 763 ELSE 764 IF ( .NOT. ALLOCATED( diss_av ) ) THEN 765 ALLOCATE( diss_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 766 diss_av = REAL( fill_value, KIND = wp ) 767 ENDIF 733 768 DO i = nxl, nxr 734 769 DO j = nys, nyn … … 750 785 ENDDO 751 786 ELSE 787 IF ( .NOT. ALLOCATED( kh_av ) ) THEN 788 ALLOCATE( kh_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 789 kh_av = REAL( fill_value, KIND = wp ) 790 ENDIF 752 791 DO i = nxl, nxr 753 792 DO j = nys, nyn … … 769 808 ENDDO 770 809 ELSE 810 IF ( .NOT. ALLOCATED( km_av ) ) THEN 811 ALLOCATE( km_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 812 km_av = REAL( fill_value, KIND = wp ) 813 ENDIF 771 814 DO i = nxl, nxr 772 815 DO j = nys, nyn
Note: See TracChangeset
for help on using the changeset viewer.