Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_ViscousFluxPatch.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 viscous fluxes based on viscosity principle: mu*S_ij
26 ! through a patch
27 !
28 ! Description: this routine works in the same way as ViscousFluxEddy
29 ! but applied on region patches
30 !
31 ! Input: region = data of current region.
32 ! patch = current patch.
33 ! indxMu = TV component index for dynamic viscosity Mu
34 ! indxTCo = TV component index for thermal conductivity TCo
35 ! tv = transport variables, mu and kappa
36 !
37 ! Output: region%levels%mixt%diss = viscous fluxes added to the dissipation.
38 !
39 ! Notes: none.
40 !
41 !******************************************************************************
42 !
43 ! $Id: RFLO_ViscousFluxPatch.F90,v 1.4 2008/12/06 08:44:28 mtcampbe Exp $
44 !
45 ! Copyright: (c) 2001 by the University of Illinois
46 !
47 !******************************************************************************
48 
49 SUBROUTINE rflo_viscousfluxpatch( region,patch,indxMu,indxTCo,tv )
50 
51  USE moddatatypes
52  USE modbndpatch, ONLY : t_patch
53  USE moddatastruct, ONLY : t_region
56 
57 #include "Indexing.h"
58 
59  USE moderror
60  USE modparameters
61  IMPLICIT NONE
62 
63 ! ... parameters
64  TYPE(t_region) :: region
65  TYPE(t_patch) :: patch
66  INTEGER :: indxmu, indxtco
67  REAL(RFREAL), POINTER :: tv(:,:)
68 
69 ! ... loop variables
70  INTEGER :: i, j, k, ic
71 
72 ! ... local variables
73  INTEGER :: ilev, lbound, bctype
74  INTEGER :: ibeg, iend, jbeg, jend, kbeg, kend
75  INTEGER :: inode, jnode, knode, idir, jdir, kdir
76  INTEGER :: icoff, ijcoff, inoff, ijnoff, ijkcb0, ijkcd, ijknb, acid0, acid1
77  INTEGER :: n1, n2, noff, j2d, aerocoeff
78 
79  REAL(RFREAL) :: oo3, beta, muf, kpaf, velf(3), div
80  REAL(RFREAL) :: ux, uy, uz, vx, vy, vz, wx, wy, wz, tx, ty, tz, &
81  tgradf, fd(4)
82  REAL(RFREAL) :: sgn, sf(3), sij(3,3), ac0, ac1
83  REAL(RFREAL) :: rref, vref, rcfref, rchref
84  REAL(RFREAL), POINTER :: avgco(:,:), diss(:,:)
85 
86  REAL(RFREAL), POINTER :: dv(:,:), grad(:,:), sface(:,:)
87 
88 !******************************************************************************
89 
90  CALL registerfunction( region%global,'RFLO_ViscousFluxPatch',&
91  'RFLO_ViscousFluxPatch.F90' )
92 
93 ! get dimensions and pointers -------------------------------------------------
94 
95  bctype = patch%bcType
96 
97  ilev = region%currLevel
98  lbound = patch%lbound
99 
100  dv => region%levels(ilev)%mixt%dv
101  diss => region%levels(ilev)%mixt%diss
102 
103 ! get coefficients -----------------------------------------------------------
104 
105  oo3 = 1.0_rfreal/3.0_rfreal
106  beta = region%mixtInput%betrk(region%irkStep)
107 
108  noff = abs(patch%l1end-patch%l1beg) + 1
109  aerocoeff = region%global%aeroCoeffs
110  rref = region%global%refDensity
111  vref = region%global%refVelocity
112 
113  rcfref = 2.0_rfreal/(rref*vref*vref)
114  rchref = 2.0_rfreal/(rref*vref*vref*vref)
115 
116 ! take the right face vector and make it point outwards ----------------------
117 
118  CALL rflo_getpatchindices( region,patch,ilev,ibeg,iend,jbeg,jend,kbeg,kend )
120  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
121  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
122 
123  sgn = +1._rfreal
124  inode = 0
125  jnode = 0
126  knode = 0
127  acid0 = 2
128  acid1 = 1
129  IF (lbound==2 .OR. lbound==4 .OR. lbound==6) THEN
130  sgn = -1._rfreal
131  inode = -idir
132  jnode = -jdir
133  knode = -kdir
134  acid0 = 1
135  acid1 = 2
136  ENDIF
137 
138 ! get the appropriate face vector --------------------------------------------
139 
140  IF (lbound==1 .OR. lbound==2) THEN
141  avgco => region%levels(ilev)%grid%c2fCoI
142  sface => region%levels(ilev)%grid%si
143  grad => region%levels(ilev)%mixt%gradi
144  ELSE IF (lbound==3 .OR. lbound==4) THEN
145  avgco => region%levels(ilev)%grid%c2fCoJ
146  sface => region%levels(ilev)%grid%sj
147  grad => region%levels(ilev)%mixt%gradj
148  ELSE
149  avgco => region%levels(ilev)%grid%c2fCoK
150  sface => region%levels(ilev)%grid%sk
151  grad => region%levels(ilev)%mixt%gradk
152  ENDIF
153 
154 ! non-conforming region interface --------------------------------------------
155 
156  IF (bctype>=bc_regionint .AND. bctype<=bc_regionint+bc_range) THEN
157 
158  ELSE IF (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range) THEN
159 
160 ! everything else
161 
162  ELSE
163 
164 ! flux in the direction normal to the patch ----------------------------------
165 
166  DO k=kbeg,kend
167  DO j=jbeg,jend
168  DO i=ibeg,iend
169 
170  ijkcb0 = indijk(i ,j ,k ,icoff,ijcoff) ! bnd cells
171  ijkcd = indijk(i-idir ,j-jdir ,k-kdir ,icoff,ijcoff) ! dummy
172  ijknb = indijk(i+inode,j+jnode,k+knode,inoff,ijnoff) ! bnd nodes
173  ac0 = avgco(acid0,ijknb)
174  ac1 = avgco(acid1,ijknb)
175 
176  muf = ac0*tv(tv_mixt_muel,ijkcb0)+ac1*tv(tv_mixt_muel,ijkcd)
177  kpaf = ac0*tv(tv_mixt_tcol,ijkcb0)+ac1*tv(tv_mixt_tcol,ijkcd)
178 
179  velf(1)= ac0*dv(dv_mixt_uvel,ijkcb0)+ac1*dv(dv_mixt_uvel,ijkcd)
180  velf(2)= ac0*dv(dv_mixt_vvel,ijkcb0)+ac1*dv(dv_mixt_vvel,ijkcd)
181  velf(3)= ac0*dv(dv_mixt_wvel,ijkcb0)+ac1*dv(dv_mixt_wvel,ijkcd)
182 
183  ux = grad(gr_mixt_ux,ijknb)
184  uy = grad(gr_mixt_uy,ijknb)
185  uz = grad(gr_mixt_uz,ijknb)
186  vx = grad(gr_mixt_vx,ijknb)
187  vy = grad(gr_mixt_vy,ijknb)
188  vz = grad(gr_mixt_vz,ijknb)
189  wx = grad(gr_mixt_wx,ijknb)
190  wy = grad(gr_mixt_wy,ijknb)
191  wz = grad(gr_mixt_wz,ijknb)
192  tx = grad(gr_mixt_tx,ijknb)
193  ty = grad(gr_mixt_ty,ijknb)
194  tz = grad(gr_mixt_tz,ijknb)
195 
196  sf(1) = sgn*sface(xcoord,ijknb)
197  sf(2) = sgn*sface(ycoord,ijknb)
198  sf(3) = sgn*sface(zcoord,ijknb)
199 
200  tgradf= (tx*sf(1)+ty*sf(2)+tz*sf(3))
201 
202  div = oo3*(ux+vy+wz)
203 
204  sij(1,1) = 2.0_rfreal*(ux-div)
205  sij(1,2) = uy+vx
206  sij(1,3) = uz+wx
207 
208  sij(2,1) = sij(1,2)
209  sij(2,2) = 2.0_rfreal*(vy-div)
210  sij(2,3) = vz+wy
211 
212  sij(3,1) = sij(1,3)
213  sij(3,2) = sij(2,3)
214  sij(3,3) = 2.0_rfreal*(wz-div)
215 
216  fd(1) = muf*(sij(1,1)*sf(1)+sij(1,2)*sf(2)+sij(1,3)*sf(3))
217  fd(2) = muf*(sij(2,1)*sf(1)+sij(2,2)*sf(2)+sij(2,3)*sf(3))
218  fd(3) = muf*(sij(3,1)*sf(1)+sij(3,2)*sf(2)+sij(3,3)*sf(3))
219  fd(4) = dot_product(fd(1:3),velf(1:3)) + kpaf*tgradf
220 
221  diss(cv_mixt_xmom,ijkcb0) = diss(cv_mixt_xmom,ijkcb0)+fd(1)*beta
222  diss(cv_mixt_ymom,ijkcb0) = diss(cv_mixt_ymom,ijkcb0)+fd(2)*beta
223  diss(cv_mixt_zmom,ijkcb0) = diss(cv_mixt_zmom,ijkcb0)+fd(3)*beta
224  diss(cv_mixt_ener,ijkcb0) = diss(cv_mixt_ener,ijkcb0)+fd(4)*beta
225 
226 ! ------- Set friction and heat-transfer coefficients
227 
228  IF (lbound==1 .OR. lbound==2) THEN
229  n1 = j - jbeg
230  n2 = k - kbeg
231  ELSE IF (lbound==3 .OR. lbound==4) THEN
232  n1 = k - kbeg
233  n2 = i - ibeg
234  ELSE IF (lbound==5 .OR. lbound==6) THEN
235  n1 = i - ibeg
236  n2 = j - jbeg
237  ENDIF
238  j2d = aerocoeff * indij(n1,n2,noff)
239  patch%cf(xcoord,j2d) = rcfref*fd(1)
240  patch%cf(ycoord,j2d) = rcfref*fd(2)
241  patch%cf(zcoord,j2d) = rcfref*fd(3)
242  patch%ch( j2d) = rchref*fd(4)
243 
244  ENDDO ! i
245  ENDDO ! j
246  ENDDO ! k
247  ENDIF
248 
249 ! finalize --------------------------------------------------------------------
250 
251  CALL deregisterfunction( region%global )
252 
253 END SUBROUTINE rflo_viscousfluxpatch
254 
255 !******************************************************************************
256 !
257 ! RCS Revision history:
258 !
259 ! $Log: RFLO_ViscousFluxPatch.F90,v $
260 ! Revision 1.4 2008/12/06 08:44:28 mtcampbe
261 ! Updated license.
262 !
263 ! Revision 1.3 2008/11/19 22:17:39 mtcampbe
264 ! Added Illinois Open Source License/Copyright
265 !
266 ! Revision 1.2 2006/03/13 03:42:28 wasistho
267 ! defined aero coeffs
268 !
269 ! Revision 1.1 2004/11/29 20:51:40 wasistho
270 ! lower to upper case
271 !
272 ! Revision 1.1 2004/08/02 23:13:59 wasistho
273 ! mv libfloflu/viscousFluxEddy(Patch) to rocflo/RFLO_viscousFlux(Patch)
274 !
275 ! Revision 1.15 2003/12/04 03:23:09 haselbac
276 ! Removed RFLU code segments, moved to RFLU_ViscousFluxesPatches
277 !
278 ! Revision 1.14 2003/11/20 16:40:36 mdbrandy
279 ! Backing out RocfluidMP changes from 11-17-03
280 !
281 ! Revision 1.11 2003/05/15 02:57:02 jblazek
282 ! Inlined index function.
283 !
284 ! Revision 1.10 2002/09/27 00:57:09 jblazek
285 ! Changed makefiles - no makelinks needed.
286 !
287 ! Revision 1.9 2002/09/20 22:22:35 jblazek
288 ! Finalized integration into GenX.
289 !
290 ! Revision 1.8 2002/09/09 14:08:12 haselbac
291 ! mixtInput now under regions, added some things, corrected a few bugs
292 !
293 ! Revision 1.7 2002/09/05 17:40:20 jblazek
294 ! Variable global moved into regions().
295 !
296 ! Revision 1.5 2002/08/01 01:40:03 wasistho
297 ! Made generic
298 !
299 ! Revision 1.4 2002/07/27 08:13:52 wasistho
300 ! prepared for rocturb implementation
301 !
302 ! Revision 1.3 2002/07/22 22:59:11 jblazek
303 ! Some more clean up.
304 !
305 ! Revision 1.2 2002/07/19 23:38:48 wasistho
306 ! made compliant with CODING RULE
307 !
308 !******************************************************************************
309 
310 
311 
312 
313 
314 
315 
**********************************************************************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 ibeg
subroutine rflo_getpatchdirection(patch, idir, jdir, kdir)
**********************************************************************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 inode
j indices k indices k
Definition: Indexing.h:6
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
**********************************************************************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 ic
subroutine rflo_getpatchindices(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
**********************************************************************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 jdir
Definition: patch.h:74
**********************************************************************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 knode iend
subroutine rflo_viscousfluxpatch(region, patch, indxMu, indxTCo, tv)
blockLoc i
Definition: read.cpp:79
**********************************************************************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 idir
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
static void div(const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for division.
Definition: op3args.C:269
j indices j
Definition: Indexing.h:6
**********************************************************************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 knode jend
**********************************************************************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 kdir
**********************************************************************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 knode jbeg
long double dot_product(pnt vec1, pnt vec2)
**********************************************************************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 knode kbeg
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 jnode