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