Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PEUL_CentralFluxPatch.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 fluxes for smoke 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%peul%rhs = convective fluxes added to the residual.
34 !
35 ! Notes: none.
36 !
37 !******************************************************************************
38 !
39 ! $Id: PEUL_CentralFluxPatch.F90,v 1.5 2008/12/06 08:44:39 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2002 by the University of Illinois
42 !
43 !******************************************************************************
44 
45 SUBROUTINE peul_centralfluxpatch( region,patch )
46 
47  USE moddatatypes
48  USE modbndpatch, ONLY : t_patch
49  USE moddatastruct, ONLY : t_region
50  USE modglobal, ONLY : t_global
51  USE moderror
52  USE modparameters
55 
58  IMPLICIT NONE
59 
60 #include "Indexing.h"
61 
62 ! ... parameters
63  TYPE(t_region), INTENT(INOUT) :: region
64  TYPE(t_patch), INTENT(IN) :: patch
65 
66 ! ... loop variables
67  INTEGER :: i,j,k,ipt
68 
69 ! ... local variables
70  CHARACTER(CHRLEN) :: rcsidentstring
71 
72  INTEGER :: ilev,lobound,bctype,nptypes,n1,n2
73  INTEGER :: ibeg,iend,jbeg,jend,kbeg,kend,idir,jdir,kdir,noff
74  INTEGER :: icoff,ijcoff,inoff,ijnoff,ijkcd,ijkcb0,ijknb
75  INTEGER :: inode,jnode,knode,indcp,indmol
76  INTEGER :: mixtdistrib,peuldistrib,mixti2d,peuli2d,gasmodel
77 
78  REAL(RFREAL) :: grhoa,grhoua,grhova,grhowa,grhoea
79  REAL(RFREAL) :: sgn,sf(3),ds,vcont,mrate
80  REAL(RFREAL) :: tburn,rhovrel(3),pa,uinj,vinj,winj,vf
81  REAL(RFREAL), POINTER :: scv(:,:),gcv(:,:),gdv(:,:),ggv(:,:)
82  REAL(RFREAL), POINTER :: srhs(:,:)
83  REAL(RFREAL), POINTER :: sface(:,:),mixtvals(:,:),peulvals(:,:)
84 
85  TYPE(t_global), POINTER :: global
86 
87 !******************************************************************************
88 
89  rcsidentstring = '$RCSfile: PEUL_CentralFluxPatch.F90,v $ $Revision: 1.5 $'
90 
91  global => region%global
92 
93  CALL registerfunction( global,'PEUL_CentralFluxPatch',&
94  'PEUL_CentralFluxPatch.F90' )
95 
96 ! begin -----------------------------------------------------------------------
97 
98 ! get dimensions and pointers -------------------------------------------------
99 
100  ilev = region%currLevel
101  lobound = patch%lbound
102 
103  CALL rflo_getpatchindices( region,patch,ilev,ibeg,iend,jbeg,jend,kbeg,kend )
105  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
106  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
107 
108  bctype = patch%bcType
109  noff = abs(patch%l1end-patch%l1beg) + 1
110  mixtdistrib = patch%mixt%distrib
111  peuldistrib = patch%peul%distrib
112  indcp = region%levels(ilev)%mixt%indCp
113  indmol = region%levels(ilev)%mixt%indMol
114  gasmodel = region%mixtInput%gasModel
115 
116  gcv => region%levels(ilev)%mixt%cv
117  gdv => region%levels(ilev)%mixt%dv
118  ggv => region%levels(ilev)%mixt%gv
119  scv => region%levels(ilev)%peul%cv
120  srhs => region%levels(ilev)%peul%rhs
121 
122  nptypes = region%peulInput%nPtypes
123  IF (region%levels(ilev)%peul%nCv /= nptypes) &
124  CALL errorstop( global,err_peul_npmismatch,__line__ )
125 
126  mixtvals => patch%mixt%vals
127 
128  nullify(peulvals)
129  IF (ASSOCIATED(patch%peul%vals)) THEN
130  peulvals => patch%peul%vals
131  IF (lbound(peulvals,1) /= 1 .OR. ubound(peulvals,1) /= nptypes) &
132  CALL errorstop( global,err_peul_npmismatch,__line__ )
133  ENDIF
134 
135 ! to take the right face vector and make it point outwards
136 
137  sgn = +1._rfreal
138  inode = 0
139  jnode = 0
140  knode = 0
141  IF (lobound==2 .OR. lobound==4 .OR. lobound==6) THEN
142  sgn = -1._rfreal
143  inode = -idir
144  jnode = -jdir
145  knode = -kdir
146  ENDIF
147 
148 ! get the appropriate face vector and grid speed
149 
150  SELECT CASE (lobound)
151  CASE (1:2)
152  sface => region%levels(ilev)%grid%si
153  CASE (3:4)
154  sface => region%levels(ilev)%grid%sj
155  CASE (5:6)
156  sface => region%levels(ilev)%grid%sk
157  END SELECT
158 
159 ! stationary grid -------------------------------------------------------------
160 
161  SELECT CASE(bctype)
162 
163 ! no mass flux for these cases
164 
165  CASE (bc_slipwall :bc_slipwall +bc_range, &
166  bc_noslipwall:bc_noslipwall+bc_range, &
167  bc_symmetry :bc_symmetry +bc_range)
168 
169 ! injection boundary (no mass flux if mass flow rate <= 0)
170 
171  CASE (bc_injection:bc_injection+bc_range)
172 
173  DO k=kbeg,kend
174  DO j=jbeg,jend
175  DO i=ibeg,iend
176 
177  SELECT CASE (lobound)
178 
179  CASE (1:2)
180  n1 = j - jbeg
181  n2 = k - kbeg
182  CASE (3:4)
183  n1 = k - kbeg
184  n2 = i - ibeg
185  CASE (5:6)
186  n1 = i - ibeg
187  n2 = j - jbeg
188 
189  END SELECT ! lobound
190 
191  mixti2d = mixtdistrib * indij(n1,n2,noff)
192  mrate = mixtvals(bcdat_inject_mfrate,mixti2d)
193 
194 ! ------- only need to augment source terms when there is a mass flux
195 ! ------- (in contrast to gas case, where there is always a pressure term)
196 
197  IF (mrate > 0._rfreal) THEN
198 
199  peuli2d = peuldistrib * indij(n1,n2,noff)
200  ijkcb0 = indijk(i,j,k,icoff,ijcoff)
201  ijkcd = indijk(i-idir ,j-jdir ,k-kdir ,icoff,ijcoff)
202  ijknb = indijk(i+inode,j+jnode,k+knode,inoff,ijnoff)
203 
204  sf(1) = sgn*sface(xcoord,ijknb)
205  sf(2) = sgn*sface(ycoord,ijknb)
206  sf(3) = sgn*sface(zcoord,ijknb)
207 
208  tburn = mixtvals(bcdat_inject_temp ,mixti2d)
209  rhovrel(1) = mixtvals(bcdat_inject_rfvfu ,mixti2d)
210  rhovrel(2) = mixtvals(bcdat_inject_rfvfv ,mixti2d)
211  rhovrel(3) = mixtvals(bcdat_inject_rfvfw ,mixti2d)
212 
213  ds = sqrt(sf(1)*sf(1)+sf(2)*sf(2)+sf(3)*sf(3))
214  IF (gasmodel == gas_model_tcperf) THEN
215  CALL bcondinjectionperf( mixtdistrib,mrate,tburn,rhovrel, &
216  sf(1)/ds,sf(2)/ds,sf(3)/ds, &
217  ggv(gv_mixt_cp ,ijkcb0*indcp ), &
218  ggv(gv_mixt_mol ,ijkcb0*indmol), &
219  gdv(dv_mixt_pres,ijkcb0 ), &
220  grhoa,grhoua,grhova,grhowa,grhoea, &
221  pa,uinj,vinj,winj )
222  ELSE
223  CALL errorstop( region%global,err_unknown_bc,__line__ )
224  ENDIF ! gasModel
225 
226  vcont = uinj*sf(1) + vinj*sf(2) + winj*sf(3)
227 
228  DO ipt=1,nptypes
229  vf = vcont*peulvals(ipt,peuli2d) ! i.e., vf = vcont*sRhoa/gRhoa
230  srhs(ipt,ijkcb0) = srhs(ipt,ijkcb0) + vf*grhoa
231  END DO ! ipt
232 
233  END IF ! mRate
234  ENDDO ! i
235  ENDDO ! j
236  ENDDO ! k
237 
238 ! do not know how to handle these yet
239 
240  CASE (bc_regionint :bc_regionint +bc_range)
241 
242  CASE (bc_regnonconf:bc_regnonconf+bc_range)
243 
244 ! everything else
245 
246  CASE default
247 
248  DO k=kbeg,kend
249  DO j=jbeg,jend
250  DO i=ibeg,iend
251  ijkcb0 = indijk(i ,j ,k ,icoff,ijcoff) ! boundary
252  ijkcd = indijk(i-idir ,j-jdir ,k-kdir ,icoff,ijcoff) ! dummy
253  ijknb = indijk(i+inode,j+jnode,k+knode,inoff,ijnoff)
254 
255  grhoa = 0.5_rfreal*(gcv(cv_mixt_dens,ijkcb0) + &
256  gcv(cv_mixt_dens,ijkcd))
257  grhoua = 0.5_rfreal*(gcv(cv_mixt_xmom,ijkcb0) + &
258  gcv(cv_mixt_xmom,ijkcd))
259  grhova = 0.5_rfreal*(gcv(cv_mixt_ymom,ijkcb0) + &
260  gcv(cv_mixt_ymom,ijkcd))
261  grhowa = 0.5_rfreal*(gcv(cv_mixt_zmom,ijkcb0) + &
262  gcv(cv_mixt_zmom,ijkcd))
263 
264  sf(1) = sgn*sface(xcoord,ijknb)
265  sf(2) = sgn*sface(ycoord,ijknb)
266  sf(3) = sgn*sface(zcoord,ijknb)
267 
268  vcont = (grhoua*sf(1)+grhova*sf(2)+grhowa*sf(3))/grhoa
269 
270  DO ipt=1,nptypes
271  srhs(ipt,ijkcb0) = srhs(ipt,ijkcb0) + &
272  0.5_rfreal*vcont*(scv(ipt,ijkcb0)+scv(ipt,ijkcd))
273  END DO ! ipt
274 
275  ENDDO ! i
276  ENDDO ! j
277  ENDDO ! k
278 
279  END SELECT ! bcType
280 
281 ! moving grid (add grid speeds) -----------------------------------------------
282 
283  IF (region%mixtInput%moveGrid) THEN
284  CALL errorstop( global,err_peul_movegrid,__line__ )
285  ENDIF ! moveGrid
286 
287 ! finalize --------------------------------------------------------------------
288 
289  CALL deregisterfunction( global )
290 
291 END SUBROUTINE peul_centralfluxpatch
292 
293 !******************************************************************************
294 !
295 ! RCS Revision history:
296 !
297 ! $Log: PEUL_CentralFluxPatch.F90,v $
298 ! Revision 1.5 2008/12/06 08:44:39 mtcampbe
299 ! Updated license.
300 !
301 ! Revision 1.4 2008/11/19 22:17:51 mtcampbe
302 ! Added Illinois Open Source License/Copyright
303 !
304 ! Revision 1.3 2006/08/19 15:40:20 mparmar
305 ! Renamed patch variables
306 !
307 ! Revision 1.2 2005/10/31 21:09:37 haselbac
308 ! Changed specModel and SPEC_MODEL_NONE
309 !
310 ! Revision 1.1 2004/12/01 21:09:27 haselbac
311 ! Initial revision after changing case
312 !
313 ! Revision 1.8 2004/07/28 15:42:13 jferry
314 ! deleted defunct constructs: useDetangle, useSmokeDrag, useSmokeHeatTransfer
315 !
316 ! Revision 1.7 2004/03/05 22:09:04 jferry
317 ! created global variables for peul, plag, and inrt use
318 !
319 ! Revision 1.6 2003/09/25 15:42:57 jferry
320 ! Added mixture source terms due to active smoke (for Detangle interaction)
321 !
322 ! Revision 1.5 2003/05/15 02:57:05 jblazek
323 ! Inlined index function.
324 !
325 ! Revision 1.4 2003/05/05 17:26:57 jferry
326 ! fixed bug in setting n1, n2
327 !
328 ! Revision 1.3 2003/04/09 15:11:31 jferry
329 ! removed dependence on temporary storage structures
330 !
331 ! Revision 1.2 2003/04/07 18:29:01 jferry
332 ! added inflow boundary condition and initialization to a constant
333 !
334 ! Revision 1.1 2003/02/11 22:52:50 jferry
335 ! Initial import of Rocsmoke
336 !
337 !******************************************************************************
338 
339 
340 
341 
342 
343 
344 
**********************************************************************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 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)
subroutine peul_centralfluxpatch(region, patch)
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