Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TURB_floFaceWidth.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: Obtained the width of all faces.
26 !
27 ! Description: Face width is defined as distance between opposing edge-mids.
28 ! Each face has two face widths, e.g. face i has fw in j & k dir.
29 !
30 ! Input: region = data of current region
31 !
32 ! Output: Face width stored in workI,J,K(2,:)
33 !
34 ! Notes: This routine is employed to construct non-uniform filter coefficients.
35 ! Hence is only relevant if non-uniform filter is selected.
36 !
37 !******************************************************************************
38 !
39 ! $Id: TURB_floFaceWidth.F90,v 1.5 2008/12/06 08:44:43 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2001 by the University of Illinois
42 !
43 !******************************************************************************
44 SUBROUTINE turb_flofacewidth( region )
45 
46  USE moddatatypes
47  USE moddatastruct, ONLY : t_region
48  USE modglobal, ONLY : t_global
52  USE moderror
53  USE modparameters
55  IMPLICIT NONE
56 
57 #include "Indexing.h"
58 
59 ! ... parameters
60  TYPE(t_region) :: region
61 
62 ! ... loop variables
63  INTEGER :: i, j, k, ijkn, ipatch
64 
65 ! ... local variables
66  CHARACTER(CHRLEN) :: rcsidentstring
67  TYPE(t_global), POINTER :: global
68 
69  INTEGER :: ibeg,iend,jbeg,jend,kbeg,kend
70  INTEGER :: idcbeg,idcend,jdcbeg,jdcend,kdcbeg,kdcend
71  INTEGER :: ilev,inoff,ijnoff
72  REAL(RFREAL), POINTER :: xyz(:,:), fw(:,:)
73  REAL(RFREAL), POINTER :: fwi(:,:), fwj(:,:), fwk(:,:)
74 
75 !******************************************************************************
76 
77  rcsidentstring = '$RCSfile: TURB_floFaceWidth.F90,v $'
78 
79  global => region%global
80  CALL registerfunction( global,'TURB_FloFaceWidth',&
81  'TURB_floFaceWidth.F90' )
82 
83 ! get indices and pointers ---------------------------------------------------
84 
85  ilev = region%currLevel
86  xyz => region%levels(ilev)%grid%xyz
87  fwi => region%levels(ilev)%turb%workI
88  fwj => region%levels(ilev)%turb%workJ
89  fwk => region%levels(ilev)%turb%workK
90 
91  CALL rflo_getdimensdummy( region,ilev,idcbeg,idcend, &
92  jdcbeg,jdcend,kdcbeg,kdcend )
93  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
94 
95 ! compute averaging coefficient at face i, j, k interior domain
96 
97  CALL computefacewidth( diri )
98  CALL computefacewidth( dirj )
99  CALL computefacewidth( dirk )
100 
101 ! compute averaging coefficient at dummy points
102 
103  DO ipatch=1,region%nPatches
104  CALL turb_flofacewidthdummy( region,region%levels(ilev)%patches(ipatch) )
105  ENDDO
106 
107 ! and copy to edge/corner dummies --------------------------------------------
108 ! the edge length is extended that corners are covered to minimize work
109 
110  CALL rflo_copyedgefacenorm( region,1,2,fwi,fwj,fwk )
111  CALL rflo_copyedgefaceparal( region,1,2,fwi,fwj,fwk )
112 
113 ! finalize --------------------------------------------------------------------
114 
115  CALL deregisterfunction( global )
116 
117 ! =============================================================================
118 ! Face width computation subroutine
119 ! =============================================================================
120 
121 CONTAINS
122 
123  SUBROUTINE computefacewidth( ijk )
124 
125 ! ... parameters
126  INTEGER :: ijk
127 
128 ! ... local variables
129  INTEGER :: i2,i3,i4,j2,j3,j4,k2,k3,k4
130  INTEGER :: corner(4)
131  REAL(RFREAL) :: fc1(xcoord:zcoord), fc2(xcoord:zcoord)
132 
133 ! - Set limits and pointers ---------------------------------------------------
134  IF (ijk==diri) THEN
135  ibeg = idcbeg
136  iend = idcend+1
137  jbeg = jdcbeg
138  jend = jdcend
139  kbeg = kdcbeg
140  kend = kdcend
141  i2 = 0
142  i3 = 0
143  i4 = 0
144  j2 = 0
145  j3 = 1
146  j4 = 1
147  k2 = 1
148  k3 = 1
149  k4 = 0
150  fw => region%levels(ilev)%turb%workI
151  ELSEIF (ijk==dirj) THEN
152  ibeg = idcbeg
153  iend = idcend
154  jbeg = jdcbeg
155  jend = jdcend+1
156  kbeg = kdcbeg
157  kend = kdcend
158  i2 = 0
159  i3 = 1
160  i4 = 1
161  j2 = 0
162  j3 = 0
163  j4 = 0
164  k2 = 1
165  k3 = 1
166  k4 = 0
167  fw => region%levels(ilev)%turb%workJ
168  ELSEIF (ijk==dirk) THEN
169  ibeg = idcbeg
170  iend = idcend
171  jbeg = jdcbeg
172  jend = jdcend
173  kbeg = kdcbeg
174  kend = kdcend+1
175  i2 = 0
176  i3 = 1
177  i4 = 1
178  j2 = 1
179  j3 = 1
180  j4 = 0
181  k2 = 0
182  k3 = 0
183  k4 = 0
184  fw => region%levels(ilev)%turb%workK
185  ENDIF
186 
187 ! define 2 face-widths for each face of non-uniform grid;
188 ! face I has face-widths in J and K direction, and so on
189 
190  DO k=kbeg,kend
191  DO j=jbeg,jend
192  DO i=ibeg,iend
193  ijkn = indijk(i ,j ,k ,inoff,ijnoff)
194  corner(1) = indijk(i ,j ,k ,inoff,ijnoff)
195  corner(2) = indijk(i+i2 ,j+j2 ,k+k2 ,inoff,ijnoff)
196  corner(3) = indijk(i+i3 ,j+j3 ,k+k3 ,inoff,ijnoff)
197  corner(4) = indijk(i+i4 ,j+j4 ,k+k4 ,inoff,ijnoff)
198 
199  fc1(xcoord:zcoord) = 0.5_rfreal* &
200  (xyz(xcoord:zcoord,corner(1))+ &
201  xyz(xcoord:zcoord,corner(2)))
202  fc2(xcoord:zcoord) = 0.5_rfreal* &
203  (xyz(xcoord:zcoord,corner(3))+ &
204  xyz(xcoord:zcoord,corner(4)))
205  fw(1,ijkn) = sqrt((fc2(xcoord)-fc1(xcoord))**2 + &
206  (fc2(ycoord)-fc1(ycoord))**2 + &
207  (fc2(zcoord)-fc1(zcoord))**2)
208 
209  fc1(xcoord:zcoord) = 0.5_rfreal* &
210  (xyz(xcoord:zcoord,corner(1))+ &
211  xyz(xcoord:zcoord,corner(4)))
212  fc2(xcoord:zcoord) = 0.5_rfreal* &
213  (xyz(xcoord:zcoord,corner(2))+ &
214  xyz(xcoord:zcoord,corner(3)))
215  fw(2,ijkn) = sqrt((fc2(xcoord)-fc1(xcoord))**2 + &
216  (fc2(ycoord)-fc1(ycoord))**2 + &
217  (fc2(zcoord)-fc1(zcoord))**2)
218 
219  ENDDO ! i
220  ENDDO ! j
221  ENDDO ! k
222 
223  END SUBROUTINE computefacewidth
224 
225 END SUBROUTINE turb_flofacewidth
226 
227 !******************************************************************************
228 !
229 ! RCS Revision history:
230 !
231 ! $Log: TURB_floFaceWidth.F90,v $
232 ! Revision 1.5 2008/12/06 08:44:43 mtcampbe
233 ! Updated license.
234 !
235 ! Revision 1.4 2008/11/19 22:17:55 mtcampbe
236 ! Added Illinois Open Source License/Copyright
237 !
238 ! Revision 1.3 2004/08/04 02:49:20 wasistho
239 ! removed turb%avgCoI,J,K as it is defined as grid%c2fCoI,J,K
240 !
241 ! Revision 1.2 2004/03/12 02:55:35 wasistho
242 ! changed rocturb routine names
243 !
244 ! Revision 1.1 2004/03/08 23:35:45 wasistho
245 ! changed turb nomenclature
246 !
247 ! Revision 1.2 2003/05/15 02:57:06 jblazek
248 ! Inlined index function.
249 !
250 ! Revision 1.1 2002/10/14 23:55:29 wasistho
251 ! Install Rocturb
252 !
253 !
254 !******************************************************************************
255 
256 
257 
258 
259 
260 
261 
**********************************************************************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
**********************************************************************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 idcend
j indices k indices k
Definition: Indexing.h:6
subroutine rflo_copyedgefacenorm(region, iFBeg, iFEnd, fvari, fvarj, fvark)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine turb_flofacewidth(region)
double sqrt(double d)
Definition: double.h:73
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
subroutine rflo_getdimensdummy(region, iLev, idcbeg, idcend, jdcbeg, jdcend, kdcbeg, kdcend)
**********************************************************************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
**********************************************************************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 kdcbeg
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 idcbeg
**********************************************************************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 jdcend
j indices j
Definition: Indexing.h:6
subroutine turb_flofacewidthdummy(region, patch)
**********************************************************************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 jdcbeg
**********************************************************************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 rflo_copyedgefaceparal(region, iFBeg, iFEnd, fvari, fvarj, fvark)
**********************************************************************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
subroutine computefacewidth(ijk)