Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_CalcGridSpeeds.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: calculate grid speeds at the faces of the control volume.
26 !
27 ! Description: none.
28 !
29 ! Input: region%levels%grid(Old) = dimensions, coordinates, face vectors.
30 !
31 ! Output: region%levels%grid%si/j/kVel = grid speeds.
32 !
33 ! Notes: grid speeds are calculated only for the faces of the physical cells.
34 !
35 !******************************************************************************
36 !
37 ! $Id: RFLO_CalcGridSpeeds.F90,v 1.3 2008/12/06 08:44:26 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2001 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE rflo_calcgridspeeds( region )
44 
45  USE moddatatypes
46  USE moddatastruct, ONLY : t_region
49  USE moderror
50  USE modparameters
51  IMPLICIT NONE
52 
53 #include "Indexing.h"
54 
55 ! ... parameters
56  TYPE(t_region) :: region
57 
58 ! ... loop variables
59  INTEGER :: ilev, i, j, k
60 
61 ! ... local variables
62  INTEGER :: ipnbeg, ipnend, jpnbeg, jpnend, kpnbeg, kpnend
63  INTEGER :: inoff, ijnoff, corner(4)
64 
65  REAL(RFREAL) :: xyzquad(3,4), xyzhexa(3,8), facevecs(3,6), dvol, dt
66  REAL(RFREAL), POINTER :: xyzold(:,:), xyz(:,:), siold(:,:), sjold(:,:), &
67  skold(:,:), si(:,:), sj(:,:), sk(:,:), &
68  sivel(:), sjvel(:), skvel(:)
69 
70 !******************************************************************************
71 
72  CALL registerfunction( region%global,'RFLO_CalcGridSpeeds',&
73  'RFLO_CalcGridSpeeds.F90' )
74 
75 ! loop over all grid levels ---------------------------------------------------
76 
77  DO ilev=1,region%nGridLevels
78 
79  CALL rflo_getdimensphysnodes( region,ilev,ipnbeg,ipnend, &
80  jpnbeg,jpnend,kpnbeg,kpnend )
81  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
82 
83  xyzold => region%levels(ilev)%gridOld%xyz
84  siold => region%levels(ilev)%gridOld%si
85  sjold => region%levels(ilev)%gridOld%sj
86  skold => region%levels(ilev)%gridOld%sk
87  xyz => region%levels(ilev)%grid%xyz
88  si => region%levels(ilev)%grid%si
89  sj => region%levels(ilev)%grid%sj
90  sk => region%levels(ilev)%grid%sk
91  sivel => region%levels(ilev)%grid%siVel
92  sjvel => region%levels(ilev)%grid%sjVel
93  skvel => region%levels(ilev)%grid%skVel
94 
95  dt = region%global%dtMin
96 
97 ! - i-direction
98 
99  DO k=kpnbeg,kpnend-1
100  DO j=jpnbeg,jpnend-1
101  DO i=ipnbeg,ipnend
102  corner(1) = indijk(i,j ,k ,inoff,ijnoff)
103  corner(2) = indijk(i,j ,k+1,inoff,ijnoff)
104  corner(3) = indijk(i,j+1,k+1,inoff,ijnoff)
105  corner(4) = indijk(i,j+1,k ,inoff,ijnoff)
106 
107  xyzhexa(1:3,1) = xyz(1:3,corner(1))
108  xyzhexa(1:3,2) = xyz(1:3,corner(2))
109  xyzhexa(1:3,3) = xyz(1:3,corner(3))
110  xyzhexa(1:3,4) = xyz(1:3,corner(4))
111  xyzhexa(1:3,5) = xyzold(1:3,corner(1))
112  xyzhexa(1:3,6) = xyzold(1:3,corner(2))
113  xyzhexa(1:3,7) = xyzold(1:3,corner(3))
114  xyzhexa(1:3,8) = xyzold(1:3,corner(4))
115 
116  facevecs(1:3,1) = si(1:3,corner(1))
117  facevecs(1:3,2) = -siold(1:3,corner(1))
118 
119  xyzquad(1:3,1) = xyzold(1:3,corner(1))
120  xyzquad(1:3,2) = xyzold(1:3,corner(2))
121  xyzquad(1:3,3) = xyz(1:3,corner(2))
122  xyzquad(1:3,4) = xyz(1:3,corner(1))
123  CALL facevectorquad( xyzquad, &
124  facevecs(xcoord,3), &
125  facevecs(ycoord,3), &
126  facevecs(zcoord,3) )
127 
128  xyzquad(1:3,1) = xyzold(1:3,corner(3))
129  xyzquad(1:3,2) = xyzold(1:3,corner(4))
130  xyzquad(1:3,3) = xyz(1:3,corner(4))
131  xyzquad(1:3,4) = xyz(1:3,corner(3))
132  CALL facevectorquad( xyzquad, &
133  facevecs(xcoord,4), &
134  facevecs(ycoord,4), &
135  facevecs(zcoord,4) )
136 
137  xyzquad(1:3,1) = xyzold(1:3,corner(4))
138  xyzquad(1:3,2) = xyzold(1:3,corner(1))
139  xyzquad(1:3,3) = xyz(1:3,corner(1))
140  xyzquad(1:3,4) = xyz(1:3,corner(4))
141  CALL facevectorquad( xyzquad, &
142  facevecs(xcoord,5), &
143  facevecs(ycoord,5), &
144  facevecs(zcoord,5) )
145 
146  xyzquad(1:3,1) = xyzold(1:3,corner(2))
147  xyzquad(1:3,2) = xyzold(1:3,corner(3))
148  xyzquad(1:3,3) = xyz(1:3,corner(3))
149  xyzquad(1:3,4) = xyz(1:3,corner(2))
150  CALL facevectorquad( xyzquad, &
151  facevecs(xcoord,6), &
152  facevecs(ycoord,6), &
153  facevecs(zcoord,6) )
154 
155  CALL volumehexa( xyzhexa,facevecs,dvol )
156 
157  sivel(corner(1)) = dvol/dt
158  ENDDO ! i
159  ENDDO ! j
160  ENDDO ! k
161 
162 ! - j-direction
163 
164  DO k=kpnbeg,kpnend-1
165  DO j=jpnbeg,jpnend
166  DO i=ipnbeg,ipnend-1
167  corner(1) = indijk(i+1,j,k ,inoff,ijnoff)
168  corner(2) = indijk(i+1,j,k+1,inoff,ijnoff)
169  corner(3) = indijk(i ,j,k+1,inoff,ijnoff)
170  corner(4) = indijk(i ,j,k ,inoff,ijnoff)
171 
172  xyzhexa(1:3,1) = xyz(1:3,corner(1))
173  xyzhexa(1:3,2) = xyz(1:3,corner(2))
174  xyzhexa(1:3,3) = xyz(1:3,corner(3))
175  xyzhexa(1:3,4) = xyz(1:3,corner(4))
176  xyzhexa(1:3,5) = xyzold(1:3,corner(1))
177  xyzhexa(1:3,6) = xyzold(1:3,corner(2))
178  xyzhexa(1:3,7) = xyzold(1:3,corner(3))
179  xyzhexa(1:3,8) = xyzold(1:3,corner(4))
180 
181  facevecs(1:3,1) = sj(1:3,corner(4))
182  facevecs(1:3,2) = -sjold(1:3,corner(4))
183 
184  xyzquad(1:3,1) = xyzold(1:3,corner(1))
185  xyzquad(1:3,2) = xyzold(1:3,corner(2))
186  xyzquad(1:3,3) = xyz(1:3,corner(2))
187  xyzquad(1:3,4) = xyz(1:3,corner(1))
188  CALL facevectorquad( xyzquad, &
189  facevecs(xcoord,3), &
190  facevecs(ycoord,3), &
191  facevecs(zcoord,3) )
192 
193  xyzquad(1:3,1) = xyzold(1:3,corner(3))
194  xyzquad(1:3,2) = xyzold(1:3,corner(4))
195  xyzquad(1:3,3) = xyz(1:3,corner(4))
196  xyzquad(1:3,4) = xyz(1:3,corner(3))
197  CALL facevectorquad( xyzquad, &
198  facevecs(xcoord,4), &
199  facevecs(ycoord,4), &
200  facevecs(zcoord,4) )
201 
202  xyzquad(1:3,1) = xyzold(1:3,corner(4))
203  xyzquad(1:3,2) = xyzold(1:3,corner(1))
204  xyzquad(1:3,3) = xyz(1:3,corner(1))
205  xyzquad(1:3,4) = xyz(1:3,corner(4))
206  CALL facevectorquad( xyzquad, &
207  facevecs(xcoord,5), &
208  facevecs(ycoord,5), &
209  facevecs(zcoord,5) )
210 
211  xyzquad(1:3,1) = xyzold(1:3,corner(2))
212  xyzquad(1:3,2) = xyzold(1:3,corner(3))
213  xyzquad(1:3,3) = xyz(1:3,corner(3))
214  xyzquad(1:3,4) = xyz(1:3,corner(2))
215  CALL facevectorquad( xyzquad, &
216  facevecs(xcoord,6), &
217  facevecs(ycoord,6), &
218  facevecs(zcoord,6) )
219 
220  CALL volumehexa( xyzhexa,facevecs,dvol )
221 
222  sjvel(corner(4)) = dvol/dt
223  ENDDO ! i
224  ENDDO ! j
225  ENDDO ! k
226 
227 ! - k-direction
228 
229  DO k=kpnbeg,kpnend
230  DO j=jpnbeg,jpnend-1
231  DO i=ipnbeg,ipnend-1
232  corner(1) = indijk(i+1,j ,k,inoff,ijnoff)
233  corner(2) = indijk(i ,j ,k,inoff,ijnoff)
234  corner(3) = indijk(i ,j+1,k,inoff,ijnoff)
235  corner(4) = indijk(i+1,j+1,k,inoff,ijnoff)
236 
237  xyzhexa(1:3,1) = xyz(1:3,corner(1))
238  xyzhexa(1:3,2) = xyz(1:3,corner(2))
239  xyzhexa(1:3,3) = xyz(1:3,corner(3))
240  xyzhexa(1:3,4) = xyz(1:3,corner(4))
241  xyzhexa(1:3,5) = xyzold(1:3,corner(1))
242  xyzhexa(1:3,6) = xyzold(1:3,corner(2))
243  xyzhexa(1:3,7) = xyzold(1:3,corner(3))
244  xyzhexa(1:3,8) = xyzold(1:3,corner(4))
245 
246  facevecs(1:3,1) = sk(1:3,corner(2))
247  facevecs(1:3,2) = -skold(1:3,corner(2))
248 
249  xyzquad(1:3,1) = xyzold(1:3,corner(1))
250  xyzquad(1:3,2) = xyzold(1:3,corner(2))
251  xyzquad(1:3,3) = xyz(1:3,corner(2))
252  xyzquad(1:3,4) = xyz(1:3,corner(1))
253  CALL facevectorquad( xyzquad, &
254  facevecs(xcoord,3), &
255  facevecs(ycoord,3), &
256  facevecs(zcoord,3) )
257 
258  xyzquad(1:3,1) = xyzold(1:3,corner(3))
259  xyzquad(1:3,2) = xyzold(1:3,corner(4))
260  xyzquad(1:3,3) = xyz(1:3,corner(4))
261  xyzquad(1:3,4) = xyz(1:3,corner(3))
262  CALL facevectorquad( xyzquad, &
263  facevecs(xcoord,4), &
264  facevecs(ycoord,4), &
265  facevecs(zcoord,4) )
266 
267  xyzquad(1:3,1) = xyzold(1:3,corner(4))
268  xyzquad(1:3,2) = xyzold(1:3,corner(1))
269  xyzquad(1:3,3) = xyz(1:3,corner(1))
270  xyzquad(1:3,4) = xyz(1:3,corner(4))
271  CALL facevectorquad( xyzquad, &
272  facevecs(xcoord,5), &
273  facevecs(ycoord,5), &
274  facevecs(zcoord,5) )
275 
276  xyzquad(1:3,1) = xyzold(1:3,corner(2))
277  xyzquad(1:3,2) = xyzold(1:3,corner(3))
278  xyzquad(1:3,3) = xyz(1:3,corner(3))
279  xyzquad(1:3,4) = xyz(1:3,corner(2))
280  CALL facevectorquad( xyzquad, &
281  facevecs(xcoord,6), &
282  facevecs(ycoord,6), &
283  facevecs(zcoord,6) )
284 
285  CALL volumehexa( xyzhexa,facevecs,dvol )
286 
287  skvel(corner(2)) = dvol/dt
288  ENDDO ! i
289  ENDDO ! j
290  ENDDO ! k
291 
292  ENDDO ! iLev
293 
294 ! finalize --------------------------------------------------------------------
295 
296  CALL deregisterfunction( region%global )
297 
298 END SUBROUTINE rflo_calcgridspeeds
299 
300 !******************************************************************************
301 !
302 ! RCS Revision history:
303 !
304 ! $Log: RFLO_CalcGridSpeeds.F90,v $
305 ! Revision 1.3 2008/12/06 08:44:26 mtcampbe
306 ! Updated license.
307 !
308 ! Revision 1.2 2008/11/19 22:17:37 mtcampbe
309 ! Added Illinois Open Source License/Copyright
310 !
311 ! Revision 1.1 2004/11/29 20:51:38 wasistho
312 ! lower to upper case
313 !
314 ! Revision 1.9 2003/11/20 16:40:37 mdbrandy
315 ! Backing out RocfluidMP changes from 11-17-03
316 !
317 ! Revision 1.5 2003/10/01 23:52:10 jblazek
318 ! Corrected bug in moving noslip wall BC and grid speeds.
319 !
320 ! Revision 1.4 2003/05/15 02:57:03 jblazek
321 ! Inlined index function.
322 !
323 ! Revision 1.3 2002/09/05 17:40:21 jblazek
324 ! Variable global moved into regions().
325 !
326 ! Revision 1.2 2002/08/30 01:47:58 jblazek
327 ! Added support for moving grids.
328 !
329 ! Revision 1.1 2002/08/27 20:44:31 jblazek
330 ! Implemented calculation of grid speeds.
331 !
332 !******************************************************************************
333 
334 
335 
336 
337 
338 
339 
**********************************************************************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 jpnbeg
j indices k indices k
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 kpnbeg
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
**********************************************************************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 jpnend
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
blockLoc i
Definition: read.cpp:79
**********************************************************************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 ipnbeg
subroutine rflo_calcgridspeeds(region)
subroutine rflo_getdimensphysnodes(region, iLev, ipnbeg, ipnend, jpnbeg, jpnend, kpnbeg, kpnend)
j indices j
Definition: Indexing.h:6
subroutine volumehexa(xyzNodes, faceVecs, volume)
subroutine facevectorquad(xyzNodes, fVecX, fVecY, fVecZ)
Definition: FaceVector.F90:80
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 ipnend