Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_CalcFaceVectors.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 face vectors.
26 !
27 ! Description: face vectors are computed using Gauss` formula. This results
28 ! in an average vector in the case of non-planar faces.
29 !
30 ! Input: region%levels%grid = dimensions, coordinates (current region)
31 !
32 ! Output: region%levels%grid%si/j/k = face vectors
33 !
34 ! Notes: face vectors are calculated for all dummy cells, including
35 ! corner and edge cells.
36 !
37 !******************************************************************************
38 !
39 ! $Id: RFLO_CalcFaceVectors.F90,v 1.4 2008/12/06 08:44:26 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2001 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE rflo_calcfacevectors( region )
46 
47  USE moddatatypes
48  USE moddatastruct, ONLY : t_region
51  USE moderror
52  USE modparameters
53  IMPLICIT NONE
54 
55 #include "Indexing.h"
56 
57 ! ... parameters
58  TYPE(t_region) :: region
59 
60 ! ... loop variables
61  INTEGER :: ilev, i, j, k
62 
63 ! ... local variables
64  INTEGER :: idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend
65  INTEGER :: inoff, ijnoff, corner(4)
66 
67  REAL(RFREAL) :: xyzquad(3,4)
68  REAL(RFREAL), POINTER :: xyz(:,:), si(:,:), sj(:,:), sk(:,:)
69 
70 !******************************************************************************
71 
72  CALL registerfunction( region%global,'RFLO_CalcFaceVectors',&
73  'RFLO_CalcFaceVectors.F90' )
74 
75 ! loop over all grid levels ---------------------------------------------------
76 
77  DO ilev=1,region%nGridLevels
78 
79  CALL rflo_getdimensdummynodes( region,ilev,idnbeg,idnend, &
80  jdnbeg,jdnend,kdnbeg,kdnend )
81  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
82 
83  xyz => region%levels(ilev)%grid%xyz
84  si => region%levels(ilev)%grid%si
85  sj => region%levels(ilev)%grid%sj
86  sk => region%levels(ilev)%grid%sk
87 
88 ! - i-direction
89 
90  DO k=kdnbeg,kdnend-1
91  DO j=jdnbeg,jdnend-1
92  DO i=idnbeg,idnend
93  corner(1) = indijk(i,j ,k ,inoff,ijnoff)
94  corner(2) = indijk(i,j ,k+1,inoff,ijnoff)
95  corner(3) = indijk(i,j+1,k+1,inoff,ijnoff)
96  corner(4) = indijk(i,j+1,k ,inoff,ijnoff)
97  xyzquad(1:3,1) = xyz(1:3,corner(1))
98  xyzquad(1:3,2) = xyz(1:3,corner(2))
99  xyzquad(1:3,3) = xyz(1:3,corner(3))
100  xyzquad(1:3,4) = xyz(1:3,corner(4))
101  CALL facevectorquad( xyzquad, &
102  si(xcoord,corner(1)), &
103  si(ycoord,corner(1)), &
104  si(zcoord,corner(1)) )
105  si(xyzmag,corner(1)) = 1._rfreal/ &
106  sqrt( si(xcoord,corner(1))*si(xcoord,corner(1)) + &
107  si(ycoord,corner(1))*si(ycoord,corner(1)) + &
108  si(zcoord,corner(1))*si(zcoord,corner(1)) )
109  ENDDO
110  ENDDO
111  ENDDO
112 
113 ! - j-direction
114 
115  DO k=kdnbeg,kdnend-1
116  DO j=jdnbeg,jdnend
117  DO i=idnbeg,idnend-1
118  corner(1) = indijk(i ,j,k ,inoff,ijnoff)
119  corner(2) = indijk(i+1,j,k ,inoff,ijnoff)
120  corner(3) = indijk(i+1,j,k+1,inoff,ijnoff)
121  corner(4) = indijk(i ,j,k+1,inoff,ijnoff)
122  xyzquad(1:3,1) = xyz(1:3,corner(1))
123  xyzquad(1:3,2) = xyz(1:3,corner(2))
124  xyzquad(1:3,3) = xyz(1:3,corner(3))
125  xyzquad(1:3,4) = xyz(1:3,corner(4))
126  CALL facevectorquad( xyzquad, &
127  sj(xcoord,corner(1)), &
128  sj(ycoord,corner(1)), &
129  sj(zcoord,corner(1)) )
130  sj(xyzmag,corner(1)) = 1._rfreal/ &
131  sqrt( sj(xcoord,corner(1))*sj(xcoord,corner(1)) + &
132  sj(ycoord,corner(1))*sj(ycoord,corner(1)) + &
133  sj(zcoord,corner(1))*sj(zcoord,corner(1)) )
134  ENDDO
135  ENDDO
136  ENDDO
137 
138 ! - k-direction
139 
140  DO k=kdnbeg,kdnend
141  DO j=jdnbeg,jdnend-1
142  DO i=idnbeg,idnend-1
143  corner(1) = indijk(i ,j ,k,inoff,ijnoff)
144  corner(2) = indijk(i ,j+1,k,inoff,ijnoff)
145  corner(3) = indijk(i+1,j+1,k,inoff,ijnoff)
146  corner(4) = indijk(i+1,j ,k,inoff,ijnoff)
147  xyzquad(1:3,1) = xyz(1:3,corner(1))
148  xyzquad(1:3,2) = xyz(1:3,corner(2))
149  xyzquad(1:3,3) = xyz(1:3,corner(3))
150  xyzquad(1:3,4) = xyz(1:3,corner(4))
151  CALL facevectorquad( xyzquad, &
152  sk(xcoord,corner(1)), &
153  sk(ycoord,corner(1)), &
154  sk(zcoord,corner(1)) )
155  sk(xyzmag,corner(1)) = 1._rfreal/ &
156  sqrt( sk(xcoord,corner(1))*sk(xcoord,corner(1)) + &
157  sk(ycoord,corner(1))*sk(ycoord,corner(1)) + &
158  sk(zcoord,corner(1))*sk(zcoord,corner(1)) )
159  ENDDO
160  ENDDO
161  ENDDO
162 
163  ENDDO ! iLev
164 
165 ! finalize --------------------------------------------------------------------
166 
167  CALL deregisterfunction( region%global )
168 
169 END SUBROUTINE rflo_calcfacevectors
170 
171 !******************************************************************************
172 !
173 ! RCS Revision history:
174 !
175 ! $Log: RFLO_CalcFaceVectors.F90,v $
176 ! Revision 1.4 2008/12/06 08:44:26 mtcampbe
177 ! Updated license.
178 !
179 ! Revision 1.3 2008/11/19 22:17:37 mtcampbe
180 ! Added Illinois Open Source License/Copyright
181 !
182 ! Revision 1.2 2006/03/24 05:04:50 wasistho
183 ! computed inverse magnitude of face vectors
184 !
185 ! Revision 1.1 2004/11/29 20:51:38 wasistho
186 ! lower to upper case
187 !
188 ! Revision 1.9 2003/11/20 16:40:36 mdbrandy
189 ! Backing out RocfluidMP changes from 11-17-03
190 !
191 ! Revision 1.5 2003/05/15 02:57:03 jblazek
192 ! Inlined index function.
193 !
194 ! Revision 1.4 2002/09/05 17:40:21 jblazek
195 ! Variable global moved into regions().
196 !
197 ! Revision 1.3 2002/02/21 23:25:05 jblazek
198 ! Blocks renamed as regions.
199 !
200 ! Revision 1.2 2002/01/23 03:51:25 jblazek
201 ! Added low-level time-stepping routines.
202 !
203 ! Revision 1.1 2002/01/08 22:09:17 jblazek
204 ! Added calculation of face vectors and volumes.
205 !
206 !******************************************************************************
207 
208 
209 
210 
211 
212 
213 
j indices k indices k
Definition: Indexing.h:6
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
double sqrt(double d)
Definition: double.h:73
**********************************************************************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
**********************************************************************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
subroutine rflo_calcfacevectors(region)
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
subroutine rflo_getdimensdummynodes(region, iLev, idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend)
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 kdnbeg