volaverage.F [SRC] [CPP] [JOB] [SCAN]
SOURCES / FUNCTIONS



   1 | include(dom.inc)
   2 | 
   3 |       SUBROUTINE VOLAVERAGE(vect, average, ndata, ivol)
   4 | 
   5 |       USE mod_pmm
   6 |       USE mod_slave
   7 | #ifdef USEPALM
   8 |       USE palmlib
   9 | #endif
  10 | 
  11 |       IMPLICIT NONE
  12 | 
  13 | !     IN
  14 |       DOM_INT                              :: ndata, ivol
  15 |       DOM_REAL,DIMENSION(ndata,is_nnodes)  :: vect
  16 | 
  17 | !     LOCAL
  18 |       DOM_INT :: j, inode, k !, ierr
  19 |       DOM_REAL, DIMENSION(ndata)           :: vect_cell
  20 |       DOM_REAL, DIMENSION(ndata)           :: local_average
  21 | 
  22 | !     OUT
  23 |       DOM_REAL, DIMENSION(ndata) :: average
  24 | 
  25 |       average  = 0.
  26 | 
  27 | !     -----------------------------!
  28 | !     Initializing local cell data !
  29 | !     -----------------------------!
  30 | 
  31 |       local_average  = 0.
  32 | 
  33 | !$OMP PARALLEL DO                                                       &
  34 | !$OMP&  PRIVATE(k,inode)                                                &
  35 | !$OMP&  SHARED(local_average)
  36 | 
  37 |        DO j= 1, is_ncells !is_cellb, is_cellf
  38 |           vect_cell = 0.d0
  39 |           DO inode=1,is_cnodes(j)
  40 |             k = is_cnnode(inode,j)
  41 |             vect_cell(:) = vect_cell(:)  + vect(:,k)
  42 |           ENDDO
  43 |         vect_cell(:)     = vect_cell(:)/ real(is_cnodes(j))
  44 |         local_average(:) = local_average(:) + vect_cell(:)*s_V(j)
  45 |       ENDDO
  46 | 
  47 | !$OMP END PARALLEL DO
  48 | 
  49 | !      CALL MPI_ALLREDUCE(local_average, average, ndata,                 &
  50 | !     &                   MPI_DOUBLE_PRECISION,MPI_SUM, SUB_COMM ,       &
  51 | !     &                   ierr)
  52 | 
  53 |       average    = local_average
  54 |       IF(ivol.eq.1) average(:) = average(:) / SUM(s_V)
  55 | 
  56 |       END SUBROUTINE VOLAVERAGE


volaverage.F could be called by:
deri_kappa.F [SOURCES/SCHEMES] - 106
Makefile [SOURCES] - 170
slave.F [SOURCES/MAIN/SLAVE] - 264