Ignore:
Timestamp:
Oct 1, 2020 11:28:33 AM (4 years ago)
Author:
pavelkrc
Message:

Bugfix of previous commit (div_old discrepancy)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/pres.f90

    r4717 r4719  
    2525! -----------------
    2626! $Id$
     27! Bugfix of previous commit (div_old discrepancy)
     28!
     29! 4717 2020-09-30 22:27:40Z pavelkrc
    2730! Fixes and optimizations of OpenMP parallelization, formatting of OpenMP
    2831! directives (J. Resler)
     
    174177    REAL(wp) ::  ddt_3d            !<
    175178    REAL(wp) ::  d_weight_pres     !<
     179    REAL(wp) ::  localsum          !<
    176180    REAL(wp) ::  threadsum         !<
    177181    REAL(wp) ::  weight_pres_l     !<
     
    386390    ENDIF
    387391
    388     !$OMP PARALLEL DO PRIVATE (i,j,k) SCHEDULE( STATIC )
     392    localsum  = 0.0_wp
     393    threadsum = 0.0_wp
     394
     395    !$OMP PARALLEL PRIVATE (i,j,k)
     396    !$OMP DO SCHEDULE( STATIC )
    389397    !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) &
    390398    !$ACC PRESENT(u, v, w, rho_air, rho_air_zw, ddzw, wall_flags_total_0) &
     
    401409       ENDDO
    402410    ENDDO
     411    !$OMP END PARALLEL
    403412
    404413!
     
    407416    IF ( intermediate_timestep_count == intermediate_timestep_count_max  .OR.                      &
    408417         intermediate_timestep_count == 0 )  THEN
    409        threadsum = 0.0_wp
    410        !$OMP PARALLEL DO PRIVATE (i,j,k) REDUCTION(+:threadsum) SCHEDULE( STATIC )
     418       !$OMP PARALLEL PRIVATE (i,j,k) FIRSTPRIVATE(threadsum) REDUCTION(+:localsum)
     419       !$OMP DO SCHEDULE( STATIC )
    411420       !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
    412421       !$ACC REDUCTION(+:threadsum) COPY(threadsum) &
     
    419428          ENDDO
    420429       ENDDO
    421        threadsum = threadsum + threadsum * dt_3d * weight_pres_l
     430       localsum = localsum + threadsum * dt_3d * weight_pres_l
     431       !$OMP END PARALLEL
    422432    ENDIF
    423433
     
    426436    IF ( intermediate_timestep_count == intermediate_timestep_count_max  .OR.                      &
    427437         intermediate_timestep_count == 0 )  THEN
    428        sums_divold_l(0:statistic_regions) = threadsum
     438       sums_divold_l(0:statistic_regions) = localsum
    429439    ENDIF
    430440
     
    665675    IF ( conserve_volume_flow  .AND.  bc_lr_cyc  .AND.  bc_ns_cyc  .AND.  nxr == nx )  THEN
    666676
    667        !$OMP PARALLEL DO PRIVATE (j,k) REDUCTION (volume_flow_l(1))
     677       !$OMP PARALLEL DO PRIVATE (j,k) REDUCTION (+:volume_flow_l(1))
    668678       DO  j = nys, nyn
    669679          DO  k = nzb+1, nzt
     
    677687    IF ( conserve_volume_flow  .AND.  bc_ns_cyc  .AND.  bc_lr_cyc  .AND. nyn == ny )  THEN
    678688
    679        !$OMP PARALLEL DO PRIVATE (i,k) REDUCTION (volume_flow_l(2))
     689       !$OMP PARALLEL DO PRIVATE (i,k) REDUCTION (+:volume_flow_l(2))
    680690       DO  i = nxl, nxr
    681691          DO  k = nzb+1, nzt
     
    736746       IF ( topography /= 'flat' )  d = 0.0_wp
    737747
    738        !$OMP PARALLEL DO PRIVATE (i,j,k) SCHEDULE( STATIC )
     748       localsum  = 0.0_wp
     749       threadsum = 0.0_wp
     750
     751       !$OMP PARALLEL PRIVATE (i,j,k) FIRSTPRIVATE(threadsum) REDUCTION(+:localsum)
     752       !$OMP DO SCHEDULE( STATIC )
    739753       !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) &
    740754       !$ACC PRESENT(u, v, w, rho_air, rho_air_zw, ddzw, wall_flags_total_0) &
     
    753767!
    754768!--    Compute possible PE-sum of divergences for flow_statistics
    755        threadsum = 0.0_wp
    756        !$OMP PARALLEL DO PRIVATE (i,j,k) REDUCTION(+:threadsum) SCHEDULE( STATIC )
     769       !$OMP DO SCHEDULE( STATIC )
    757770       !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i, j, k) &
    758771       !$ACC REDUCTION(+:threadsum) COPY(threadsum) &
     
    766779       ENDDO
    767780
     781       localsum = localsum + threadsum
     782       !$OMP END PARALLEL
     783
    768784!
    769785!--    For completeness, set the divergence sum of all statistic regions to those of the total
    770786!--    domain
    771        sums_divnew_l(0:statistic_regions) = threadsum
     787       sums_divnew_l(0:statistic_regions) = localsum
    772788
    773789       CALL cpu_log( log_point_s(1), 'divergence', 'stop' )
Note: See TracChangeset for help on using the changeset viewer.