Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TURB_floRansSACentFluxPatch.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 central convective fluxe of SA eq. through a patch
26 ! by using an average of variables.
27 !
28 ! Description: none.
29 !
30 ! Input: region = data of current region
31 ! patch = current patch.
32 !
33 ! Output: region%levels%turb%rhs = convective fluxes added to SA residual.
34 !
35 ! Notes: grid speeds already contain face area.
36 !
37 !******************************************************************************
38 !
39 ! $Id: TURB_floRansSACentFluxPatch.F90,v 1.7 2008/12/06 08:44:44 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2003 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE turb_floranssacentfluxpatch( region,patch )
46 
47  USE moddatatypes
48  USE modbndpatch, ONLY : t_patch
49  USE moddatastruct, ONLY : t_region
52  USE moderror
53  USE modparameters
55  IMPLICIT NONE
56 
57 #include "Indexing.h"
58 
59 ! ... parameters
60  TYPE(t_region) :: region
61  TYPE(t_patch) :: patch
62 
63 ! ... loop variables
64  INTEGER :: i, j, k, n1, n2
65 
66 ! ... local variables
67  INTEGER :: ilev, lbound, bctype, distrib, gasmodel, indcp, indmol
68  INTEGER :: ibeg, iend, jbeg, jend, kbeg, kend, idir, jdir, kdir, i2d, noff
69  INTEGER :: icoff, ijcoff, inoff, ijnoff, ijkcd, ijkcb0, ijkcb1, ijknb
70  INTEGER :: inode, jnode, knode, indsvel, acid0, acid1
71 
72  REAL(RFREAL) :: sgn, rhoa, rhoua, rhova, rhowa, rhoea, rhovrel(3)
73  REAL(RFREAL) :: rnutila, pa, mrate, tburn, ds, sf(3)
74  REAL(RFREAL) :: ua, va, wa, uinj, vinj, winj, vcont, sv, ac0, ac1
75  REAL(RFREAL), POINTER :: dv(:,:), gv(:,:), tcv(:,:), trhs(:,:)
76  REAL(RFREAL), POINTER :: avgco(:,:), sface(:,:), svel(:), vals(:,:)
77 
78 !******************************************************************************
79 
80  CALL registerfunction( region%global,'TURB_FloRansSACentFluxPatch',&
81  'TURB_floRansSACentFluxPatch.F90' )
82 
83 ! get dimensions and pointers -------------------------------------------------
84 
85  ilev = region%currLevel
86  lbound = patch%lbound
87 
88  CALL rflo_getpatchindices( region,patch,ilev,ibeg,iend,jbeg,jend,kbeg,kend )
90  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
91  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
92 
93  bctype = patch%bcType
94  noff = abs(patch%l1end-patch%l1beg) + 1
95  distrib = patch%mixt%distrib
96  gasmodel = region%mixtInput%gasModel
97  indcp = region%levels(ilev)%mixt%indCp
98  indmol = region%levels(ilev)%mixt%indMol
99  indsvel = region%levels(ilev)%grid%indSvel
100 
101  dv => region%levels(ilev)%mixt%dv
102  gv => region%levels(ilev)%mixt%gv
103  tcv => region%levels(ilev)%turb%cv
104  trhs => region%levels(ilev)%turb%rhs
105  vals => patch%mixt%vals
106 
107 ! to take the right face vector and make it point outwards
108 
109  sgn = +1._rfreal
110  inode = 0
111  jnode = 0
112  knode = 0
113  acid0 = 2
114  acid1 = 1
115  IF (lbound==2 .OR. lbound==4 .OR. lbound==6) THEN
116  sgn = -1._rfreal
117  inode = -idir
118  jnode = -jdir
119  knode = -kdir
120  acid0 = 1
121  acid1 = 2
122  ENDIF
123 
124 ! get the appropriate face vector and grid speed
125 
126  IF (lbound==1 .OR. lbound==2) THEN
127  avgco => region%levels(ilev)%grid%c2fCoI
128  sface => region%levels(ilev)%grid%si
129  svel => region%levels(ilev)%grid%siVel
130  ELSE IF (lbound==3 .OR. lbound==4) THEN
131  avgco => region%levels(ilev)%grid%c2fCoJ
132  sface => region%levels(ilev)%grid%sj
133  svel => region%levels(ilev)%grid%sjVel
134  ELSE IF (lbound==5 .OR. lbound==6) THEN
135  avgco => region%levels(ilev)%grid%c2fCoK
136  sface => region%levels(ilev)%grid%sk
137  svel => region%levels(ilev)%grid%skVel
138  ENDIF
139 
140 ! stationary grid -------------------------------------------------------------
141 
142  IF (bctype>=bc_slipwall .AND. bctype<=bc_slipwall+bc_range) THEN
143 
144  ELSE IF (bctype>=bc_noslipwall .AND. bctype<=bc_noslipwall+bc_range) THEN
145 
146  ELSE IF (bctype>=bc_symmetry .AND. bctype<=bc_symmetry+bc_range) THEN
147 
148  ELSE IF (bctype>=bc_injection .AND. bctype<=bc_injection+bc_range) THEN
149 
150 ! injection boundary (as wall if mass flow rate <= 0)
151 
152  DO k=kbeg,kend
153  DO j=jbeg,jend
154  DO i=ibeg,iend
155  ijkcb0 = indijk(i ,j ,k ,icoff,ijcoff) ! boundary
156  ijkcd = indijk(i-idir ,j-jdir ,k-kdir ,icoff,ijcoff) ! dummy
157  ijkcb1 = indijk(i+idir ,j+jdir ,k+kdir ,icoff,ijcoff) ! interior
158  ijknb = indijk(i+inode,j+jnode,k+knode,inoff,ijnoff)
159  ac0 = avgco(acid0,ijknb)
160  ac1 = avgco(acid1,ijknb)
161  sf(1) = sgn*sface(xcoord,ijknb)
162  sf(2) = sgn*sface(ycoord,ijknb)
163  sf(3) = sgn*sface(zcoord,ijknb)
164 
165  IF (lbound==1 .OR. lbound==2) THEN
166  n1 = j - jbeg
167  n2 = k - kbeg
168  ELSE IF (lbound==3 .OR. lbound==4) THEN
169  n1 = k - kbeg
170  n2 = i - ibeg
171  ELSE IF (lbound==5 .OR. lbound==6) THEN
172  n1 = i - ibeg
173  n2 = j - jbeg
174  ENDIF
175  i2d = distrib * indij(n1,n2,noff)
176  mrate = vals(bcdat_inject_mfrate,i2d)
177  tburn = vals(bcdat_inject_temp ,i2d)
178  rhovrel(1) = vals(bcdat_inject_rfvfu ,i2d)
179  rhovrel(2) = vals(bcdat_inject_rfvfv ,i2d)
180  rhovrel(3) = vals(bcdat_inject_rfvfw ,i2d)
181 
182  IF (mrate > 0._rfreal) THEN ! surface burning
183 ! rnutila = ac0*tcv(CV_SA_NUTIL,ijkCB0)+ &
184 ! ac1*tcv(CV_SA_NUTIL,ijkCD)
185  rnutila = 0.5_rfreal*(3._rfreal*tcv(cv_sa_nutil,ijkcb0)- &
186  tcv(cv_sa_nutil,ijkcb1))
187  ds = sqrt(sf(1)*sf(1)+sf(2)*sf(2)+sf(3)*sf(3))
188 
189  IF (gasmodel == gas_model_tcperf) THEN
190  CALL bcondinjectionperf( distrib,mrate,tburn,rhovrel, &
191  sf(1)/ds,sf(2)/ds,sf(3)/ds, &
192  gv(gv_mixt_cp ,ijkcb0*indcp ), &
193  gv(gv_mixt_mol ,ijkcb0*indmol), &
194  dv(dv_mixt_pres,ijkcb0 ), &
195  rhoa,rhoua,rhova,rhowa,rhoea,pa, &
196  uinj,vinj,winj )
197  ELSE
198  CALL errorstop( region%global,err_unknown_bc,__line__ )
199  ENDIF
200  vcont = uinj*sf(1) + vinj*sf(2) + winj*sf(3)
201 
202  ELSE ! not burning - slip/noslip wall
203  rnutila = 0._rfreal
204  vcont = 0._rfreal
205  ENDIF
206 
207  trhs(cv_sa_nutil,ijkcb0) = trhs(cv_sa_nutil,ijkcb0) + &
208  vcont*rnutila
209 
210  ENDDO ! i
211  ENDDO ! j
212  ENDDO ! k
213 
214 ! non-conforming region interface
215 
216  ELSE IF (bctype>=bc_regionint .AND. bctype<=bc_regionint +bc_range) THEN
217 
218  ELSE IF (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range) THEN
219 
220 ! everything else
221 
222  ELSE
223 
224  DO k=kbeg,kend
225  DO j=jbeg,jend
226  DO i=ibeg,iend
227  ijkcb0 = indijk(i ,j ,k ,icoff,ijcoff) ! boundary
228  ijkcd = indijk(i-idir ,j-jdir ,k-kdir ,icoff,ijcoff) ! dummy
229  ijknb = indijk(i+inode,j+jnode,k+knode,inoff,ijnoff)
230  ac0 = avgco(acid0,ijknb)
231  ac1 = avgco(acid1,ijknb)
232 
233  rnutila= ac0*tcv(cv_sa_nutil,ijkcb0)+ac1*tcv(cv_sa_nutil,ijkcd)
234  ua = ac0*dv(dv_mixt_uvel,ijkcb0)+ac1*dv(dv_mixt_uvel,ijkcd)
235  va = ac0*dv(dv_mixt_vvel,ijkcb0)+ac1*dv(dv_mixt_vvel,ijkcd)
236  wa = ac0*dv(dv_mixt_wvel,ijkcb0)+ac1*dv(dv_mixt_wvel,ijkcd)
237  sf(1) = sgn*sface(xcoord,ijknb)
238  sf(2) = sgn*sface(ycoord,ijknb)
239  sf(3) = sgn*sface(zcoord,ijknb)
240  sv = svel(ijknb*indsvel)
241  vcont = ua*sf(1)+va*sf(2)+wa*sf(3) - sv
242 
243  trhs(cv_sa_nutil,ijkcb0) = trhs(cv_sa_nutil,ijkcb0) + &
244  vcont*rnutila
245  ENDDO ! i
246  ENDDO ! j
247  ENDDO ! k
248 
249  ENDIF ! bcType
250 
251 ! finalize --------------------------------------------------------------------
252 
253  CALL deregisterfunction( region%global )
254 
255 END SUBROUTINE turb_floranssacentfluxpatch
256 
257 !******************************************************************************
258 !
259 ! RCS Revision history:
260 !
261 ! $Log: TURB_floRansSACentFluxPatch.F90,v $
262 ! Revision 1.7 2008/12/06 08:44:44 mtcampbe
263 ! Updated license.
264 !
265 ! Revision 1.6 2008/11/19 22:17:56 mtcampbe
266 ! Added Illinois Open Source License/Copyright
267 !
268 ! Revision 1.5 2006/08/19 15:40:49 mparmar
269 ! Renamed patch variables
270 !
271 ! Revision 1.4 2005/10/31 21:09:37 haselbac
272 ! Changed specModel and SPEC_MODEL_NONE
273 !
274 ! Revision 1.3 2004/08/02 21:55:11 wasistho
275 ! replaced cell2face midpoint by linear averaging
276 !
277 ! Revision 1.2 2004/03/12 02:55:36 wasistho
278 ! changed rocturb routine names
279 !
280 ! Revision 1.1 2004/03/08 23:35:46 wasistho
281 ! changed turb nomenclature
282 !
283 ! Revision 1.3 2003/10/21 22:08:47 wasistho
284 ! modified grid speed as it already contain face area
285 !
286 ! Revision 1.2 2003/10/20 20:27:40 wasistho
287 ! made consistent with compressible SA formulation
288 !
289 ! Revision 1.1 2003/10/07 02:17:03 wasistho
290 ! initial installation of RaNS-SA and DES
291 !
292 !
293 !******************************************************************************
294 
295 
296 
297 
298 
299 
300 
**********************************************************************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)
subroutine bcondinjectionperf(distrib, minj, tinj, rhoVrel, sxn, syn, szn, cpgas, mm, p, rhob, rhoub, rhovb, rhowb, rhoeb, pb, uinj, vinj, winj)
**********************************************************************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
subroutine turb_floranssacentfluxpatch(region, patch)
subroutine rflo_getpatchindices(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
double sqrt(double d)
Definition: double.h:73
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
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)
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
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
**********************************************************************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
**********************************************************************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