Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ConvFluxOLES.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 convective fluxes using optimal LES approach.
26 !
27 ! Description: None.
28 !
29 ! Input: region = data of current region.
30 !
31 ! Output: region%mixt%rhs = convective fluxes added to the residual.
32 !
33 ! Notes:
34 ! 1. No boundary fluxes because present implementation works only for
35 ! isotropic turbulence
36 ! 2. No grid speeds implemented.
37 !
38 !******************************************************************************
39 !
40 ! $Id: RFLU_ConvFluxOLES.F90,v 1.7 2008/12/06 08:44:29 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2002 by the University of Illinois
43 !
44 !******************************************************************************
45 
46 SUBROUTINE rflu_convfluxoles(region)
47 
48  USE modglobal, ONLY: t_global
49  USE moddatatypes
50  USE moddatastruct, ONLY: t_region
51  USE modgrid, ONLY: t_grid
52  USE moderror
53  USE modparameters
54 
55  IMPLICIT NONE
56 
57 ! ... parameters
58  TYPE(t_region) :: region
59 
60 ! ... loop variables
61  INTEGER :: i,ifc,ifcp,ipatch,j,k
62 
63 ! ... local variables
64  CHARACTER(CHRLEN) :: rcsidentstring
65 
66  INTEGER :: c1,c2,ic1l,ic1g,ic2l,ic2g,ncells,netmassfluxcntr
67  INTEGER, DIMENSION(:), POINTER :: f2fp
68  INTEGER, DIMENSION(:,:), POINTER :: fs,f2c
69  REAL(RFREAL) :: el,er,irl,irr,netmassflux,nm,nx,ny,nz,ql,qr,rl,rm,rr,vcont, &
70  ul,ur,vl,vr,wl,wr,pl,pr
71  REAL(RFREAL) :: fc(5),fl(3),fq(3),v1(3),v2(3)
72  REAL(RFREAL), DIMENSION(:,:), POINTER :: cv,dv,rhs,fn
73  REAL(RFREAL), DIMENSION(:,:,:,:), POINTER :: wtl
74  REAL(RFREAL), DIMENSION(:,:,:,:,:,:), POINTER :: wtq
75  TYPE(t_global), POINTER :: global
76 
77 !******************************************************************************
78 
79  rcsidentstring = '$RCSfile: RFLU_ConvFluxOLES.F90,v $ $Revision: 1.7 $'
80 
81  global => region%global
82 
83  CALL registerfunction(global,'RFLU_ConvFluxOLES',&
84  'RFLU_ConvFluxOLES.F90')
85 
86 ! get dimensions and pointers -------------------------------------------------
87 
88  cv => region%mixt%cv
89  dv => region%mixt%dv
90  rhs => region%mixt%rhs
91 
92  f2c => region%grid%f2c
93  fn => region%grid%fn
94 
95  fs => region%grid%fsOLES
96  f2fp => region%grid%f2fpOLES
97  wtl => region%grid%wtLinOLES
98  wtq => region%grid%wtQuadOLES
99 
100  netmassfluxcntr = 0
101  netmassflux = 0.0_rfreal
102 
103 ! stationary grid -------------------------------------------------------------
104 ! flux (except through boundary)
105 
106  ncells = SIZE(fs,1) ! Get size of optimal LES stencil
107 
108  DO ifc = 1,region%grid%nFaces
109  ifcp = f2fp(ifc) ! Get prototype face
110 
111  c1 = f2c(1,ifc)
112  c2 = f2c(2,ifc)
113 
114  nx = fn(xcoord,ifc)
115  ny = fn(ycoord,ifc)
116  nz = fn(zcoord,ifc)
117  nm = fn(xyzmag,ifc)
118 
119  rl = cv(cv_mixt_dens,c1)
120  irl = 1.0_rfreal/rl
121 
122  ul = cv(cv_mixt_xmom,c1)*irl
123  vl = cv(cv_mixt_ymom,c1)*irl
124  wl = cv(cv_mixt_zmom,c1)*irl
125  el = cv(cv_mixt_ener,c1)*irl
126  pl = dv(dv_mixt_pres,c1)
127 
128  ql = ul*nx + vl*ny + wl*nz
129 
130  rr = cv(cv_mixt_dens,c2)
131  irr = 1.0_rfreal/rr
132 
133  rm = 0.5_rfreal*(rl + rr)
134 
135  ur = cv(cv_mixt_xmom,c2)*irr
136  vr = cv(cv_mixt_ymom,c2)*irr
137  wr = cv(cv_mixt_zmom,c2)*irr
138  er = cv(cv_mixt_ener,c2)*irr
139  pr = dv(dv_mixt_pres,c2)
140 
141  qr = ur*nx + vr*ny + wr*nz
142 
143 ! - Fluxes: mass and energy
144 
145  fc(1) = 0.5_rfreal*(ql* rl + qr* rr )*nm
146  fc(5) = 0.5_rfreal*(ql*(rl*el + pl) + qr*(rr*er + pr))*nm
147 
148 ! - Fluxes: momenta
149 
150  fl(:) = 0.0_rfreal
151  fq(:) = 0.0_rfreal
152 
153  DO i = 1,3
154  DO ic1l = 1,ncells
155  ic1g = fs(ic1l,ifc)
156 
157  v1(1:3) = cv(cv_mixt_xmom:cv_mixt_zmom,ic1g)/cv(cv_mixt_dens,ic1g)
158 
159  DO j = 1,3
160  fl(i) = fl(i) + wtl(i,j,ic1l,ifcp)*v1(j)
161  END DO ! j
162 
163  DO ic2l = 1,ncells
164  ic2g = fs(ic2l,ifc)
165  v2(1:3) = cv(cv_mixt_xmom:cv_mixt_zmom,ic2g)/cv(cv_mixt_dens,ic2g)
166 
167  DO j = 1,3
168  DO k = 1,3
169  fq(i) = fq(i) + wtq(i,j,k,ic1l,ic2l,ifcp)*v1(j)*v2(k)
170  END DO ! k
171  END DO ! j
172 
173  END DO ! ic2l
174  END DO ! ic1l
175 
176  fl(i) = rm*fl(i)*nm
177  fq(i) = rm*fq(i)*nm*sign(1.0_rfreal,fn(ifcp,ifc))
178 
179  fc(i+1) = fl(i) + fq(i)
180  END DO ! i
181 
182 ! - Add pressure fluxes (simple central difference)
183 
184  fc(2) = fc(2) + 0.5_rfreal*(pl + pr)*nx*nm
185  fc(3) = fc(3) + 0.5_rfreal*(pl + pr)*ny*nm
186  fc(4) = fc(4) + 0.5_rfreal*(pl + pr)*nz*nm
187 
188 ! - Add/subtract from residual
189 
190  rhs(cv_mixt_dens,c1) = rhs(cv_mixt_dens,c1) + fc(1)
191  rhs(cv_mixt_xmom,c1) = rhs(cv_mixt_xmom,c1) + fc(2)
192  rhs(cv_mixt_ymom,c1) = rhs(cv_mixt_ymom,c1) + fc(3)
193  rhs(cv_mixt_zmom,c1) = rhs(cv_mixt_zmom,c1) + fc(4)
194  rhs(cv_mixt_ener,c1) = rhs(cv_mixt_ener,c1) + fc(5)
195 
196  rhs(cv_mixt_dens,c2) = rhs(cv_mixt_dens,c2) - fc(1)
197  rhs(cv_mixt_xmom,c2) = rhs(cv_mixt_xmom,c2) - fc(2)
198  rhs(cv_mixt_ymom,c2) = rhs(cv_mixt_ymom,c2) - fc(3)
199  rhs(cv_mixt_zmom,c2) = rhs(cv_mixt_zmom,c2) - fc(4)
200  rhs(cv_mixt_ener,c2) = rhs(cv_mixt_ener,c2) - fc(5)
201 
202 ! - Periodic boundary fluxes
203 
204  IF ( max(c1,c2) > region%grid%nCells ) THEN
205  netmassfluxcntr = netmassfluxcntr + 1
206  netmassflux = netmassflux + fc(1)
207  END IF ! MAX
208  END DO ! ifc
209 
210 ! finalize --------------------------------------------------------------------
211 
212  CALL deregisterfunction(global)
213 
214 END SUBROUTINE rflu_convfluxoles
215 
216 !******************************************************************************
217 !
218 ! RCS Revision history:
219 !
220 ! $Log: RFLU_ConvFluxOLES.F90,v $
221 ! Revision 1.7 2008/12/06 08:44:29 mtcampbe
222 ! Updated license.
223 !
224 ! Revision 1.6 2008/11/19 22:17:42 mtcampbe
225 ! Added Illinois Open Source License/Copyright
226 !
227 ! Revision 1.5 2003/06/04 22:52:30 haselbac
228 ! Removed unnecessary interface
229 !
230 ! Revision 1.4 2003/04/10 14:38:36 haselbac
231 ! Changed interface statement
232 !
233 ! Revision 1.3 2003/01/28 14:33:45 haselbac
234 ! Use parameters in fn
235 !
236 ! Revision 1.2 2002/09/09 15:46:05 haselbac
237 ! complete basic coding, global now under regions, several bug fixes
238 !
239 ! Revision 1.1 2002/07/25 14:18:28 haselbac
240 ! Initial revision
241 !
242 !******************************************************************************
243 
244 
245 
246 
247 
248 
249 
static SURF_BEGIN_NAMESPACE double sign(double x)
j indices k indices k
Definition: Indexing.h:6
NT rhs
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflu_convfluxoles(region)
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
subroutine deregisterfunction(global)
Definition: ModError.F90:469