Changeset 1833 for palm/trunk/SOURCE/data_output_spectra.f90
- Timestamp:
- Apr 7, 2016 2:23:03 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/data_output_spectra.f90
r1818 r1833 19 19 ! Current revisions: 20 20 ! ------------------ 21 ! 21 ! spectrum renamed spectra_mod, spectra related variables moved to spectra_mod, 22 ! routines data_output_spectra_x/y removed 22 23 ! 23 24 ! Former revisions: … … 78 79 #if defined( __netcdf ) 79 80 USE control_parameters, & 80 ONLY: average_count_sp, averaging_interval_sp, dosp_time_count, & 81 message_string, run_description_header, & 81 ONLY: message_string, run_description_header, & 82 82 time_since_reference_point 83 83 … … 94 94 USE pegrid 95 95 96 USE spectrum, & 97 ONLY: comp_spectra_level, data_output_sp, spectra_direction 98 99 USE statistics, & 100 ONLY: spectrum_x, spectrum_y 96 USE spectra_mod, & 97 ONLY: average_count_sp, averaging_interval_sp, comp_spectra_level, & 98 data_output_sp, dosp_time_count, spectra_direction, spectrum_x, & 99 spectrum_y 101 100 102 101 … … 226 225 ONLY: pi 227 226 228 USE control_parameters, &229 ONLY: dosp_time_count230 231 227 USE grid_variables, & 232 228 ONLY: dx, dy … … 243 239 netcdf_handle_error 244 240 245 USE spectrum, & 246 ONLY: n_sp_x, n_sp_y 247 248 USE statistics, & 249 ONLY: spectrum_x, spectrum_y 241 USE spectra_mod, & 242 ONLY: dosp_time_count, n_sp_x, n_sp_y, spectrum_x, spectrum_y 243 250 244 251 245 IMPLICIT NONE … … 302 296 #endif 303 297 END SUBROUTINE output_spectra_netcdf 304 305 306 !------------------------------------------------------------------------------!307 ! Description:308 ! ------------309 !> @todo Missing subroutine description.310 !------------------------------------------------------------------------------!311 SUBROUTINE data_output_spectra_x( m, cranz, pr, frame_written )312 313 USE arrays_3d, &314 ONLY: zu, zw315 USE constants, &316 ONLY: pi317 318 USE control_parameters, &319 ONLY: averaging_interval_sp, run_description_header, simulated_time_chr320 321 USE grid_variables, &322 ONLY: dx323 324 USE indices, &325 ONLY: nx326 327 USE kinds328 329 USE pegrid330 331 USE statistics, &332 ONLY: spectrum_x333 334 USE spectrum, &335 ONLY: comp_spectra_level, header_char, lstyles, klist_x, n_sp_x, &336 plot_spectra_level, utext_char, ytext_char337 338 IMPLICIT NONE339 340 CHARACTER (LEN=30) :: atext !<341 342 INTEGER(iwp) :: i !<343 INTEGER(iwp) :: j !<344 INTEGER(iwp) :: k !<345 INTEGER(iwp) :: m !<346 INTEGER(iwp) :: pr !<347 348 LOGICAL :: frame_written !<349 350 REAL(wp) :: frequency = 0.0_wp !<351 !352 !-- Variables needed for PROFIL-namelist353 CHARACTER (LEN=80) :: rtext !<354 CHARACTER (LEN=80) :: utext !<355 CHARACTER (LEN=80) :: xtext = 'k in m>->1' !<356 CHARACTER (LEN=80) :: ytext !<357 358 INTEGER(iwp) :: cranz !<359 INTEGER(iwp) :: labforx = 3 !<360 INTEGER(iwp) :: labfory = 3 !<361 INTEGER(iwp) :: legpos = 3 !<362 INTEGER(iwp) :: timodex = 1 !<363 364 INTEGER(iwp), DIMENSION(1:100) :: cucol = 1 !<365 INTEGER(iwp), DIMENSION(1:100) :: klist = 999999 !<366 INTEGER(iwp), DIMENSION(1:100) :: lstyle = 0 !<367 368 LOGICAL :: datleg = .TRUE. !<369 LOGICAL :: grid = .TRUE. !<370 LOGICAL :: lclose = .TRUE. !<371 LOGICAL :: rand = .TRUE. !<372 LOGICAL :: swap = .TRUE. !<373 LOGICAL :: twoxa = .TRUE. !<374 LOGICAL :: xlog = .TRUE. !<375 LOGICAL :: ylog = .TRUE. !<376 377 REAL(wp) :: gwid = 0.1_wp !<378 REAL(wp) :: rlegfak = 0.7_wp !<379 REAL(wp) :: uxmin !<380 REAL(wp) :: uxmax !<381 REAL(wp) :: uymin !<382 REAL(wp) :: uymax !<383 384 REAL(wp), DIMENSION(1:100) :: lwid = 0.6_wp !<385 REAL(wp), DIMENSION(100) :: uyma !<386 REAL(wp), DIMENSION(100) :: uymi !<387 388 NAMELIST /RAHMEN/ cranz, datleg, rtext, swap389 NAMELIST /CROSS/ rand, cucol, grid, gwid, klist, labforx, labfory, &390 legpos, lclose, lstyle, lwid, rlegfak, timodex, utext, &391 uxmin, uxmax, uymin, uymax, twoxa, xlog, xtext, ylog, &392 ytext393 394 395 rtext = '\0.5 ' // run_description_header396 397 !398 !-- Open parameter- and data-file399 CALL check_open( 81 )400 CALL check_open( 82 )401 402 !403 !-- Write file header,404 !-- write RAHMEN-parameters (pr=3: w-array is on zw, other arrys on zu,405 !-- pr serves as an index for output of strings (axis-labels) of the406 !-- different quantities u, v, w, pt and q)407 DO k = 1, n_sp_x408 IF ( k < 100 ) THEN409 IF ( pr == 3 ) THEN410 WRITE ( 82, 100 ) '#', k, header_char( pr ), &411 INT( zw(comp_spectra_level(k)) ), &412 simulated_time_chr413 ELSE414 WRITE ( 82, 100 ) '#', k, header_char( pr ), &415 INT( zu(comp_spectra_level(k)) ), &416 simulated_time_chr417 ENDIF418 ELSE419 IF ( pr == 3 ) THEN420 WRITE ( 82, 101 ) '#', k, header_char( pr ), &421 INT( zw(comp_spectra_level(k)) ), &422 simulated_time_chr423 ELSE424 WRITE ( 82, 101 ) '#', k, header_char( pr ), &425 INT( zu(comp_spectra_level(k)) ), &426 simulated_time_chr427 ENDIF428 ENDIF429 ENDDO430 431 IF ( .NOT. frame_written ) THEN432 WRITE ( 81, RAHMEN )433 frame_written = .TRUE.434 ENDIF435 436 !437 !-- Write all data and calculate uymi and uyma. They serve to calculate438 !-- the CROSS-parameters uymin and uymax439 uymi = 999.999_wp; uyma = -999.999_wp440 DO i = 1, nx/2441 frequency = 2.0_wp * pi * i / ( dx * ( nx + 1 ) )442 WRITE ( 82, 102 ) frequency, ( frequency * spectrum_x(i,k,m), k = 1, &443 n_sp_x )444 DO k = 1, n_sp_x445 uymi(k) = MIN( uymi(k), frequency * spectrum_x(i,k,m) )446 uyma(k) = MAX( uyma(k), frequency * spectrum_x(i,k,m) )447 ENDDO448 ENDDO449 450 !451 !-- Determine CROSS-parameters452 cucol(1:n_sp_x) = (/ ( k, k = 1, n_sp_x ) /)453 lstyle(1:n_sp_x) = (/ ( lstyles(k), k = 1, n_sp_x ) /)454 455 !456 !-- Calculate klist-values from the available comp_spectra_level values457 i = 1; k = 1458 DO WHILE ( i <= 100 .AND. plot_spectra_level(i) /= 999999 )459 DO WHILE ( k <= n_sp_x .AND. &460 plot_spectra_level(i) >= comp_spectra_level(k) )461 IF ( plot_spectra_level(i) == comp_spectra_level(k) ) THEN462 klist(i) = k + klist_x463 ELSE464 uymi(k) = 999.999_wp465 uyma(k) = -999.999_wp466 ENDIF467 k = k + 1468 ENDDO469 i = i + 1470 ENDDO471 uymi(k:n_sp_x) = 999.999_wp472 uyma(k:n_sp_x) = -999.999_wp473 utext = 'x'//utext_char( pr )474 IF ( averaging_interval_sp /= 0.0_wp ) THEN475 WRITE ( atext, 104 ) averaging_interval_sp476 utext = TRIM(utext) // ', ' // TRIM( atext )477 ENDIF478 uxmin = 0.8_wp * 2.0_wp * pi / ( dx * ( nx + 1 ) )479 uxmax = 1.2_wp * 2.0_wp * pi * nx/2 / ( dx * ( nx + 1 ) )480 uymin = 0.8_wp * MIN ( 999.999_wp, MINVAL ( uymi ) )481 uymax = 1.2_wp * MAX ( -999.999_wp, MAXVAL ( uyma ) )482 ytext = ytext_char( pr )483 484 !485 !-- Output of CROSS-parameters486 WRITE ( 81, CROSS )487 488 !489 !-- Increase counter by the number of profiles written in the actual block490 klist_x = klist_x + n_sp_x491 492 !493 !-- Write end-mark494 WRITE ( 82, 103 )495 496 !497 !-- Close parameter- and data-file498 CALL close_file( 81 )499 CALL close_file( 82 )500 501 !502 !-- Formats503 100 FORMAT (A,I1,1X,A,1X,I4,'m ',A)504 101 FORMAT (A,I2,1X,A,1X,I4,'m ',A)505 102 FORMAT (E15.7,100(1X,E15.7))506 103 FORMAT ('NEXT')507 104 FORMAT ('time averaged over',F7.1,' s')508 509 END SUBROUTINE data_output_spectra_x510 511 512 !------------------------------------------------------------------------------!513 ! Description:514 ! ------------515 !> @todo Missing subroutine description.516 !------------------------------------------------------------------------------!517 SUBROUTINE data_output_spectra_y( m, cranz, pr, frame_written )518 519 USE arrays_3d, &520 ONLY: zu, zw521 522 USE constants, &523 ONLY: pi524 525 USE control_parameters, &526 ONLY: averaging_interval_sp, run_description_header, simulated_time_chr527 528 USE grid_variables, &529 ONLY: dy530 531 USE indices, &532 ONLY: ny533 534 USE kinds535 536 USE pegrid537 538 USE statistics, &539 ONLY: spectrum_y540 541 USE spectrum, &542 ONLY: comp_spectra_level, header_char, klist_y, lstyles, n_sp_y, &543 plot_spectra_level, utext_char, ytext_char544 545 IMPLICIT NONE546 547 548 CHARACTER (LEN=30) :: atext !<549 550 INTEGER(iwp) :: i !<551 INTEGER(iwp) :: j !<552 INTEGER(iwp) :: k !<553 INTEGER(iwp) :: m !<554 INTEGER(iwp) :: pr !<555 556 LOGICAL :: frame_written !<557 558 REAL(wp) :: frequency = 0.0_wp !<559 560 !561 !-- Variables needed for PROFIL-namelist562 CHARACTER (LEN=80) :: rtext !<563 CHARACTER (LEN=80) :: utext !<564 CHARACTER (LEN=80) :: xtext = 'k in m>->1' !<565 CHARACTER (LEN=80) :: ytext !<566 567 INTEGER(iwp) :: cranz !<568 INTEGER(iwp) :: labforx = 3 !<569 INTEGER(iwp) :: labfory = 3 !<570 INTEGER(iwp) :: legpos = 3 !<571 INTEGER(iwp) :: timodex = 1 !<572 573 INTEGER(iwp), DIMENSION(1:100) :: cucol = 1 !<574 INTEGER(iwp), DIMENSION(1:100) :: klist = 999999 !<575 INTEGER(iwp), DIMENSION(1:100) :: lstyle = 0 !<576 577 LOGICAL :: datleg = .TRUE. !<578 LOGICAL :: grid = .TRUE. !<579 LOGICAL :: lclose = .TRUE. !<580 LOGICAL :: rand = .TRUE. !<581 LOGICAL :: swap = .TRUE. !<582 LOGICAL :: twoxa = .TRUE. !<583 LOGICAL :: xlog = .TRUE. !<584 LOGICAL :: ylog = .TRUE. !<585 586 REAL(wp) :: gwid = 0.1_wp !<587 REAL(wp) :: rlegfak = 0.7_wp !<588 REAL(wp) :: uxmin !<589 REAL(wp) :: uxmax !<590 REAL(wp) :: uymin !<591 REAL(wp) :: uymax !<592 593 REAL(wp), DIMENSION(1:100) :: lwid = 0.6_wp !<594 595 REAL(wp), DIMENSION(100) :: uyma !<596 REAL(wp), DIMENSION(100) :: uymi !<597 598 NAMELIST /RAHMEN/ cranz, datleg, rtext, swap599 NAMELIST /CROSS/ rand, cucol, grid, gwid, klist, labforx, labfory, &600 legpos, lclose, lstyle, lwid, rlegfak, timodex, utext, &601 uxmin, uxmax, uymin, uymax, twoxa, xlog, xtext, ylog, &602 ytext603 604 605 rtext = '\0.5 ' // run_description_header606 607 !608 !-- Open parameter- and data-file609 CALL check_open( 83 )610 CALL check_open( 84 )611 612 !613 !-- Write file header,614 !-- write RAHMEN-parameters (pr=3: w-array is on zw, other arrys on zu,615 !-- pr serves as an index for output of strings (axis-labels) of the616 !-- different quantities u, v, w, pt and q)617 DO k = 1, n_sp_y618 IF ( k < 100 ) THEN619 IF ( pr == 3 ) THEN620 WRITE ( 84, 100 ) '#', k, header_char( pr ), &621 INT( zw(comp_spectra_level(k)) ), &622 simulated_time_chr623 ELSE624 WRITE ( 84, 100 ) '#', k, header_char( pr ), &625 INT( zu(comp_spectra_level(k)) ), &626 simulated_time_chr627 ENDIF628 ELSE629 IF ( pr == 3 ) THEN630 WRITE ( 84, 101 ) '#', k, header_char( pr ), &631 INT( zw(comp_spectra_level(k)) ), &632 simulated_time_chr633 ELSE634 WRITE ( 84, 101 ) '#', k, header_char( pr ), &635 INT( zu(comp_spectra_level(k)) ), &636 simulated_time_chr637 ENDIF638 ENDIF639 ENDDO640 641 IF ( .NOT. frame_written ) THEN642 WRITE ( 83, RAHMEN )643 frame_written = .TRUE.644 ENDIF645 646 !647 !-- Write all data and calculate uymi and uyma. They serve to calculate648 !-- the CROSS-parameters uymin and uymax649 uymi = 999.999_wp; uyma = -999.999_wp650 DO j = 1, ny/2651 frequency = 2.0_wp * pi * j / ( dy * ( ny + 1 ) )652 WRITE ( 84, 102 ) frequency, ( frequency * spectrum_y(j,k,m), &653 k = 1, n_sp_y )654 DO k = 1, n_sp_y655 uymi(k) = MIN( uymi(k), frequency * spectrum_y(j,k,m) )656 uyma(k) = MAX( uyma(k), frequency * spectrum_y(j,k,m) )657 ENDDO658 ENDDO659 660 !661 !-- Determine CROSS-parameters662 cucol(1:n_sp_y) = (/ ( k, k = 1, n_sp_y ) /)663 lstyle(1:n_sp_y) = (/ ( lstyles(k), k = 1, n_sp_y ) /)664 665 !666 !-- Calculate klist-values from the available comp_spectra_level values667 j = 1; k = 1668 DO WHILE ( j <= 100 .AND. plot_spectra_level(j) /= 999999 )669 DO WHILE ( k <= n_sp_y .AND. &670 plot_spectra_level(j) >= comp_spectra_level(k) )671 IF ( plot_spectra_level(j) == comp_spectra_level(k) ) THEN672 klist(j) = k + klist_y673 ELSE674 uymi(k) = 999.999_wp675 uyma(k) = -999.999_wp676 ENDIF677 k = k + 1678 ENDDO679 j = j + 1680 ENDDO681 uymi(k:n_sp_y) = 999.999_wp682 uyma(k:n_sp_y) = -999.999_wp683 utext = 'y'//utext_char( pr )684 IF ( averaging_interval_sp /= 0.0_wp ) THEN685 WRITE ( atext, 104 ) averaging_interval_sp686 utext = TRIM(utext) // ', ' // TRIM( atext )687 ENDIF688 uxmin = 0.8_wp * 2.0_wp * pi / ( dy * ( ny + 1 ) )689 uxmax = 1.2_wp * 2.0_wp * pi * ny/2 / ( dy * ( ny + 1 ) )690 uymin = 0.8_wp * MIN ( 999.999_wp, MINVAL ( uymi ) )691 uymax = 1.2_wp * MAX ( -999.999_wp, MAXVAL ( uyma ) )692 ytext = ytext_char( pr )693 694 !695 !-- Output CROSS-parameters696 WRITE ( 83, CROSS )697 698 !699 !-- Increase counter by the number of profiles written in the actual block700 klist_y = klist_y + n_sp_y701 702 !703 !-- Write end-mark704 WRITE ( 84, 103 )705 706 !707 !-- Close parameter- and data-file708 CALL close_file( 83 )709 CALL close_file( 84 )710 711 !712 !-- Formats713 100 FORMAT (A,I1,1X,A,1X,I4,'m ',A)714 101 FORMAT (A,I2,1X,A,1X,I4,'m ',A)715 102 FORMAT (E15.7,100(1X,E15.7))716 103 FORMAT ('NEXT')717 104 FORMAT ('time averaged over',F7.1,' s')718 719 END SUBROUTINE data_output_spectra_y
Note: See TracChangeset
for help on using the changeset viewer.