Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ComputeIntegral1OLES.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 1 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_ComputeIntegral1OLES.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_computeintegral1oles(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,errorflag,i,ic1l,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_ComputeIntegral1OLES',&
80  'RFLU_ComputeIntegral1OLES.F90')
81 
82  IF ( global%myProcid == masterproc .AND. &
83  global%verbLevel > verbose_low ) THEN
84  WRITE(stdout,'(A,3X,A)') solver_name,'Computing integral 1...'
85  END IF ! global%verbLevel
86 
87 ! ==============================================================================
88 ! Set grid pointer
89 ! ==============================================================================
90 
91  pgrid => pregion%grid
92 
93 ! ==============================================================================
94 ! Set DCUHRE parameters
95 ! ==============================================================================
96 
97  ndim = 5
98  nfun = 9
99  nfunnz = 3 ! Change this to nFun if you want all integrals evaluated
100  key = 0 ! Use accurate integration
101 
102  errabsreq = 10.0_rfreal*epsilon(1.0_rfreal)
103  errrelreq = 5.0e-3_rfreal
104 
105 ! ==============================================================================
106 ! Compute DCUHRE information and allocate arrays
107 ! ==============================================================================
108 
109  maxcalls = max_calls_limit
110 
111  CALL rflu_computedcuhreinfo(global,ndim,nfunnz,key,maxcalls,workarraysize)
112  CALL rflu_allocatedcuhrearrays(global,ndim,nfunnz,nfun)
113 
114  ALLOCATE(integral(nfun),stat=errorflag)
115  global%error = errorflag
116  IF ( global%error /= err_none ) THEN
117  CALL errorstop(global,err_allocate,__line__,'integral')
118  END IF ! global%error
119 
120  integral(:) = 0.0_rfreal
121 
122  ALLOCATE(workarray(workarraysize),stat=errorflag)
123  global%error = errorflag
124  IF ( global%error /= err_none ) THEN
125  CALL errorstop(global,err_allocate,__line__,'workArray')
126  END IF ! global%error
127 
128 ! ==============================================================================
129 ! Set normalization factor
130 ! ==============================================================================
131 
132  normfact = 1.0_rfreal/(15.0_rfreal*pgrid%deltaOLES**6)
133 
134 ! ==============================================================================
135 ! Set non-zero functions
136 ! ==============================================================================
137 
138  CALL rflu_setmapfunnz2funcorr32(nfunnz)
139 
140 ! ==============================================================================
141 ! Loop over prototype faces
142 ! ==============================================================================
143 
144  DO ifcp = 1,3
145  ifc = pgrid%fp2fOLES(ifcp)
146 
147 ! ------------------------------------------------------------------------------
148 ! Get face limits from normal face list
149 ! ------------------------------------------------------------------------------
150 
151  c1g = pgrid%f2c(1,ifc)
152 
153  dummy = maxloc(abs(pgrid%fn(1:3,ifc)))
154  nzloc = dummy(1) ! Used in RFLU_DefineCorrelation32 (next two also)
155  nzval = pgrid%fc(nzloc,ifc)
156  nzsgn = nint(pgrid%fn(nzloc,ifc))
157 
158  n = ndim-2
159 
160  DO m = 1,3
161  IF ( m /= nzloc ) THEN
162  n = n + 1
163 
164  lowlim(n) = pgrid%intLimOLES(int_lim_low,m,c1g)
165  upplim(n) = pgrid%intLimOLES(int_lim_upp,m,c1g)
166  END IF ! m
167  END DO ! m
168 
169 ! ------------------------------------------------------------------------------
170 ! Loop over cells
171 ! ------------------------------------------------------------------------------
172 
173  ncells = SIZE(pgrid%fsOLES,1)
174 
175  DO ic1l = 1,ncells
176  c1g = pgrid%fsOLES(ic1l,ifc)
177 
178  lowlim(1) = pgrid%intLimOLES(int_lim_low,xcoord,c1g)
179  lowlim(2) = pgrid%intLimOLES(int_lim_low,ycoord,c1g)
180  lowlim(3) = pgrid%intLimOLES(int_lim_low,zcoord,c1g)
181 
182  upplim(1) = pgrid%intLimOLES(int_lim_upp,xcoord,c1g)
183  upplim(2) = pgrid%intLimOLES(int_lim_upp,ycoord,c1g)
184  upplim(3) = pgrid%intLimOLES(int_lim_upp,zcoord,c1g)
185 
186 
187  errorflag = 0
188  maxcalls = max_calls_start
189  restartflag = 0
190 
191 ! --- Compute integrals --------------------------------------------------------
192 
193  DO loopcounter = 1,dcuhre_loop_limit
194  CALL dcuhre(ndim,nfunnz,lowlim,upplim,min_calls,maxcalls, &
195  rflu_definecorrelation32,errabsreq,errrelreq, &
196  key,workarraysize,restartflag,integralnz, &
197  errabsest,neval,errorflag,workarray)
198 
199  IF ( errorflag == 0 .OR. loopcounter == dcuhre_loop_limit ) THEN
200  EXIT
201  ELSE IF ( errorflag == 1 ) THEN
202  restartflag = 1
203  maxcalls = max_calls_factor*maxcalls
204 
205  CALL rflu_computedcuhreinfo(global,ndim,nfunnz,key,maxcalls, &
206  workarraysizenew)
207 
208  IF ( workarraysizenew > workarraysize ) THEN
209  EXIT
210  END IF ! workArraySizeNew
211  ELSE
212  CALL errorstop(global,err_dcuhre_output,__line__)
213  END IF ! errorFlag
214  END DO ! loopCounter
215 
216 ! --- Normalize integral -------------------------------------------------------
217 
218  DO ifunnz = 1,nfunnz
219  ifun = mapfunnz2funcorr32(ifunnz)
220  integral(ifun) = normfact*integralnz(ifunnz)
221  END DO ! iFunNZ
222 
223 ! --- Store integral in array --------------------------------------------------
224 
225  DO ifun = 1,nfun
226  CALL rflu_mapk2ij(ifun,l,i)
227  vloc = rflu_geti1posoles(l,ic1l)
228  pgrid%int1OLES(i,ifcp,vloc) = integral(ifun)
229  END DO ! iFun
230  END DO ! ic1l
231  END DO ! ifcp
232 
233 
234 #ifdef CHECK_DATASTRUCT
235 ! --- Data structure output for checking
236  WRITE(stdout,'(A)') solver_name
237  WRITE(stdout,'(A,1X,A)') solver_name,'### START CHECK OUTPUT ###'
238  WRITE(stdout,'(A,1X,A)') solver_name,'Optimal LES I1 integral vector'
239  DO i = 1,3 ! loop over components
240  WRITE(stdout,'(2(A,1X),I1)') solver_name,'Component:',i
241  DO ifcp = 1,3 ! loop over prototype faces
242  WRITE(stdout,'(A,3X,A,1X,I2)') solver_name,'Face:',ifcp
243  DO vloc = 1,3*ncells ! loop over components
244  WRITE(stdout,'(A,1X,I6,1X,E11.4)') solver_name,vloc, &
245  pgrid%int1OLES(i,ifcp,vloc)
246  END DO ! vLoc
247  END DO ! ifcp
248  END DO ! i
249  WRITE(stdout,'(A,1X,A)') solver_name,'### END CHECK OUTPUT ###'
250  WRITE(stdout,'(A)') solver_name
251 #endif
252 
253 ! ==============================================================================
254 ! Deallocate arrays
255 ! ==============================================================================
256 
257  CALL rflu_deallocatedcuhrearrays(global)
258 
259  DEALLOCATE(integral,stat=errorflag)
260  global%error = errorflag
261  IF ( global%error /= err_none ) THEN
262  CALL errorstop(global,err_deallocate,__line__,'integral')
263  END IF ! global%error
264 
265  DEALLOCATE(workarray,stat=errorflag)
266  global%error = errorflag
267  IF ( global%error /= err_none ) THEN
268  CALL errorstop(global,err_deallocate,__line__,'workArray')
269  END IF ! global%error
270 
271 ! ==============================================================================
272 ! End
273 ! ==============================================================================
274 
275  CALL deregisterfunction(global)
276 
277 END SUBROUTINE rflu_computeintegral1oles
278 
279 !*******************************************************************************
280 !
281 ! RCS Revision history:
282 !
283 ! $Log: RFLU_ComputeIntegral1OLES.F90,v $
284 ! Revision 1.8 2008/12/06 08:44:29 mtcampbe
285 ! Updated license.
286 !
287 ! Revision 1.7 2008/11/19 22:17:42 mtcampbe
288 ! Added Illinois Open Source License/Copyright
289 !
290 ! Revision 1.6 2003/05/16 02:27:44 haselbac
291 ! Removed KIND=RFREAL from NINT statements
292 !
293 ! Revision 1.5 2003/03/15 18:29:42 haselbac
294 ! Added KIND qualifyer to NINT, added footer
295 !
296 !*******************************************************************************
297 
298 
299 
300 
301 
302 
303 
subroutine rflu_computedcuhreinfo(global, NDIM, NF, KEY, MAXCLS, NW)
FT m(int i, int j) const
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
INTEGER function, public rflu_geti1posoles(l, d)
subroutine, public rflu_setmapfunnz2funcorr32(nFunNZ)
subroutine rflu_allocatedcuhrearrays(nDim, nFunNZ, nFun)
subroutine rflu_computeintegral1oles(pRegion)
subroutine, public rflu_mapk2ij(k, i, j)
subroutine, public rflu_definecorrelation32(nDim, z, nFunNZ, f)
blockLoc i
Definition: read.cpp:79
const NT & n
subroutine rflu_deallocatedcuhrearrays
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
static T_Key key
Definition: vinci_lass.c:76
subroutine deregisterfunction(global)
Definition: ModError.F90:469