Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RADI_floFlimSendDummyConf.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 FLD radiation data to dummy cells of the corresponding patch
26 ! of the adjacent region located 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%valRadi%nSendBuff = send buffer.
35 !
36 ! Notes: intended for conforming grid boundaries only.
37 !
38 !******************************************************************************
39 !
40 ! $Id: RADI_floFlimSendDummyConf.F90,v 1.3 2008/12/06 08:44:38 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2003 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE radi_floflimsenddummyconf( 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
57  IMPLICIT NONE
58 
59 #include "Indexing.h"
60 
61 ! ... parameters
62  TYPE(t_region) :: region, regionsrc
63  TYPE(t_patch) :: patch
64 
65 ! ... loop variables
66  INTEGER :: idum, i, j, k, l, ijkbuff
67 
68 ! ... local variables
69  INTEGER :: ilev, ibeg, iend, jbeg, jend, kbeg, kend, icoff, ijcoff, ijkc, &
70  n1, n2, ndim, dest, tag
71  INTEGER :: lb, l1srcdir, l2srcdir, l1beg, l1end, l1step, l2beg, l2end, l2step
72  INTEGER :: ncv
73 
74  LOGICAL :: align
75 
76  REAL(RFREAL), POINTER :: rcv(:,:)
77 
78  TYPE(t_global), POINTER :: global
79 
80 !******************************************************************************
81 
82  global => region%global
83 
84  CALL registerfunction( global,'RADI_FloFlimSendDummyConf',&
85  'RADI_floFlimSendDummyConf.F90' )
86 
87 ! check if the source region is active
88 
89  IF (regionsrc%active == off) THEN
90  CALL errorstop( global,err_srcregion_off,__line__ )
91  ENDIF
92 
93 ! get dimensions and pointers
94 
95  ilev = region%currLevel
96 
97  CALL rflo_getpatchindices( region,patch,ilev,ibeg,iend, &
98  jbeg,jend,kbeg,kend )
99  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
100 
101  rcv => region%levels(ilev)%radi%cv
102  ncv = region%radiInput%nCv
103 
104  n1 = abs(patch%l1end-patch%l1beg) + 1 ! here, dimensions of current
105  n2 = abs(patch%l2end-patch%l2beg) + 1 ! and source patch are identical
106  ndim = n1*n2*regionsrc%nDumCells ! ... but not the # of dummy cells
107 
108 ! mapping between patches
109 
110  l1srcdir = 1
111  IF (patch%srcL1beg > patch%srcL1end) l1srcdir = -1
112  l2srcdir = 1
113  IF (patch%srcL2beg > patch%srcL2end) l2srcdir = -1
114 
115  lb = patch%lbound
116  align = patch%align
117 
118 ! loop over interior cells of current patch -----------------------------------
119 
120  ijkbuff = 0
121 
122  DO idum=0,regionsrc%nDumCells-1
123 
124 ! - face i=const.
125 
126  IF (lb==1 .OR. lb==2) THEN
127 
128  IF (lb == 1) i = ibeg + idum
129  IF (lb == 2) i = iend - idum
130  IF (align) THEN
131  IF (l1srcdir > 0) THEN
132  l1beg = jbeg
133  l1end = jend
134  ELSE
135  l1beg = jend
136  l1end = jbeg
137  ENDIF
138  l1step = l1srcdir
139  IF (l2srcdir > 0) THEN
140  l2beg = kbeg
141  l2end = kend
142  ELSE
143  l2beg = kend
144  l2end = kbeg
145  ENDIF
146  l2step = l2srcdir
147  DO k=l2beg,l2end,l2step
148  DO j=l1beg,l1end,l1step
149  ijkc = indijk(i,j,k,icoff,ijcoff)
150  ijkbuff = ijkbuff + 1
151  DO l=1,ncv
152  patch%valRadi%sendBuff(ijkbuff+(l-1)*ndim) = rcv(l,ijkc)
153  ENDDO
154  ENDDO
155  ENDDO
156  ELSE
157  IF (l1srcdir > 0) THEN
158  l1beg = kbeg
159  l1end = kend
160  ELSE
161  l1beg = kend
162  l1end = kbeg
163  ENDIF
164  l1step = l1srcdir
165  IF (l2srcdir > 0) THEN
166  l2beg = jbeg
167  l2end = jend
168  ELSE
169  l2beg = jend
170  l2end = jbeg
171  ENDIF
172  l2step = l2srcdir
173  DO j=l2beg,l2end,l2step
174  DO k=l1beg,l1end,l1step
175  ijkc = indijk(i,j,k,icoff,ijcoff)
176  ijkbuff = ijkbuff + 1
177  DO l=1,ncv
178  patch%valRadi%sendBuff(ijkbuff+(l-1)*ndim) = rcv(l,ijkc)
179  ENDDO
180  ENDDO
181  ENDDO
182  ENDIF
183 
184 ! - face j=const.
185 
186  ELSE IF (lb==3 .OR. lb==4) THEN
187 
188  IF (lb == 3) j = jbeg + idum
189  IF (lb == 4) j = jend - idum
190  IF (align) THEN
191  IF (l1srcdir > 0) THEN
192  l1beg = kbeg
193  l1end = kend
194  ELSE
195  l1beg = kend
196  l1end = kbeg
197  ENDIF
198  l1step = l1srcdir
199  IF (l2srcdir > 0) THEN
200  l2beg = ibeg
201  l2end = iend
202  ELSE
203  l2beg = iend
204  l2end = ibeg
205  ENDIF
206  l2step = l2srcdir
207  DO i=l2beg,l2end,l2step
208  DO k=l1beg,l1end,l1step
209  ijkc = indijk(i,j,k,icoff,ijcoff)
210  ijkbuff = ijkbuff + 1
211  DO l=1,ncv
212  patch%valRadi%sendBuff(ijkbuff+(l-1)*ndim) = rcv(l,ijkc)
213  ENDDO
214  ENDDO
215  ENDDO
216  ELSE
217  IF (l1srcdir > 0) THEN
218  l1beg = ibeg
219  l1end = iend
220  ELSE
221  l1beg = iend
222  l1end = ibeg
223  ENDIF
224  l1step = l1srcdir
225  IF (l2srcdir > 0) THEN
226  l2beg = kbeg
227  l2end = kend
228  ELSE
229  l2beg = kend
230  l2end = kbeg
231  ENDIF
232  l2step = l2srcdir
233  DO k=l2beg,l2end,l2step
234  DO i=l1beg,l1end,l1step
235  ijkc = indijk(i,j,k,icoff,ijcoff)
236  ijkbuff = ijkbuff + 1
237  DO l=1,ncv
238  patch%valRadi%sendBuff(ijkbuff+(l-1)*ndim) = rcv(l,ijkc)
239  ENDDO
240  ENDDO
241  ENDDO
242  ENDIF
243 
244 ! - face k=const.
245 
246  ELSE IF (lb==5 .OR. lb==6) THEN
247 
248  IF (lb == 5) k = kbeg + idum
249  IF (lb == 6) k = kend - idum
250  IF (align) THEN
251  IF (l1srcdir > 0) THEN
252  l1beg = ibeg
253  l1end = iend
254  ELSE
255  l1beg = iend
256  l1end = ibeg
257  ENDIF
258  l1step = l1srcdir
259  IF (l2srcdir > 0) THEN
260  l2beg = jbeg
261  l2end = jend
262  ELSE
263  l2beg = jend
264  l2end = jbeg
265  ENDIF
266  l2step = l2srcdir
267  DO j=l2beg,l2end,l2step
268  DO i=l1beg,l1end,l1step
269  ijkc = indijk(i,j,k,icoff,ijcoff)
270  ijkbuff = ijkbuff + 1
271  DO l=1,ncv
272  patch%valRadi%sendBuff(ijkbuff+(l-1)*ndim) = rcv(l,ijkc)
273  ENDDO
274  ENDDO
275  ENDDO
276  ELSE
277  IF (l1srcdir > 0) THEN
278  l1beg = jbeg
279  l1end = jend
280  ELSE
281  l1beg = jend
282  l1end = jbeg
283  ENDIF
284  l1step = l1srcdir
285  IF (l2srcdir > 0) THEN
286  l2beg = ibeg
287  l2end = iend
288  ELSE
289  l2beg = iend
290  l2end = ibeg
291  ENDIF
292  l2step = l2srcdir
293  DO i=l2beg,l2end,l2step
294  DO j=l1beg,l1end,l1step
295  ijkc = indijk(i,j,k,icoff,ijcoff)
296  ijkbuff = ijkbuff + 1
297  DO l=1,ncv
298  patch%valRadi%sendBuff(ijkbuff+(l-1)*ndim) = rcv(l,ijkc)
299  ENDDO
300  ENDDO
301  ENDDO
302  ENDIF
303 
304  ENDIF ! lb
305 
306  ENDDO ! idum
307 
308 ! send data
309 
310 #ifdef MPI
311  dest = regionsrc%procid
312  tag = regionsrc%localNumber + mpi_patchoff*patch%srcPatch* &
313  radi_tag_shift
314  CALL mpi_isend( patch%valRadi%sendBuff,ncv*ndim,mpi_rfreal, &
315  dest,tag,global%mpiComm, &
316  global%requests(patch%valRadi%iRequest),global%mpierr )
317  IF (global%mpierr /= 0) CALL errorstop( global,err_mpi_trouble,__line__ )
318 #endif
319 
320 ! finalize
321 
322  CALL deregisterfunction( global )
323 
324 END SUBROUTINE radi_floflimsenddummyconf
325 
326 !******************************************************************************
327 !
328 ! RCS Revision history:
329 !
330 ! $Log: RADI_floFlimSendDummyConf.F90,v $
331 ! Revision 1.3 2008/12/06 08:44:38 mtcampbe
332 ! Updated license.
333 !
334 ! Revision 1.2 2008/11/19 22:17:50 mtcampbe
335 ! Added Illinois Open Source License/Copyright
336 !
337 ! Revision 1.1 2004/09/30 17:49:10 wasistho
338 ! prepared for full FLD radiation model
339 !
340 !
341 !
342 !******************************************************************************
343 
344 
345 
346 
347 
348 
349 
**********************************************************************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)
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 radi_floflimsenddummyconf(region, regionSrc, patch)
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