Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TFLU_ConvertFlo2FluPatch.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: obtain face (quads) and vertex connectivity at non-connecting
26 ! boundary patches in structured grid, equivalent to true boundary
27 ! patches in unstructured grid.
28 !
29 ! Description: quad and vertex connectivity at boundary patches are obtined
30 ! from current region l2g mapping
31 !
32 ! Input: iReg = region number
33 ! regions = data for all regions
34 !
35 ! Output: global%tofluQuad2v (for quads) and tofluBLoc2g (for vertices)
36 !
37 ! Notes: none.
38 !
39 !******************************************************************************
40 !
41 ! $Id: TFLU_ConvertFlo2FluPatch.F90,v 1.4 2008/12/06 08:44:53 mtcampbe Exp $
42 !
43 ! Copyright: (c) 2001 by the University of Illinois
44 !
45 !******************************************************************************
46 
47 SUBROUTINE convertflo2flupatch( iReg,regions )
48 
49  USE moddatatypes
50  USE moderror
51  USE moddatastruct, ONLY : t_region
52  USE modglobal, ONLY : t_global
53  USE modgrid, ONLY : t_grid
54  USE modbndpatch, ONLY : t_patch
57  USE modparameters
58  IMPLICIT NONE
59 
60 #include "Indexing.h"
61 
62 ! ... parameters
63  INTEGER :: ireg
64  TYPE(t_region), POINTER :: regions(:)
65 
66 ! ... loop variables
67  INTEGER :: ipatch, i, j, k
68 
69 ! ... local variables
70  TYPE(t_global), POINTER :: global
71  TYPE(t_grid) , POINTER :: grid
72  TYPE(t_patch) , POINTER :: patch
73 
74  INTEGER :: ilev, lbound, bctype, inoff, ijnoff, ibn, ien, ijkn, ng1, ng2
75  INTEGER :: ibeg, iend, jbeg, jend, kbeg, kend, igpatch, dims(2), errorflag
76  INTEGER :: iadd, jadd, kadd, iq
77 
78 !******************************************************************************
79 
80  global => regions(1)%global
81  CALL registerfunction( global,'ConvertFlo2FluPatch',&
82  'TFLU_ConvertFlo2FluPatch.F90' )
83 
84 ! obtain boundary vertices and faces (quads) connectivity ---------------------
85 
86  ilev = regions(ireg)%currLevel
87  grid => regions(ireg)%levels(ilev)%grid
88 
89  CALL rflo_getnodeoffset( regions(ireg),ilev,inoff,ijnoff )
90 
91  DO ipatch=1,regions(ireg)%nPatches
92 
93  patch => regions(ireg)%levels(ilev)%patches(ipatch)
94  lbound = patch%lbound
95  bctype = patch%bcType
96 
97 ! - only at non-connecting patches --------------------------------------------
98 
99  IF (bctype<bc_regionconf .OR. bctype>bc_regionconf+bc_range) THEN
100 
101 ! --- get dimensions needed to output the unstructured grid
102 
103  global%tofluNPatches = global%tofluNPatches + 1
104  igpatch = global%tofluNPatches
105  CALL rflo_getpatchindices( regions(ireg),patch,ilev, &
106  ibeg,iend,jbeg,jend,kbeg,kend )
107 
108  dims(1) = abs(patch%l1end-patch%l1beg) + 2 ! nodal values
109  dims(2) = abs(patch%l2end-patch%l2beg) + 2
110 
111  global%tofluNbVerts(igpatch) = global%tofluNbVerts(igpatch) + &
112  dims(1)*dims(2)
113 
114  dims(1) = abs(patch%l1end-patch%l1beg) + 1 ! face values
115  dims(2) = abs(patch%l2end-patch%l2beg) + 1
116 
117  global%tofluNbFaces(igpatch) = global%tofluNbFaces(igpatch) + &
118  dims(1)*dims(2)
119  iadd = 0
120  jadd = 0
121  kadd = 0
122  IF (lbound==2) THEN
123  iadd=1
124  ELSEIF (lbound==4) THEN
125  jadd=1
126  ELSEIF (lbound==6) THEN
127  kadd=1
128  ENDIF
129 
130 ! --- obtain quads connectivity depending on lbound ---------------------------
131 
132  DO k=kbeg+kadd,kend+kadd
133  DO j=jbeg+jadd,jend+jadd
134  DO i=ibeg+iadd,iend+iadd
135 
136  IF (lbound==1 .OR. lbound==2) THEN
137  ng1 = j - jbeg + 1
138  ng2 = k - kbeg + 1
139  iq = (ng2-1)*(jend-jbeg+1)+ng1
140  IF (lbound==1) THEN
141  global%tofluQuad2v(1,iq,igpatch) = grid%tofluLoc2g(i ,j ,k )
142  global%tofluQuad2v(2,iq,igpatch) = grid%tofluLoc2g(i ,j ,k+1)
143  global%tofluQuad2v(3,iq,igpatch) = grid%tofluLoc2g(i ,j+1,k+1)
144  global%tofluQuad2v(4,iq,igpatch) = grid%tofluLoc2g(i ,j+1,k )
145  ELSE
146  global%tofluQuad2v(1,iq,igpatch) = grid%tofluLoc2g(i ,j ,k )
147  global%tofluQuad2v(2,iq,igpatch) = grid%tofluLoc2g(i ,j+1,k )
148  global%tofluQuad2v(3,iq,igpatch) = grid%tofluLoc2g(i ,j+1,k+1)
149  global%tofluQuad2v(4,iq,igpatch) = grid%tofluLoc2g(i ,j ,k+1)
150  ENDIF
151  ELSE IF (lbound==3 .OR. lbound==4) THEN
152  ng1 = k - kbeg + 1
153  ng2 = i - ibeg + 1
154  iq = (ng2-1)*(kend-kbeg+1)+ng1
155  IF (lbound==3) THEN
156  global%tofluQuad2v(1,iq,igpatch) = grid%tofluLoc2g(i ,j ,k )
157  global%tofluQuad2v(2,iq,igpatch) = grid%tofluLoc2g(i+1,j ,k )
158  global%tofluQuad2v(3,iq,igpatch) = grid%tofluLoc2g(i+1,j ,k+1)
159  global%tofluQuad2v(4,iq,igpatch) = grid%tofluLoc2g(i ,j ,k+1)
160  ELSE
161  global%tofluQuad2v(1,iq,igpatch) = grid%tofluLoc2g(i ,j ,k )
162  global%tofluQuad2v(2,iq,igpatch) = grid%tofluLoc2g(i ,j ,k+1)
163  global%tofluQuad2v(3,iq,igpatch) = grid%tofluLoc2g(i+1,j ,k+1)
164  global%tofluQuad2v(4,iq,igpatch) = grid%tofluLoc2g(i+1,j ,k )
165  ENDIF
166  ELSE IF (lbound==5 .OR. lbound==6) THEN
167  ng1 = i - ibeg + 1
168  ng2 = j - jbeg + 1
169  iq = (ng2-1)*(iend-ibeg+1)+ng1
170  IF (lbound==5) THEN
171  global%tofluQuad2v(1,iq,igpatch) = grid%tofluLoc2g(i ,j ,k )
172  global%tofluQuad2v(2,iq,igpatch) = grid%tofluLoc2g(i ,j+1,k )
173  global%tofluQuad2v(3,iq,igpatch) = grid%tofluLoc2g(i+1,j+1,k )
174  global%tofluQuad2v(4,iq,igpatch) = grid%tofluLoc2g(i+1,j ,k )
175  ELSE
176  global%tofluQuad2v(1,iq,igpatch) = grid%tofluLoc2g(i ,j ,k )
177  global%tofluQuad2v(2,iq,igpatch) = grid%tofluLoc2g(i+1,j ,k )
178  global%tofluQuad2v(3,iq,igpatch) = grid%tofluLoc2g(i+1,j+1,k )
179  global%tofluQuad2v(4,iq,igpatch) = grid%tofluLoc2g(i ,j+1,k )
180  ENDIF ! lbound
181  ENDIF ! lbound
182  ENDDO ! i
183  ENDDO ! j
184  ENDDO ! k
185 
186 ! --- obtain connectivity at boundary vertices --------------------------------
187 
188  CALL rflo_getpatchindicesnodes( regions(ireg),patch,ilev, &
189  ibeg,iend,jbeg,jend,kbeg,kend )
190  DO k=kbeg,kend
191  DO j=jbeg,jend
192  DO i=ibeg,iend
193 
194  IF (lbound==1 .OR. lbound==2) THEN
195  ng1 = j - jbeg + 1
196  ng2 = k - kbeg + 1
197  iq = (ng2-1)*(jend-jbeg+1)+ng1
198  ELSE IF (lbound==3 .OR. lbound==4) THEN
199  ng1 = k - kbeg + 1
200  ng2 = i - ibeg + 1
201  iq = (ng2-1)*(kend-kbeg+1)+ng1
202  ELSE IF (lbound==5 .OR. lbound==6) THEN
203  ng1 = i - ibeg + 1
204  ng2 = j - jbeg + 1
205  iq = (ng2-1)*(iend-ibeg+1)+ng1
206  ENDIF
207  global%tofluBLoc2g(iq,igpatch) = grid%tofluLoc2g(i,j,k)
208 
209  IF (lbound==2) THEN
210  global%tofluMaxBind = &
211  max( global%tofluMaxBind , grid%tofluLoc2g(i,j,k) )
212  ELSEIF (lbound==4) THEN
213  global%tofluMaxBind = &
214  max( global%tofluMaxBind , grid%tofluLoc2g(i,j,k) )
215  ELSEIF (lbound==6) THEN
216  global%tofluMaxBind = &
217  max( global%tofluMaxBind , grid%tofluLoc2g(i,j,k) )
218  ENDIF
219 
220  ENDDO ! i
221  ENDDO ! j
222  ENDDO ! k
223 
224  global%tofluIq(igpatch) = iq
225 
226  ENDIF ! bcType
227  ENDDO ! iPatch
228 
229 ! finalize --------------------------------------------------------------------
230 
231  CALL deregisterfunction( global )
232 
233 END SUBROUTINE convertflo2flupatch
234 
235 !******************************************************************************
236 !
237 ! RCS Revision history:
238 !
239 ! $Log: TFLU_ConvertFlo2FluPatch.F90,v $
240 ! Revision 1.4 2008/12/06 08:44:53 mtcampbe
241 ! Updated license.
242 !
243 ! Revision 1.3 2008/11/19 22:18:03 mtcampbe
244 ! Added Illinois Open Source License/Copyright
245 !
246 ! Revision 1.2 2004/12/03 03:43:49 wasistho
247 ! rflo_modinterfacestoflu to tflu_modinterfaces
248 !
249 ! Revision 1.1 2004/12/03 02:59:30 wasistho
250 ! added prefix
251 !
252 ! Revision 1.1 2004/12/03 00:58:20 wasistho
253 ! lower to upper case
254 !
255 ! Revision 1.2 2004/08/18 02:10:40 wasistho
256 ! added new routines to create dimension file
257 !
258 ! Revision 1.1.1.1 2004/08/17 01:41:39 wasistho
259 ! initial checkin
260 !
261 !
262 !******************************************************************************
263 
264 
265 
266 
267 
268 
269 
**********************************************************************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 convertflo2flupatch(iReg, regions)
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
subroutine rflo_getpatchindices(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
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)
blockLoc i
Definition: read.cpp:79
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
**********************************************************************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 grid(bp)
Definition: setup_py.f90:257
**********************************************************************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