Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_CECellsSendSize.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: send buffer size to edge and corner cells of an adjacent region.
26 !
27 ! Description: kernel is pertinent when the other region is located
28 ! on a different processor.
29 !
30 ! Input:
31 ! regions = data of all regions
32 ! iReg = current region.
33 !
34 ! Output: buffer size sent.
35 !
36 ! Notes: none.
37 !
38 !******************************************************************************
39 !
40 ! $Id: PLAG_CECellsSendSize.F90,v 1.5 2009/03/02 00:19:36 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2004 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE plag_cecellssendsize( regions,iReg )
47 
48  USE moddatatypes
49  USE moderror
50  USE modmpi
51  USE modparameters
52  USE modglobal, ONLY : t_global
53  USE moddatastruct, ONLY : t_dcell, t_dcelltransf, t_region, t_level
54  USE modpartlag, ONLY : t_plag, t_buffer_plag
55 
56  IMPLICIT NONE
57 
58 ! ******************************************************************************
59 ! Definitions and declarations
60 ! ******************************************************************************
61 
62 ! ==============================================================================
63 ! Arguments
64 ! ==============================================================================
65 
66  TYPE(t_region), POINTER :: regions(:)
67 
68  INTEGER, INTENT(IN) :: ireg
69 
70 ! ==============================================================================
71 ! Locals
72 ! ==============================================================================
73 
74  CHARACTER(CHRLEN) :: rcsidentstring
75 
76  INTEGER :: dest,i,j,k,icell,icorner,iedge,ijk,ilev,ir,iregdes, iregsrc, &
77  irequestplag,nbuffsizecornsrc,nbuffsizeedgesrc,nbuffsizetotsrc, &
78  ncorners,ndimbuffsize,nedges,tag
79 
80  TYPE(t_buffer_plag), POINTER :: pcorncellsxbuff, pedgecellsxbuff
81  TYPE(t_dcelltransf), POINTER :: psendeccell
82  TYPE(t_global), POINTER :: global
83  TYPE(t_level), POINTER :: plevelsrc
84  TYPE(t_plag), POINTER :: pplag
85  TYPE(t_region), POINTER :: pregionsrc, pregiondes
86 
87 ! ******************************************************************************
88 ! Start
89 ! ******************************************************************************
90 
91  rcsidentstring = '$RCSfile: PLAG_CECellsSendSize.F90,v $ $Revision: 1.5 $'
92 
93  global => regions(ireg)%global
94 
95  CALL registerfunction( global,'PLAG_CECellsSendSize',&
96  'PLAG_CECellsSendSize.F90' )
97 
98 ! ******************************************************************************
99 ! Get dimensions
100 ! ******************************************************************************
101 
102  ilev = regions(ireg)%currLevel
103  ncorners = 8
104  nedges = 12
105 
106  ndimbuffsize = 1
107 
108  nbuffsizecornsrc = 0
109  nbuffsizeedgesrc = 0
110  nbuffsizetotsrc = 0
111 
112 ! ******************************************************************************
113 ! Set pointers
114 ! ******************************************************************************
115 
116  pregionsrc => regions(ireg)
117  plevelsrc => pregionsrc%levels(ilev)
118  pplag => plevelsrc%plag
119 
120 ! ******************************************************************************
121 ! Load send buffer size
122 ! ******************************************************************************
123 
124  DO ir=1,global%nRegions
125  IF (regions(ir)%procid == global%myProcid) goto 1999
126 
127  IF ( plevelsrc%sendEcCells(ir)%nCells > 0 ) THEN
128  psendeccell => plevelsrc%sendEcCells(ir)
129 
130 ! =============================================================================
131 ! Reset buffer size in active communicating regions to zero
132 ! since RFLO has possibility to have multiple active edges/corners
133 ! on various regions interacting; while for PLAG, edges/corners interact
134 ! dynamically when buffer size is non-null.
135 ! =============================================================================
136 
137  nbuffsizecornsrc = 0
138  nbuffsizeedgesrc = 0
139  nbuffsizetotsrc = 0
140 
141 ! =============================================================================
142 ! Loop over edges of source region
143 ! Loading buffer size for edge
144 ! =============================================================================
145 
146  DO iedge=1,nedges
147  IF( .NOT. plevelsrc%edgeCells(iedge)%interact ) goto 2999
148 
149 ! -- Bypass for degenerate edge cells -----------------------------------------
150 
151  IF( plevelsrc%edgeCells(iedge)%degenrt /= degenerat_none ) goto 2999
152 
153  DO ijk=1,ubound(plevelsrc%edgeCells(iedge)%cells,1)
154  iregdes = plevelsrc%edgeCells(iedge)%cells(ijk)%srcRegion
155  pedgecellsxbuff => plevelsrc%edgeCells(iedge)%cells(ijk)%bufferExchPlag
156  IF ( iregdes == ir .AND. regions(iregdes)%procid /= global%myProcid ) THEN
157  nbuffsizeedgesrc = nbuffsizeedgesrc +pedgecellsxbuff%nBuffSize
158  ENDIF ! iRegDes
159  ENDDO ! ijk
160 
161 #ifdef PLAG_CECELLS_MPI_DEBUG
162  IF ( nbuffsizeedgesrc > 0 ) &
163  print*,' PLAG_CECellsSendSize: procId, iReg, iR, procIdiR, iEdge, nBuffSizeEdgeSrc,iRegDes = ',&
164  global%myProcid, ireg, ir, regions(ir)%procid ,iedge, nbuffsizeedgesrc,iregdes
165 #endif
166 
167 2999 CONTINUE
168  ENDDO ! iEdge
169 
170 ! =============================================================================
171 ! Loop over corners of source region
172 ! Loading buffer size for corner
173 ! =============================================================================
174 
175  DO icorner=1,ncorners
176  IF (.NOT. plevelsrc%cornerCells(icorner)%interact) goto 3999
177 
178 ! -- Bypass for degenerate corner cells ---------------------------------------
179 
180  IF( plevelsrc%cornerCells(icorner)%degenrt /= degenerat_none ) goto 3999
181 
182  DO ijk=1,ubound(plevelsrc%cornerCells(icorner)%cells,1)
183  iregdes = plevelsrc%cornerCells(icorner)%cells(ijk)%srcRegion
184  pcorncellsxbuff => plevelsrc%cornerCells(icorner)%cells(ijk)%bufferExchPlag
185  IF ( iregdes == ir .AND. regions(iregdes)%procid /= global%myProcid ) THEN
186  nbuffsizecornsrc = nbuffsizecornsrc +pcorncellsxbuff%nBuffSize
187  ENDIF ! iRegDes
188  ENDDO ! ijk
189 
190 #ifdef PLAG_CECELLS_MPI_DEBUG
191  IF ( nbuffsizecornsrc > 0 ) &
192  print*,' PLAG_CECellsSendSize : procId, iReg, iR, iCorner, nBuffSizeCornSrc,iRegDes = ',&
193  global%myProcid, ireg, ir, regions(ir)%procid ,icorner, nbuffsizecornsrc,iregdes
194 #endif
195 
196 3999 CONTINUE
197  ENDDO ! iCorner
198 
199 ! =============================================================================
200 ! Send buffers to destination processor
201 ! =============================================================================
202 
203  nbuffsizetotsrc = nbuffsizecornsrc +nbuffsizeedgesrc
204  psendeccell%nBuffSizePlag = nbuffsizetotsrc
205  irequestplag = psendeccell%iRequestPlag
206 
207 #ifdef MPI
208  dest = regions(ir)%procid
209  tag = regions(ir)%localNumber +plag_tag_shift +mpi_patchoff +1000
210 
211  IF(tag .gt. global%mpiTagMax) tag = mod(tag,global%mpiTagMax)
212 #ifdef PLAG_CECELLS_MPI_DEBUG
213  IF ( nbuffsizetotsrc > 0 ) &
214  print*,' PLAG_CECellsSendSize: iRegDes, iRegSrc, procDes, procSrc, tagSrc, nBuffSizePlag = ',&
215  ir, ireg, dest, global%myProcid,tag, psendeccell%nBuffSizePlag
216 #endif
217 
218  CALL mpi_isend( psendeccell%nBuffSizePlag,ndimbuffsize,mpi_integer, &
219  dest,tag,global%mpiComm, &
220  pplag%requestsCECells(irequestplag),global%mpierr )
221  IF ( global%mpierr /= err_none ) &
222  CALL errorstop( global,err_mpi_trouble,__line__ )
223 #endif
224 
225  ENDIF ! some cells to send
226 
227 1999 CONTINUE
228  ENDDO ! ir
229 
230 ! ******************************************************************************
231 ! finalize
232 ! ******************************************************************************
233 
234  CALL deregisterfunction( global )
235 
236 END SUBROUTINE plag_cecellssendsize
237 
238 !******************************************************************************
239 !
240 ! RCS Revision history:
241 !
242 ! $Log: PLAG_CECellsSendSize.F90,v $
243 ! Revision 1.5 2009/03/02 00:19:36 mtcampbe
244 ! Added some ifdefs around Rocflo to disable particle injection on INFLOW
245 ! boundaries and added some checks around MPI tags utilizing a new global
246 ! data item, global%mpiTagMax.
247 !
248 ! Revision 1.4 2008/12/06 08:44:33 mtcampbe
249 ! Updated license.
250 !
251 ! Revision 1.3 2008/11/19 22:17:45 mtcampbe
252 ! Added Illinois Open Source License/Copyright
253 !
254 ! Revision 1.2 2006/04/07 15:19:23 haselbac
255 ! Removed tabs
256 !
257 ! Revision 1.1 2004/12/01 20:57:20 fnajjar
258 ! Initial revision after changing case
259 !
260 ! Revision 1.4 2004/11/29 19:26:25 fnajjar
261 ! Added bypass statement for dengerate cells
262 !
263 ! Revision 1.3 2004/03/20 21:33:20 fnajjar
264 ! Reset buffer sizes in active communicating regions to zero
265 !
266 ! Revision 1.2 2004/03/10 23:42:31 fnajjar
267 ! Activated IF-statement based on buffer size in ifdef construct
268 !
269 ! Revision 1.1 2004/03/10 23:16:09 fnajjar
270 ! Initial import of routines to MPI-communicate buffer sizes
271 !
272 !******************************************************************************
273 
274 
275 
276 
277 
278 
279 
j indices k indices k
Definition: Indexing.h:6
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
IndexType nedges() const
Definition: Mesh.H:564
blockLoc i
Definition: read.cpp:79
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE icorner
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE icell
virtual std::ostream & print(std::ostream &os) const
j indices j
Definition: Indexing.h:6
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine plag_cecellssendsize(regions, iReg)
subroutine deregisterfunction(global)
Definition: ModError.F90:469