Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PEUL_ReadBcInjectSection.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: read in user input related to inflow boundary condition for
26 ! Eulerian particles
27 !
28 ! Description: none.
29 !
30 ! Input: boundary condition file.
31 !
32 ! Output: regions = BC data.
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: PEUL_ReadBcInjectSection.F90,v 1.4 2008/12/06 08:44:39 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2002 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE peul_readbcinjectsection( regions )
45 
46  USE moddatatypes
47  USE modbndpatch, ONLY : t_patch
48  USE moddatastruct, ONLY : t_region
49  USE modglobal, ONLY : t_global
50  USE moderror
51  USE modparameters
53 
56  IMPLICIT NONE
57 
58 #include "Indexing.h"
59 
60 ! ... parameters
61  TYPE(t_region), POINTER :: regions(:)
62 
63 ! ... loop variables
64  INTEGER :: ireg, ipatch, ipt
65 
66 ! ... local variables
67  INTEGER, PARAMETER :: nkeys_max = 20
68  INTEGER, PARAMETER :: npeul_keys = 10
69 
70  CHARACTER(CHRLEN) :: rcsidentstring
71  CHARACTER(10) :: keys(nkeys_max)
72  CHARACTER(256) :: fname
73 
74  INTEGER :: nkeys, brbeg, brend, prbeg, prend, distrib
75  INTEGER :: n1, n2, ioff, ijbeg, ijend, errorflag
76  INTEGER :: ikeyfrac,ikeyfrac0
77 
78  LOGICAL :: defined(nkeys_max), alldef
79 
80  REAL(RFREAL) :: vals(nkeys_max)
81 
82  TYPE(t_patch), POINTER :: patch
83  TYPE(t_global), POINTER :: global
84 
85 !******************************************************************************
86 
87  rcsidentstring = &
88  '$RCSfile: PEUL_ReadBcInjectSection.F90,v $ $Revision: 1.4 $'
89 
90  global => regions(1)%global
91 
92  CALL registerfunction( global,'PEUL_ReadBcInjectSection',&
93  'PEUL_ReadBcInjectSection.F90' )
94 
95 ! begin -----------------------------------------------------------------------
96 
97 ! define keys
98 
99  ikeyfrac = 1
100  ikeyfrac0 = ikeyfrac
101 
102  keys(ikeyfrac) = 'FRAC_'
103  CALL makenumberedkeys(keys,ikeyfrac0+1,'FRAC',1,npeul_keys,1)
104 
105  nkeys = ikeyfrac0 + npeul_keys
106 
107  IF (nkeys > nkeys_max) CALL errorstop( global,err_exceeds_decl_mem,__line__ )
108 
109 ! Read smoke BC section from BC input file
110 
111  CALL readpatchsection( global,if_input,nkeys,keys,vals,brbeg,brend, &
112  prbeg,prend,distrib,fname,defined )
113 
114 ! check if all necessary values defined ---------------------------------------
115 
116  DO ireg=brbeg,brend
117 
118  IF (regions(ireg)%peulInput%nPtypes > npeul_keys) &
119  CALL errorstop( global,err_exceeds_decl_mem,__line__ )
120 
121  DO ipatch=prbeg,min(prend,regions(ireg)%nPatches)
122 
123  patch => regions(ireg)%levels(1)%patches(ipatch)
124 
125  IF ((patch%bcType>=bc_injection .AND. &
126  patch%bcType<=bc_injection+bc_range) .AND. & ! my boundary type,
127  regions(ireg)%procid==global%myProcid .AND. & ! region active and
128  regions(ireg)%active==active) THEN ! on my processor
129 
130  IF (patch%peul%bcSet) &
131  CALL errorstop( global,err_patch_overspec,__line__, &
132  'PEUL Injection boundary.' )
133 
134 ! IF (patch%bcCoupled == BC_EXTERNAL) THEN ! data from outside
135 ! patch%peul%distrib = BCDAT_DISTRIB ! => always distribution
136 ! CALL ErrorStop( global,ERR_PEUL_EXTERNAL,__LINE__ )
137 ! ELSE
138 ! patch%peul%distrib = distrib
139 ! END IF ! bcCoupled
140  patch%peul%distrib = distrib
141 
142 ! ----- check if appropriate values specified
143  IF ( patch%peul%distrib == bcdat_constant ) THEN
144  IF (.NOT. defined(ikeyfrac)) THEN
145  alldef = .true.
146  DO ipt = 1, regions(ireg)%peulInput%nPtypes
147  alldef = alldef .AND. defined(ikeyfrac0+ipt)
148  END DO ! ipt
149  IF (.NOT. alldef) CALL errorstop(global,err_bcval_missing,__line__)
150  END IF
151  ELSE
152  CALL errorstop( global,err_peul_distrib,__line__ )
153  END IF
154 
155 ! ----- check if extra values specified
156 
157  DO ipt = 1, npeul_keys
158  IF (defined(ikeyfrac0+ipt)) THEN
159  IF (ipt > regions(ireg)%peulInput%nPtypes) THEN
160  CALL errorstop(global,err_peul_bcval_extra,__line__)
161  END IF ! ipt
162  END IF ! defined
163  END DO ! ipt
164 
165 ! ----- set flag to BC specified
166  patch%peul%bcSet = .true.
167 
168  END IF ! my BC & processor, active
169 
170  END DO ! iPatch
171  END DO ! iReg
172 
173 ! copy values/distribution to variables ---------------------------------------
174 
175  DO ireg=brbeg,brend
176 
177  DO ipatch=prbeg,min(prend,regions(ireg)%nPatches)
178 
179  patch => regions(ireg)%levels(1)%patches(ipatch)
180 
181  IF ((patch%bcType>=bc_injection .AND. &
182  patch%bcType<=bc_injection+bc_range) .AND. & ! my boundary type,
183  regions(ireg)%procid==global%myProcid .AND. & ! region active and
184  regions(ireg)%active==active) THEN ! on my processor
185 
186  patch%peul%nData = regions(ireg)%peulInput%nPtypes
187 
188 ! ----- allocate memory for the values
189 
190  IF (patch%peul%distrib == bcdat_distrib) THEN
191  n1 = abs(patch%l1end-patch%l1beg)
192  n2 = abs(patch%l2end-patch%l2beg)
193  ioff = n1 + 1
194  ijbeg = indij( 0, 0,ioff)
195  ijend = indij(n1,n2,ioff)
196  ELSE
197  ijbeg = 0
198  ijend = 1
199  END IF
200 
201  nullify(patch%peul%vals)
202  IF (patch%peul%nData > 0) THEN
203  ALLOCATE( patch%peul%vals(patch%peul%nData,ijbeg:ijend), &
204  stat=errorflag )
205  global%error = errorflag
206  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
207  END IF
208 
209 ! ----- distribution from file
210 
211  IF (patch%peul%distrib==bcdat_distrib .AND. &
212  patch%bcCoupled /=bc_external ) THEN
213 
214  CALL errorstop( global,err_peul_distrib,__line__ )
215 
216 ! ----- distribution from external source / constant value
217 
218  ELSE
219 
220  IF (ASSOCIATED(patch%peul%vals)) THEN
221  IF (defined(ikeyfrac)) patch%peul%vals(:,:) = vals(ikeyfrac)
222  DO ipt = 1, patch%peul%nData
223  IF (defined(ikeyfrac0+ipt)) patch%peul%vals(ipt,:) = &
224  vals(ikeyfrac0+ipt)
225  END DO ! ipt
226  END IF
227 
228  END IF ! distribution?
229 
230  END IF ! bcType, active region on my processor
231 
232  END DO ! iPatch
233  END DO ! iReg
234 
235 ! finalize --------------------------------------------------------------------
236 
237  CALL deregisterfunction( global )
238 
239 END SUBROUTINE peul_readbcinjectsection
240 
241 !******************************************************************************
242 !
243 ! RCS Revision history:
244 !
245 ! $Log: PEUL_ReadBcInjectSection.F90,v $
246 ! Revision 1.4 2008/12/06 08:44:39 mtcampbe
247 ! Updated license.
248 !
249 ! Revision 1.3 2008/11/19 22:17:51 mtcampbe
250 ! Added Illinois Open Source License/Copyright
251 !
252 ! Revision 1.2 2006/08/19 15:40:24 mparmar
253 ! Renamed patch variables
254 !
255 ! Revision 1.1 2004/12/01 21:09:42 haselbac
256 ! Initial revision after changing case
257 !
258 ! Revision 1.10 2004/03/05 22:09:04 jferry
259 ! created global variables for peul, plag, and inrt use
260 !
261 ! Revision 1.9 2004/03/02 21:45:12 jferry
262 ! Added check on number of keys
263 !
264 ! Revision 1.8 2003/11/21 23:20:03 jferry
265 ! Turned off error trap for BC_EXTERNAL
266 !
267 ! Revision 1.7 2003/09/19 20:34:44 jferry
268 ! Added underscore character to default keys to make key set prefix-free
269 !
270 ! Revision 1.6 2003/05/15 02:57:05 jblazek
271 ! Inlined index function.
272 !
273 ! Revision 1.5 2003/04/09 22:51:45 jferry
274 ! removed peul_save and peul_verify structures
275 !
276 ! Revision 1.4 2003/03/24 23:30:53 jferry
277 ! overhauled rocinteract to allow interaction design to use user input
278 !
279 ! Revision 1.3 2003/03/04 19:26:47 jferry
280 ! Cleaned up routines that read sections of input files
281 !
282 ! Revision 1.2 2003/02/12 23:34:48 jferry
283 ! Replaced [io]stat=global%error with local errorFlag
284 !
285 ! Revision 1.1 2003/02/11 22:52:51 jferry
286 ! Initial import of Rocsmoke
287 !
288 !******************************************************************************
289 
290 
291 
292 
293 
294 
295 
subroutine makenumberedkeys(keys, indBegin, string, numBegin, numEnd, numSkip)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_getpatchindices(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
**********************************************************************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 brbeg
subroutine readpatchsection(global, fileID, nvals, keys, vals, brbeg, brend, prbeg, prend, distrib, profType, fname, defined)
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 USE ModDataTypes USE prend
subroutine peul_readbcinjectsection(regions)
**********************************************************************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 USE ModDataTypes USE prbeg
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469