1 | include(dom.inc)
2 |
3 | SUBROUTINE POSTPROCESSING(gb_Lbtot, loc_Gtot, loc_Qrtot, loc_Qptot,&
4 | & Htot)
5 | ! ================================================================!
6 | ! !
7 | ! postprocessing.F : Prepare result vector !
8 | ! -> reduce all datas over procs in each part !
9 | ! -> scatter results on nodes !
10 | ! -> send result to the master mesh !
11 | ! !
12 | ! author : D. Poitou (Sept 2011) !
13 | ! !
14 | ! ================================================================!
15 |
16 | USE mod_slave
17 | USE mod_pmm
18 | #ifdef USEPALM
19 | USE palmlib
20 | #endif
21 |
22 | IMPLICIT NONE
23 |
24 | include 'pmm_constants.h'
25 |
26 | ! IN
27 | DOM_REAL,DIMENSION(is_ncells) :: loc_Gtot, gb_Lbtot
28 | DOM_REAL,DIMENSION(3,is_ncells) :: loc_Qrtot
29 | DOM_REAL,DIMENSION(3,is_nprobes) :: loc_Qptot
30 | DOM_REAL,DIMENSION(is_nbfaces) :: Htot
31 |
32 | ! LOCAL
33 | DOM_INT :: ibnd, i, j, ierr
34 | DOM_REAL,DIMENSION(is_ncells) :: gb_Gtot
35 | DOM_REAL,DIMENSION(3,is_ncells) :: gb_Qrtot
36 | DOM_REAL,DIMENSION(3,is_nbfaces) :: Qrtot_face
37 |
38 | DOM_REAL,DIMENSION(is_nnodes) :: Gtot, Lbtot
39 | DOM_REAL,DIMENSION(3,is_nnodes) :: Qrtot
40 | DOM_REAL,DIMENSION(is_nbfaces) :: Qw
41 | DOM_REAL,DIMENSION(3,is_nprobes) :: Qptot
42 |
43 | ! -------------------------------------------------------------!
44 | ! Sum over ALL slave quadrature point/frequency and directions !
45 | ! -------------------------------------------------------------!
46 |
47 | IF(is_ntask.gt.1) THEN
48 | CALL MPI_ALLREDUCE(loc_Gtot, gb_Gtot, is_ncells, &
49 | & MPI_DOUBLE_PRECISION, MPI_SUM, SUB_COMM, ierr)
50 |
51 | CALL MPI_ALLREDUCE(loc_Qrtot, gb_Qrtot, 3*is_ncells, &
52 | & MPI_DOUBLE_PRECISION, MPI_SUM, SUB_COMM, ierr)
53 |
54 | CALL MPI_ALLREDUCE(loc_Qptot, Qptot, 3*is_nprobes, &
55 | & MPI_DOUBLE_PRECISION, MPI_SUM, SUB_COMM, ierr)
56 |
57 | ELSE
58 | gb_Gtot = loc_Gtot
59 | gb_Qrtot = loc_Qrtot
60 | Qptot = loc_Qptot
61 | ENDIF
62 |
63 | Sr_vol = SUM((gb_Lbtot-gb_Gtot)*s_V)
64 |
65 | ! ----------------!
66 | ! Scatter results !
67 | ! ----------------!
68 |
69 | CALL SCATTER(gb_Lbtot, Lbtot, 1)
70 | CALL SCATTER(gb_Gtot , Gtot , 1)
71 | CALL SCATTER(gb_Qrtot, Qrtot, 3)
72 |
73 | CALL GATHER_FACES(Qrtot,Qrtot_face,3)
74 | ! --------------------------------------------!
75 | ! Calculation of the wall radiative heat flux !
76 | ! --------------------------------------------!
77 |
78 | DO ibnd = 1,is_nbfaces
79 |
80 | j = ts_boundary(ibnd)%icell
81 | i = ts_boundary(ibnd)%iface
82 |
83 | Qw(ibnd) = gb_Qrtot(1,j)*s_norm(1,i,j) + &
84 | & gb_Qrtot(2,j)*s_norm(2,i,j) + &
85 | & gb_Qrtot(3,j)*s_norm(3,i,j)
86 |
87 | ! Qw(ibnd) = Qrtot_face(1,ibnd)*s_norm(1,i,j) + &
88 | ! & Qrtot_face(2,ibnd)*s_norm(2,i,j) + &
89 | ! & Qrtot_face(3,ibnd)*s_norm(3,i,j)
90 |
91 | ENDDO
92 |
93 | IF (pmm_rank.ne.PMM_HOST) THEN
94 | IF(is_task.eq.0) THEN
95 | CALL MPI_SEND(Gtot, is_nnodes, MPI_DOUBLE_PRECISION, &
96 | & PMM_HOST, PMM_RETURN, COMM_PARA, ierr)
97 |
98 | CALL MPI_SEND(Lbtot, is_nnodes, MPI_DOUBLE_PRECISION, &
99 | & PMM_HOST, PMM_RETURN, COMM_PARA, ierr)
100 |
101 | CALL MPI_SEND(Qrtot, 3*is_nnodes, MPI_DOUBLE_PRECISION, &
102 | & PMM_HOST, PMM_RETURN, COMM_PARA, ierr)
103 |
104 | CALL MPI_SEND(Qw, is_nbfaces, MPI_DOUBLE_PRECISION, &
105 | & PMM_HOST, PMM_RETURN, COMM_PARA, ierr)
106 |
107 | CALL MPI_SEND(Htot, is_nbfaces, MPI_DOUBLE_PRECISION, &
108 | & PMM_HOST, PMM_RETURN, COMM_PARA, ierr)
109 |
110 | CALL MPI_SEND(Sr_vol, 1, MPI_DOUBLE_PRECISION, PMM_HOST, &
111 | & PMM_RETURN, COMM_PARA, ierr)
112 |
113 | CALL MPI_SEND(is_nprobes, 1, MPI_INTEGER, PMM_HOST, &
114 | & PMM_RETURN, COMM_PARA, ierr)
115 |
116 | CALL MPI_SEND(Qptot, 3*is_nprobes, MPI_DOUBLE_PRECISION, &
117 | & PMM_HOST, PMM_RETURN, COMM_PARA, ierr)
118 | ENDIF
119 |
120 | ELSE
121 | ALLOCATE(s_Gtot (is_nnodes))
122 | ALLOCATE(s_Lbtot(is_nnodes))
123 | ALLOCATE(s_Qrtot(3,is_nnodes))
124 | ALLOCATE(s_Qw(is_nbfaces))
125 | ALLOCATE(s_Htot(is_nbfaces))
126 | ALLOCATE(s_Qptot(3,is_nprobes))
127 | s_Gtot = Gtot
128 | s_Lbtot = Lbtot
129 | s_Qrtot = Qrtot
130 | s_Qw = Qw
131 | s_Htot = Htot
132 | s_Qptot = Qptot
133 | ENDIF
134 |
135 | ENDSUBROUTINE POSTPROCESSING
postprocessing.F could be called by: