Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_InjcTileInitialize.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: initialize the tiles for the multiphase injection algorithm.
26 !
27 ! Description: none.
28 !
29 ! Input: region = current region
30 !
31 ! Output: regions(iReg)%levels%patch%tile = initial tile values
32 ! of current region.
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: PLAG_InjcTileInitialize.F90,v 1.4 2008/12/06 08:44:34 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2002 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE plag_injctileinitialize( region )
45 
46  USE moddatatypes
48  USE modbndpatch, ONLY : t_patch
49  USE moddatastruct, ONLY : t_region
50  USE modglobal, ONLY : t_global
51  USE modrandom, ONLY : rand1uniform
52 #ifdef RFLO
55 #endif
57  USE moderror
58  USE modparameters
59  USE modmpi
61  IMPLICIT NONE
62 
63 ! ... parameters
64  TYPE(t_region) :: region
65 
66 ! ... loop variables
67  INTEGER :: ipatch, itile
68 
69 ! ... local variables
70  CHARACTER(CHRLEN) :: rcsidentstring
71 
72  INTEGER :: bctype, npatches, ntiles
73 #ifdef RFLO
74  INTEGER :: ilev, n1, n2
75 #endif
76  INTEGER :: injcdiamdist
77  INTEGER :: ncv, ndv
78  INTEGER :: ejecmodel,icont,ncont
79 
80  REAL(RFREAL) :: randunif
81  REAL(RFREAL) :: poolvolumeinit, ratiophidensinv
82  REAL(RFREAL), POINTER, DIMENSION(:) :: injcmassfluxratio, densplag
83 
84  TYPE(t_patch), POINTER :: ppatch
85  TYPE(t_tile_plag), POINTER :: ptileplag
86  TYPE(t_global), POINTER :: global
87 
88 !******************************************************************************
89 
90  rcsidentstring = '$RCSfile: PLAG_InjcTileInitialize.F90,v $ $Revision: 1.4 $'
91 
92  global => region%global
93 
94  CALL registerfunction( global, 'PLAG_InjcTileInitialize',&
95  'PLAG_InjcTileInitialize.F90' )
96 
97  IF ( global%myProcid == masterproc .AND. &
98  global%verbLevel > verbose_none ) THEN
99  WRITE(stdout,'(A,3X,A)') solver_name,'Initializing tile memory for PLAG...'
100  END IF ! global%verbLevel
101 
102 ! Get dimensions --------------------------------------------------------------
103 
104 #ifdef RFLO
105  ilev = region%currLevel
106  npatches = region%nPatches
107 #endif
108 #ifdef RFLU
109  npatches = region%grid%nPatches
110 #endif
111 
112  ncont = region%plagInput%nCont
113  injcdiamdist = region%plagInput%injcDiamDist
114  ejecmodel = region%plagInput%ejecModel
115 
116  injcmassfluxratio => region%plagInput%injcMassFluxRatio
117  densplag => region%plagInput%dens
118 
119 ! Loop over patches -----------------------------------------------------------
120 
121  DO ipatch=1,npatches
122 
123 #ifdef RFLO
124  ppatch => region%levels(ilev)%patches(ipatch)
125 #endif
126 #ifdef RFLU
127  ppatch => region%patches(ipatch)
128 #endif
129 
130  bctype = ppatch%bcType
131 
132 ! - Select injection boundary condition ---------------------------------------
133 
134  IF (bctype>=bc_injection .AND. bctype<=bc_injection+bc_range) THEN
135 
136 ! - Get dimensions -----------------------------------------------------------
137 
138 #ifdef RFLO
139  n1 = abs(ppatch%l1end -ppatch%l1beg ) + 1
140  n2 = abs(ppatch%l2end -ppatch%l2beg ) + 1
141  ntiles = n1*n2
142 #endif
143 #ifdef RFLU
144  ntiles = ppatch%nBFaces
145 #endif
146 
147  ptileplag => ppatch%tilePlag
148 
149  ncv = ptileplag%nCv
150  ndv = ptileplag%nDv
151 
152  ptileplag%nPclsInjc(:ntiles) = 0
153 
154  ptileplag%cv(:ncv,:ntiles) = 0.0_rfreal
155  ptileplag%dv(:ndv,:ntiles) = 0.0_rfreal
156 
157  ptileplag%rhs(:ncv,:ntiles) = 0.0_rfreal
158 
159  ptileplag%cvOld(:ncv,:ntiles) = 0.0_rfreal
160  ptileplag%rhsSum(:ncv,:ntiles) = 0.0_rfreal
161 
162 ! --- Loop over tile patch ----------------------------------------------------
163 
164  DO itile = 1, ntiles
165 
166  CALL plag_injcmakeparticle(region, injcdiamdist, &
167  ptileplag%dv(dv_tile_diam,itile), &
168  ptileplag%dv(dv_tile_spload,itile) )
169 
170  randunif = rand1uniform(region%randData)
171 
172 ! ---- Avoid error if randUnif is 0 -------------------------------------------
173 ! ---- and set timefactor such that EXP(-50) = 1.9E-22 ------------------------
174 
175  IF ( randunif <= 0.0_rfreal) THEN
176  ptileplag%dv(dv_tile_countdown,itile) = 50.0_rfreal
177  ELSE
178  ptileplag%dv(dv_tile_countdown,itile) = -log(randunif)
179  END IF ! randUnif
180 
181 ! ---- Set initial pool volume
182 
183  IF ( ejecmodel == plag_ejec_cre ) THEN
184  poolvolumeinit = 0.0_rfreal
185  ratiophidensinv = poolvolumeinit &
186  *1.0_rfreal/sum(injcmassfluxratio(:)/densplag(:))
187 
188  DO icont = 1, ncont
189  ptileplag%cv(ptileplag%cvTileMass(icont),itile) = poolvolumeinit &
190  * injcmassfluxratio(icont)
191  END DO ! iCont
192  ENDIF ! ejecModel
193  END DO ! iTile
194 
195  ENDIF ! bcType
196 
197  ENDDO ! iPatch
198 
199 ! finalize --------------------------------------------------------------------
200 
201  CALL deregisterfunction( global )
202 
203 END SUBROUTINE plag_injctileinitialize
204 
205 !******************************************************************************
206 !
207 ! RCS Revision history:
208 !
209 ! $Log: PLAG_InjcTileInitialize.F90,v $
210 ! Revision 1.4 2008/12/06 08:44:34 mtcampbe
211 ! Updated license.
212 !
213 ! Revision 1.3 2008/11/19 22:17:46 mtcampbe
214 ! Added Illinois Open Source License/Copyright
215 !
216 ! Revision 1.2 2006/04/07 15:19:23 haselbac
217 ! Removed tabs
218 !
219 ! Revision 1.1 2004/12/01 20:57:45 fnajjar
220 ! Initial revision after changing case
221 !
222 ! Revision 1.8 2004/06/30 15:43:27 fnajjar
223 ! Added initialization step for CRE model
224 !
225 ! Revision 1.7 2004/06/16 23:06:33 fnajjar
226 ! Renamed variabled for CRE kernel
227 !
228 ! Revision 1.6 2004/03/03 00:30:52 fnajjar
229 ! Incorrect ifdef construct for RFLU pPatch pointer
230 !
231 ! Revision 1.5 2003/11/26 22:00:28 fnajjar
232 ! Removed improper comment symbol after USE ModRandom
233 !
234 ! Revision 1.4 2003/11/21 22:35:51 fnajjar
235 ! Update Random Number Generator
236 !
237 ! Revision 1.3 2003/05/15 02:57:05 jblazek
238 ! Inlined index function.
239 !
240 ! Revision 1.2 2003/01/16 20:15:11 f-najjar
241 ! Removed iRegionGlobal
242 !
243 ! Revision 1.1 2002/10/25 14:16:31 f-najjar
244 ! Initial Import of Rocpart
245 !
246 !******************************************************************************
247 
248 
249 
250 
251 
252 
253 
Tfloat sum() const
Return the sum of all the pixel values in an image.
Definition: CImg.h:13022
subroutine rflo_getpatchdirection(patch, idir, jdir, kdir)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_getpatchindices(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
subroutine plag_injcmakeparticle(region, injcDiamDist, diam, spLoad)
REAL(RFREAL) function rand1uniform(rdata)
Definition: ModRandom.F90:345
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
subroutine plag_injctileinitialize(region)
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
subroutine deregisterfunction(global)
Definition: ModError.F90:469