Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ComputeIntegral3OLES.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: Compute integral 3 of optimal LES approach.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! region Current region
31 !
32 ! Output: None.
33 !
34 ! Notes:
35 ! 1. At present, assume that velocity components are stored in positions 2-4.
36 ! 2. Note normalization of integrals - because of use of dissipation, must
37 ! compute integral after computation of dissipation.
38 ! 3. IMPORTANT: Note that since an average over prototype faces is made, need
39 ! to divide by a third of nFaces, and NOT nFaces!
40 !
41 !******************************************************************************
42 !
43 ! $Id: RFLU_ComputeIntegral3OLES.F90,v 1.5 2008/12/06 08:44:29 mtcampbe Exp $
44 !
45 ! Copyright: (c) 2002 by the University of Illinois
46 !
47 !******************************************************************************
48 
49 SUBROUTINE rflu_computeintegral3oles(region)
50 
51  USE moddatatypes
52  USE moddatastruct, ONLY: t_region
53  USE modgrid, ONLY: t_grid
54  USE moderror
55  USE modglobal, ONLY: t_global
56  USE modparameters
57  USE modtools, ONLY: makenonzero
58 
59  USE rflu_modoles
60 
61  IMPLICIT NONE
62 
63 ! parameters
64 
65  TYPE(t_region) :: region
66 
67 ! local variables
68 
69  CHARACTER(CHRLEN) :: rcsidentstring
70  INTEGER :: a,b,c1g,c2g,c3g,d,e,g,hloc1,hloc2,ic1l,ic2l,ic3l,ifc,ifcp, &
71  iv1,iv2,iv3,j,k,l,m,ncells,nfaces,vloc1,vloc2
72  INTEGER, DIMENSION(:), POINTER :: f2fpoles
73  INTEGER, DIMENSION(:,:), POINTER :: fsoles
74  REAL(RFREAL) :: avgfac,corr,term
75  REAL(RFREAL), DIMENSION(:), POINTER :: vol
76  REAL(RFREAL), DIMENSION(:,:), POINTER :: cv
77  REAL(RFREAL), DIMENSION(:,:,:), POINTER :: int31oles,int32oles
78  TYPE(t_global), POINTER :: global
79 
80 ! ******************************************************************************
81 ! Start, check that have primitive variables
82 ! ******************************************************************************
83 
84  rcsidentstring = '$RCSfile: RFLU_ComputeIntegral3OLES.F90,v $ $Revision: 1.5 $'
85 
86  global => region%global
87 
88  CALL registerfunction(global,'RFLU_ComputeIntegral3OLES',&
89  'RFLU_ComputeIntegral3OLES.F90')
90 
91  IF ( region%mixt%cvState == cv_mixt_state_cons ) THEN
92  CALL errorstop(global,err_cv_state_invalid,__line__)
93  END IF ! region
94 
95 ! ******************************************************************************
96 ! Set pointers and variables
97 ! ******************************************************************************
98 
99  fsoles => region%grid%fsOLES
100  f2fpoles => region%grid%f2fpOLES
101 
102  int31oles => region%grid%int31OLES
103  int32oles => region%grid%int32OLES
104 
105  vol => region%grid%vol
106  cv => region%mixt%cv
107 
108  ncells = SIZE(region%grid%fsOLES,1)
109  nfaces = region%grid%nFaces
110  avgfac = 3.0_rfreal/REAL(nFaces,KIND=RFREAL) ! NOTE factor of 3
111 
112 ! ******************************************************************************
113 ! Initialize integrals
114 ! ******************************************************************************
115 
116  int31oles(:,:,:) = 0.0_rfreal
117  int32oles(:,:,:) = 0.0_rfreal
118 
119 ! ******************************************************************************
120 ! Compute integrals through loop over faces
121 ! ******************************************************************************
122 
123  DO ifc = 1,nfaces
124  ifcp = f2fpoles(ifc) ! get prototype face
125 
126 ! ==============================================================================
127 ! Loop over cells
128 ! ==============================================================================
129 
130  DO ic1l = 1,ncells
131  c1g = fsoles(ic1l,ifc)
132  d = ic1l
133 
134  DO ic2l = 1,ncells
135  c2g = fsoles(ic2l,ifc)
136  b = ic2l
137  e = ic2l
138 
139  DO ic3l = 1,ncells
140  c3g = fsoles(ic3l,ifc)
141  g = ic3l
142  a = ic3l
143 
144  term = vol(c1g)*vol(c2g)*vol(c3g)
145 
146 ! ------------------------------------------------------------------------------
147 ! Loop over velocity components
148 ! ------------------------------------------------------------------------------
149 
150  DO iv1 = 1,3
151  l = iv1
152 
153  DO iv2 = 1,3
154  DO iv3 = 1,3
155 
156 ! ------------- Compute correlation
157 
158  corr = term*cv(iv1+1,c1g)*cv(iv2+1,c2g)*cv(iv3+1,c3g)
159 
160 ! ------------- Determine storage location for correlation
161 
162  j = iv2
163  k = iv3
164 
165  vloc1 = rflu_geti1posoles(l,d)
166  hloc1 = rflu_getqposoles(j,k,b,g,ncells)
167 
168  m = iv2
169  j = iv3
170 
171  vloc2 = rflu_geti4posoles(l,m,d,e,ncells)
172  hloc2 = rflu_getlposoles(j,a)
173 
174 ! ------------- Store correlation
175 
176  int31oles(ifcp,vloc1,hloc1) = int31oles(ifcp,vloc1,hloc1) &
177  + corr
178  int32oles(ifcp,vloc2,hloc2) = int32oles(ifcp,vloc2,hloc2) &
179  + corr
180  END DO ! iv3
181  END DO ! iv2
182  END DO ! iv1
183 
184  END DO ! icl3
185  END DO ! icl2
186  END DO ! icl1
187 
188  END DO ! ifcp
189 
190 ! ******************************************************************************
191 ! Normalize and average integrals
192 ! ******************************************************************************
193 
194  term = avgfac/(makenonzero(global%dissOLES)*region%grid%deltaOLES**10)
195 
196  int31oles(:,:,:) = term*int31oles(:,:,:)
197  int32oles(:,:,:) = term*int32oles(:,:,:)
198 
199 
200 ! ******************************************************************************
201 ! End
202 ! ******************************************************************************
203 
204  CALL deregisterfunction(global)
205 
206 END SUBROUTINE rflu_computeintegral3oles
207 
208 !*******************************************************************************
209 !
210 ! RCS Revision history:
211 !
212 ! $Log: RFLU_ComputeIntegral3OLES.F90,v $
213 ! Revision 1.5 2008/12/06 08:44:29 mtcampbe
214 ! Updated license.
215 !
216 ! Revision 1.4 2008/11/19 22:17:42 mtcampbe
217 ! Added Illinois Open Source License/Copyright
218 !
219 ! Revision 1.3 2003/03/15 18:31:27 haselbac
220 ! Added footer
221 !
222 !*******************************************************************************
223 
224 
225 
226 
227 
228 
229 
FT m(int i, int j) const
const NT & d
j indices k indices k
Definition: Indexing.h:6
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
unsigned char b() const
Definition: Color.h:70
subroutine rflu_computeintegral3oles(region)
INTEGER function, public rflu_geti1posoles(l, d)
INTEGER function, public rflu_getlposoles(j, a)
IndexType nfaces() const
Definition: Mesh.H:641
INTEGER function, public rflu_geti4posoles(l, m, d, e, nCells)
j indices j
Definition: Indexing.h:6
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
INTEGER function, public rflu_getqposoles(j, k, b, g, nCells)
subroutine deregisterfunction(global)
Definition: ModError.F90:469
RT a() const
Definition: Line_2.h:140
unsigned char g() const
Definition: Color.h:69
real(rfreal) function makenonzero(x)
Definition: ModTools.F90:85