Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_ReadBcOutflowSection.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 outflow boundary condition.
26 !
27 ! Description: none.
28 !
29 ! Input: boundary condition file.
30 !
31 ! Output: regions = BC data.
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: RFLO_ReadBcOutflowSection.F90,v 1.7 2008/12/06 08:44:07 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2001 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE rflo_readbcoutflowsection( regions )
44 
45  USE moddatatypes
46  USE modbndpatch, ONLY : t_patch
47  USE moddatastruct, ONLY : t_region
48  USE modglobal, ONLY : t_global
50  USE moderror
51  USE modparameters
52  IMPLICIT NONE
53 
54 #include "Indexing.h"
55 
56 ! ... parameters
57  TYPE(t_region), POINTER :: regions(:)
58 
59 ! ... loop variables
60  INTEGER :: ireg, ipatch
61 
62 ! ... local variables
63  CHARACTER(10) :: keys(4)
64  CHARACTER(256) :: fname
65 
66  INTEGER :: brbeg, brend, prbeg, prend, distrib, switch
67  INTEGER :: n1, n2, ioff, ijbeg, ijend, errorflag
68 
69  LOGICAL :: defined(4)
70 
71  REAL(RFREAL) :: vals(4)
72 
73  TYPE(t_patch), POINTER :: patch
74  TYPE(t_global), POINTER :: global
75 
76 !******************************************************************************
77 
78  global => regions(1)%global
79 
80  CALL registerfunction( global,'RFLO_ReadBcOutflowSection',&
81  'RFLO_ReadBcOutflowSection.F90' )
82 
83 ! specify keywords and search for them ----------------------------------------
84 
85  keys(1) = 'TYPE'
86  keys(2) = 'PRESS'
87  keys(3) = 'MODEL'
88  keys(4) = 'NRCOEF'
89 
90  CALL readpatchsection( global,if_input,4,keys,vals,brbeg,brend, &
91  prbeg,prend,distrib,fname,defined )
92 
93 ! get switches & check if all necessary values defined ------------------------
94 
95  DO ireg=brbeg,brend
96  DO ipatch=prbeg,min(prend,regions(ireg)%nPatches)
97 
98  patch => regions(ireg)%levels(1)%patches(ipatch)
99 
100  IF ((patch%bcType>=bc_outflow .AND. &
101  patch%bcType<=bc_outflow+bc_range) .AND. & ! my boundary type,
102  regions(ireg)%procid==global%myProcid .AND. & ! region active and
103  regions(ireg)%active==active) THEN ! on my processor
104 
105  IF (patch%mixt%bcSet .eqv. .true.) &
106  CALL errorstop( global,err_patch_overspec,&
107  __line__,'Outflow boundary.' )
108 
109  patch%mixt%nData = 0
110  patch%mixt%nSwitches = 2
111  IF (patch%bcCoupled == bc_external) THEN ! data from outside
112  patch%mixt%distrib = bcdat_distrib ! => always distribution
113  ELSE
114  patch%mixt%distrib = distrib
115  ENDIF
116 
117  ALLOCATE( patch%mixt%switches(patch%mixt%nSwitches), &
118  stat=errorflag )
119  global%error = errorflag
120  IF (global%error /= 0) CALL errorstop( global,err_allocate,&
121  __line__ )
122 
123 ! ----- check if switch defined
124  IF (defined(1).eqv..true.) THEN
125  patch%mixt%switches(bcswi_outflow_type) = bcopt_subsonic
126  IF (vals(1) < 0.1) &
127  patch%mixt%switches(bcswi_outflow_type) = bcopt_supersonic
128  IF (vals(1) > 1.9) &
129  patch%mixt%switches(bcswi_outflow_type) = bcopt_mixed
130  ELSE
131  CALL errorstop( global,err_no_bcswitch,&
132  __line__,'(outflow type).' )
133  ENDIF
134 
135  IF (defined(3).eqv..true.) THEN
136  IF (vals(3) < 0.1) &
137  patch%mixt%switches(bcswi_outflow_model) = bcopt_default
138  IF (vals(3) > 0.1) &
139  patch%mixt%switches(bcswi_outflow_model) = bcopt_model1
140  ELSE
141  patch%mixt%switches(bcswi_outflow_model) = bcopt_default
142  ENDIF
143 
144 ! ----- check if appropriate values specified
145  IF (patch%mixt%switches(bcswi_outflow_type) /= bcopt_supersonic) THEN
146  IF (patch%mixt%distrib==bcdat_constant .AND. &
147  .NOT. (defined(2).eqv..true.)) CALL errorstop( global,err_bcval_missing,&
148  __line__ )
149  ENDIF
150 
151  IF (patch%mixt%switches(bcswi_outflow_model) == bcopt_model1) THEN
152  IF (.NOT. (defined(4).eqv..true.)) CALL errorstop( global,err_bcval_missing, &
153  __line__,'BC_OUTFLOW: specify NRCOEF for model 1' )
154  ENDIF
155 
156 ! ----- set flag to BC specified
157  patch%mixt%bcSet = .true.
158 
159  ENDIF ! my BC & processor, active
160  ENDDO
161  ENDDO
162 
163 ! copy values/distribution to variables ---------------------------------------
164 
165  DO ireg=brbeg,brend
166  DO ipatch=prbeg,min(prend,regions(ireg)%nPatches)
167 
168  patch => regions(ireg)%levels(1)%patches(ipatch)
169 
170  IF ((patch%bcType>=bc_outflow .AND. &
171  patch%bcType<=bc_outflow+bc_range) .AND. & ! my boundary type,
172  regions(ireg)%procid==global%myProcid .AND. & ! region active and
173  regions(ireg)%active==active) THEN ! on my processor
174  switch = patch%mixt%switches(bcswi_outflow_type)
175  ELSE
176  switch = bcopt_supersonic
177  ENDIF
178 
179  IF ((patch%bcType>=bc_outflow .AND. &
180  patch%bcType<=bc_outflow+bc_range) .AND. & ! my boundary type,
181  switch/=bcopt_supersonic .AND. & ! p required
182  regions(ireg)%procid==global%myProcid .AND. & ! region active and
183  regions(ireg)%active==active) THEN ! on my processor
184 
185 ! ----- allocate memory for the values
186 
187  IF (patch%mixt%switches(bcswi_outflow_model) == bcopt_model1) THEN
188  patch%mixt%nData = 2
189  ELSE
190  patch%mixt%nData = 1
191  ENDIF
192 
193  IF (patch%mixt%distrib == bcdat_distrib) THEN
194  n1 = abs(patch%l1end-patch%l1beg)
195  n2 = abs(patch%l2end-patch%l2beg)
196  ioff = n1 + 1
197  ijbeg = indij( 0, 0,ioff)
198  ijend = indij(n1,n2,ioff)
199  ELSE
200  ijbeg = 0
201  ijend = 1
202  ENDIF
203  ALLOCATE( patch%mixt%vals(patch%mixt%nData,ijbeg:ijend), &
204  stat=errorflag )
205  global%error = errorflag
206  IF (global%error /= 0) CALL errorstop( global,err_allocate,&
207  __line__ )
208 
209 ! ----- distribution from file
210 
211  IF (patch%mixt%distrib==bcdat_distrib .AND. &
212  patch%bcCoupled /=bc_external ) THEN
213  CALL rflo_readbcfromfile( global,fname,patch )
214 
215 ! ----- distribution from external source / constant value
216 
217  ELSE
218  patch%mixt%vals(bcdat_outflow_press,:) = vals(2)
219  ENDIF ! distribution?
220 
221  IF (patch%mixt%switches(bcswi_outflow_model) == bcopt_model1) THEN
222  IF (vals(4) < 0._rfreal) CALL errorstop( global,err_illegal_value, &
223  __line__,'BC_OUTFLOW: NRCOEF cannot be negative' )
224  patch%mixt%vals(bcdat_outflow_nrcoef,:) = vals(4)
225  ENDIF
226 
227  ENDIF ! bcType, p req., active region on my processor
228 
229  ENDDO ! iPatch
230  ENDDO ! iReg
231 
232 ! finalize --------------------------------------------------------------------
233 
234  CALL deregisterfunction( global )
235 
236 END SUBROUTINE rflo_readbcoutflowsection
237 
238 !******************************************************************************
239 !
240 ! RCS Revision history:
241 !
242 ! $Log: RFLO_ReadBcOutflowSection.F90,v $
243 ! Revision 1.7 2008/12/06 08:44:07 mtcampbe
244 ! Updated license.
245 !
246 ! Revision 1.6 2008/11/19 22:17:20 mtcampbe
247 ! Added Illinois Open Source License/Copyright
248 !
249 ! Revision 1.5 2008/10/23 18:20:53 mtcampbe
250 ! Crazy number of changes to track and fix initialization and
251 ! restart bugs. Many improperly formed logical expressions
252 ! were fixed, and bug in allocation for data associated with
253 ! the BC_INFLOWVELTEMP boundary condition squashed in
254 ! RFLO_ReadBcInflowVelSection.F90.
255 !
256 ! Revision 1.4 2006/08/19 15:38:19 mparmar
257 ! Renamed patch variables
258 !
259 ! Revision 1.3 2005/05/13 08:07:15 wasistho
260 ! added additional check for NRCOEF value
261 !
262 ! Revision 1.2 2005/05/13 06:07:28 wasistho
263 ! added more input options
264 !
265 ! Revision 1.1 2004/11/29 21:25:16 wasistho
266 ! lower to upper case
267 !
268 ! Revision 1.7 2003/11/20 16:40:34 mdbrandy
269 ! Backing out RocfluidMP changes from 11-17-03
270 !
271 ! Revision 1.4 2003/05/15 02:57:01 jblazek
272 ! Inlined index function.
273 !
274 ! Revision 1.3 2003/02/11 22:30:21 jferry
275 ! Re-worked BC and TBC input routines to add multi-physics capability
276 !
277 ! Revision 1.2 2003/01/10 17:58:43 jblazek
278 ! Added missing explicit interfaces.
279 !
280 ! Revision 1.1 2002/10/19 00:40:30 jblazek
281 ! Added utility (rflosurf) to write out surface grids for GenX.
282 !
283 ! Revision 1.13 2002/10/12 03:20:50 jblazek
284 ! Replaced [io]stat=global%error with local errorFlag for Rocflo.
285 !
286 ! Revision 1.12 2002/09/27 00:57:10 jblazek
287 ! Changed makefiles - no makelinks needed.
288 !
289 ! Revision 1.11 2002/09/20 22:22:36 jblazek
290 ! Finalized integration into GenX.
291 !
292 ! Revision 1.10 2002/09/17 13:43:00 jferry
293 ! Added Time-dependent boundary conditions
294 !
295 ! Revision 1.9 2002/09/05 17:40:22 jblazek
296 ! Variable global moved into regions().
297 !
298 ! Revision 1.8 2002/06/22 01:13:38 jblazek
299 ! Modified interfaces to BC routines.
300 !
301 ! Revision 1.7 2002/03/30 00:50:49 jblazek
302 ! Cleaned up with flint.
303 !
304 ! Revision 1.6 2002/02/21 23:25:06 jblazek
305 ! Blocks renamed as regions.
306 !
307 ! Revision 1.5 2002/02/09 01:47:01 jblazek
308 ! Added multi-probe option, residual smoothing, physical time step.
309 !
310 ! Revision 1.4 2002/01/31 20:56:30 jblazek
311 ! Added basic boundary conditions.
312 !
313 ! Revision 1.3 2002/01/11 17:20:19 jblazek
314 ! Added time stamp or iteration number to file names.
315 !
316 ! Revision 1.2 2001/12/22 00:09:39 jblazek
317 ! Added routines to store grid and solution.
318 !
319 ! Revision 1.1 2001/12/08 00:18:42 jblazek
320 ! Added routines to read BC input file.
321 !
322 !******************************************************************************
323 
324 
325 
326 
327 
328 
329 
subroutine rflo_readbcoutflowsection(regions)
subroutine rflo_readbcfromfile(global, fname, patch)
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 errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469