Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_PatchExchangeConf.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: exchange values between buffers of the corresponding
26 ! patches of the adjacent regions (both regions
27 ! are on the same processor).
28 !
29 ! Description: none.
30 !
31 ! Input: region = current (source) region
32 ! regionDes = destination region
33 ! patch = current patch of region
34 ! patchDes = destination patch of regionDes
35 ! iReg = index of current region
36 ! iRegDes = index of destination region.
37 !
38 ! Output: regions%levels%plagBuff = variables in buffers.
39 !
40 ! Notes: intended for conforming grid boundaries only.
41 ! Patch of current (source) region has data residing in dummy cells and
42 ! send them to patch of destination region.
43 ! RFLO srcLbound corresponds to the destination (Des) region for PLAG
44 ! since the communication pattern is opposite for PLAG.
45 !
46 !******************************************************************************
47 !
48 ! $Id: PLAG_PatchExchangeConf.F90,v 1.3 2008/12/06 08:44:34 mtcampbe Exp $
49 !
50 ! Copyright: (c) 2002 by the University of Illinois
51 !
52 !******************************************************************************
53 
54 SUBROUTINE plag_patchexchangeconf( region,regionDes,patch,patchDes,iReg,iRegDes )
55 
56  USE moddatatypes
57  USE modpartlag, ONLY : t_buffer_plag
58  USE modbndpatch, ONLY : t_patch
59  USE moddatastruct, ONLY : t_region
60  USE modglobal, ONLY : t_global
61  USE modindexing, ONLY : getijk, indijkmap
64  USE moderror
65  USE modparameters
67  IMPLICIT NONE
68 
69 ! ... parameters
70  TYPE(t_region) :: region, regiondes
71  TYPE(t_patch) :: patch, patchdes
72 
73  INTEGER :: ireg, iregdes
74 
75 ! ... loop variables
76  INTEGER :: idum, i, j, k, ii, jj, kk
77 
78 ! ... local variables
79  CHARACTER(CHRLEN) :: rcsidentstring
80 
81  INTEGER :: ibeg, iend, jbeg, jend, kbeg, kend, idir, jdir, kdir, &
82  icoff, ijcoff, ijkd, ilev
83  INTEGER :: ibegdes, ienddes, jbegdes, jenddes, kbegdes, kenddes, &
84  idirdes, jdirdes, kdirdes, icoffdes, ijcoffdes, &
85  ijkcdes, ilevdes
86  INTEGER :: lb, lbdes, l1desdir, l2desdir, mapmat(3,4), &
87  ndumcells, ndumcellsdes
88 
89  INTEGER :: ibuff, ibuffdes, ibuffsrc, jbuffdes, jbuffsrc, &
90  kbuffdes, kbuffsrc, ijkbuffsrc, nbuffsizedes, nbuffsizesrc
91 
92  LOGICAL :: align
93 
94  INTEGER, POINTER, DIMENSION(:,:) :: paiv, paivdes, paivold, paivolddes
95 
96  REAL(RFREAL), POINTER, DIMENSION(:,:) :: parv, parvdes, &
97  parvold, parvolddes, &
98  pcv, pcvdes, &
99  pcvold, pcvolddes, &
100  pdv, pdvdes, prhs, prhsdes, &
101  prhssum, prhssumdes, ptv, ptvdes
102 
103  TYPE(t_global), POINTER :: global
104 
105 !******************************************************************************
106 
107  rcsidentstring = '$RCSfile: PLAG_PatchExchangeConf.F90,v $ $Revision: 1.3 $'
108 
109  global => region%global
110 
111  CALL registerfunction( global,'PLAG_PatchExchangeConf',&
112  'PLAG_PatchExchangeConf.F90' )
113 
114 ! check if the source region is active ----------------------------------------
115 
116  IF (regiondes%active == off) THEN
117  CALL errorstop( global,err_srcregion_off,__line__ )
118  ENDIF
119 
120 ! Get dimensions --------------------------------------------------------------
121 
122  ilev = region%currLevel
123  ndumcells = region%nDumCells
124 
125  ilevdes = regiondes%currLevel
126  ndumcellsdes = regiondes%nDumCells
127 
128  CALL rflo_getpatchindices( region,patch,ilev,ibeg,iend, &
129  jbeg,jend,kbeg,kend )
130  CALL rflo_getpatchindices( regiondes,patchdes,ilevdes,ibegdes,ienddes, &
131  jbegdes,jenddes,kbegdes,kenddes )
133  CALL rflo_getpatchdirection( patchdes,idirdes,jdirdes,kdirdes )
134  CALL rflo_getcelloffset( region ,ilev,icoff ,ijcoff )
135  CALL rflo_getcelloffset( regiondes,ilevdes,icoffdes,ijcoffdes )
136 
137 ! Set pointers ----------------------------------------------------------------
138 
139  paiv => patch%bufferPlag%aiv
140  parv => patch%bufferPlag%arv
141  pcv => patch%bufferPlag%cv
142  pdv => patch%bufferPlag%dv
143  ptv => patch%bufferPlag%tv
144  prhs => patch%bufferPlag%rhs
145  prhssum => patch%bufferPlag%rhsSum
146 
147  paivold => patch%bufferPlag%aivOld
148  parvold => patch%bufferPlag%arvOld
149  pcvold => patch%bufferPlag%cvOld
150 
151  paivdes => patchdes%bufferPlag%aiv
152  parvdes => patchdes%bufferPlag%arv
153  pcvdes => patchdes%bufferPlag%cv
154  pdvdes => patchdes%bufferPlag%dv
155  ptvdes => patchdes%bufferPlag%tv
156  prhsdes => patchdes%bufferPlag%rhs
157  prhssumdes => patchdes%bufferPlag%rhsSum
158 
159  paivolddes => patchdes%bufferPlag%aivOld
160  parvolddes => patchdes%bufferPlag%arvOld
161  pcvolddes => patchdes%bufferPlag%cvOld
162 
163  nbuffsizesrc = patch%bufferPlag%nBuffSize
164 
165  nbuffsizedes = nbuffsizesrc
166  patchdes%bufferPlag%nBuffSizeDes = nbuffsizedes
167 
168 ! exit when Buffer Size is Zero
169 
170  IF ( nbuffsizesrc == 0 ) goto 999
171 
172 ! mapping between patches -----------------------------------------------------
173 
174  l1desdir = 1
175  IF (patch%srcL1beg > patch%srcL1end) l1desdir = -1
176  l2desdir = 1
177  IF (patch%srcL2beg > patch%srcL2end) l2desdir = -1
178 
179  lb = patch%lbound
180  lbdes = patch%srcLbound
181  align = patch%align
182 
183  CALL rflo_getpatchmapping( lb,lbdes,l1desdir,l2desdir,align, &
184  idir,jdir,kdir,idirdes,jdirdes,kdirdes, &
185  ibeg,iend,jbeg,jend,kbeg,kend, &
186  ibegdes,ienddes,jbegdes,jenddes,kbegdes,kenddes, &
187  mapmat )
188 
189 ! Loop over buffer particles of current patch ---------------------------------
190 
191  DO ibuff=1, nbuffsizesrc
192 
193  ibuffsrc = paiv(aiv_plag_indexi,ibuff)
194  jbuffsrc = paiv(aiv_plag_indexj,ibuff)
195  kbuffsrc = paiv(aiv_plag_indexk,ibuff)
196  ijkbuffsrc = paiv(aiv_plag_icells,ibuff)
197 
198  ijkcdes = indijkmap(ibuffsrc,jbuffsrc,kbuffsrc,mapmat,icoffdes,ijcoffdes)
199  CALL getijk(ijkcdes,icoffdes,ijcoffdes,ndumcellsdes,ibuffdes,jbuffdes,kbuffdes)
200 
201 ! - Update aiv field ----------------------------------------------------------
202 
203  paivdes(aiv_plag_icells,ibuff) = ijkcdes
204  paivdes(aiv_plag_indexi,ibuff) = ibuffdes
205  paivdes(aiv_plag_indexj,ibuff) = jbuffdes
206  paivdes(aiv_plag_indexk,ibuff) = kbuffdes
207 
208  paivdes(aiv_plag_pidini,ibuff) = paiv(aiv_plag_pidini,ibuff)
209  paivdes(aiv_plag_regini,ibuff) = paiv(aiv_plag_regini,ibuff)
210  paivdes(aiv_plag_regcrt,ibuff) = iregdes
211  paivdes(aiv_plag_burnstat,ibuff) = paiv(aiv_plag_burnstat,ibuff)
212 
213  paivolddes(:,ibuff) = paivdes(:,ibuff)
214 
215 ! - Update arv, cv, dv, rhs, rhsSum, tv field ---------------------------------
216 
217  parvdes(:,ibuff) = parv(:,ibuff)
218  pcvdes(:,ibuff) = pcv(:,ibuff)
219  pdvdes(:,ibuff) = pdv(:,ibuff)
220  prhsdes(:,ibuff) = prhs(:,ibuff)
221  prhssumdes(:,ibuff) = prhssum(:,ibuff)
222  ptvdes(:,ibuff) = ptv(:,ibuff)
223 
224  parvolddes(:,ibuff) = parvold(:,ibuff)
225  pcvolddes(:,ibuff) = pcvold(:,ibuff)
226 
227  ENDDO ! iBuff
228 
229 ! reset Buffer size on Source Region to Zero to trap null-particle regions ----
230 
231  patch%bufferPlag%nBuffSize = 0
232 
233 ! finalize
234 
235 999 CONTINUE
236 
237  CALL deregisterfunction( global )
238 
239 END SUBROUTINE plag_patchexchangeconf
240 
241 !******************************************************************************
242 !
243 ! RCS Revision history:
244 !
245 ! $Log: PLAG_PatchExchangeConf.F90,v $
246 ! Revision 1.3 2008/12/06 08:44:34 mtcampbe
247 ! Updated license.
248 !
249 ! Revision 1.2 2008/11/19 22:17:47 mtcampbe
250 ! Added Illinois Open Source License/Copyright
251 !
252 ! Revision 1.1 2004/12/01 20:57:55 fnajjar
253 ! Initial revision after changing case
254 !
255 ! Revision 1.6 2004/02/13 23:22:07 fnajjar
256 ! Included new cv and aiv definitions for particle burning module
257 !
258 ! Revision 1.5 2003/09/21 00:19:58 fnajjar
259 ! Reset buffer size on source region to zero
260 !
261 ! Revision 1.4 2003/05/15 02:57:05 jblazek
262 ! Inlined index function.
263 !
264 ! Revision 1.3 2003/02/04 22:32:34 f-najjar
265 ! Bug fix in GetIJK call by loading nDumCellsDes
266 !
267 ! Revision 1.2 2003/01/17 19:45:21 f-najjar
268 ! Compute nBuffSizeDes for buffer size of destination buffers
269 !
270 ! Revision 1.1 2003/01/13 19:14:50 f-najjar
271 ! Initial Import of Multiblock capability
272 !
273 !******************************************************************************
274 
275 
276 
277 
278 
279 
280 
**********************************************************************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_getpatchdirection(patch, idir, jdir, kdir)
j indices k indices k
Definition: Indexing.h:6
subroutine plag_patchexchangeconf(region, regionDes, patch, patchDes, iReg, iRegDes)
INTEGER function indijkmap(i, j, k, mapMat, iOffset, ijOffset)
Definition: ModIndexing.F90:67
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_getpatchindices(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
**********************************************************************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 jdir
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
**********************************************************************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 idir
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
**********************************************************************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 kdir
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
subroutine rflo_getpatchmapping(lb, lbs, l1SrcDir, l2SrcDir, align, idir, jdir, kdir, idirSrc, jdirSrc, kdirSrc, ibeg, iend, jbeg, jend, kbeg, kend, ibegSrc, iendSrc, jbegSrc, jendSrc, kbegSrc, kendSrc, mapMat)
**********************************************************************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
subroutine getijk(ijk, iOffset, ijOffset, nDumCells, i, j, k)
Definition: ModIndexing.F90:54