Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TURB_LesCoefDynSmag.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: Obtain model coefficient for dynamic Smagorinsky model.
26 !
27 ! Description: none.
28 !
29 ! Input: region = data of current region
30 ! ibn,ien = begin and end node index
31 ! ijk = ijk-face is being treated
32 !
33 ! Output: cModel = turb%coef = model coefficient
34 !
35 ! Notes: none.
36 !
37 !******************************************************************************
38 !
39 ! $Id: TURB_LesCoefDynSmag.F90,v 1.7 2008/12/06 08:44:41 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2001 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE turb_lescoefdynsmag( region,ibn,ien,ijk )
46 
47  USE moddatatypes
48  USE moddatastruct, ONLY : t_region
49  USE modturbulence, ONLY : t_turb
50  USE modglobal, ONLY : t_global
51 #ifdef RFLU
52  USE modbndpatch, ONLY : t_patch
55 #endif
56 #ifdef RFLO
58 #endif
60  USE moderror
61  USE modparameters
63  IMPLICIT NONE
64 
65 ! ... parameters
66 #ifdef RFLO
67  TYPE(t_region), TARGET :: region
68 #endif
69 #ifdef RFLU
70  TYPE(t_region), POINTER :: region
71 #endif
72  INTEGER :: ibn,ien,ijk
73 
74 ! ... loops variables
75  INTEGER :: ipatch
76 
77 ! ... local variables
78  CHARACTER(CHRLEN) :: rcsidentstring
79  TYPE(t_global), POINTER :: global
80  TYPE(t_turb), POINTER :: turb
81 #ifdef RFLU
82  TYPE(t_patch), POINTER :: patch
83 #endif
84 
85  INTEGER :: tndel(diri:dirk), errorflag
86  REAL(RFREAL), POINTER :: lij(:,:)
87 #ifdef RFLO
88  INTEGER :: ilev, filtertype
89 #endif
90 #ifdef RFLU
91  INTEGER :: npatches, nbfaces
92  REAL(RFREAL), POINTER :: blij(:,:)
93 #endif
94 
95 !******************************************************************************
96 
97  rcsidentstring = '$RCSfile: TURB_LesCoefDynSmag.F90,v $'
98 
99  global => region%global
100  CALL registerfunction( global,'Turb_LesCoefDynSmag',&
101  'TURB_LesCoefDynSmag.F90' )
102 
103 ! get some parameters and pointers ------------------------------------------
104 
105 #ifdef RFLO
106  ilev = region%currLevel
107  filtertype = region%turbInput%filterType
108  turb => region%levels(ilev)%turb
109 #endif
110 #ifdef RFLU
111  npatches = region%grid%nPatches
112  nbfaces = 0
113 
114  DO ipatch = 1,npatches
115  patch => region%patches(ipatch)
116  nbfaces = nbfaces + patch%nBTris + patch%nBQuads
117  END DO ! iPatch
118  turb => region%turb
119 #endif
120 
121 ! settle the filter-width for the test-filter
122 
123  tndel(diri) = 2*region%turbInput%filterWidth(diri)
124 #ifdef RFLO
125  tndel(dirj) = 2*region%turbInput%filterWidth(dirj)
126  tndel(dirk) = 2*region%turbInput%filterWidth(dirk)
127 #endif
128 #ifdef RFLU
129  tndel(dirj) = 0._rfreal
130  tndel(dirk) = 0._rfreal
131 #endif
132 
133 ! first transfer rho and rho*ui from the centers to the faces since we
134 ! require the turbulent stress tensor in these points; store the results
135 ! in rhof, rhou1f, rhou2f and rhou3f; face-cv, fVar, is already allocated
136 
137 #ifdef RFLO
138  CALL turb_flolesgenc2f( region,ijk )
139 #endif
140 #ifdef RFLU
141  CALL turb_flulesc2f( region )
142 #endif
143 
144 ! allocate and point arrays required by LesLij (ffVar, lij), LesMij (ffVar),
145 ! and by lesContract (lij)
146 
147  ALLOCATE( turb%ffVar(cv_turb_nelm,ibn:ien),stat=errorflag )
148  ALLOCATE( turb%lij(tensor_symm_nelm,ibn:ien),stat=errorflag )
149  ALLOCATE( turb%mij(tensor_symm_nelm,ibn:ien),stat=errorflag )
150  global%error = errorflag
151  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
152 
153  lij => turb%lij
154 
155 #ifdef RFLU
156  ALLOCATE( turb%bffVar(cv_turb_nelm,nbfaces),stat=errorflag )
157  ALLOCATE( turb%bLij(tensor_symm_nelm,nbfaces),stat=errorflag )
158  ALLOCATE( turb%bMij(tensor_symm_nelm,nbfaces),stat=errorflag )
159  global%error = errorflag
160  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
161 
162  blij => turb%bLij
163 #endif
164 
165 ! determine components of lij for which we use the routine TURB_LesLij
166 ! with test-filter instead of bar-filter
167 
168  CALL turb_leslij( region,ijk,tndel,lij )
169 #ifdef RFLU
170  CALL turb_flulesblij( region,tndel,blij )
171 #endif
172 
173 ! determine components of mij which we store in mij using rhof and rhoftb
174 ! already available from TURB_LesLij
175 
176  CALL turb_lesmij( region,ijk )
177  DEALLOCATE( turb%ffVar )
178 #ifdef RFLU
179  CALL turb_flulesbmij( region )
180  DEALLOCATE( turb%bffVar )
181 #endif
182 
183 ! contract lij and mij to obtain model-coefficient at cell faces
184 
185  CALL turb_lescontract( region,ijk )
186  DEALLOCATE( turb%lij,turb%mij )
187 #ifdef RFLU
188  DEALLOCATE( turb%bLij,turb%bMij )
189 #endif
190 
191 ! finalize --------------------------------------------------------------------
192 
193  CALL deregisterfunction( global )
194 
195 END SUBROUTINE turb_lescoefdynsmag
196 
197 !******************************************************************************
198 !
199 ! RCS Revision history:
200 !
201 ! $Log: TURB_LesCoefDynSmag.F90,v $
202 ! Revision 1.7 2008/12/06 08:44:41 mtcampbe
203 ! Updated license.
204 !
205 ! Revision 1.6 2008/11/19 22:17:54 mtcampbe
206 ! Added Illinois Open Source License/Copyright
207 !
208 ! Revision 1.5 2004/07/30 22:34:33 wasistho
209 ! replaced floLesUniC2F by floLesGenC2F
210 !
211 ! Revision 1.4 2004/05/28 02:00:45 wasistho
212 ! update unstructured grid LES
213 !
214 ! Revision 1.3 2004/03/19 02:49:17 wasistho
215 ! prepared for RFLU
216 !
217 ! Revision 1.2 2004/03/12 02:55:35 wasistho
218 ! changed rocturb routine names
219 !
220 ! Revision 1.1 2004/03/05 04:37:00 wasistho
221 ! changed nomenclature
222 !
223 ! Revision 1.3 2003/08/29 01:40:56 wasistho
224 ! Added TARGET attribute to region variable, since pointers are cached into it
225 !
226 ! Revision 1.2 2002/10/16 01:59:27 wasistho
227 ! Changed global%error flag
228 !
229 ! Revision 1.1 2002/10/14 23:55:29 wasistho
230 ! Install Rocturb
231 !
232 !
233 !******************************************************************************
234 
235 
236 
237 
238 
239 
240 
subroutine turb_flulesblij(region, nDel, lij)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine turb_flulesc2f(region)
subroutine turb_flulesbmij(region, ijk)
subroutine turb_lescoefdynsmag(region, ibn, ien, ijk)
Definition: patch.h:74
subroutine turb_lescontract(region, ijk)
subroutine turb_lesmij(region, ijk)
Definition: TURB_LesMij.F90:52
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine turb_leslij(region, ijk, nDel, lij)
Definition: TURB_LesLij.F90:57
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine turb_flolesgenc2f(region, ijk)