Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_FindSourcePatches.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: find source patches for inter-region communication.
26 !
27 ! Description: none.
28 !
29 ! Input: regions = dimensions and topology of all regions.
30 !
31 ! Output: regions%levels(1)%patches = source patches.
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: RFLO_FindSourcePatches.F90,v 1.3 2008/12/06 08:44:27 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2001 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE rflo_findsourcepatches( regions )
44 
45  USE moddatatypes
46  USE modbndpatch, ONLY : t_patch
47  USE moddatastruct, ONLY : t_region
48  USE modglobal, ONLY : t_global
49  USE modparameters
50  USE moderror
51  IMPLICIT NONE
52 
53 ! ... parameters
54  TYPE(t_region), POINTER :: regions(:)
55 
56 ! ... loop variables
57  INTEGER :: ireg, ipatch, ipatchsrc
58 
59 ! ... local variables
60  CHARACTER(CHRLEN) :: msg
61 
62  INTEGER :: bctype, iregsrc, lbs, l1bs, l1es, l2bs, l2es
63 
64  TYPE(t_patch), POINTER :: patch, patchsrc
65  TYPE(t_global), POINTER :: global
66 
67 !******************************************************************************
68 
69  global => regions(1)%global
70 
71  CALL registerfunction( global,'RFLO_FindSourcePatches',&
72  'RFLO_FindSourcePatches.F90' )
73 
74 ! loop over regions and patches
75 
76  DO ireg=1,global%nRegions
77  DO ipatch=1,regions(ireg)%nPatches
78 
79  patch => regions(ireg)%levels(1)%patches(ipatch)
80  bctype = patch%bcType
81 
82  IF ((bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
83  (bctype>=bc_regionint .AND. bctype<=bc_regionint +bc_range) .OR. &
84  (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range) .OR. &
85  (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
86  (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range)) THEN
87  iregsrc = patch%srcRegion
88  lbs = patch%srcLbound
89  l1bs = min(patch%srcL1beg,patch%srcL1end)
90  l1es = max(patch%srcL1beg,patch%srcL1end)
91  l2bs = min(patch%srcL2beg,patch%srcL2end)
92  l2es = max(patch%srcL2beg,patch%srcL2end)
93 
94 ! ----- search for corresponding source patch on source region
95 
96  patch%srcPatch = -999
97 
98  DO ipatchsrc=1,regions(iregsrc)%nPatches
99  IF (iregsrc/=ireg .OR. ipatchsrc/=ipatch) THEN
100  patchsrc => regions(iregsrc)%levels(1)%patches(ipatchsrc)
101  IF (patchsrc%bcType==bctype .AND. &
102  patchsrc%lbound==lbs .AND. &
103  patchsrc%l1beg ==l1bs .AND. &
104  patchsrc%l1end ==l1es .AND. &
105  patchsrc%l2beg ==l2bs .AND. &
106  patchsrc%l2end ==l2es) THEN ! OK, patch found
107  patch%srcPatch = ipatchsrc
108  ENDIF
109  ENDIF
110  ENDDO ! iPatchSrc
111 
112  IF (patch%srcPatch < 0) THEN
113  WRITE(msg,1000) ireg,ipatch,bctype
114  CALL errorstop( global,err_patch_nosource,__line__,msg )
115  ENDIF
116  ENDIF ! bcType
117 
118  ENDDO ! iPatch
119  ENDDO ! iReg
120 
121 ! finalize
122 
123  CALL deregisterfunction( global )
124 
125 1000 FORMAT('Region ',i5,', patch ',i3,', BC type ',i3)
126 
127 END SUBROUTINE rflo_findsourcepatches
128 
129 !******************************************************************************
130 !
131 ! RCS Revision history:
132 !
133 ! $Log: RFLO_FindSourcePatches.F90,v $
134 ! Revision 1.3 2008/12/06 08:44:27 mtcampbe
135 ! Updated license.
136 !
137 ! Revision 1.2 2008/11/19 22:17:38 mtcampbe
138 ! Added Illinois Open Source License/Copyright
139 !
140 ! Revision 1.1 2004/11/29 20:51:39 wasistho
141 ! lower to upper case
142 !
143 ! Revision 1.9 2003/05/15 02:57:04 jblazek
144 ! Inlined index function.
145 !
146 ! Revision 1.8 2002/09/27 00:57:10 jblazek
147 ! Changed makefiles - no makelinks needed.
148 !
149 ! Revision 1.7 2002/09/05 17:40:21 jblazek
150 ! Variable global moved into regions().
151 !
152 ! Revision 1.6 2002/03/18 23:11:33 jblazek
153 ! Finished multiblock and MPI.
154 !
155 ! Revision 1.5 2002/02/21 23:25:06 jblazek
156 ! Blocks renamed as regions.
157 !
158 ! Revision 1.4 2002/01/11 17:20:19 jblazek
159 ! Added time stamp or iteration number to file names.
160 !
161 ! Revision 1.3 2001/12/22 00:09:39 jblazek
162 ! Added routines to store grid and solution.
163 !
164 ! Revision 1.2 2001/12/19 23:09:22 jblazek
165 ! Added routines to read grid and solution.
166 !
167 ! Revision 1.1.1.1 2001/12/03 21:44:04 jblazek
168 ! Import of RocfluidMP
169 !
170 !******************************************************************************
171 
172 
173 
174 
175 
176 
177 
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
Definition: patch.h:74
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
subroutine rflo_findsourcepatches(regions)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469