Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_ReceiveDummyVals.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 values to the dummy cells of the patch from neighboring
26 ! region / periodic boundary, which is located on a different
27 ! processor.
28 !
29 ! Description: none.
30 !
31 ! Input: region = current region
32 ! regionSrc = source region
33 ! patch = current patch of region
34 ! patchSrc = source patch of regionSrc.
35 !
36 ! Output: region%levels%mixt = flow variables in dummy cells.
37 !
38 ! Notes: none.
39 !
40 !******************************************************************************
41 !
42 ! $Id: RFLO_ReceiveDummyVals.F90,v 1.5 2008/12/06 08:44:27 mtcampbe Exp $
43 !
44 ! Copyright: (c) 2001 by the University of Illinois
45 !
46 !******************************************************************************
47 
48 SUBROUTINE rflo_receivedummyvals( region,regionSrc,patch,patchSrc )
49 
50  USE moddatatypes
51  USE modbndpatch, ONLY : t_patch
52  USE moddatastruct, ONLY : t_region
53  USE modglobal, ONLY : t_global
56  USE moderror
57  USE modmpi
58  USE modparameters
59  IMPLICIT NONE
60 
61 #include "Indexing.h"
62 
63 ! ... parameters
64  TYPE(t_region) :: region, regionsrc
65  TYPE(t_patch) :: patch, patchsrc
66 
67 ! ... loop variables
68  INTEGER :: idum, i, j, k, ijkbuff
69 
70 ! ... local variables
71 #ifdef MPI
72  INTEGER :: status(mpi_status_size)
73 #endif
74  INTEGER :: lb, ibeg, iend, jbeg, jend, kbeg, kend, icoff, ijcoff, ijkd, &
75  n1, n2, ndim, source, tag, ilev, gasmodel
76 
77  REAL(RFREAL), POINTER :: cv(:,:)
78 
79  TYPE(t_global), POINTER :: global
80 
81 !******************************************************************************
82 
83  global => region%global
84 
85  CALL registerfunction( global,'RFLO_ReceiveDummyVals',&
86  'RFLO_ReceiveDummyVals.F90' )
87 
88 ! check if the source region is active
89 
90  IF (regionsrc%active == off) THEN
91  CALL errorstop( global,err_srcregion_off,__line__ )
92  ENDIF
93 
94 ! get dimensions and pointers
95 
96  ilev = region%currLevel
97 
98  CALL rflo_getpatchindices( region,patch,ilev,ibeg,iend, &
99  jbeg,jend,kbeg,kend )
100  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
101 
102  gasmodel = region%mixtInput%gasModel
103 
104  cv => region%levels(ilev)%mixt%cv
105 
106  n1 = abs(patch%l1end-patch%l1beg) + 1 ! here, dimensions of current
107  n2 = abs(patch%l2end-patch%l2beg) + 1 ! and source patch are identical
108  ndim = n1*n2*region%nDumCells ! ... but not the # of dummy cells
109 
110 ! receive data
111 
112 #ifdef MPI
113  source = regionsrc%procid
114  tag = region%localNumber + mpi_patchoff*patchsrc%srcPatch
115  CALL mpi_recv( patch%mixt%recvBuff,cv_mixt_neqs*ndim,mpi_rfreal, &
116  source,tag,global%mpiComm,status,global%mpierr )
117  IF (global%mpierr /= 0) CALL errorstop( global,err_mpi_trouble,__line__ )
118 #endif
119 
120 ! copy from buffer to dummy nodes ---------------------------------------------
121 
122  lb = patch%lbound
123  ijkbuff = 0
124 
125  DO idum=1,region%nDumCells
126 
127 ! - face i=const.
128 
129  IF (lb==1 .OR. lb==2) THEN
130  IF (lb == 1) i = ibeg - idum
131  IF (lb == 2) i = iend + idum
132  DO k=kbeg,kend
133  DO j=jbeg,jend
134  ijkd = indijk(i,j,k,icoff,ijcoff)
135  ijkbuff = ijkbuff + 1
136  cv(cv_mixt_dens,ijkd) = patch%mixt%recvBuff(ijkbuff )
137  cv(cv_mixt_xmom,ijkd) = patch%mixt%recvBuff(ijkbuff+ ndim)
138  cv(cv_mixt_ymom,ijkd) = patch%mixt%recvBuff(ijkbuff+2*ndim)
139  cv(cv_mixt_zmom,ijkd) = patch%mixt%recvBuff(ijkbuff+3*ndim)
140  cv(cv_mixt_ener,ijkd) = patch%mixt%recvBuff(ijkbuff+4*ndim)
141  IF (gasmodel == gas_model_tcperf) THEN
142  CALL mixtureproperties( region,ijkd,ijkd,.false. )
143  ELSE
144  CALL mixtureproperties( region,ijkd,ijkd,.true. )
145  ENDIF
146  ENDDO
147  ENDDO
148 
149 ! - face j=const.
150 
151  ELSE IF (lb==3 .OR. lb==4) THEN
152  IF (lb == 3) j = jbeg - idum
153  IF (lb == 4) j = jend + idum
154  DO i=ibeg,iend
155  DO k=kbeg,kend
156  ijkd = indijk(i,j,k,icoff,ijcoff)
157  ijkbuff = ijkbuff + 1
158  cv(cv_mixt_dens,ijkd) = patch%mixt%recvBuff(ijkbuff )
159  cv(cv_mixt_xmom,ijkd) = patch%mixt%recvBuff(ijkbuff+ ndim)
160  cv(cv_mixt_ymom,ijkd) = patch%mixt%recvBuff(ijkbuff+2*ndim)
161  cv(cv_mixt_zmom,ijkd) = patch%mixt%recvBuff(ijkbuff+3*ndim)
162  cv(cv_mixt_ener,ijkd) = patch%mixt%recvBuff(ijkbuff+4*ndim)
163  IF (gasmodel == gas_model_tcperf) THEN
164  CALL mixtureproperties( region,ijkd,ijkd,.false. )
165  ELSE
166  CALL mixtureproperties( region,ijkd,ijkd,.true. )
167  ENDIF
168  ENDDO
169  ENDDO
170 
171 ! - face k=const.
172 
173  ELSE IF (lb==5 .OR. lb==6) THEN
174  IF (lb == 5) k = kbeg - idum
175  IF (lb == 6) k = kend + idum
176  DO j=jbeg,jend
177  DO i=ibeg,iend
178  ijkd = indijk(i,j,k,icoff,ijcoff)
179  ijkbuff = ijkbuff + 1
180  cv(cv_mixt_dens,ijkd) = patch%mixt%recvBuff(ijkbuff )
181  cv(cv_mixt_xmom,ijkd) = patch%mixt%recvBuff(ijkbuff+ ndim)
182  cv(cv_mixt_ymom,ijkd) = patch%mixt%recvBuff(ijkbuff+2*ndim)
183  cv(cv_mixt_zmom,ijkd) = patch%mixt%recvBuff(ijkbuff+3*ndim)
184  cv(cv_mixt_ener,ijkd) = patch%mixt%recvBuff(ijkbuff+4*ndim)
185  IF (gasmodel == gas_model_tcperf) THEN
186  CALL mixtureproperties( region,ijkd,ijkd,.false. )
187  ELSE
188  CALL mixtureproperties( region,ijkd,ijkd,.true. )
189  ENDIF
190  ENDDO
191  ENDDO
192  ENDIF ! lb
193 
194  ENDDO ! idum
195 
196 ! finalize --------------------------------------------------------------------
197 
198  CALL deregisterfunction( global )
199 
200 END SUBROUTINE rflo_receivedummyvals
201 
202 !******************************************************************************
203 !
204 ! RCS Revision history:
205 !
206 ! $Log: RFLO_ReceiveDummyVals.F90,v $
207 ! Revision 1.5 2008/12/06 08:44:27 mtcampbe
208 ! Updated license.
209 !
210 ! Revision 1.4 2008/11/19 22:17:38 mtcampbe
211 ! Added Illinois Open Source License/Copyright
212 !
213 ! Revision 1.3 2006/08/19 15:39:40 mparmar
214 ! Renamed patch variables
215 !
216 ! Revision 1.2 2005/10/31 21:09:36 haselbac
217 ! Changed specModel and SPEC_MODEL_NONE
218 !
219 ! Revision 1.1 2004/11/29 20:51:40 wasistho
220 ! lower to upper case
221 !
222 ! Revision 1.16 2003/11/20 16:40:40 mdbrandy
223 ! Backing out RocfluidMP changes from 11-17-03
224 !
225 ! Revision 1.12 2003/05/15 02:57:04 jblazek
226 ! Inlined index function.
227 !
228 ! Revision 1.11 2002/09/27 00:57:10 jblazek
229 ! Changed makefiles - no makelinks needed.
230 !
231 ! Revision 1.10 2002/09/20 22:22:36 jblazek
232 ! Finalized integration into GenX.
233 !
234 ! Revision 1.9 2002/09/05 17:40:22 jblazek
235 ! Variable global moved into regions().
236 !
237 ! Revision 1.8 2002/08/16 21:33:48 jblazek
238 ! Changed interface to MixtureProperties.
239 !
240 ! Revision 1.7 2002/04/01 19:36:08 jblazek
241 ! Added routine to clear send requests.
242 !
243 ! Revision 1.6 2002/03/30 00:50:49 jblazek
244 ! Cleaned up with flint.
245 !
246 ! Revision 1.5 2002/03/29 23:15:22 jblazek
247 ! Corrected bug in MPI send.
248 !
249 ! Revision 1.4 2002/03/18 23:11:33 jblazek
250 ! Finished multiblock and MPI.
251 !
252 ! Revision 1.3 2002/02/21 23:25:06 jblazek
253 ! Blocks renamed as regions.
254 !
255 ! Revision 1.2 2002/01/28 23:55:22 jblazek
256 ! Added flux computation (central scheme).
257 !
258 ! Revision 1.1 2002/01/16 22:03:35 jblazek
259 ! Added time-stepping routines.
260 !
261 !******************************************************************************
262 
263 
264 
265 
266 
267 
268 
**********************************************************************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
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
subroutine rflo_getpatchindices(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
subroutine rflo_receivedummyvals(region, regionSrc, patch, patchSrc)
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
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
subroutine mixtureproperties(region, inBeg, inEnd, gasUpdate)
**********************************************************************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