Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ComputeIntegral4OLES.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 4 of optimal LES approach.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Pointer to current region
31 !
32 ! Output: None.
33 !
34 ! Notes: None.
35 !
36 !******************************************************************************
37 !
38 ! $Id: RFLU_ComputeIntegral4OLES.F90,v 1.8 2008/12/06 08:44:29 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2002 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE rflu_computeintegral4oles(pRegion)
45 
46  USE moddatatypes
47  USE moddatastruct, ONLY : t_region
48  USE modgrid, ONLY: t_grid
49  USE moderror
50  USE modglobal, ONLY: t_global
51  USE modparameters
52  USE modmpi
53 
55 
56  USE rflu_modoles
57 
58  IMPLICIT NONE
59 
60 ! --- parameters
61 
62  TYPE(t_region), POINTER :: pregion
63 
64 ! --- local variables
65 
66  INTEGER :: c1g,c2g,errorflag,i,iint,ic1l,ic2l,ifc,ifcp,ifun,ifunnz,key,l, &
67  loopcounter,m,n,ncells,nfun,nfunnz,restartflag,vloc
68  REAL(RFREAL) :: normfact,normfactterm
69 
70  TYPE(t_grid), POINTER :: pgrid
71  TYPE(t_global), POINTER :: global
72 
73 ! ==============================================================================
74 ! Start
75 ! ==============================================================================
76 
77  global => pregion%global
78 
79  CALL registerfunction(global,'RFLU_ComputeIntegral4OLES',&
80  'RFLU_ComputeIntegral4OLES.F90')
81 
82  IF ( global%myProcid == masterproc .AND. &
83  global%verbLevel > verbose_low ) THEN
84  WRITE(stdout,'(A,3X,A)') solver_name,'Computing integral 4...'
85  END IF ! global%verbLevel
86 
87 ! ==============================================================================
88 ! Set grid pointer
89 ! ==============================================================================
90 
91  pgrid => pregion%grid
92 
93 ! ==============================================================================
94 ! Set various quantities
95 ! ==============================================================================
96 
97 ! ------------------------------------------------------------------------------
98 ! Set DCUHRE parameters
99 ! ------------------------------------------------------------------------------
100 
101  ndim = 8
102  nfun = 27
103  nfunnz = 7
104  key = 0
105 
106  errabsreq = 10.0_rfreal*epsilon(1.0_rfreal)
107  errrelreq = 5.0e-3_rfreal
108 
109 ! ------------------------------------------------------------------------------
110 ! Compute DCUHRE information and allocate work array
111 ! ------------------------------------------------------------------------------
112 
113  maxcalls = max_calls_limit
114 
115  CALL rflu_computedcuhreinfo(global,ndim,nfunnz,key,maxcalls,workarraysize)
116  CALL rflu_allocatedcuhrearrays(global,ndim,nfunnz,nfun)
117 
118  ALLOCATE(integral(nfun),stat=errorflag)
119  global%error = errorflag
120  IF ( global%error /= err_none ) THEN
121  CALL errorstop(global,err_allocate,__line__,'integral')
122  END IF ! global%error
123 
124  ALLOCATE(workarray(workarraysize),stat=errorflag)
125  global%error = errorflag
126  IF ( global%error /= err_none ) THEN
127  CALL errorstop(global,err_allocate,__line__,'workArray')
128  END IF ! global%error
129 
130 ! ------------------------------------------------------------------------------
131 ! Set normalization factor
132 ! ------------------------------------------------------------------------------
133 
134  normfactterm = 1.0_rfreal/(pgrid%deltaOLES**8)
135 
136 ! ==============================================================================
137 ! Loop over protoype faces
138 ! ==============================================================================
139 
140  DO ifcp = 1,3
141  ifc = pgrid%fp2fOLES(ifcp)
142 
143 ! ------------------------------------------------------------------------------
144 ! Get face limits from normal face list
145 ! ------------------------------------------------------------------------------
146 
147  c1g = pgrid%f2c(1,ifc)
148 
149  dummy = maxloc(abs(pgrid%fn(1:3,ifc)))
150  nzloc = dummy(1) ! Used in RFLU_DefineCorrelation43x (next two also)
151  nzval = pgrid%fc(nzloc,ifc)
152  nzsgn = nint(pgrid%fn(nzloc,ifc))
153 
154  n = ndim-2
155 
156  DO m = 1,3
157  IF ( m /= nzloc ) THEN
158  n = n + 1
159 
160  lowlim(n) = pgrid%intLimOLES(int_lim_low,m,c1g)
161  upplim(n) = pgrid%intLimOLES(int_lim_upp,m,c1g)
162  END IF ! m
163  END DO ! m
164 
165 ! ------------------------------------------------------------------------------
166 ! Set non-zero integral components (NOTE depends on nzLoc)
167 ! ------------------------------------------------------------------------------
168 
169  CALL rflu_setmapfunnz2funcorr43(nfunnz)
170 
171 ! ------------------------------------------------------------------------------
172 ! Loop over cells
173 ! ------------------------------------------------------------------------------
174 
175  ncells = SIZE(pgrid%fsOLES,1)
176 
177  DO ic1l = 1,ncells
178  c1g = pgrid%fsOLES(ic1l,ifc)
179 
180  lowlim(1) = pgrid%intLimOLES(int_lim_low,xcoord,c1g)
181  lowlim(2) = pgrid%intLimOLES(int_lim_low,ycoord,c1g)
182  lowlim(3) = pgrid%intLimOLES(int_lim_low,zcoord,c1g)
183 
184  upplim(1) = pgrid%intLimOLES(int_lim_upp,xcoord,c1g)
185  upplim(2) = pgrid%intLimOLES(int_lim_upp,ycoord,c1g)
186  upplim(3) = pgrid%intLimOLES(int_lim_upp,zcoord,c1g)
187 
188  DO ic2l = 1,ncells
189  c2g = pgrid%fsOLES(ic2l,ifc)
190 
191  lowlim(4) = pgrid%intLimOLES(int_lim_low,xcoord,c2g)
192  lowlim(5) = pgrid%intLimOLES(int_lim_low,ycoord,c2g)
193  lowlim(6) = pgrid%intLimOLES(int_lim_low,zcoord,c2g)
194 
195  upplim(4) = pgrid%intLimOLES(int_lim_upp,xcoord,c2g)
196  upplim(5) = pgrid%intLimOLES(int_lim_upp,ycoord,c2g)
197  upplim(6) = pgrid%intLimOLES(int_lim_upp,zcoord,c2g)
198 
199 ! ----- Loop over integrals ----------------------------------------------------
200 
201  DO iint = 1,3
202  errorflag = 0
203  maxcalls = max_calls_start
204  restartflag = 0
205 
206  integral(:) = 0.0_rfreal
207  integralnz(:) = 0.0_rfreal
208 
209  DO loopcounter = 1,dcuhre_loop_limit
210  IF ( iint == 1 ) THEN
211  CALL dcuhre(ndim,nfunnz,lowlim,upplim,min_calls,maxcalls, &
212  rflu_definecorrelation430,errabsreq,errrelreq, &
213  key,workarraysize,restartflag,integralnz, &
214  errabsest,neval,errorflag,workarray)
215  ELSE IF ( iint == 2 ) THEN
216  CALL dcuhre(ndim,nfunnz,lowlim,upplim,min_calls,maxcalls, &
217  rflu_definecorrelation431,errabsreq,errrelreq, &
218  key,workarraysize,restartflag,integralnz, &
219  errabsest,neval,errorflag,workarray)
220  ELSE IF ( iint == 3 ) THEN
221  CALL dcuhre(ndim,nfunnz,lowlim,upplim,min_calls,maxcalls, &
222  rflu_definecorrelation432,errabsreq,errrelreq, &
223  key,workarraysize,restartflag,integralnz, &
224  errabsest,neval,errorflag,workarray)
225  END IF ! iInt
226 
227  IF ( errorflag == 0 .OR. loopcounter == dcuhre_loop_limit ) THEN
228  EXIT
229  ELSE IF ( errorflag == 1 ) THEN
230  restartflag = 1
231  maxcalls = max_calls_factor*maxcalls
232 
233  CALL rflu_computedcuhreinfo(global,ndim,nfunnz,key,maxcalls, &
234  workarraysizenew)
235 
236  IF ( workarraysizenew > workarraysize ) THEN
237  EXIT
238  END IF ! workArraySizeNew
239  ELSE
240  CALL errorstop(global,err_dcuhre_output,__line__)
241  END IF ! errorFlag
242  END DO ! loopCounter
243 
244 ! ------- Normalize integral ---------------------------------------------------
245 
246  IF ( iint == 1 ) THEN
247  normfact = normfactterm
248  ELSE IF ( iint == 2 ) THEN
249  normfact = normfactterm*const_kolmogorov/ &
250  (6.0_rfreal*pgrid%rhoOLES(ifc)**(2.0_rfreal/3.0_rfreal))
251  ELSE IF ( iint == 3 ) THEN
252  normfact = normfactterm*const_kolmogorov*const_kolmogorov/ &
253  (36.0_rfreal*pgrid%rhoOLES(ifc)**(4.0_rfreal/3.0_rfreal))
254  END IF ! iInt
255 
256  DO ifunnz = 1,nfunnz
257  ifun = mapfunnz2funcorr43(ifunnz)
258  integral(ifun) = normfact*integralnz(ifunnz)
259  END DO ! iFunNZ
260 
261 ! ------- Store integral in array ----------------------------------------------
262 
263  DO ifun = 1,nfun
264  CALL rflu_mapl2ijk(ifun,l,m,i)
265 
266  vloc = rflu_geti4posoles(l,m,ic1l,ic2l,ncells)
267 
268  IF ( iint == 1 ) THEN
269  pgrid%int40OLES(i,ifcp,vloc) = integral(ifun)
270  ELSE IF ( iint == 2 ) THEN
271  pgrid%int41OLES(i,ifcp,vloc) = integral(ifun)
272  ELSE
273  pgrid%int42OLES(i,ifcp,vloc) = integral(ifun)
274  END IF ! iInt
275  END DO ! iFun
276  END DO ! iInt
277 
278  END DO ! ic2l
279  END DO ! ic1l
280  END DO ! ifcp
281 
282 
283 #ifdef CHECK_DATASTRUCT
284 ! Data structure output for checking
285  WRITE(stdout,'(A)') solver_name
286  WRITE(stdout,'(A,1X,A)') solver_name,'### START CHECK OUTPUT ###'
287  WRITE(stdout,'(A,1X,A)') solver_name,'Optimal LES I40 integral vector'
288  DO i = 1,3 ! loop over components
289  WRITE(stdout,'(2(A,1X),I1)') solver_name,'Component:',i
290  DO ifcp = 1,3 ! loop over prototype faces
291  WRITE(stdout,'(A,3X,A,1X,I2)') solver_name,'Face:',ifcp
292  DO vloc = 1,9*ncells*ncells ! loop over components
293  WRITE(stdout,'(A,1X,I6,1X,E11.4)') solver_name,vloc, &
294  pgrid%int40OLES(i,ifcp,vloc)
295  END DO ! vLoc
296  END DO ! ifcp
297  END DO ! i
298  WRITE(stdout,'(A,1X,A)') solver_name,'Optimal LES I41 integral matrix'
299  DO i = 1,3 ! loop over components
300  WRITE(stdout,'(2(A,1X),I1)') solver_name,'Component:',i
301  DO ifcp = 1,3 ! loop over prototype faces
302  WRITE(stdout,'(A,3X,A,1X,I2)') solver_name,'Face:',ifcp
303  DO vloc = 1,9*ncells*ncells ! loop over components
304  WRITE(stdout,'(A,1X,I6,1X,E11.4)') solver_name,vloc, &
305  pgrid%int41OLES(i,ifcp,vloc)
306  END DO ! vLoc
307  END DO ! ifcp
308  END DO ! i
309  WRITE(stdout,'(A,1X,A)') solver_name,'Optimal LES I42 integral matrix'
310  DO i = 1,3 ! loop over components
311  WRITE(stdout,'(2(A,1X),I1)') solver_name,'Component:',i
312  DO ifcp = 1,3 ! loop over prototype faces
313  WRITE(stdout,'(A,3X,A,1X,I2)') solver_name,'Face:',ifcp
314  DO vloc = 1,9*ncells*ncells ! loop over components
315  WRITE(stdout,'(A,1X,I6,1X,E11.4)') solver_name,vloc, &
316  pgrid%int42OLES(i,ifcp,vloc)
317  END DO ! vLoc
318  END DO ! ifcp
319  END DO ! i
320  WRITE(stdout,'(A,1X,A)') solver_name,'### END CHECK OUTPUT ###'
321  WRITE(stdout,'(A)') solver_name
322 #endif
323 
324 
325 ! ==============================================================================
326 ! Deallocate arrays
327 ! ==============================================================================
328 
329  CALL rflu_deallocatedcuhrearrays(global)
330 
331  DEALLOCATE(integral,stat=errorflag)
332  global%error = errorflag
333  IF ( global%error /= err_none ) THEN
334  CALL errorstop(global,err_deallocate,__line__,'integral')
335  END IF ! global%error
336 
337  DEALLOCATE(workarray,stat=errorflag)
338  global%error = errorflag
339  IF ( global%error /= err_none ) THEN
340  CALL errorstop(global,err_deallocate,__line__,'workArray')
341  END IF ! global%error
342 
343 ! ==============================================================================
344 ! End
345 ! ==============================================================================
346 
347  CALL deregisterfunction(global)
348 
349 END SUBROUTINE rflu_computeintegral4oles
350 
351 !*******************************************************************************
352 !
353 ! RCS Revision history:
354 !
355 ! $Log: RFLU_ComputeIntegral4OLES.F90,v $
356 ! Revision 1.8 2008/12/06 08:44:29 mtcampbe
357 ! Updated license.
358 !
359 ! Revision 1.7 2008/11/19 22:17:42 mtcampbe
360 ! Added Illinois Open Source License/Copyright
361 !
362 ! Revision 1.6 2003/05/16 02:27:45 haselbac
363 ! Removed KIND=RFREAL from NINT statements
364 !
365 ! Revision 1.5 2003/03/15 18:32:52 haselbac
366 ! Added KIND qualifyer to NINT, added footer
367 !
368 !*******************************************************************************
369 
370 
371 
372 
373 
374 
375 
subroutine rflu_computedcuhreinfo(global, NDIM, NF, KEY, MAXCLS, NW)
FT m(int i, int j) const
subroutine, public rflu_definecorrelation432(nDim, z, nFunNZ, f)
subroutine rflu_computeintegral4oles(pRegion)
subroutine, public rflu_definecorrelation430(nDim, z, nFunNZ, f)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflu_allocatedcuhrearrays(nDim, nFunNZ, nFun)
subroutine, public rflu_definecorrelation431(nDim, z, nFunNZ, f)
blockLoc i
Definition: read.cpp:79
const NT & n
subroutine rflu_deallocatedcuhrearrays
INTEGER function, public rflu_geti4posoles(l, m, d, e, nCells)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine, public rflu_mapl2ijk(l, i, j, k)
static T_Key key
Definition: vinci_lass.c:76
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine, public rflu_setmapfunnz2funcorr43(nFunNZ)