Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_ExchangeGeometryRecv.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: receive geometry of dummy nodes from adjacent region on
26 ! another processor.
27 !
28 ! Description: none.
29 !
30 ! Input: region = current region
31 ! regionSrc = source region
32 ! patch = current patch of region
33 ! patchSrc = source patch of regionSrc.
34 !
35 ! Output: region%levels(1)%grid%xyz = grid coordinates.
36 !
37 ! Notes: operation carried out for the finest grid only. Intended for
38 ! conforming grid boundaries (also periodic) only. In the case
39 ! of rotationally periodic boundary, it is assumed that the
40 ! axis of rotation coincides with the x-axis.
41 !
42 !******************************************************************************
43 !
44 ! $Id: RFLO_ExchangeGeometryRecv.F90,v 1.4 2008/12/06 08:44:27 mtcampbe Exp $
45 !
46 ! Copyright: (c) 2001 by the University of Illinois
47 !
48 !******************************************************************************
49 
50 SUBROUTINE rflo_exchangegeometryrecv( region,regionSrc,patch,patchSrc )
51 
52  USE moddatatypes
53  USE modbndpatch, ONLY : t_patch
54  USE moddatastruct, ONLY : t_region
55  USE modglobal, ONLY : t_global
57  USE moderror
58  USE modmpi
59  USE modparameters
60  IMPLICIT NONE
61 
62 #include "Indexing.h"
63 
64 ! ... parameters
65  TYPE(t_region) :: region, regionsrc
66  TYPE(t_patch) :: patch, patchsrc
67 
68 ! ... loop variables
69  INTEGER :: idum, i, j, k, ijkbuff
70 
71 ! ... local variables
72 #ifdef MPI
73  INTEGER :: status(mpi_status_size)
74 #endif
75  INTEGER :: bctype, ibeg, iend, jbeg, jend, kbeg, kend, inoff, ijnoff, &
76  ijkn, ijknb, ibnd, jbnd, kbnd, n1, n2, ndim, lb, source, tag
77 
78  REAL(RFREAL) :: dx, dy, dz, cosa, sina
79  REAL(RFREAL), POINTER :: xyz(:,:)
80 
81  TYPE(t_global), POINTER :: global
82 
83 !******************************************************************************
84 
85  global => region%global
86 
87  CALL registerfunction( global,'RFLO_ExchangeGeometryRecv',&
88  'RFLO_ExchangeGeometryRecv.F90' )
89 
90 ! check if the source region is active
91 
92  IF (regionsrc%active == off) THEN
93  CALL errorstop( global,err_srcregion_off,__line__ )
94  ENDIF
95 
96 ! get dimensions and pointers
97 
98  CALL rflo_getpatchindicesnodes( region,patch,1,ibeg,iend, &
99  jbeg,jend,kbeg,kend )
100  CALL rflo_getnodeoffset( region,1,inoff,ijnoff )
101 
102  xyz => region%levels(1)%grid%xyz
103 
104  n1 = abs(patch%l1end-patch%l1beg) + 2 ! here, dimensions of current
105  n2 = abs(patch%l2end-patch%l2beg) + 2 ! and source patch are identical
106  ndim = n1*n2*region%nDumCells ! ... but not the # of dummy cells
107 
108 ! receive data
109 
110 #ifdef MPI
111  source = regionsrc%procid
112  tag = region%localNumber + mpi_patchoff*patchsrc%srcPatch
113  CALL mpi_recv( patch%mixt%recvBuff,3*ndim,mpi_rfreal,source,tag, &
114  global%mpiComm,status,global%mpierr )
115  IF (global%mpierr /= 0) CALL errorstop( global,err_mpi_trouble,__line__ )
116 #endif
117 
118 ! copy from buffer to dummy nodes ---------------------------------------------
119 
120  lb = patch%lbound
121  bctype = patch%bcType
122  ijkbuff = 0
123 
124  DO idum=1,region%nDumCells
125 
126 ! - face i=const.
127 
128  IF (lb==1 .OR. lb==2) THEN
129 
130  IF (lb == 1) THEN
131  i = ibeg - idum
132  ibnd = ibeg
133  ELSE IF (lb == 2) THEN
134  i = iend + idum
135  ibnd = iend
136  ENDIF
137 
138  IF (bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) THEN
139  DO k=kbeg,kend
140  DO j=jbeg,jend
141  ijkn = indijk(i,j,k,inoff,ijnoff)
142  ijkbuff = ijkbuff + 1
143  xyz(xcoord,ijkn) = patch%mixt%recvBuff(ijkbuff )
144  xyz(ycoord,ijkn) = patch%mixt%recvBuff(ijkbuff+ ndim)
145  xyz(zcoord,ijkn) = patch%mixt%recvBuff(ijkbuff+2*ndim)
146  ENDDO
147  ENDDO
148  ELSE IF (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri+bc_range) THEN
149  DO k=kbeg,kend
150  DO j=jbeg,jend
151  ijkn = indijk(i ,j,k,inoff,ijnoff)
152  ijknb = indijk(ibnd,j,k,inoff,ijnoff)
153  ijkbuff = ijkbuff + 1
154  dx = patch%mixt%recvBuff(ijkbuff )
155  dy = patch%mixt%recvBuff(ijkbuff+ ndim)
156  dz = patch%mixt%recvBuff(ijkbuff+2*ndim)
157  xyz(xcoord,ijkn) = xyz(xcoord,ijknb) + dx
158  xyz(ycoord,ijkn) = xyz(ycoord,ijknb) + dy
159  xyz(zcoord,ijkn) = xyz(zcoord,ijknb) + dz
160  ENDDO
161  ENDDO
162  ELSE IF (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri+bc_range) THEN
163  cosa = cos(patch%periodAngle)
164  sina = sin(patch%periodAngle)
165  DO k=kbeg,kend
166  DO j=jbeg,jend
167  ijkn = indijk(i,j,k,inoff,ijnoff)
168  ijkbuff = ijkbuff + 1
169  dy = patch%mixt%recvBuff(ijkbuff+ ndim)
170  dz = patch%mixt%recvBuff(ijkbuff+2*ndim)
171  xyz(xcoord,ijkn) = patch%mixt%recvBuff(ijkbuff)
172  xyz(ycoord,ijkn) = cosa*dy - sina*dz
173  xyz(zcoord,ijkn) = sina*dy + cosa*dz
174  ENDDO
175  ENDDO
176  ENDIF
177 
178 ! - face j=const.
179 
180  ELSE IF (lb==3 .OR. lb==4) THEN
181 
182  IF (lb == 3) THEN
183  j = jbeg - idum
184  jbnd = jbeg
185  ELSE IF (lb == 4) THEN
186  j = jend + idum
187  jbnd = jend
188  ENDIF
189 
190  IF (bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) THEN
191  DO i=ibeg,iend
192  DO k=kbeg,kend
193  ijkn = indijk(i,j,k,inoff,ijnoff)
194  ijkbuff = ijkbuff + 1
195  xyz(xcoord,ijkn) = patch%mixt%recvBuff(ijkbuff )
196  xyz(ycoord,ijkn) = patch%mixt%recvBuff(ijkbuff+ ndim)
197  xyz(zcoord,ijkn) = patch%mixt%recvBuff(ijkbuff+2*ndim)
198  ENDDO
199  ENDDO
200  ELSE IF (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri+bc_range) THEN
201  DO i=ibeg,iend
202  DO k=kbeg,kend
203  ijkn = indijk(i,j ,k,inoff,ijnoff)
204  ijknb = indijk(i,jbnd,k,inoff,ijnoff)
205  ijkbuff = ijkbuff + 1
206  dx = patch%mixt%recvBuff(ijkbuff )
207  dy = patch%mixt%recvBuff(ijkbuff+ ndim)
208  dz = patch%mixt%recvBuff(ijkbuff+2*ndim)
209  xyz(xcoord,ijkn) = xyz(xcoord,ijknb) + dx
210  xyz(ycoord,ijkn) = xyz(ycoord,ijknb) + dy
211  xyz(zcoord,ijkn) = xyz(zcoord,ijknb) + dz
212  ENDDO
213  ENDDO
214  ELSE IF (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri+bc_range) THEN
215  cosa = cos(patch%periodAngle)
216  sina = sin(patch%periodAngle)
217  DO i=ibeg,iend
218  DO k=kbeg,kend
219  ijkn = indijk(i,j,k,inoff,ijnoff)
220  ijkbuff = ijkbuff + 1
221  dy = patch%mixt%recvBuff(ijkbuff+ ndim)
222  dz = patch%mixt%recvBuff(ijkbuff+2*ndim)
223  xyz(xcoord,ijkn) = patch%mixt%recvBuff(ijkbuff)
224  xyz(ycoord,ijkn) = cosa*dy - sina*dz
225  xyz(zcoord,ijkn) = sina*dy + cosa*dz
226  ENDDO
227  ENDDO
228  ENDIF
229 
230 ! - face k=const.
231 
232  ELSE IF (lb==5 .OR. lb==6) THEN
233 
234  IF (lb == 5) THEN
235  k = kbeg - idum
236  kbnd = kbeg
237  ELSE IF (lb == 6) THEN
238  k = kend + idum
239  kbnd = kend
240  ENDIF
241 
242  IF (bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) THEN
243  DO j=jbeg,jend
244  DO i=ibeg,iend
245  ijkn = indijk(i,j,k,inoff,ijnoff)
246  ijkbuff = ijkbuff + 1
247  xyz(xcoord,ijkn) = patch%mixt%recvBuff(ijkbuff )
248  xyz(ycoord,ijkn) = patch%mixt%recvBuff(ijkbuff+ ndim)
249  xyz(zcoord,ijkn) = patch%mixt%recvBuff(ijkbuff+2*ndim)
250  ENDDO
251  ENDDO
252  ELSE IF (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri+bc_range) THEN
253  DO j=jbeg,jend
254  DO i=ibeg,iend
255  ijkn = indijk(i,j,k ,inoff,ijnoff)
256  ijknb = indijk(i,j,kbnd,inoff,ijnoff)
257  ijkbuff = ijkbuff + 1
258  dx = patch%mixt%recvBuff(ijkbuff )
259  dy = patch%mixt%recvBuff(ijkbuff+ ndim)
260  dz = patch%mixt%recvBuff(ijkbuff+2*ndim)
261  xyz(xcoord,ijkn) = xyz(xcoord,ijknb) + dx
262  xyz(ycoord,ijkn) = xyz(ycoord,ijknb) + dy
263  xyz(zcoord,ijkn) = xyz(zcoord,ijknb) + dz
264  ENDDO
265  ENDDO
266  ELSE IF (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri+bc_range) THEN
267  cosa = cos(patch%periodAngle)
268  sina = sin(patch%periodAngle)
269  DO j=jbeg,jend
270  DO i=ibeg,iend
271  ijkn = indijk(i,j,k,inoff,ijnoff)
272  ijkbuff = ijkbuff + 1
273  dy = patch%mixt%recvBuff(ijkbuff+ ndim)
274  dz = patch%mixt%recvBuff(ijkbuff+2*ndim)
275  xyz(xcoord,ijkn) = patch%mixt%recvBuff(ijkbuff)
276  xyz(ycoord,ijkn) = cosa*dy - sina*dz
277  xyz(zcoord,ijkn) = sina*dy + cosa*dz
278  ENDDO
279  ENDDO
280  ENDIF
281 
282  ENDIF ! lb
283 
284  ENDDO ! idum
285 
286 ! finalize --------------------------------------------------------------------
287 
288  CALL deregisterfunction( global )
289 
290 END SUBROUTINE rflo_exchangegeometryrecv
291 
292 !******************************************************************************
293 !
294 ! RCS Revision history:
295 !
296 ! $Log: RFLO_ExchangeGeometryRecv.F90,v $
297 ! Revision 1.4 2008/12/06 08:44:27 mtcampbe
298 ! Updated license.
299 !
300 ! Revision 1.3 2008/11/19 22:17:37 mtcampbe
301 ! Added Illinois Open Source License/Copyright
302 !
303 ! Revision 1.2 2006/08/19 15:39:37 mparmar
304 ! Renamed patch variables
305 !
306 ! Revision 1.1 2004/11/29 20:51:39 wasistho
307 ! lower to upper case
308 !
309 ! Revision 1.13 2003/11/20 16:40:39 mdbrandy
310 ! Backing out RocfluidMP changes from 11-17-03
311 !
312 ! Revision 1.9 2003/05/15 02:57:04 jblazek
313 ! Inlined index function.
314 !
315 ! Revision 1.8 2002/09/27 00:57:10 jblazek
316 ! Changed makefiles - no makelinks needed.
317 !
318 ! Revision 1.7 2002/09/20 22:22:36 jblazek
319 ! Finalized integration into GenX.
320 !
321 ! Revision 1.6 2002/09/05 17:40:21 jblazek
322 ! Variable global moved into regions().
323 !
324 ! Revision 1.5 2002/06/22 01:13:38 jblazek
325 ! Modified interfaces to BC routines.
326 !
327 ! Revision 1.4 2002/04/01 19:36:08 jblazek
328 ! Added routine to clear send requests.
329 !
330 ! Revision 1.3 2002/03/30 00:50:49 jblazek
331 ! Cleaned up with flint.
332 !
333 ! Revision 1.2 2002/03/29 23:15:22 jblazek
334 ! Corrected bug in MPI send.
335 !
336 ! Revision 1.1 2002/03/18 23:11:33 jblazek
337 ! Finished multiblock and MPI.
338 !
339 !******************************************************************************
340 
341 
342 
343 
344 
345 
346 
**********************************************************************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 ibeg
subroutine rflo_exchangegeometryrecv(region, regionSrc, patch, patchSrc)
j indices k indices k
Definition: Indexing.h:6
NT dx
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
Definition: patch.h:74
**********************************************************************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 knode iend
NT & sin
subroutine rflo_getpatchindicesnodes(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
blockLoc i
Definition: read.cpp:79
RT dz() const
Definition: Direction_3.h:133
j indices j
Definition: Indexing.h:6
NT dy
**********************************************************************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 knode jend
CGAL::Point_2< R > source() const
Definition: Ray_2.h:128
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
**********************************************************************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 knode jbeg
**********************************************************************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 knode kbeg
subroutine deregisterfunction(global)
Definition: ModError.F90:469
NT & cos