Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_RFLU_InjectionDriver.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: main injection driver specific to RFLU
26 ! for the multiphase injection algorithm.
27 !
28 ! Description: none.
29 !
30 ! Input:
31 ! pRegion Pointer to region data
32 !
33 ! Output:
34 ! pPlag Plag values for cv, aiv, arv of current region.
35 ! pTilePlag Tile values for cv, dv of current region.
36 !
37 ! Notes: none.
38 !
39 ! ******************************************************************************
40 !
41 ! $Id: PLAG_RFLU_InjectionDriver.F90,v 1.14 2008/12/06 08:44:35 mtcampbe Exp $
42 !
43 ! Copyright: (c) 2004-2005 by the University of Illinois
44 !
45 ! ******************************************************************************
46 
47 SUBROUTINE plag_rflu_injectiondriver(pRegion)
48 
49  USE moddatatypes
51  USE modbndpatch, ONLY : t_patch
52  USE moddatastruct, ONLY : t_region
53  USE modglobal, ONLY : t_global
54  USE modgrid, ONLY : t_grid
55  USE moderror
56  USE modparameters
57 
61 
62  IMPLICIT NONE
63 
64 ! ******************************************************************************
65 ! Definitions and declarations
66 ! ******************************************************************************
67 
68 ! ==============================================================================
69 ! Arguments
70 ! ==============================================================================
71 
72  TYPE(t_region), POINTER :: pregion
73 
74 ! ==============================================================================
75 ! Locals
76 ! ==============================================================================
77 
78  CHARACTER(CHRLEN) :: rcsidentstring
79 
80  INTEGER :: bctype,burnstat,ejecmodel,icg,ifc,injcdiamdist,ipatch,&
81  itile,iv1,iv2,iv3,iv4,nextidnumber,normdirflag,npatches,nvert
82  INTEGER :: ifileplagtile
83  INTEGER, POINTER, DIMENSION(:) :: bf2c,pcvtilemass
84  INTEGER, POINTER, DIMENSION(:,:) :: bf2v
85 
86  REAL(RFREAL) :: cellheight,injcbeta,pi,volmeanpart
87  REAL(RFREAL) :: injcbetafac,injcbetafacinv,meansuperparticlevolume,spload
88 
89  REAL(RFREAL), DIMENSION(3,4) :: xyzvertex
90 
91  REAL(RFREAL), POINTER, DIMENSION(:) :: pvol
92  REAL(RFREAL), POINTER, DIMENSION(:,:) :: fc,fn,pxyz
93 
94  REAL(RFREAL), POINTER, DIMENSION(:,:) :: pcvtile,pdvtile
95 
96  TYPE(t_grid), POINTER :: pgrid
97  TYPE(t_global), POINTER :: global
98  TYPE(t_patch), POINTER :: ppatch
99  TYPE(t_plag), POINTER :: pplag
100  TYPE(t_tile_plag), POINTER :: ptileplag
101 
102 ! ******************************************************************************
103 ! Start
104 ! ******************************************************************************
105 
106  rcsidentstring = '$RCSfile: PLAG_RFLU_InjectionDriver.F90,v $ $Revision: 1.14 $'
107 
108  global => pregion%global
109 
110  CALL registerfunction( global, 'PLAG_RFLU_InjectionDriver',&
111  'PLAG_RFLU_InjectionDriver.F90' )
112 
113 ! ******************************************************************************
114 ! Set pointers and variables
115 ! ******************************************************************************
116 
117  pgrid => pregion%grid
118  pplag => pregion%plag
119 
120  npatches = pgrid%nPatches
121 
122  pi = global%pi
123  normdirflag = -1
124 
125  injcdiamdist = pregion%plagInput%injcDiamDist
126  injcbeta = pregion%plagInput%injcBeta
127  volmeanpart = pi/6.0_rfreal * pregion%plagInput%injcDiamMean**3
128  ejecmodel = pregion%plagInput%ejecModel
129  spload = pregion%plagInput%spLoad
130 
131  IF ( ejecmodel == plag_ejec_cre ) THEN
132  meansuperparticlevolume = volmeanpart *spload
133 
134  injcbetafac = 2.0_rfreal *injcbeta *meansuperparticlevolume**2
135  injcbetafacinv = 1.0_rfreal/injcbetafac
136  ENDIF ! ejecModel
137 
138  pxyz => pgrid%xyz
139 
140  pvol => pgrid%vol
141 
142 ! ******************************************************************************
143 ! Initial burning status of particles
144 ! ******************************************************************************
145 
146 ! Currently all particles start off burning if the burning interaction is used
147 
148  IF (pregion%inrtInput%inrts(inrt_type_burning)%used) THEN
149  burnstat = inrt_burnstat_on
150  ELSE
151  burnstat = inrt_burnstat_off
152  ENDIF
153 
154 ! ******************************************************************************
155 ! Loop over patches
156 ! ******************************************************************************
157 
158  DO ipatch=1,npatches
159 
160  ppatch => pregion%patches(ipatch)
161 
162  bctype = ppatch%bcType
163 
164  bf2c => ppatch%bf2c
165  bf2v => ppatch%bf2v
166 
167  fc => ppatch%fc
168  fn => ppatch%fn
169 
170 !===============================================================================
171 ! Select injection boundary condition
172 !===============================================================================
173 
174  IF ( (bctype >= bc_injection .AND. bctype <= bc_injection + bc_range) .OR. &
175  (bctype >= bc_inflow .AND. bctype <= bc_inflow + bc_range) ) THEN
176 
177 !-------------------------------------------------------------------------------
178 ! Set tile pointers
179 !-------------------------------------------------------------------------------
180 
181  ptileplag => ppatch%tilePlag
182 
183  pcvtile => ptileplag%cv
184  pcvtilemass => ptileplag%cvTileMass
185  pdvtile => ptileplag%dv
186 
187 !-------------------------------------------------------------------------------
188 ! Loop over face patches
189 !-------------------------------------------------------------------------------
190 
191  DO ifc = 1, ppatch%nBFaces
192  itile = ifc
193  icg = bf2c(ifc)
194 
195 !-------------------------------------------------------------------------------
196 ! Set cell height, element type and vertex coordinates
197 !-------------------------------------------------------------------------------
198 
199  cellheight = pvol(icg)/fn(xyzmag,ifc)
200 
201  iv1 = ppatch%bv(bf2v(1,ifc))
202  iv2 = ppatch%bv(bf2v(2,ifc))
203  iv3 = ppatch%bv(bf2v(3,ifc))
204 
205  xyzvertex(xcoord:zcoord,1) = pxyz(xcoord:zcoord,iv1)
206  xyzvertex(xcoord:zcoord,2) = pxyz(xcoord:zcoord,iv2)
207  xyzvertex(xcoord:zcoord,3) = pxyz(xcoord:zcoord,iv3)
208 
209  IF ( bf2v(4,ifc) == vert_none ) THEN
210  nvert = 3
211  iv4 = vert_none
212  xyzvertex(xcoord:zcoord,4) = 0.0_rfreal
213  ELSE
214  nvert = 4
215  iv4 = ppatch%bv(bf2v(4,ifc))
216  xyzvertex(xcoord:zcoord,4) = pxyz(xcoord:zcoord,iv4)
217  ENDIF ! iv4
218 
219 !-------------------------------------------------------------------------------
220 ! Invoke injection algorithm
221 !-------------------------------------------------------------------------------
222 
223  SELECT CASE(ejecmodel)
224 
225 !------------------------------------------------------------------------------
226 ! Ejection Model 1
227 !------------------------------------------------------------------------------
228 
229  CASE(plag_ejec_model1)
230  CALL plag_invokeejecmodel1( pregion,pplag,ptileplag, &
231  itile,icg,burnstat,nvert, &
232  normdirflag,xyzvertex,volmeanpart, &
233  fn(xcoord:zcoord,ifc), &
234  fc(xcoord:zcoord,ifc), &
235  cellheight )
236 
237 !------------------------------------------------------------------------------
238 ! Conservative Random Ejection (CRE) Model
239 !------------------------------------------------------------------------------
240 
241  CASE(plag_ejec_cre)
242  CALL plag_invokeconsrandejec( pregion,pplag,ptileplag, &
243  itile,icg,burnstat,nvert, &
244  normdirflag,xyzvertex,volmeanpart, &
245  fn(xcoord:zcoord,ifc), &
246  fc(xcoord:zcoord,ifc), &
247  cellheight )
248 
249 !------------------------------------------------------------------------------
250 ! Default case: trap error
251 !------------------------------------------------------------------------------
252 
253  CASE default
254  CALL errorstop( global,err_reached_default,__line__ )
255  END SELECT ! ejecModel
256  END DO ! ifc
257 
258 !-------------------------------------------------------------------------------
259 ! Reset injected particle size
260 !-------------------------------------------------------------------------------
261 
262  ptileplag%nPclsInjc(:) = 0
263 
264  END IF ! bcType
265  END DO ! iPatch
266 
267 ! ******************************************************************************
268 ! End
269 ! ******************************************************************************
270 
271  CALL deregisterfunction( global )
272 
273 END SUBROUTINE plag_rflu_injectiondriver
274 
275 ! ******************************************************************************
276 !
277 ! RCS Revision history:
278 !
279 ! $Log: PLAG_RFLU_InjectionDriver.F90,v $
280 ! Revision 1.14 2008/12/06 08:44:35 mtcampbe
281 ! Updated license.
282 !
283 ! Revision 1.13 2008/11/19 22:17:48 mtcampbe
284 ! Added Illinois Open Source License/Copyright
285 !
286 ! Revision 1.12 2006/09/18 20:36:20 fnajjar
287 ! Activated tile datastructure for inflow bc
288 !
289 ! Revision 1.11 2006/04/07 15:19:24 haselbac
290 ! Removed tabs
291 !
292 ! Revision 1.10 2005/12/24 21:38:51 haselbac
293 ! Cosmetics only
294 !
295 ! Revision 1.9 2004/08/17 21:00:11 fnajjar
296 ! Moved iv4 into IF statement for proper programming definition
297 !
298 ! Revision 1.8 2004/08/15 20:36:41 fnajjar
299 ! Bug fix for nVert, need to use bf2v instead of iv4
300 !
301 ! Revision 1.7 2004/07/12 15:52:39 fnajjar
302 ! Included interface and routine for conservative random ejection model
303 !
304 ! Revision 1.6 2004/07/12 14:42:24 fnajjar
305 ! Created proper interface to prepare for CRE ejection model
306 !
307 ! Revision 1.5 2004/06/16 23:02:24 fnajjar
308 ! Renamed variables for CRE kernel
309 !
310 ! Revision 1.4 2004/05/21 23:28:45 fnajjar
311 ! Bug fix for iv to properly access global face-to-vertex mapping and made io-cleanup
312 !
313 ! Revision 1.3 2004/03/26 21:28:59 fnajjar
314 ! Added aiv status flag at injection and properly activated burn status
315 !
316 ! Revision 1.2 2004/03/25 21:16:06 jferry
317 ! made initial BurnStatus depend on whether burning interaction is used
318 !
319 ! Revision 1.1 2004/03/08 22:36:08 fnajjar
320 ! Initial import of RFLU-specific injection routines
321 !
322 ! ******************************************************************************
323 
324 
325 
326 
327 
328 
329 
subroutine, public plag_invokeejecmodel1(pRegion, pPlag, pTilePlag, iTile, icg, burnStat, nVert, normDirFlag, xyzVertex, volMeanPart, fn, fc, cellHeight)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine plag_rflu_injectiondriver(pRegion)
static const double pi
Definition: smooth_medial.C:43
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine, public plag_invokeconsrandejec(pRegion, pPlag, pTilePlag, iTile, icg, burnStat, nVert, normDirFlag, xyzVertex, volMeanPart, fn, fc, cellHeight)
IndexType nvert() const
Definition: Mesh.H:565