Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_CalcFaceCentroids.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 centroids (optionally).
26 !
27 ! Description: none.
28 !
29 ! Input: region%levels%grid = dimensions, coordinates (current region)
30 !
31 ! Output: region%levels%grid%cfcI,J,K = i,j,k-face centroids
32 !
33 !
34 !******************************************************************************
35 !
36 ! $Id: RFLO_CalcFaceCentroids.F90,v 1.4 2008/12/06 08:44:06 mtcampbe Exp $
37 !
38 ! Copyright: (c) 2001 by the University of Illinois
39 !
40 !******************************************************************************
41 
42 SUBROUTINE rflo_calcfacecentroids( region )
43 
44  USE moddatatypes
45  USE moddatastruct, ONLY : t_region
47  USE moderror
48  USE modparameters
49  IMPLICIT NONE
50 
51 #include "Indexing.h"
52 
53 ! ... parameters
54  TYPE(t_region) :: region
55 
56 ! ... loop variables
57  INTEGER :: ilev, i, j, k, l
58 
59 ! ... local variables
60  INTEGER :: idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend
61  INTEGER :: inoff, ijnoff
62  INTEGER, PARAMETER :: idir=1, jdir=2, kdir=3
63 
64  REAL(RFREAL), POINTER :: xyz(:,:)
65 
66 !******************************************************************************
67 
68  CALL registerfunction( region%global,'RFLO_CalcFaceCentroids',&
69  'RFLO_CalcFaceCentroids.F90' )
70 
71 ! loop over all grid levels
72 
73  DO ilev=1,region%nGridLevels
74 
75  IF (region%global%calcFaceCtr) THEN
76  CALL rflo_getdimensdummynodes( region,ilev,idnbeg,idnend, &
77  jdnbeg,jdnend,kdnbeg,kdnend )
78  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
79 
80  xyz => region%levels(ilev)%grid%xyz
81 
82 ! --- compute i, j, k-face centroids
83 
84  CALL computefacectr( idir )
85  CALL computefacectr( jdir )
86  CALL computefacectr( kdir )
87 
88  ENDIF ! calcFaceCtr
89  ENDDO ! iLev
90 
91 ! finalize
92 
93  CALL deregisterfunction( region%global )
94 
95 ! =============================================================================
96 ! Face centroids computation subroutine
97 ! =============================================================================
98 
99 CONTAINS
100 
101  SUBROUTINE computefacectr( ijk )
102 
103 ! ... parameters
104  INTEGER :: ijk
105 
106 ! ... local variables
107  INTEGER :: ibeg,iend,jbeg,jend,kbeg,kend
108  INTEGER :: i2,i3,i4,j2,j3,j4,k2,k3,k4
109  INTEGER :: corner(4)
110  REAL(RFREAL), POINTER :: facectr(:,:)
111 
112 ! - Set limits and pointers ---------------------------------------------------
113  IF (ijk==idir) THEN
114  ibeg = idnbeg
115  iend = idnend
116  jbeg = jdnbeg
117  jend = jdnend-1
118  kbeg = kdnbeg
119  kend = kdnend-1
120  i2 = 0
121  i3 = 0
122  i4 = 0
123  j2 = 0
124  j3 = 1
125  j4 = 1
126  k2 = 1
127  k3 = 1
128  k4 = 0
129  facectr => region%levels(ilev)%grid%cfcI
130  ELSEIF (ijk==jdir) THEN
131  ibeg = idnbeg
132  iend = idnend-1
133  jbeg = jdnbeg
134  jend = jdnend
135  kbeg = kdnbeg
136  kend = kdnend-1
137  i2 = 0
138  i3 = 1
139  i4 = 1
140  j2 = 0
141  j3 = 0
142  j4 = 0
143  k2 = 1
144  k3 = 1
145  k4 = 0
146  facectr => region%levels(ilev)%grid%cfcJ
147  ELSEIF (ijk==kdir) THEN
148  ibeg = idnbeg
149  iend = idnend-1
150  jbeg = jdnbeg
151  jend = jdnend-1
152  kbeg = kdnbeg
153  kend = kdnend
154  i2 = 0
155  i3 = 1
156  i4 = 1
157  j2 = 1
158  j3 = 1
159  j4 = 0
160  k2 = 0
161  k3 = 0
162  k4 = 0
163  facectr => region%levels(ilev)%grid%cfcK
164  ENDIF
165 
166 ! - define face centroids
167 
168  DO k=kbeg,kend
169  DO j=jbeg,jend
170  DO i=ibeg,iend
171  corner(1) = indijk(i ,j ,k ,inoff,ijnoff)
172  corner(2) = indijk(i+i2 ,j+j2 ,k+k2 ,inoff,ijnoff)
173  corner(3) = indijk(i+i3 ,j+j3 ,k+k3 ,inoff,ijnoff)
174  corner(4) = indijk(i+i4 ,j+j4 ,k+k4 ,inoff,ijnoff)
175 
176  DO l=1,3
177  facectr(l,corner(1)) = 0.25_rfreal*(xyz(l,corner(1))+ &
178  xyz(l,corner(2))+ &
179  xyz(l,corner(3))+ &
180  xyz(l,corner(4)))
181  ENDDO
182  ENDDO ! i
183  ENDDO ! j
184  ENDDO ! k
185 
186  IF (ijk==idir) THEN
187 
188  DO j=jdnbeg,jdnend-1
189  DO i=idnbeg,idnend
190  corner(1) = indijk(i ,j ,kdnend ,inoff,ijnoff)
191  corner(2) = indijk(i ,j ,kdnend-1,inoff,ijnoff)
192  DO l=1,3
193  facectr(l,corner(1)) = facectr(l,corner(2))
194  ENDDO
195  ENDDO
196  ENDDO
197  DO k=kdnbeg,kdnend
198  DO i=idnbeg,idnend
199  corner(1) = indijk(i ,jdnend ,k ,inoff,ijnoff)
200  corner(2) = indijk(i ,jdnend-1,k ,inoff,ijnoff)
201  DO l=1,3
202  facectr(l,corner(1)) = facectr(l,corner(2))
203  ENDDO
204  ENDDO
205  ENDDO
206 
207  ELSEIF (ijk==jdir) THEN
208 
209  DO k=kdnbeg,kdnend-1
210  DO j=jdnbeg,jdnend
211  corner(1) = indijk(idnend ,j ,k ,inoff,ijnoff)
212  corner(2) = indijk(idnend-1,j ,k ,inoff,ijnoff)
213  DO l=1,3
214  facectr(l,corner(1)) = facectr(l,corner(2))
215  ENDDO
216  ENDDO
217  ENDDO
218  DO j=jdnbeg,jdnend
219  DO i=idnbeg,idnend
220  corner(1) = indijk(i ,j ,kdnend ,inoff,ijnoff)
221  corner(2) = indijk(i ,j ,kdnend-1,inoff,ijnoff)
222  DO l=1,3
223  facectr(l,corner(1)) = facectr(l,corner(2))
224  ENDDO
225  ENDDO
226  ENDDO
227 
228  ELSEIF (ijk==kdir) THEN
229 
230  DO k=kdnbeg,kdnend
231  DO j=jdnbeg,jdnend-1
232  corner(1) = indijk(idnend ,j ,k ,inoff,ijnoff)
233  corner(2) = indijk(idnend-1,j ,k ,inoff,ijnoff)
234  DO l=1,3
235  facectr(l,corner(1)) = facectr(l,corner(2))
236  ENDDO
237  ENDDO
238  ENDDO
239  DO k=kdnbeg,kdnend
240  DO i=idnbeg,idnend
241  corner(1) = indijk(i ,jdnend ,k ,inoff,ijnoff)
242  corner(2) = indijk(i ,jdnend-1,k ,inoff,ijnoff)
243  DO l=1,3
244  facectr(l,corner(1)) = facectr(l,corner(2))
245  ENDDO
246  ENDDO
247  ENDDO
248 
249  ENDIF ! ijk
250 
251  END SUBROUTINE computefacectr
252 
253 END SUBROUTINE rflo_calcfacecentroids
254 
255 !******************************************************************************
256 !
257 ! RCS Revision history:
258 !
259 ! $Log: RFLO_CalcFaceCentroids.F90,v $
260 ! Revision 1.4 2008/12/06 08:44:06 mtcampbe
261 ! Updated license.
262 !
263 ! Revision 1.3 2008/11/19 22:17:19 mtcampbe
264 ! Added Illinois Open Source License/Copyright
265 !
266 ! Revision 1.2 2006/01/12 09:47:02 wasistho
267 ! extrapolate to idnend, jdnend, kdnend
268 !
269 ! Revision 1.1 2005/10/20 06:57:44 wasistho
270 ! initial import RFLO_CalcFaceCentroids
271 !
272 !
273 !******************************************************************************
274 
275 
276 
277 
278 
279 
280 
**********************************************************************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 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 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 jdir
**********************************************************************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
**********************************************************************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
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 idir
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 kdir
subroutine rflo_getdimensdummynodes(region, iLev, idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend)
**********************************************************************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 computefacectr(ijk)
**********************************************************************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
subroutine rflo_calcfacecentroids(region)