Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_InitPatchData.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 patch data for Rocpart.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Pointer to region
31 !
32 ! Output: None.
33 !
34 ! Notes:
35 ! 1. Only treat injection boundaries right now.
36 ! 2. Avoid error if randUnif is 0, and set timefactor such that
37 ! EXP(-50) = 1.9E-22
38 !
39 !******************************************************************************
40 !
41 ! $Id: PLAG_InitPatchData.F90,v 1.7 2009/03/02 00:19:36 mtcampbe Exp $
42 !
43 ! Copyright: (c) 2004 by the University of Illinois
44 !
45 !******************************************************************************
46 
47 SUBROUTINE plag_initpatchdata(pRegion)
48 
49  USE moddatatypes
50  USE modpartlag, ONLY: t_tile_plag
51  USE modbndpatch, ONLY: t_patch
52  USE moddatastruct, ONLY: t_region
53  USE modglobal, ONLY: t_global
54  USE modrandom, ONLY: rand1uniform
55  USE moderror
56  USE modparameters
57  USE modmpi
58 
60 
62 
63  IMPLICIT NONE
64 
65 ! ******************************************************************************
66 ! Declarations and definitions
67 ! ******************************************************************************
68 
69 ! ==============================================================================
70 ! Arguments
71 ! ==============================================================================
72 
73  TYPE(t_region), POINTER :: pregion
74 
75 ! ==============================================================================
76 ! Local variables
77 ! ==============================================================================
78 
79  CHARACTER(CHRLEN) :: rcsidentstring
80  INTEGER :: injcdiamdist,ipatch,itile,npatches,ntiles
81 #ifdef RFLO
82  INTEGER :: ilev,n1,n2
83 #endif
84  REAL(RFREAL) :: randunif
85  TYPE(t_patch), POINTER :: ppatch
86  TYPE(t_tile_plag), POINTER :: ptileplag
87  TYPE(t_global), POINTER :: global
88 
89 ! ******************************************************************************
90 ! Start
91 ! ******************************************************************************
92 
93  rcsidentstring = '$RCSfile: PLAG_InitPatchData.F90,v $ $Revision: 1.7 $'
94 
95  global => pregion%global
96 
97  CALL registerfunction(global,'PLAG_InitPatchData',&
98  'PLAG_InitPatchData.F90')
99 
100 #ifdef RFLO
101  ilev = pregion%currLevel
102  npatches = pregion%nPatches
103 #endif
104 #ifdef RFLU
105  npatches = pregion%grid%nPatches
106 #endif
107 
108  injcdiamdist = pregion%plagInput%injcDiamDist
109 
110 ! ******************************************************************************
111 ! Loop over patches
112 ! ******************************************************************************
113 
114  DO ipatch=1,npatches
115 #ifdef RFLO
116  ppatch => pregion%levels(ilev)%patches(ipatch)
117 #endif
118 #ifdef RFLU
119  ppatch => pregion%patches(ipatch)
120 #endif
121 
122 ! ==============================================================================
123 ! Select patch type
124 ! ==============================================================================
125 
126  SELECT CASE ( ppatch%bcType )
127 
128 ! ------------------------------------------------------------------------------
129 ! Injection boundary
130 ! ------------------------------------------------------------------------------
131 
132 #ifdef RFLU
133  CASE ( bc_injection:bc_injection+bc_range, &
134  bc_inflow:bc_inflow+bc_range )
135 #else
136  CASE ( bc_injection:bc_injection+bc_range )
137 #endif
138 ! ----- Get dimensions ---------------------------------------------------------
139 
140 #ifdef RFLO
141  n1 = abs(ppatch%l1end-ppatch%l1beg) + 1
142  n2 = abs(ppatch%l2end-ppatch%l2beg) + 1
143  ntiles = n1*n2
144 #endif
145 #ifdef RFLU
146  ntiles = ppatch%nBFaces
147 #endif
148 
149  ptileplag => ppatch%tilePlag
150 
151 
152 ! ----- Loop over tiles --------------------------------------------------------
153 
154  DO itile = 1,ntiles
155  CALL plag_injcmakeparticle(pregion,injcdiamdist, &
156  ptileplag%dv(dv_tile_diam,itile), &
157  ptileplag%dv(dv_tile_spload,itile))
158 
159  randunif = rand1uniform(pregion%randData)
160 
161  IF ( randunif <= 0.0_rfreal ) THEN
162  ptileplag%dv(dv_tile_countdown,itile) = 50.0_rfreal
163  ELSE
164  ptileplag%dv(dv_tile_countdown,itile) = -log(randunif)
165  END IF ! randUnif
166  END DO ! iTile
167  END SELECT ! pPatch%bcType
168  END DO ! iPatch
169 
170 ! ******************************************************************************
171 ! End
172 ! ******************************************************************************
173 
174  CALL deregisterfunction(global)
175 
176 END SUBROUTINE plag_initpatchdata
177 
178 !******************************************************************************
179 !
180 ! RCS Revision history:
181 !
182 ! $Log: PLAG_InitPatchData.F90,v $
183 ! Revision 1.7 2009/03/02 00:19:36 mtcampbe
184 ! Added some ifdefs around Rocflo to disable particle injection on INFLOW
185 ! boundaries and added some checks around MPI tags utilizing a new global
186 ! data item, global%mpiTagMax.
187 !
188 ! Revision 1.6 2008/12/06 08:44:33 mtcampbe
189 ! Updated license.
190 !
191 ! Revision 1.5 2008/11/19 22:17:46 mtcampbe
192 ! Added Illinois Open Source License/Copyright
193 !
194 ! Revision 1.4 2006/09/18 20:29:07 fnajjar
195 ! Activated tile infrastructure for inflow bc
196 !
197 ! Revision 1.3 2006/04/07 15:19:23 haselbac
198 ! Removed tabs
199 !
200 ! Revision 1.2 2004/06/16 22:58:13 fnajjar
201 ! Renamed injcModel to injcDiamDist and dv(TIMEFCTR) to dv(COUNTDOWN) for CRE kernel
202 !
203 ! Revision 1.1 2004/03/05 23:15:54 haselbac
204 ! Initial revision
205 !
206 !******************************************************************************
207 
208 
209 
210 
211 
212 
213 
subroutine plag_initpatchdata(pRegion)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine plag_injcmakeparticle(region, injcDiamDist, diam, spLoad)
REAL(RFREAL) function rand1uniform(rdata)
Definition: ModRandom.F90:345
subroutine deregisterfunction(global)
Definition: ModError.F90:469