Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModCellFaceEdgeInfo.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: Suite of functions to determine information on cell and face
26 ! types and kinds, before and after renumbering.
27 !
28 ! Description: None.
29 !
30 ! Notes: None.
31 !
32 ! ******************************************************************************
33 !
34 ! $Id: RFLU_ModCellFaceEdgeInfo.F90,v 1.12 2008/12/06 08:44:20 mtcampbe Exp $
35 !
36 ! Copyright: (c) 2002-2005 by the University of Illinois
37 !
38 ! ******************************************************************************
39 
41 
42  USE modglobal, ONLY: t_global
43  USE moddatatypes
44  USE modparameters
45  USE moderror
46  USE modgrid, ONLY: t_grid
47 
49 
50  IMPLICIT NONE
51 
52  PRIVATE
53  PUBLIC :: rflu_getglobalcelltype, &
58 
59 
60 
61 ! ******************************************************************************
62 ! Declarations and definitions
63 ! ******************************************************************************
64 
65  CHARACTER(CHRLEN), PRIVATE :: &
66  RCSIdentString = '$RCSfile: RFLU_ModCellFaceEdgeInfo.F90,v $ $Revision: 1.12 $'
67 
68 ! ******************************************************************************
69 ! Routines
70 ! ******************************************************************************
71 
72  CONTAINS
73 
74 
75 
76 
77 
78 
79 ! ******************************************************************************
80 !
81 ! Purpose: Determine global cell type (after renumbering).
82 !
83 ! Description: None.
84 !
85 ! Input:
86 ! global Pointer to global data
87 ! pGrid Pointer to grid data
88 ! icg Global cell id
89 !
90 ! Output: None.
91 !
92 ! Notes: None.
93 !
94 ! ******************************************************************************
95 
96  INTEGER FUNCTION rflu_getglobalcelltype(global,pGrid,icg)
97 
98 ! ******************************************************************************
99 ! Declarations and definitions
100 ! ******************************************************************************
101 
102 ! ==============================================================================
103 ! Arguments
104 ! ==============================================================================
105 
106  INTEGER, INTENT(IN) :: icg
107  TYPE(t_grid), POINTER :: pgrid
108  TYPE(t_global), POINTER :: global
109 
110 ! ******************************************************************************
111 ! Start
112 ! ******************************************************************************
113 
114  CALL registerfunction(global,'RFLU_GetGlobalCellType',&
115  'RFLU_ModCellFaceEdgeInfo.F90')
116 
117 ! ******************************************************************************
118 ! Determine global cell type
119 ! ******************************************************************************
120 
121  IF ( icg > 0 ) THEN ! Interior cell
122  rflu_getglobalcelltype = pgrid%cellGlob2Loc(1,icg)
123  ELSE IF ( icg == cell_type_bnd ) THEN ! Boundary cell
124  rflu_getglobalcelltype = cell_type_bnd
125  ELSE IF ( icg == cell_type_ext ) THEN ! Exterior cell
126  rflu_getglobalcelltype = cell_type_ext
127  ELSE
128  CALL errorstop(global,err_reached_default,__line__)
129  END IF ! icg
130 
131 ! ******************************************************************************
132 ! End
133 ! ******************************************************************************
134 
135  CALL deregisterfunction(global)
136 
137  END FUNCTION rflu_getglobalcelltype
138 
139 
140 
141 
142 
143 
144 
145 
146 ! ******************************************************************************
147 !
148 ! Purpose: Determine global cell kind (after renumbering)
149 !
150 ! Description: None.
151 !
152 ! Input:
153 ! global Pointer to global data
154 ! pGrid Pointer to grid data
155 ! icg Global cell id
156 !
157 ! Output: None.
158 !
159 ! Notes: None.
160 !
161 ! ******************************************************************************
162 
163  INTEGER FUNCTION rflu_getglobalcellkind(global,pGrid,icg)
164 
165 ! ******************************************************************************
166 ! Declarations and definitions
167 ! ******************************************************************************
168 
169 ! ==============================================================================
170 ! Arguments
171 ! ==============================================================================
172 
173  INTEGER, INTENT(IN) :: icg
174  TYPE(t_grid), POINTER :: pgrid
175  TYPE(t_global), POINTER :: global
176 
177 ! ==============================================================================
178 ! Locals
179 ! ==============================================================================
180 
181  CHARACTER(CHRLEN) :: errorstring
182  INTEGER :: icl,ict
183 
184 ! ******************************************************************************
185 ! Start
186 ! ******************************************************************************
187 
188  CALL registerfunction(global,'RFLU_GetGlobalCellKind',&
189  'RFLU_ModCellFaceEdgeInfo.F90')
190 
191 ! ******************************************************************************
192 ! Get global cell kind
193 ! ******************************************************************************
194 
195  IF ( icg > 0 ) THEN
196  ict = pgrid%cellGlob2Loc(1,icg)
197  icl = pgrid%cellGlob2Loc(2,icg)
198  ELSE IF ( icg == cell_type_bnd ) THEN
199  ict = cell_type_bnd
200  ELSE IF ( icg == cell_type_ext ) THEN
201  ict = cell_type_ext
202  ELSE
203  CALL errorstop(global,err_reached_default,__line__)
204  END IF ! icg
205 
206  SELECT CASE (ict)
207  CASE ( cell_type_tet )
208  IF ( icl <= pgrid%nTets ) THEN
209  rflu_getglobalcellkind = cell_kind_actual
210  ELSE
211  rflu_getglobalcellkind = cell_kind_virtual
212  END IF ! icl
213  CASE ( cell_type_hex )
214  IF ( icl <= pgrid%nHexs ) THEN
215  rflu_getglobalcellkind = cell_kind_actual
216  ELSE
217  rflu_getglobalcellkind = cell_kind_virtual
218  END IF ! icl
219  CASE ( cell_type_pri )
220  IF ( icl <= pgrid%nPris ) THEN
221  rflu_getglobalcellkind = cell_kind_actual
222  ELSE
223  rflu_getglobalcellkind = cell_kind_virtual
224  END IF ! icl
225  CASE ( cell_type_pyr )
226  IF ( icl <= pgrid%nPyrs ) THEN
227  rflu_getglobalcellkind = cell_kind_actual
228  ELSE
229  rflu_getglobalcellkind = cell_kind_virtual
230  END IF ! icl
231  CASE ( cell_type_bnd )
232  rflu_getglobalcellkind = cell_kind_bnd
233  CASE ( cell_type_ext )
234  rflu_getglobalcellkind = cell_kind_ext
235  CASE default
236  WRITE(errorstring,'(1X,I3)') ict
237  CALL errorstop(global,err_cell_type,__line__,trim(errorstring))
238  END SELECT ! icType
239 
240 ! ******************************************************************************
241 ! End
242 ! ******************************************************************************
243 
244  CALL deregisterfunction(global)
245 
246  END FUNCTION rflu_getglobalcellkind
247 
248 
249 
250 
251 
252 
253 
254 ! ******************************************************************************
255 !
256 ! Purpose: Determine virtual cell region index.
257 !
258 ! Description: Loop over cells which are to be received, if cell among these,
259 ! then know region from border index.
260 !
261 ! Input:
262 ! global Pointer to global data
263 ! pGrid Pointer to grid data
264 ! icg Global cell id
265 !
266 ! Output: None.
267 !
268 ! Notes:
269 ! 1. If the cell is not found in any border list, return ELEMENT_NOT_FOUND.
270 !
271 ! ******************************************************************************
272 
273  INTEGER FUNCTION rflu_getvirtualcellreg(global,pGrid,icg)
274 
275  USE modborder, ONLY: t_border
276 
277  USE modsortsearch
278 
279 ! ******************************************************************************
280 ! Declarations and definitions
281 ! ******************************************************************************
282 
283 ! ==============================================================================
284 ! Arguments
285 ! ==============================================================================
286 
287  INTEGER, INTENT(IN) :: icg
288  TYPE(t_grid), POINTER :: pgrid
289  TYPE(t_global), POINTER :: global
290 
291 ! ==============================================================================
292 ! Locals
293 ! ==============================================================================
294 
295  INTEGER :: iborder,iloc
296  TYPE(t_border), POINTER :: pborder
297 
298 ! ******************************************************************************
299 ! Start
300 ! ******************************************************************************
301 
302  CALL registerfunction(global,'RFLU_GetVirtualCellReg',&
303  'RFLU_ModCellFaceEdgeInfo.F90')
304 
305 ! ******************************************************************************
306 ! Determine global cell type
307 ! ******************************************************************************
308 
309  rflu_getvirtualcellreg = element_not_found
310 
311  borderloop: DO iborder = 1,pgrid%nBorders
312  pborder => pgrid%borders(iborder)
313 
314  CALL binarysearchinteger(pborder%icgRecv,pborder%nCellsRecv,icg,iloc)
315 
316  IF ( iloc /= element_not_found ) THEN
317  rflu_getvirtualcellreg = pborder%iRegionGlobal
318 
319  EXIT borderloop
320  END IF ! iLoc
321  END DO borderloop
322 
323 ! ******************************************************************************
324 ! End
325 ! ******************************************************************************
326 
327  CALL deregisterfunction(global)
328 
329  END FUNCTION rflu_getvirtualcellreg
330 
331 
332 
333 
334 
335 
336 
337 ! ******************************************************************************
338 !
339 ! Purpose: Determine face kind before renumbering.
340 !
341 ! Description: None.
342 !
343 ! Input:
344 ! global Pointer to global data
345 ! c1k Kind of cell 1
346 ! c2k Kind of cell 2
347 !
348 ! Output: None.
349 !
350 ! Notes:
351 ! 1. Can only get FACE_KIND_AB if have partitioned case with no dummy cells,
352 ! which must not arise in practice but may be of interest for testing
353 ! purposes.
354 ! 2. Can only get FACE_KIND_VX if have partitioned case.
355 !
356 ! ******************************************************************************
357 
358  INTEGER FUNCTION rflu_getfacekind(global,c1k,c2k)
359 
360 ! ******************************************************************************
361 ! Declarations and definitions
362 ! ******************************************************************************
363 
364 ! ==============================================================================
365 ! Arguments
366 ! ==============================================================================
367 
368  INTEGER, INTENT(IN) :: c1k,c2k
369  TYPE(t_global), POINTER :: global
370 
371 ! ==============================================================================
372 ! Locals
373 ! ==============================================================================
374 
375  CHARACTER(CHRLEN) :: errorstring
376 
377 ! ******************************************************************************
378 ! Start
379 ! ******************************************************************************
380 
381  CALL registerfunction(global,'RFLU_GetFaceKind',&
382  'RFLU_ModCellFaceEdgeInfo.F90')
383 
384 ! ******************************************************************************
385 ! Get face kind
386 ! ******************************************************************************
387 
388  SELECT CASE (c1k + c2k)
389  CASE ( cell_kind_actual + cell_kind_actual )
390  rflu_getfacekind = face_kind_aa
391  CASE ( cell_kind_actual + cell_kind_virtual )
392  rflu_getfacekind = face_kind_av
393  CASE ( cell_kind_virtual + cell_kind_virtual )
394  rflu_getfacekind = face_kind_vv
395  CASE ( cell_kind_virtual + cell_kind_bnd )
396  rflu_getfacekind = face_kind_vb
397  CASE ( cell_kind_virtual + cell_kind_ext )
398  rflu_getfacekind = face_kind_vx
399  CASE ( cell_kind_actual + cell_kind_bnd )
400  rflu_getfacekind = face_kind_ab
401  CASE default
402  WRITE(errorstring,'(1X,I3)') c1k+c2k
403  CALL errorstop(global,err_face_kind,__line__,trim(errorstring))
404  END SELECT ! c1k + c2k
405 
406 ! ******************************************************************************
407 ! End
408 ! ******************************************************************************
409 
410  CALL deregisterfunction(global)
411 
412  END FUNCTION rflu_getfacekind
413 
414 
415 
416 
417 
418 ! ******************************************************************************
419 !
420 ! Purpose: Determine edge kind.
421 !
422 ! Description: None.
423 !
424 ! Input:
425 ! pRegion Pointer to region
426 !
427 ! Output: None.
428 !
429 ! Notes: None.
430 !
431 ! ******************************************************************************
432 
433  INTEGER FUNCTION rflu_getedgekind(global,pGrid,v1,v2)
434 
435 ! ******************************************************************************
436 ! Declarations and definitions
437 ! ******************************************************************************
438 
439 ! ==============================================================================
440 ! Arguments
441 ! ==============================================================================
442 
443  INTEGER, INTENT(IN) :: v1,v2
444  TYPE(t_global), POINTER :: global
445  TYPE(t_grid), POINTER :: pgrid
446 
447 ! ==============================================================================
448 ! Locals
449 ! ==============================================================================
450 
451  INTEGER :: v1k,v2k
452 
453 ! ******************************************************************************
454 ! Start
455 ! ******************************************************************************
456 
457  CALL registerfunction(global,'RFLU_GetEdgeKind',&
458  'RFLU_ModCellFaceEdgeInfo.F90')
459 
460 ! ******************************************************************************
461 ! Get face kind
462 ! ******************************************************************************
463 
464  IF ( v1 <= pgrid%nVert ) THEN
465  v1k = vert_kind_actual
466  ELSE
467  v1k = vert_kind_virtual
468  END IF ! v1
469 
470  IF ( v2 <= pgrid%nVert ) THEN
471  v2k = vert_kind_actual
472  ELSE
473  v2k = vert_kind_virtual
474  END IF ! v2
475 
476  SELECT CASE (v1k + v2k)
477  CASE ( vert_kind_actual + vert_kind_actual )
478  rflu_getedgekind = edge_kind_aa
479  CASE ( vert_kind_actual + vert_kind_virtual )
480  rflu_getedgekind = edge_kind_av
481  CASE ( vert_kind_virtual + vert_kind_virtual )
482  rflu_getedgekind = edge_kind_vv
483  CASE default
484  CALL errorstop(global,err_cell_type,__line__)
485  END SELECT ! v1k + v2k
486 
487 ! ******************************************************************************
488 ! End
489 ! ******************************************************************************
490 
491  CALL deregisterfunction(global)
492 
493  END FUNCTION rflu_getedgekind
494 
495 
496 
497 
498 ! ******************************************************************************
499 ! End
500 ! ******************************************************************************
501 
502 END MODULE rflu_modcellfaceedgeinfo
503 
504 
505 ! ******************************************************************************
506 !
507 ! RCS Revision history:
508 !
509 ! $Log: RFLU_ModCellFaceEdgeInfo.F90,v $
510 ! Revision 1.12 2008/12/06 08:44:20 mtcampbe
511 ! Updated license.
512 !
513 ! Revision 1.11 2008/11/19 22:17:31 mtcampbe
514 ! Added Illinois Open Source License/Copyright
515 !
516 ! Revision 1.10 2006/04/07 15:19:18 haselbac
517 ! Removed tabs
518 !
519 ! Revision 1.9 2005/04/15 15:06:45 haselbac
520 ! Added RFLU_GetVirtualCellReg
521 !
522 ! Revision 1.8 2004/11/03 17:01:20 haselbac
523 ! Rewrite because of removal of vertex anc cell flags, cosmetics
524 !
525 ! Revision 1.7 2004/01/22 16:03:58 haselbac
526 ! Made contents of modules PRIVATE, only procs PUBLIC, to avoid errors on ALC and titan
527 !
528 ! Revision 1.6 2003/11/20 21:30:32 haselbac
529 ! Added register and deregister calls for better error reporting
530 !
531 ! Revision 1.5 2003/11/20 16:40:36 mdbrandy
532 ! Backing out RocfluidMP changes from 11-17-03
533 !
534 ! Revision 1.2 2003/08/19 22:47:54 haselbac
535 ! Improved error reporting
536 !
537 ! Revision 1.1 2003/03/15 18:16:29 haselbac
538 ! Formerly called RFLU_ModCellFaceInfo.F90
539 !
540 ! Revision 1.5 2003/01/28 16:25:14 haselbac
541 ! Made simpler and more self-consistent
542 !
543 ! Revision 1.4 2002/10/05 19:02:31 haselbac
544 ! Fixed comment
545 !
546 ! Revision 1.3 2002/09/09 15:02:02 haselbac
547 ! global now under regions
548 !
549 ! Revision 1.2 2002/07/25 14:58:19 haselbac
550 ! Fixed bug in RFLU_GetCellIndexAfter and RFLU_GetCellKindBefore
551 !
552 ! Revision 1.1 2002/06/27 15:48:16 haselbac
553 ! Initial revision
554 !
555 ! ******************************************************************************
556 
557 
558 
559 
560 
561 
562 
563 
564 
565 
566 
INTEGER function, public rflu_getglobalcellkind(global, pGrid, icg)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
INTEGER function, public rflu_getedgekind(global, pGrid, v1, v2)
subroutine binarysearchinteger(a, n, v, i, j)
INTEGER function, public rflu_getfacekind(global, c1k, c2k)
INTEGER function, public rflu_getvirtualcellreg(global, pGrid, icg)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
INTEGER function, public rflu_getglobalcelltype(global, pGrid, icg)