Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModBoundaryTests.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: Collection of routines for testing whether vertices or cells are on
26 ! boundaries.
27 !
28 ! Description: None.
29 !
30 ! Notes: None.
31 !
32 ! ******************************************************************************
33 !
34 ! $Id: RFLU_ModBoundaryTests.F90,v 1.3 2008/12/06 08:44:20 mtcampbe Exp $
35 !
36 ! Copyright: (c) 2006 by the University of Illinois
37 !
38 ! ******************************************************************************
39 
41 
42  USE modparameters
43  USE moddatatypes
44  USE modglobal, ONLY: t_global
45  USE modgrid, ONLY: t_grid
46  USE modbndpatch, ONLY: t_patch
47  USE moddatastruct, ONLY: t_region
48  USE moderror
49  USE modmpi
50 
51  USE modsortsearch
52 
53  IMPLICIT NONE
54 
55 ! ******************************************************************************
56 ! Definitions and declarations
57 ! ******************************************************************************
58 
59 ! ==============================================================================
60 ! Private data
61 ! ==============================================================================
62 
63  CHARACTER(CHRLEN), PRIVATE :: &
64  RCSIdentString = '$RCSfile: RFLU_ModBoundaryTests.F90,v $ $Revision: 1.3 $'
65 
66 ! ==============================================================================
67 ! Public functions
68 ! ==============================================================================
69 
70  PUBLIC :: rflu_testisboundarycell, &
72 
73 ! ==============================================================================
74 ! Private functions
75 ! ==============================================================================
76 
77 
78 
79 ! ******************************************************************************
80 ! Routines
81 ! ******************************************************************************
82 
83  CONTAINS
84 
85 
86 
87 
88 
89 
90 
91 ! ******************************************************************************
92 !
93 ! Purpose: Determine whether cell is adjacent to boundaries.
94 !
95 ! Description: None.
96 !
97 ! Input:
98 ! pRegion Pointer to region data
99 ! icg Global cell index
100 !
101 ! Output:
102 ! RFLU_TestIsBoundaryCell = .TRUE. If cell adjacent to boundaries
103 ! RFLU_TestIsBoundaryCell = .FALSE. If cell not adjacent to boundaries
104 !
105 ! Notes:
106 ! 1. This routine is not efficient if calling it for large numbers of cells.
107 ! Would need to consider sorting actual boundary-face lists which would
108 ! avoid the need to sort them (repeatedly) here.
109 !
110 ! ******************************************************************************
111 
112 LOGICAL FUNCTION rflu_testisboundarycell(pRegion,icg)
113 
114  IMPLICIT NONE
115 
116 ! ******************************************************************************
117 ! Declarations and definitions
118 ! ******************************************************************************
119 
120 ! ==============================================================================
121 ! Arguments
122 ! ==============================================================================
123 
124  INTEGER, INTENT(IN) :: icg
125  TYPE(t_region), POINTER :: pregion
126 
127 ! ==============================================================================
128 ! Locals
129 ! ==============================================================================
130 
131  INTEGER :: errorflag,ifl,iloc,ipatch
132  INTEGER, DIMENSION(:), ALLOCATABLE :: bf2csorted
133  TYPE(t_global), POINTER :: global
134  TYPE(t_grid), POINTER :: pgrid
135  TYPE(t_patch), POINTER :: ppatch
136 
137 ! ******************************************************************************
138 ! Start
139 ! ******************************************************************************
140 
141  global => pregion%global
142 
143  CALL registerfunction(global,'RFLU_TestIsBoundaryCell',&
144  'RFLU_ModBoundaryTests.F90')
145 
146 ! ==============================================================================
147 ! Set grid pointer and initialize RFLU_TestIsBoundaryCell
148 ! ==============================================================================
149 
150  pgrid => pregion%grid
151 
152  rflu_testisboundarycell = .false.
153 
154 ! ******************************************************************************
155 ! Check whether point is on boundaries
156 ! ******************************************************************************
157 
158  DO ipatch = 1,pgrid%nPatches
159  ppatch => pregion%patches(ipatch)
160 
161  ALLOCATE(bf2csorted(ppatch%nBFacesTot),stat=errorflag)
162  global%error = errorflag
163  IF ( global%error /= err_none ) THEN
164  CALL errorstop(global,err_allocate,__line__,'bf2cSorted')
165  END IF ! global%error
166 
167  DO ifl = 1,ppatch%nBFacesTot ! Explicit loop because of ASCI White
168  bf2csorted(ifl) = ppatch%bf2c(ifl)
169  END DO ! ifl
170 
171  CALL quicksortinteger(bf2csorted,ppatch%nBFacesTot)
172 
173  CALL binarysearchinteger(bf2csorted,ppatch%nBFacesTot,icg,iloc)
174 
175  IF ( iloc /= element_not_found ) THEN
176  rflu_testisboundarycell = .true.
177  END IF ! iLoc
178 
179  DEALLOCATE(bf2csorted,stat=errorflag)
180  global%error = errorflag
181  IF ( global%error /= err_none ) THEN
182  CALL errorstop(global,err_deallocate,__line__,'bf2cSorted')
183  END IF ! global%error
184 
185  IF ( rflu_testisboundarycell .EQV. .true. ) THEN
186  EXIT
187  END IF ! RFLU_TestIsBoundaryCell
188  END DO ! iPatch
189 
190 ! ******************************************************************************
191 ! End
192 ! ******************************************************************************
193 
194  CALL deregisterfunction(global)
195 
196 END FUNCTION rflu_testisboundarycell
197 
198 
199 
200 
201 
202 ! ******************************************************************************
203 !
204 ! Purpose: Determine whether vertex is on boundaries.
205 !
206 ! Description: None.
207 !
208 ! Input:
209 ! pRegion Pointer to region data
210 ! ivg Global vertex index
211 !
212 ! Output:
213 ! RFLU_TestIsBoundaryVertex = .TRUE. If vertex on boundaries
214 ! RFLU_TestIsBoundaryVertex = .FALSE. If vertex not on boundaries
215 !
216 ! Notes: None.
217 !
218 ! ******************************************************************************
219 
220 LOGICAL FUNCTION rflu_testisboundaryvertex(pRegion,ivg)
221 
222  IMPLICIT NONE
223 
224 ! ******************************************************************************
225 ! Declarations and definitions
226 ! ******************************************************************************
227 
228 ! ==============================================================================
229 ! Arguments
230 ! ==============================================================================
231 
232  INTEGER, INTENT(IN) :: ivg
233  TYPE(t_region), POINTER :: pregion
234 
235 ! ==============================================================================
236 ! Locals
237 ! ==============================================================================
238 
239  INTEGER :: errorflag,iloc,ipatch
240  TYPE(t_global), POINTER :: global
241  TYPE(t_grid), POINTER :: pgrid
242  TYPE(t_patch), POINTER :: ppatch
243 
244 ! ******************************************************************************
245 ! Start
246 ! ******************************************************************************
247 
248  global => pregion%global
249 
250  CALL registerfunction(global,'RFLU_TestIsBoundaryVertex',&
251  'RFLU_ModBoundaryTests.F90')
252 
253 ! ==============================================================================
254 ! Set grid pointer and initialize RFLU_TestIsBoundaryVertex
255 ! ==============================================================================
256 
257  pgrid => pregion%grid
258 
259  rflu_testisboundaryvertex = .false.
260 
261 ! ******************************************************************************
262 ! Check whether vertex is on boundary
263 ! ******************************************************************************
264 
265  DO ipatch = 1,pgrid%nPatches
266  ppatch => pregion%patches(ipatch)
267 
268  CALL binarysearchinteger(ppatch%bv,ppatch%nBVertTot,ivg,iloc)
269 
270  IF ( iloc /= element_not_found ) THEN
272 
273  EXIT
274  END IF ! RFLU_TestIsBoundaryVertex
275  END DO ! iPatch
276 
277 ! ******************************************************************************
278 ! End
279 ! ******************************************************************************
280 
281  CALL deregisterfunction(global)
282 
283 END FUNCTION rflu_testisboundaryvertex
284 
285 
286 
287 
288 
289 
290 END MODULE rflu_modboundarytests
291 
292 ! ******************************************************************************
293 !
294 ! RCS Revision history:
295 !
296 ! $Log: RFLU_ModBoundaryTests.F90,v $
297 ! Revision 1.3 2008/12/06 08:44:20 mtcampbe
298 ! Updated license.
299 !
300 ! Revision 1.2 2008/11/19 22:17:31 mtcampbe
301 ! Added Illinois Open Source License/Copyright
302 !
303 ! Revision 1.1 2006/08/04 02:59:30 haselbac
304 ! Initial revision
305 !
306 ! ******************************************************************************
307 
308 
309 
310 
311 
312 
313 
314 
315 
316 
LOGICAL function, public rflu_testisboundaryvertex(pRegion, ivg)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine quicksortinteger(a, n)
subroutine binarysearchinteger(a, n, v, i, j)
LOGICAL function, public rflu_testisboundarycell(pRegion, icg)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469