Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PREP_GetGrid.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 volume and surface grid.
26 !
27 ! Description: none.
28 !
29 ! Input: gridLevel = initial grid level
30 ! regions = data for all regions
31 ! iReg = region number
32 !
33 ! Output: vol-grid.
34 !
35 ! Notes: none.
36 !
37 !******************************************************************************
38 !
39 ! $Id: PREP_GetGrid.F90,v 1.7 2008/12/06 08:44:50 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2001 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE getgrid( gridLevel,iReg,regions )
46 
47  USE moddatatypes
48  USE moderror
49  USE moddatastruct, ONLY : t_region
50  USE modglobal, ONLY : t_global
51  USE modbndpatch, ONLY : t_patch
56  USE modparameters
57  IMPLICIT NONE
58 
59 #include "Indexing.h"
60 
61 ! ... parameters
62  INTEGER :: gridlevel,ireg
63  TYPE(t_region), POINTER :: regions(:)
64 
65 ! ... loop variables
66  INTEGER :: ipatch, i, j, k, ijkn, ng1, ng2
67 
68 ! ... local variables
69  TYPE(t_global), POINTER :: global
70  TYPE(t_patch) , POINTER :: patch
71 
72  INTEGER :: ilev, lbound, inoff, ijnoff
73  INTEGER :: ibn, ien, idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend
74  INTEGER :: ibeg, iend, jbeg, jend, kbeg, kend, dims(2), errorflag
75 
76 !******************************************************************************
77 
78  global => regions(1)%global
79  CALL registerfunction( global,'GetGrid',&
80  'PREP_GetGrid.F90' )
81 
82 ! read grid -------------------------------------------------------------------
83 
84 ! allocate memory for grid
85 
86  regions(ireg)%currLevel = gridlevel
87  ilev = regions(ireg)%currLevel
88 
89  CALL rflo_getdimensdummynodes( regions(ireg),ilev,idnbeg,idnend, &
90  jdnbeg,jdnend,kdnbeg,kdnend )
91  CALL rflo_getnodeoffset( regions(ireg),ilev,inoff,ijnoff )
92  ibn = indijk(idnbeg,jdnbeg,kdnbeg,inoff,ijnoff)
93  ien = indijk(idnend,jdnend,kdnend,inoff,ijnoff)
94  ALLOCATE( regions(ireg)%levels(ilev)%grid%xyz(3,ibn:ien),stat=errorflag )
95  global%error = errorflag
96  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
97 
98 ! read volume grid
99 
100  CALL rflo_readgridregion( ireg,regions )
101 
102  CALL rflo_copygeometrydummy( regions(ireg) ) ! copy to dummy nodes
103  CALL rflo_extrapolategeometry( regions(ireg) ) ! extrapolate
104 
105 ! define surface grid
106 
107  DO ipatch=1,regions(ireg)%nPatches
108 
109  patch => regions(ireg)%levels(ilev)%patches(ipatch)
110  lbound = patch%lbound
111 
112 ! - get dimensions, allocate memory
113 
114  dims(1) = abs(patch%l1end-patch%l1beg) + 2 ! nodal values
115  dims(2) = abs(patch%l2end-patch%l2beg) + 2
116  ALLOCATE( patch%surfCoord(3,dims(1),dims(2)),stat=errorflag )
117  global%error = errorflag
118  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
119 
120  CALL rflo_getpatchindicesnodes( regions(ireg),patch,ilev, &
121  ibeg,iend,jbeg,jend,kbeg,kend )
122 
123 ! - initialize bcSet
124 
125  patch%mixt%bcSet = .false.
126 
127 ! - copy coordinates to temporary array
128 
129  DO k=kbeg,kend
130  DO j=jbeg,jend
131  DO i=ibeg,iend
132  ijkn = indijk(i,j,k,inoff,ijnoff)
133  IF (lbound==1 .OR. lbound==2) THEN
134  IF (lbound == 2) THEN
135  ng1 = j - jbeg + 1
136  ELSE
137  ng1 = jend - j + 1
138  ENDIF
139  ng2 = k - kbeg + 1
140  ELSE IF (lbound==3 .OR. lbound==4) THEN
141  ng1 = k - kbeg + 1
142  IF (lbound == 4) THEN
143  ng2 = i - ibeg + 1
144  ELSE
145  ng2 = iend - i + 1
146  ENDIF
147  ELSE IF (lbound==5 .OR. lbound==6) THEN
148  IF (lbound == 6) THEN
149  ng1 = i - ibeg + 1
150  ELSE
151  ng1 = iend - i + 1
152  ENDIF
153  ng2 = j - jbeg + 1
154  ENDIF
155  patch%surfCoord(1,ng1,ng2) = &
156  regions(ireg)%levels(ilev)%grid%xyz(xcoord,ijkn)
157  patch%surfCoord(2,ng1,ng2) = &
158  regions(ireg)%levels(ilev)%grid%xyz(ycoord,ijkn)
159  patch%surfCoord(3,ng1,ng2) = &
160  regions(ireg)%levels(ilev)%grid%xyz(zcoord,ijkn)
161  ENDDO ! i
162  ENDDO ! j
163  ENDDO ! k
164  ENDDO ! iPatch
165 
166 ! finalize --------------------------------------------------------------------
167 
168  CALL deregisterfunction( global )
169 
170 END SUBROUTINE getgrid
171 
172 !******************************************************************************
173 !
174 ! RCS Revision history:
175 !
176 ! $Log: PREP_GetGrid.F90,v $
177 ! Revision 1.7 2008/12/06 08:44:50 mtcampbe
178 ! Updated license.
179 !
180 ! Revision 1.6 2008/11/19 22:18:00 mtcampbe
181 ! Added Illinois Open Source License/Copyright
182 !
183 ! Revision 1.5 2006/08/19 15:41:06 mparmar
184 ! Renamed patch variables
185 !
186 ! Revision 1.4 2005/09/30 00:13:16 wasistho
187 ! added copy geometry to dummy
188 !
189 ! Revision 1.3 2005/05/03 08:17:30 wasistho
190 ! initialized bcSet to false
191 !
192 ! Revision 1.2 2005/05/03 03:20:17 wasistho
193 ! enabled modified cyl.Taylor inflow profile
194 !
195 ! Revision 1.1 2005/05/02 18:09:34 wasistho
196 ! added cylindrical Taylor inflow profile capability
197 !
198 !
199 !
200 !******************************************************************************
201 
202 
203 
204 
205 
206 
207 
**********************************************************************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 rflo_copygeometrydummy(region)
j indices k indices k
Definition: Indexing.h:6
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_extrapolategeometry(region)
subroutine getgrid(gridLevel, iReg, 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 jdnbeg
**********************************************************************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 idnend
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
**********************************************************************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 jdnend
subroutine rflo_readgridregion(iReg, 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 idnbeg
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_generatecoarsegrids(region)
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
subroutine rflo_getdimensdummynodes(region, iLev, idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
**********************************************************************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
**********************************************************************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 kdnbeg