Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_ExchangeGeometryPrepare.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 orientation of l1- and l2-directions between regions
26 ! on different processors.
27 !
28 ! Description: none.
29 !
30 ! Input: regions%levels%grid = coordinates (physical cells) and dimensions
31 !
32 ! Output: regions%levels%patches%l1/2Vec = vectors in l1/2-direction.
33 !
34 ! Notes: only region interfaces with continuous grid are treated here.
35 !
36 !******************************************************************************
37 !
38 ! $Id: RFLO_ExchangeGeometryPrepare.F90,v 1.4 2008/12/06 08:44:26 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2002 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE rflo_exchangegeometryprepare( regions )
45 
46  USE moddatatypes
47  USE modbndpatch, ONLY : t_patch
48  USE moddatastruct, ONLY : t_region
49  USE modglobal, ONLY : t_global
52  USE moderror
53  USE modmpi
54  USE modparameters
55  IMPLICIT NONE
56 
57 #include "Indexing.h"
58 
59 ! ... parameters
60  TYPE(t_region), POINTER :: regions(:)
61 
62 ! ... loop variables
63  INTEGER :: ireg, ipatch
64 
65 ! ... local variables
66  INTEGER :: bctype, iregsrc, ipatchsrc, lb, dest, source, tag
67  INTEGER :: ibeg, iend, jbeg, jend, kbeg, kend, inoff, ijnoff
68 #ifdef MPI
69  INTEGER :: status(mpi_status_size)
70 #endif
71 
72  REAL(RFREAL) :: vec(6)
73  REAL(RFREAL), POINTER :: xyz(:,:)
74 
75  TYPE(t_patch), POINTER :: patch, patchsrc
76  TYPE(t_global), POINTER :: global
77 
78 !******************************************************************************
79 
80  global => regions(1)%global
81 
82  CALL registerfunction( global,'RFLO_ExchangeGeometryPrepare',&
83  'RFLO_ExchangeGeometryPrepare.F90' )
84 
85 ! send direction vectors ------------------------------------------------------
86 
87  DO ireg=1,global%nRegions
88  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
89  regions(ireg)%active==active) THEN ! on my processor
90 
91 ! --- loop over patches (finest grid level)
92 
93  DO ipatch=1,regions(ireg)%nPatches
94  patch => regions(ireg)%levels(1)%patches(ipatch)
95  bctype = patch%bcType
96 
97 ! ----- conforming inter-region boundary, translational
98 ! and rotational periodicity
99 
100  IF ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
101  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
102  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range)) THEN
103  iregsrc = patch%srcRegion
104  IF (regions(iregsrc)%active == off) &
105  CALL errorstop( global,err_srcregion_off,__line__ )
106 
107  IF (regions(iregsrc)%procid /= global%myProcid) THEN
108  CALL rflo_getpatchindicesnodes( regions(ireg),patch,1,ibeg,iend, &
109  jbeg,jend,kbeg,kend )
110  CALL rflo_getnodeoffset( regions(ireg),1,inoff,ijnoff )
111  lb = patch%lbound
112  xyz => regions(ireg)%levels(1)%grid%xyz
113  IF (lb==1 .OR. lb==2) THEN
114  vec(1:3) = xyz(1:3,indijk(ibeg,jend,kbeg,inoff,ijnoff)) - &
115  xyz(1:3,indijk(ibeg,jbeg,kbeg,inoff,ijnoff))
116  vec(4:6) = xyz(1:3,indijk(ibeg,jbeg,kend,inoff,ijnoff)) - &
117  xyz(1:3,indijk(ibeg,jbeg,kbeg,inoff,ijnoff))
118  ELSE IF (lb==3 .OR. lb==4) THEN
119  vec(1:3) = xyz(1:3,indijk(ibeg,jbeg,kend,inoff,ijnoff)) - &
120  xyz(1:3,indijk(ibeg,jbeg,kbeg,inoff,ijnoff))
121  vec(4:6) = xyz(1:3,indijk(iend,jbeg,kbeg,inoff,ijnoff)) - &
122  xyz(1:3,indijk(ibeg,jbeg,kbeg,inoff,ijnoff))
123  ELSE IF (lb==5 .OR. lb==6) THEN
124  vec(1:3) = xyz(1:3,indijk(iend,jbeg,kbeg,inoff,ijnoff)) - &
125  xyz(1:3,indijk(ibeg,jbeg,kbeg,inoff,ijnoff))
126  vec(4:6) = xyz(1:3,indijk(ibeg,jend,kbeg,inoff,ijnoff)) - &
127  xyz(1:3,indijk(ibeg,jbeg,kbeg,inoff,ijnoff))
128  ENDIF
129 #ifdef MPI
130  dest = regions(iregsrc)%procid
131  tag = regions(iregsrc)%localNumber + mpi_patchoff*patch%srcPatch
132  CALL mpi_isend( vec,6,mpi_rfreal,dest,tag,global%mpiComm, &
133  global%requests(patch%mixt%iRequest), &
134  global%mpierr )
135  IF (global%mpierr /= 0) &
136  CALL errorstop( global,err_mpi_trouble,__line__ )
137 #endif
138  ENDIF
139  ENDIF ! bcType
140  ENDDO ! iPatch
141 
142  ENDIF ! region on this processor and active
143  ENDDO ! iReg
144 
145 ! receive direction vectors ---------------------------------------------------
146 
147  DO ireg=1,global%nRegions
148  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
149  regions(ireg)%active==active) THEN ! on my processor
150 
151 ! --- loop over patches (finest grid level)
152 
153  DO ipatch=1,regions(ireg)%nPatches
154  patch => regions(ireg)%levels(1)%patches(ipatch)
155  bctype = patch%bcType
156 
157 ! ----- conforming inter-region boundary, translational
158 ! or rotational periodicity
159 
160  IF ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
161  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
162  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range)) THEN
163  iregsrc = patch%srcRegion
164  ipatchsrc = patch%srcPatch
165  patchsrc => regions(iregsrc)%levels(1)%patches(ipatchsrc)
166 
167  IF (regions(iregsrc)%procid /= global%myProcid) THEN
168 #ifdef MPI
169  source = regions(iregsrc)%procid
170  tag = regions(ireg)%localNumber + mpi_patchoff*patchsrc%srcPatch
171  CALL mpi_recv( vec,6,mpi_rfreal,source,tag,global%mpiComm, &
172  status,global%mpierr )
173  IF (global%mpierr /= 0) &
174  CALL errorstop( global,err_mpi_trouble,__line__ )
175 
176  patch%l1VecSrc(1:3) = vec(1:3)
177  patch%l2VecSrc(1:3) = vec(4:6)
178 #endif
179  ENDIF
180  ENDIF ! bcType
181  ENDDO ! iPatch
182 
183  ENDIF ! region on this processor and active
184  ENDDO ! iReg
185 
186 ! clear send requests ---------------------------------------------------------
187 
188  DO ireg=1,global%nRegions
189  IF (regions(ireg)%procid==global%myProcid .AND. & ! region active and
190  regions(ireg)%active==active) THEN ! on my processor
191  CALL rflo_clearsendrequests( regions,ireg,.true. )
192  ENDIF
193  ENDDO
194 
195 ! finalize --------------------------------------------------------------------
196 
197  CALL deregisterfunction( global )
198 
199 END SUBROUTINE rflo_exchangegeometryprepare
200 
201 !******************************************************************************
202 !
203 ! RCS Revision history:
204 !
205 ! $Log: RFLO_ExchangeGeometryPrepare.F90,v $
206 ! Revision 1.4 2008/12/06 08:44:26 mtcampbe
207 ! Updated license.
208 !
209 ! Revision 1.3 2008/11/19 22:17:37 mtcampbe
210 ! Added Illinois Open Source License/Copyright
211 !
212 ! Revision 1.2 2006/08/19 15:39:35 mparmar
213 ! Renamed patch variables
214 !
215 ! Revision 1.1 2004/11/29 20:51:39 wasistho
216 ! lower to upper case
217 !
218 ! Revision 1.6 2003/11/20 16:40:39 mdbrandy
219 ! Backing out RocfluidMP changes from 11-17-03
220 !
221 ! Revision 1.2 2003/05/15 02:57:04 jblazek
222 ! Inlined index function.
223 !
224 ! Revision 1.1 2002/12/06 22:32:12 jblazek
225 ! Corrected bug for geometry exchange between minimal patches.
226 !
227 !******************************************************************************
228 
229 
230 
231 
232 
233 
234 
**********************************************************************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 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
subroutine rflo_getpatchindicesnodes(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
subroutine rflo_clearsendrequests(regions, iReg, geometry)
**********************************************************************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
subroutine rflo_exchangegeometryprepare(regions)
**********************************************************************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