- Timestamp:
- Jul 15, 2014 2:47:17 PM (10 years ago)
- Location:
- palm/trunk/SOURCE
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/calc_spectra.f90
r1343 r1431 20 20 ! Current revisions: 21 21 ! ----------------- 22 ! 22 ! Wavenumber-integrated spectra coincide with respective variance. 23 23 ! 24 24 ! Former revisions: … … 198 198 199 199 USE indices, & 200 ONLY: n xl, nxr, nyn, nys, nzb, nzt200 ONLY: ngp_2dh, nxl, nxr, nyn, nys, nzb, nzt 201 201 202 202 USE kinds … … 208 208 209 209 USE statistics, & 210 ONLY: sums210 ONLY: hom, var_d 211 211 212 212 … … 218 218 INTEGER(iwp) :: m !: 219 219 INTEGER(iwp) :: pr !: 220 221 REAL(wp), DIMENSION(nzb:nzt+1) :: var_d_l 220 222 221 223 SELECT CASE ( TRIM( data_output_sp(m) ) ) … … 254 256 !-- Subtract horizontal mean from the array, for which spectra have to be 255 257 !-- calculated 258 var_d_l(:) = 0.0_wp 256 259 DO i = nxl, nxr 257 260 DO j = nys, nyn 258 261 DO k = nzb+1, nzt 259 d(k,j,i) = d(k,j,i) - sums(k,pr) 262 d(k,j,i) = d(k,j,i) - hom(k,1,pr,0) 263 var_d_l(k) = var_d_l(k) + d(k,j,i) * d(k,j,i) 260 264 ENDDO 261 265 ENDDO 262 266 ENDDO 267 ! 268 !-- Compute total variance from local variances 269 var_d(:) = 0.0_wp 270 #if defined( __parallel ) 271 IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) 272 CALL MPI_ALLREDUCE( var_d_l(0), var_d(0), nzt+1-nzb, MPI_REAL, & 273 MPI_SUM, comm2d, ierr ) 274 #else 275 var_d(:) = var_d_l(:) 276 #endif 277 var_d(:) = var_d(:) / ngp_2dh(0) 263 278 264 279 END SUBROUTINE preprocess_spectra … … 290 305 291 306 USE statistics, & 292 ONLY: spectrum_x 307 ONLY: spectrum_x, var_d 293 308 294 309 USE transpose_indices, & … … 306 321 INTEGER(iwp) :: pr !: 307 322 308 REAL(wp) :: fac !: 309 REAL(wp) :: exponent !: 323 REAL(wp) :: fac !: 324 REAL(wp) :: exponent !: 325 REAL(wp) :: sum_spec_dum !: wavenumber-integrated spectrum 310 326 311 327 REAL(wp), DIMENSION(0:nx) :: work !: … … 373 389 sums_spectra(:,n) = sums_spectra_l 374 390 #endif 375 391 ! 392 !-- Normalize spectra by variance 393 sum_spec_dum = SUM( sums_spectra(:,n) ) 394 IF ( sum_spec_dum /= 0.0_wp ) THEN 395 sums_spectra(:,n) = sums_spectra(:,n) * var_d(k) / sum_spec_dum 396 ENDIF 376 397 n = n + 1 377 398 … … 390 411 DO i = 1, nx/2 391 412 DO k = 1, n 392 spectrum_x(i,k,m) = spectrum_x(i,k,m) + sums_spectra(i,k) * fac 413 spectrum_x(i,k,m) = spectrum_x(i,k,m) + sums_spectra(i,k) * fac 393 414 ENDDO 394 415 ENDDO 395 416 396 417 ENDIF 397 398 418 ! 399 419 !-- n_sp_x is needed by data_output_spectra_x … … 428 448 429 449 USE statistics, & 430 ONLY: spectrum_y 450 ONLY: spectrum_y, var_d 431 451 432 452 USE transpose_indices, & … … 446 466 REAL(wp) :: fac !: 447 467 REAL(wp) :: exponent !: 468 REAL(wp) :: sum_spec_dum !: wavenumber-integrated spectrum 448 469 449 470 REAL(wp), DIMENSION(0:ny) :: work !: … … 512 533 sums_spectra(:,n) = sums_spectra_l 513 534 #endif 514 535 ! 536 !-- Normalize spectra by variance 537 sum_spec_dum = SUM( sums_spectra(:,n) ) 538 IF ( SUM(sums_spectra(:,n)) /= 0.0_wp ) THEN 539 sums_spectra(:,n) = sums_spectra(:,n) * var_d(k) / SUM(sums_spectra(:,n)) 540 ENDIF 515 541 n = n + 1 516 542 -
palm/trunk/SOURCE/init_3d_model.f90
r1430 r1431 20 20 ! Current revisions: 21 21 ! ------------------ 22 ! 22 ! var_d added, in order to normalize spectra. 23 23 ! 24 24 ! Former revisions: … … 224 224 statistic_regions, sums, sums_divnew_l, sums_divold_l, sums_l, & 225 225 sums_l_l, sums_up_fraction_l, sums_wsts_bc_l, ts_value, & 226 weight_pres, weight_substep226 var_d, weight_pres, weight_substep 227 227 228 228 USE transpose_indices … … 492 492 spectrum_x = 0.0_wp 493 493 spectrum_y = 0.0_wp 494 495 ALLOCATE( var_d(nzb:nzt+1) ) 496 var_d = 0.0_wp 494 497 ENDIF 495 498 -
palm/trunk/SOURCE/modules.f90
r1430 r1431 20 20 ! Current revisions: 21 21 ! ------------------ 22 ! 22 ! +var_d 23 23 ! 24 24 ! Former revisions: … … 1411 1411 REAL(wp) :: u_max, v_max, w_max 1412 1412 REAL(wp), DIMENSION(:), ALLOCATABLE :: sums_divnew_l, sums_divold_l, & 1413 weight_substep, weight_pres 1413 var_d, weight_substep, & 1414 weight_pres 1414 1415 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: sums, sums_wsts_bc_l, ts_value, & 1415 1416 sums_wsus_ws_l, sums_wsvs_ws_l, &
Note: See TracChangeset
for help on using the changeset viewer.