Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_SendDummyConf.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 values to dummy cells of the corresponding patch
26 ! of the adjacent region which is on another processor.
27 !
28 ! Description: none.
29 !
30 ! Input: region = current region
31 ! regionSrc = region to send data to
32 ! patch = current patch of region.
33 !
34 ! Output: patch%mixt%nSendBuff = send buffer.
35 !
36 ! Notes: intended for conforming grid boundaries only.
37 !
38 !******************************************************************************
39 !
40 ! $Id: RFLO_SendDummyConf.F90,v 1.4 2008/12/06 08:44:28 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2001 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE rflo_senddummyconf( region,regionSrc,patch )
47 
48  USE moddatatypes
49  USE modglobal, ONLY : t_global
50  USE moddatastruct, ONLY : t_region
51  USE modbndpatch, ONLY : t_patch
53  USE moderror
54  USE modmpi
55  USE modparameters
56  IMPLICIT NONE
57 
58 #include "Indexing.h"
59 
60 ! ... parameters
61  TYPE(t_region) :: region, regionsrc
62  TYPE(t_patch) :: patch
63 
64 ! ... loop variables
65  INTEGER :: idum, i, j, k, ijkbuff
66 
67 ! ... local variables
68  INTEGER :: ilev, ibeg, iend, jbeg, jend, kbeg, kend, icoff, ijcoff, ijkc, &
69  n1, n2, ndim, dest, tag
70  INTEGER :: lb, l1srcdir, l2srcdir, l1beg, l1end, l1step, l2beg, l2end, l2step
71 
72  LOGICAL :: align
73 
74  REAL(RFREAL), POINTER :: cv(:,:)
75 
76  TYPE(t_global), POINTER :: global
77 
78 !******************************************************************************
79 
80  global => region%global
81 
82  CALL registerfunction( global,'RFLO_SendDummyConf',&
83  'RFLO_SendDummyConf.F90' )
84 
85 ! check if the source region is active
86 
87  IF (regionsrc%active == off) THEN
88  CALL errorstop( global,err_srcregion_off,__line__ )
89  ENDIF
90 
91 ! get dimensions and pointers
92 
93  ilev = region%currLevel
94 
95  CALL rflo_getpatchindices( region,patch,ilev,ibeg,iend, &
96  jbeg,jend,kbeg,kend )
97  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
98 
99  cv => region%levels(ilev)%mixt%cv
100 
101  n1 = abs(patch%l1end-patch%l1beg) + 1 ! here, dimensions of current
102  n2 = abs(patch%l2end-patch%l2beg) + 1 ! and source patch are identical
103  ndim = n1*n2*regionsrc%nDumCells ! ... but not the # of dummy cells
104 
105 ! mapping between patches
106 
107  l1srcdir = 1
108  IF (patch%srcL1beg > patch%srcL1end) l1srcdir = -1
109  l2srcdir = 1
110  IF (patch%srcL2beg > patch%srcL2end) l2srcdir = -1
111 
112  lb = patch%lbound
113  align = patch%align
114 
115 ! loop over interior cells of current patch -----------------------------------
116 
117  ijkbuff = 0
118 
119  DO idum=0,regionsrc%nDumCells-1
120 
121 ! - face i=const.
122 
123  IF (lb==1 .OR. lb==2) THEN
124 
125  IF (lb == 1) i = ibeg + idum
126  IF (lb == 2) i = iend - idum
127  IF (align) THEN
128  IF (l1srcdir > 0) THEN
129  l1beg = jbeg
130  l1end = jend
131  ELSE
132  l1beg = jend
133  l1end = jbeg
134  ENDIF
135  l1step = l1srcdir
136  IF (l2srcdir > 0) THEN
137  l2beg = kbeg
138  l2end = kend
139  ELSE
140  l2beg = kend
141  l2end = kbeg
142  ENDIF
143  l2step = l2srcdir
144  DO k=l2beg,l2end,l2step
145  DO j=l1beg,l1end,l1step
146  ijkc = indijk(i,j,k,icoff,ijcoff)
147  ijkbuff = ijkbuff + 1
148  patch%mixt%sendBuff(ijkbuff ) = cv(cv_mixt_dens,ijkc)
149  patch%mixt%sendBuff(ijkbuff+ ndim) = cv(cv_mixt_xmom,ijkc)
150  patch%mixt%sendBuff(ijkbuff+2*ndim) = cv(cv_mixt_ymom,ijkc)
151  patch%mixt%sendBuff(ijkbuff+3*ndim) = cv(cv_mixt_zmom,ijkc)
152  patch%mixt%sendBuff(ijkbuff+4*ndim) = cv(cv_mixt_ener,ijkc)
153  ENDDO
154  ENDDO
155  ELSE
156  IF (l1srcdir > 0) THEN
157  l1beg = kbeg
158  l1end = kend
159  ELSE
160  l1beg = kend
161  l1end = kbeg
162  ENDIF
163  l1step = l1srcdir
164  IF (l2srcdir > 0) THEN
165  l2beg = jbeg
166  l2end = jend
167  ELSE
168  l2beg = jend
169  l2end = jbeg
170  ENDIF
171  l2step = l2srcdir
172  DO j=l2beg,l2end,l2step
173  DO k=l1beg,l1end,l1step
174  ijkc = indijk(i,j,k,icoff,ijcoff)
175  ijkbuff = ijkbuff + 1
176  patch%mixt%sendBuff(ijkbuff ) = cv(cv_mixt_dens,ijkc)
177  patch%mixt%sendBuff(ijkbuff+ ndim) = cv(cv_mixt_xmom,ijkc)
178  patch%mixt%sendBuff(ijkbuff+2*ndim) = cv(cv_mixt_ymom,ijkc)
179  patch%mixt%sendBuff(ijkbuff+3*ndim) = cv(cv_mixt_zmom,ijkc)
180  patch%mixt%sendBuff(ijkbuff+4*ndim) = cv(cv_mixt_ener,ijkc)
181  ENDDO
182  ENDDO
183  ENDIF
184 
185 ! - face j=const.
186 
187  ELSE IF (lb==3 .OR. lb==4) THEN
188 
189  IF (lb == 3) j = jbeg + idum
190  IF (lb == 4) j = jend - idum
191  IF (align) THEN
192  IF (l1srcdir > 0) THEN
193  l1beg = kbeg
194  l1end = kend
195  ELSE
196  l1beg = kend
197  l1end = kbeg
198  ENDIF
199  l1step = l1srcdir
200  IF (l2srcdir > 0) THEN
201  l2beg = ibeg
202  l2end = iend
203  ELSE
204  l2beg = iend
205  l2end = ibeg
206  ENDIF
207  l2step = l2srcdir
208  DO i=l2beg,l2end,l2step
209  DO k=l1beg,l1end,l1step
210  ijkc = indijk(i,j,k,icoff,ijcoff)
211  ijkbuff = ijkbuff + 1
212  patch%mixt%sendBuff(ijkbuff ) = cv(cv_mixt_dens,ijkc)
213  patch%mixt%sendBuff(ijkbuff+ ndim) = cv(cv_mixt_xmom,ijkc)
214  patch%mixt%sendBuff(ijkbuff+2*ndim) = cv(cv_mixt_ymom,ijkc)
215  patch%mixt%sendBuff(ijkbuff+3*ndim) = cv(cv_mixt_zmom,ijkc)
216  patch%mixt%sendBuff(ijkbuff+4*ndim) = cv(cv_mixt_ener,ijkc)
217  ENDDO
218  ENDDO
219  ELSE
220  IF (l1srcdir > 0) THEN
221  l1beg = ibeg
222  l1end = iend
223  ELSE
224  l1beg = iend
225  l1end = ibeg
226  ENDIF
227  l1step = l1srcdir
228  IF (l2srcdir > 0) THEN
229  l2beg = kbeg
230  l2end = kend
231  ELSE
232  l2beg = kend
233  l2end = kbeg
234  ENDIF
235  l2step = l2srcdir
236  DO k=l2beg,l2end,l2step
237  DO i=l1beg,l1end,l1step
238  ijkc = indijk(i,j,k,icoff,ijcoff)
239  ijkbuff = ijkbuff + 1
240  patch%mixt%sendBuff(ijkbuff ) = cv(cv_mixt_dens,ijkc)
241  patch%mixt%sendBuff(ijkbuff+ ndim) = cv(cv_mixt_xmom,ijkc)
242  patch%mixt%sendBuff(ijkbuff+2*ndim) = cv(cv_mixt_ymom,ijkc)
243  patch%mixt%sendBuff(ijkbuff+3*ndim) = cv(cv_mixt_zmom,ijkc)
244  patch%mixt%sendBuff(ijkbuff+4*ndim) = cv(cv_mixt_ener,ijkc)
245  ENDDO
246  ENDDO
247  ENDIF
248 
249 ! - face k=const.
250 
251  ELSE IF (lb==5 .OR. lb==6) THEN
252 
253  IF (lb == 5) k = kbeg + idum
254  IF (lb == 6) k = kend - idum
255  IF (align) THEN
256  IF (l1srcdir > 0) THEN
257  l1beg = ibeg
258  l1end = iend
259  ELSE
260  l1beg = iend
261  l1end = ibeg
262  ENDIF
263  l1step = l1srcdir
264  IF (l2srcdir > 0) THEN
265  l2beg = jbeg
266  l2end = jend
267  ELSE
268  l2beg = jend
269  l2end = jbeg
270  ENDIF
271  l2step = l2srcdir
272  DO j=l2beg,l2end,l2step
273  DO i=l1beg,l1end,l1step
274  ijkc = indijk(i,j,k,icoff,ijcoff)
275  ijkbuff = ijkbuff + 1
276  patch%mixt%sendBuff(ijkbuff ) = cv(cv_mixt_dens,ijkc)
277  patch%mixt%sendBuff(ijkbuff+ ndim) = cv(cv_mixt_xmom,ijkc)
278  patch%mixt%sendBuff(ijkbuff+2*ndim) = cv(cv_mixt_ymom,ijkc)
279  patch%mixt%sendBuff(ijkbuff+3*ndim) = cv(cv_mixt_zmom,ijkc)
280  patch%mixt%sendBuff(ijkbuff+4*ndim) = cv(cv_mixt_ener,ijkc)
281  ENDDO
282  ENDDO
283  ELSE
284  IF (l1srcdir > 0) THEN
285  l1beg = jbeg
286  l1end = jend
287  ELSE
288  l1beg = jend
289  l1end = jbeg
290  ENDIF
291  l1step = l1srcdir
292  IF (l2srcdir > 0) THEN
293  l2beg = ibeg
294  l2end = iend
295  ELSE
296  l2beg = iend
297  l2end = ibeg
298  ENDIF
299  l2step = l2srcdir
300  DO i=l2beg,l2end,l2step
301  DO j=l1beg,l1end,l1step
302  ijkc = indijk(i,j,k,icoff,ijcoff)
303  ijkbuff = ijkbuff + 1
304  patch%mixt%sendBuff(ijkbuff ) = cv(cv_mixt_dens,ijkc)
305  patch%mixt%sendBuff(ijkbuff+ ndim) = cv(cv_mixt_xmom,ijkc)
306  patch%mixt%sendBuff(ijkbuff+2*ndim) = cv(cv_mixt_ymom,ijkc)
307  patch%mixt%sendBuff(ijkbuff+3*ndim) = cv(cv_mixt_zmom,ijkc)
308  patch%mixt%sendBuff(ijkbuff+4*ndim) = cv(cv_mixt_ener,ijkc)
309  ENDDO
310  ENDDO
311  ENDIF
312 
313  ENDIF ! lb
314 
315  ENDDO ! idum
316 
317 ! send data
318 
319 #ifdef MPI
320  dest = regionsrc%procid
321  tag = regionsrc%localNumber + mpi_patchoff*patch%srcPatch
322  CALL mpi_isend( patch%mixt%sendBuff,cv_mixt_neqs*ndim,mpi_rfreal, &
323  dest,tag,global%mpiComm, &
324  global%requests(patch%mixt%iRequest),global%mpierr )
325  IF (global%mpierr /= 0) CALL errorstop( global,err_mpi_trouble,__line__ )
326 #endif
327 
328 ! finalize
329 
330  CALL deregisterfunction( global )
331 
332 END SUBROUTINE rflo_senddummyconf
333 
334 !******************************************************************************
335 !
336 ! RCS Revision history:
337 !
338 ! $Log: RFLO_SendDummyConf.F90,v $
339 ! Revision 1.4 2008/12/06 08:44:28 mtcampbe
340 ! Updated license.
341 !
342 ! Revision 1.3 2008/11/19 22:17:38 mtcampbe
343 ! Added Illinois Open Source License/Copyright
344 !
345 ! Revision 1.2 2006/08/19 15:39:44 mparmar
346 ! Renamed patch variables
347 !
348 ! Revision 1.1 2004/11/29 20:51:40 wasistho
349 ! lower to upper case
350 !
351 ! Revision 1.13 2003/11/20 16:40:40 mdbrandy
352 ! Backing out RocfluidMP changes from 11-17-03
353 !
354 ! Revision 1.9 2003/05/15 02:57:04 jblazek
355 ! Inlined index function.
356 !
357 ! Revision 1.8 2002/09/27 00:57:10 jblazek
358 ! Changed makefiles - no makelinks needed.
359 !
360 ! Revision 1.7 2002/09/20 22:22:36 jblazek
361 ! Finalized integration into GenX.
362 !
363 ! Revision 1.6 2002/09/05 17:40:22 jblazek
364 ! Variable global moved into regions().
365 !
366 ! Revision 1.5 2002/03/30 00:50:49 jblazek
367 ! Cleaned up with flint.
368 !
369 ! Revision 1.4 2002/03/29 23:15:22 jblazek
370 ! Corrected bug in MPI send.
371 !
372 ! Revision 1.3 2002/03/18 23:11:33 jblazek
373 ! Finished multiblock and MPI.
374 !
375 ! Revision 1.2 2002/02/21 23:25:06 jblazek
376 ! Blocks renamed as regions.
377 !
378 ! Revision 1.1 2002/01/28 23:55:22 jblazek
379 ! Added flux computation (central scheme).
380 !
381 !******************************************************************************
382 
383 
384 
385 
386 
387 
388 
**********************************************************************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
j indices k indices k
Definition: Indexing.h:6
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_getpatchindices(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
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
blockLoc i
Definition: read.cpp:79
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
subroutine rflo_senddummyconf(region, regionSrc, patch)
j indices j
Definition: Indexing.h:6
**********************************************************************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
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