Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TURB_fluLesBMij.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 the mij stress appearing in the dynamic LES models.
26 !
27 ! Description: We determine mij as appearing in the dynamic formulation:
28 ! M_{ij}=-test[bar(rho)](kappa \Delta)^2 |S(v)|S_{ij(v)
29 ! +test[bar(rho)\Delta^{2}|S(u)|S_{ij}(u)]
30 ! in which v=test[bar(rho ui)]/test[bar(rho)] where test denotes
31 ! the test-filter with twice the filter-width. M_ij is computed
32 ! on the cell faces. S_ij(u) and Sij(test[u]) are already
33 ! available, respectively, in mSij for mixture field and fSij for
34 ! filtered field at cell faces. Moreover, we use the fact that we
35 ! know 1/test[bar(rho)] (rhoFTb) and 1/[bar(rho)] (rhoF) at faces.
36 !
37 ! Input: region = data of current region
38 ! ijk = ijk-face is being treated
39 !
40 ! Output: mij = resulting stress tensor in dynamic LES models
41 !
42 ! Notes: This routine relevant only for physical boundaries of FLU regions.
43 !
44 !******************************************************************************
45 !
46 ! $Id: TURB_fluLesBMij.F90,v 1.3 2008/12/06 08:44:44 mtcampbe Exp $
47 !
48 ! Copyright: (c) 2001 by the University of Illinois
49 !
50 !******************************************************************************
51 
52 SUBROUTINE turb_flulesbmij( region,ijk )
53 
54  USE moddatatypes
55  USE moddatastruct, ONLY : t_region
56  USE modglobal, ONLY : t_global
57  USE modbndpatch, ONLY : t_patch
58 ! USE RFLU_ModInterpolation, ONLY : RFLU_InterpFaces2FacesPatches
59  USE moderror
61  IMPLICIT NONE
62 
63 ! ... parameters
64  TYPE(t_region), POINTER :: region
65  INTEGER :: ijk
66 
67 ! ... loop variables
68  INTEGER :: i, j, k, ijkn, ijkc0, ijkc1, ipatch
69 
70 ! ... local variables
71  CHARACTER(CHRLEN) :: rcsidentstring
72  TYPE(t_global), POINTER :: global
73  TYPE(t_patch), POINTER :: patch
74 
75  INTEGER :: ibn,ien,idbeg,idend,npatches,nbfaces,tndel(diri:dirk)
76  REAL(RFREAL) :: kappa2,rkappa2,two3rd
77  REAL(RFREAL) :: delfac2,delfkap2,forterm
78  REAL(RFREAL), POINTER :: bfvol(:),bfsij(:,:),bfvar(:,:),bffvar(:,:)
79  REAL(RFREAL), POINTER :: bsij(:,:),bmij(:,:)
80  REAL(RFREAL), POINTER :: field(:,:),tfield(:,:)
81  REAL(RFREAL), ALLOCATABLE :: modstrain(:)
82 
83 !******************************************************************************
84 
85  rcsidentstring = '$RCSfile: TURB_fluLesBMij.F90,v $'
86 
87  global => region%global
88  CALL registerfunction( global,'TURB_FluLesBMij',&
89  'TURB_fluLesBMij.F90' )
90 
91 ! get indices and pointers ----------------------------------------------------
92 
93  npatches = region%grid%nPatches
94  nbfaces = 0
95 
96  DO ipatch = 1,npatches
97  patch => region%patches(ipatch)
98  nbfaces = nbfaces + patch%nBTris + patch%nBQuads
99  END DO ! iPatch
100  ibn = 1
101  ien = nbfaces
102 
103  bfvar => region%turb%bfVar
104  bffvar => region%turb%bffVar
105  bmij => region%turb%bMij
106  bfvol => region%turb%bfVolI
107  bsij => region%turb%bmIsij
108  bfsij => region%turb%bfISij
109 
110 ! allocate work arrays used within this scope
111 
112  ALLOCATE( modstrain(ibn:ien) )
113  ALLOCATE( field(e11:e33,ibn:ien),tfield(e11:e33,ibn:ien) )
114 
115 ! test filter width is twice bar filter width
116 
117  tndel(diri) = 2*region%turbInput%filterWidth(diri)
118 
119 ! filterwidth on the fg-level (test-bar) is sqrt(5) times larger than
120 ! on the f-level (bar), i.e. kappa=sqrt(5)
121 
122  kappa2 = 5._rfreal
123  rkappa2= 1._rfreal/kappa2
124  two3rd = 2._rfreal/3._rfreal
125 
126 ! determine the bar filter width delta which appears in the dynamic model;
127 ! this factor in square is defined as (kappa*delfac)^2 and stored in delFKap2
128 
129  delfac2 = region%turbInput%delFac2
130  delfkap2 = delfac2*kappa2
131 
132 ! first calculate test[bar(rho)](\kappa \Delta)^2|S(v)|Sij(v) at cell faces;
133 ! we obtain Sij(v) from array fSij;
134 
135  DO ijkn=ibn,ien
136 
137 ! - generate the 6-th component of fSij using the tracelessness of S_{ij}
138 
139  bfsij(e33,ijkn)=-(bfsij(e11,ijkn)+bfsij(e22,ijkn))
140 
141 ! - get modulus of Sij(v): |S(v)|
142  modstrain(ijkn)=sqrt(bfsij(e11,ijkn)*bfsij(e11,ijkn) &
143  +bfsij(e22,ijkn)*bfsij(e22,ijkn) &
144  +bfsij(e11,ijkn)*bfsij(e22,ijkn) &
145  +bfsij(e12,ijkn)*bfsij(e12,ijkn) &
146  +bfsij(e13,ijkn)*bfsij(e13,ijkn) &
147  +bfsij(e23,ijkn)*bfsij(e23,ijkn))
148 
149 ! - in turn, (kappa*delta)^2 in fg-level is stored in tField
150 
151  tfield(e11,ijkn) = delfkap2*bfvol(ijkn)**two3rd
152 
153 ! - fg-level contribution to M_{ij} can now be computed since
154 ! we already have test(bar[rho]) available at cell faces,
155 ! in fact we have 1/test(bar[rho]), so we devide instead of multiply;
156 ! install the first term of mij; the space of fSij in used in the process
157 
158  forterm = -tfield(e11,ijkn)/bffvar(cv_turb_dens,ijkn)* &
159  modstrain(ijkn)
160 
161  bmij(e11,ijkn) = forterm*bfsij(e11,ijkn)
162  bmij(e12,ijkn) = forterm*bfsij(e12,ijkn)
163  bmij(e13,ijkn) = forterm*bfsij(e13,ijkn)
164  bmij(e22,ijkn) = forterm*bfsij(e22,ijkn)
165  bmij(e23,ijkn) = forterm*bfsij(e23,ijkn)
166  bmij(e33,ijkn) = forterm*bfsij(e33,ijkn)
167 
168 ! - as final step we determine contribution of test-filtered f-level term;
169 ! note we have bar[rho] available at cell faces bRho stored in fVar;
170 ! in fact we have 1/bRho in fVar(CV_TURB_DENS,:), so we devide by bRho
171 ! instead of multiply and compute modulus of Sij: |S(u)|
172 
173  modstrain(ijkn) = sqrt(bsij(e11,ijkn)*bsij(e11,ijkn) &
174  +bsij(e22,ijkn)*bsij(e22,ijkn) &
175  +bsij(e11,ijkn)*bsij(e22,ijkn) &
176  +bsij(e12,ijkn)*bsij(e12,ijkn) &
177  +bsij(e13,ijkn)*bsij(e13,ijkn) &
178  +bsij(e23,ijkn)*bsij(e23,ijkn))
179 
180 ! - finish computation of mij; filterwidth^2 at f-level is tField/kappa2;
181 ! build terms need to be filtered
182 
183  forterm = tfield(e11,ijkn)/bfvar(cv_turb_dens,ijkn)*rkappa2* &
184  modstrain(ijkn)
185 
186  field(e11,ijkn) = forterm*bsij(e11,ijkn)
187  field(e12,ijkn) = forterm*bsij(e12,ijkn)
188  field(e13,ijkn) = forterm*bsij(e13,ijkn)
189  field(e22,ijkn) = forterm*bsij(e22,ijkn)
190  field(e23,ijkn) = forterm*bsij(e23,ijkn)
191  field(e33,ijkn) = -forterm*(bsij(e11,ijkn)+bsij(e22,ijkn))
192  ENDDO
193 
194 ! perform test filtering:
195 
196  idbeg = e11
197  idend = e33
198 
199 ! CALL RFLU_InterpFaces2FacesPatches( region,field,tField )
200 
201 ! and complete components of mij:
202 
203  DO ijkn=ibn,ien
204  bmij(e11,ijkn) = bmij(e11,ijkn) + tfield(e11,ijkn)
205  bmij(e12,ijkn) = bmij(e12,ijkn) + tfield(e12,ijkn)
206  bmij(e13,ijkn) = bmij(e13,ijkn) + tfield(e13,ijkn)
207  bmij(e22,ijkn) = bmij(e22,ijkn) + tfield(e22,ijkn)
208  bmij(e23,ijkn) = bmij(e23,ijkn) + tfield(e23,ijkn)
209  bmij(e33,ijkn) = bmij(e33,ijkn) + tfield(e33,ijkn)
210  ENDDO
211 
212 ! deallocate temporary arrays
213 
214  DEALLOCATE( modstrain,field,tfield )
215 
216 ! finalize --------------------------------------------------------------------
217 
218  CALL deregisterfunction( global )
219 
220 END SUBROUTINE turb_flulesbmij
221 
222 !******************************************************************************
223 !
224 ! RCS Revision history:
225 !
226 ! $Log: TURB_fluLesBMij.F90,v $
227 ! Revision 1.3 2008/12/06 08:44:44 mtcampbe
228 ! Updated license.
229 !
230 ! Revision 1.2 2008/11/19 22:17:56 mtcampbe
231 ! Added Illinois Open Source License/Copyright
232 !
233 ! Revision 1.1 2004/05/28 02:03:58 wasistho
234 ! update unstructured grid LES
235 !
236 !
237 !
238 !******************************************************************************
239 
240 
241 
242 
243 
244 
245 
j indices k indices k
Definition: Indexing.h:6
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine turb_flulesbmij(region, ijk)
double sqrt(double d)
Definition: double.h:73
Definition: patch.h:74
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
subroutine deregisterfunction(global)
Definition: ModError.F90:469