Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TURB_LesGetEddyVis.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: Get eddy viscosity based the dynamic LES model.
26 !
27 ! Description: First, cell filtered cv is computed, then the filtered
28 ! velocities are obtained from this. The gradients of the
29 ! filtered velocities are computed. This is in turn used
30 ! to construct the strain rate tensor of the filtered field.
31 ! The strain rate tensor of filtered field is employed in the
32 ! formulation of the eddy viscosity of the dynamic models.
33 !
34 ! Input: region = data of current region
35 ! ibn,ien = begin and end node index
36 !
37 ! Output: eddy viscosity (mueT), stored in turb%mueT(DIRI:DIRK,:)
38 !
39 ! Notes: none.
40 !
41 !******************************************************************************
42 !
43 ! $Id: TURB_LesGetEddyVis.F90,v 1.13 2008/12/06 08:44:41 mtcampbe Exp $
44 !
45 ! Copyright: (c) 2001 by the University of Illinois
46 !
47 !******************************************************************************
48 
49 SUBROUTINE turb_lesgeteddyvis( region,ibc,iec,ibn,ien )
50 
51  USE moddatatypes
52  USE moddatastruct, ONLY : t_region
53  USE modturbulence, ONLY : t_turb
54  USE modglobal, ONLY : t_global
55 #ifdef RFLU
56  USE modbndpatch, ONLY : t_patch
60 #endif
61 #ifdef RFLO
63 #endif
64  USE turb_modinterfaces, ONLY : turb_lestestrhov, turb_calcstrainrate, &
66  USE moderror
67  USE modparameters
69  IMPLICIT NONE
70 
71 ! ... parameters
72 #ifdef RFLO
73  TYPE(t_region), TARGET :: region
74 #endif
75 #ifdef RFLU
76  TYPE(t_region), POINTER :: region
77 #endif
78  INTEGER :: ibc, iec, ibn, ien
79 
80 ! ... loop variables
81  INTEGER :: ipatch
82 
83 ! ... local variables
84  CHARACTER(CHRLEN) :: rcsidentstring
85  TYPE(t_global), POINTER :: global
86  TYPE(t_turb), POINTER :: turb
87 #ifdef RFLU
88  TYPE(t_patch), POINTER :: ppatch
89 #endif
90 
91  INTEGER :: ibegv, iendv, ibegg, iendg, ngrad, errorflag
92  REAL(RFREAL), POINTER :: ccvar(:,:)
93 #ifdef RFLO
94  INTEGER :: ilev, gradindx(9)
95  REAL(RFREAL), POINTER :: gradi(:,:), gradj(:,:), gradk(:,:)
96 #endif
97 #ifdef RFLU
98  INTEGER :: npatches, nbfaces, nbfacestot, gradindx(3)
99  REAL(RFREAL), POINTER :: gradi(:,:,:), bgradi(:,:,:)
100 #endif
101 
102 !******************************************************************************
103 
104  rcsidentstring = '$RCSfile: TURB_LesGetEddyVis.F90,v $'
105 
106  global => region%global
107  CALL registerfunction( global,'TURB_LesGetEddyVis',&
108  'TURB_LesGetEddyVis.F90' )
109 
110 ! get pointers and parameters ------------------------------------------------
111  ngrad = region%turbInput%nGrad
112 #ifdef RFLO
113  ilev = region%currLevel
114  turb => region%levels(ilev)%turb
115 #endif
116 #ifdef RFLU
117  npatches = region%grid%nPatches
118  nbfaces = 0
119  nbfacestot = 0
120 
121  DO ipatch = 1,npatches
122  ppatch => region%patches(ipatch)
123 
124  nbfaces = nbfaces + ppatch%nBTris + ppatch%nBQuads
125  nbfacestot = nbfacestot + ppatch%nBTrisTot + ppatch%nBQuadsTot
126  END DO ! iPatch
127  turb => region%turb
128 #endif
129 
130 ! allocate and point arrays required by LesTestRhoV and CalcGradVector
131 
132  ALLOCATE( turb%ccVar(cv_turb_nelm,ibc:iec),stat=errorflag )
133  global%error = errorflag
134  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
135 
136 #ifdef RFLO
137  ALLOCATE( turb%gradi(ngrad,ibn:ien),stat=errorflag )
138  global%error = errorflag
139  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
140 
141  ALLOCATE( turb%gradj(ngrad,ibn:ien),stat=errorflag )
142  global%error = errorflag
143  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
144 
145  ALLOCATE( turb%gradk(ngrad,ibn:ien),stat=errorflag )
146  global%error = errorflag
147  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
148 #endif
149 #ifdef RFLU
150  ALLOCATE( turb%gradi(xcoord:zcoord,ngrad,ibn:ien),stat=errorflag )
151  global%error = errorflag
152  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
153 
154  ALLOCATE( turb%bGradi(xcoord:zcoord,ngrad,nbfaces),stat=errorflag )
155  global%error = errorflag
156  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
157 #endif
158 
159  ccvar => turb%ccVar
160  gradi => turb%gradi
161 #ifdef RFLO
162  gradj => turb%gradj
163  gradk => turb%gradk
164 #endif
165 #ifdef RFLU
166  bgradi => turb%bGradi
167 #endif
168 
169 ! compute cell-filtered cv and store in ccVar
170  CALL turb_lestestrhov( region,ibc,iec )
171 
172 ! compute gradients of ccVar
173 #ifdef RFLO
174  ibegv = cv_turb_uvel
175  iendv = cv_turb_wvel
176  ibegg = gr_turb_ux
177  iendg = gr_turb_wz
178  CALL rflo_calcgradvector( region,ibegv,iendv,ibegg,iendg,ccvar, &
179  gradi,gradj,gradk )
180 #endif
181 #ifdef RFLU
182  ibegv = cv_turb_uvel
183  iendv = cv_turb_wvel
184  ibegg = gr_turb_ux
185  iendg = gr_turb_wx
186  CALL rflu_computegradfaceswrapper( region,ibegv,iendv,ibegg,iendg,ccvar,gradi )
187  DO ipatch = 1,npatches
188  ppatch => region%patches(ipatch)
189 
190  IF ( rflu_decideneedbgradface(region,ppatch) .EQV. .true. ) THEN
191  CALL rflu_computegradbfaceswrapper( region,ppatch,ibegv,iendv,ibegg,iendg, &
192  ccvar,bgradi )
193  END IF ! RFLU_DecideNeedBGradFace
194  ENDDO ! iPatch
195 #endif
196  DEALLOCATE( turb%ccVar )
197 
198 ! compute sij based on cell-filtered cv, Sij(v) = Sij(test[bar(u_i)])
199 ! and store this in fISij, fJSij, fKSij
200  gradindx(1) = gr_turb_ux
201  gradindx(2) = gr_turb_vx
202  gradindx(3) = gr_turb_wx
203 #ifdef RFLO
204  gradindx(4) = gr_turb_uy
205  gradindx(5) = gr_turb_vy
206  gradindx(6) = gr_turb_wy
207  gradindx(7) = gr_turb_uz
208  gradindx(8) = gr_turb_vz
209  gradindx(9) = gr_turb_wz
210 
211  CALL turb_calcstrainrate( region,ibn,ien,gradindx,gradi,gradj,gradk, &
212  turb%fISij,turb%fJSij,turb%fKSij )
213  DEALLOCATE( turb%gradi,turb%gradj,turb%gradk )
214 #endif
215 #ifdef RFLU
216  CALL turb_calcstrainrate( region, ibn,ien, gradindx, gradi, turb%fISij )
217  IF (npatches > 0) &
218  CALL turb_calcstrainrate( region,1,nbfaces,gradindx,bgradi,turb%bfISij )
219  DEALLOCATE( turb%gradi, turb%bGradi )
220 #endif
221 
222 ! obtain eddyviscosity in i, j and k faces
223  CALL turb_lescalceddyvis( region,ibn,ien,diri )
224 #ifdef RFLO
225  CALL turb_lescalceddyvis( region,ibn,ien,dirj )
226  CALL turb_lescalceddyvis( region,ibn,ien,dirk )
227 #endif
228 
229 ! finalize --------------------------------------------------------------------
230 
231  CALL deregisterfunction( global )
232 
233 END SUBROUTINE turb_lesgeteddyvis
234 
235 !******************************************************************************
236 !
237 ! RCS Revision history:
238 !
239 ! $Log: TURB_LesGetEddyVis.F90,v $
240 ! Revision 1.13 2008/12/06 08:44:41 mtcampbe
241 ! Updated license.
242 !
243 ! Revision 1.12 2008/11/19 22:17:54 mtcampbe
244 ! Added Illinois Open Source License/Copyright
245 !
246 ! Revision 1.11 2006/08/19 15:40:36 mparmar
247 ! Added use of RFLU_DecideNeedBGradFace
248 !
249 ! Revision 1.10 2006/04/07 15:06:06 haselbac
250 ! Bug fix: Incorrect ifs
251 !
252 ! Revision 1.9 2006/04/07 14:56:02 haselbac
253 ! Adapted to changes in f and bf grad routines
254 !
255 ! Revision 1.8 2005/12/20 20:43:29 wasistho
256 ! adapted to changing in Rocflu on face gradient routines
257 !
258 ! Revision 1.7 2004/05/28 01:58:49 wasistho
259 ! update unstructured grid LES
260 !
261 ! Revision 1.6 2004/05/17 20:33:39 wasistho
262 ! reordering gradIndx for more efficient cache memory addressing
263 !
264 ! Revision 1.5 2004/03/27 02:16:42 wasistho
265 ! compiled with Rocflu
266 !
267 ! Revision 1.4 2004/03/25 04:40:41 wasistho
268 ! prepared for RFLU
269 !
270 ! Revision 1.3 2004/03/20 03:28:29 wasistho
271 ! prepared for RFLU
272 !
273 ! Revision 1.2 2004/03/19 02:50:18 wasistho
274 ! prepared for RFLU
275 !
276 ! Revision 1.1 2004/03/05 04:37:00 wasistho
277 ! changed nomenclature
278 !
279 ! Revision 1.5 2003/10/09 23:07:41 wasistho
280 ! renamed CalcEddyVis to LesCalcEddyVis
281 !
282 ! Revision 1.4 2003/08/29 01:42:25 wasistho
283 ! Added TARGET attribute to region variable, since pointers are cached into it
284 !
285 ! Revision 1.3 2003/05/16 05:43:34 wasistho
286 ! modified array range of CC-filtered
287 !
288 ! Revision 1.2 2002/10/16 02:00:06 wasistho
289 ! Changed global%error flag
290 !
291 ! Revision 1.1 2002/10/14 23:55:30 wasistho
292 ! Install Rocturb
293 !
294 !
295 !******************************************************************************
296 
297 
298 
299 
300 
301 
302 
subroutine, public rflu_computegradfaceswrapper(pRegion, iBegVar, iEndVar, iBegGrad, iEndGrad, var, grad)
LOGICAL function rflu_decideneedbgradface(pRegion, pPatch)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine, public rflu_computegradbfaceswrapper(pRegion, pPatch, iBegVar, iEndVar, iBegGrad, iEndGrad, var, grad)
subroutine turb_lesgeteddyvis(region, ibc, iec, ibn, ien)
subroutine turb_lestestrhov(region, ibc, iec)
**********************************************************************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 iEndG gradi(:,:)
subroutine turb_lescalceddyvis(region, ibn, ien, ijk)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
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 iEndG gradj(:,:)
subroutine rflo_calcgradvector(region, iBegV, iEndV, iBegG, iEndG, var, gradi, gradj, gradk)