Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLO_ReadBcInjectAPNSection.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 APN injection 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_ReadBcInjectAPNSection.F90,v 1.5 2008/12/06 08:44:07 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2001 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE rflo_readbcinjectapnsection( 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(6)
64  CHARACTER(256) :: fname
65 
66  INTEGER :: brbeg, brend, prbeg, prend, distrib
67  INTEGER :: n1, n2, ioff, ijbeg, ijend, errorflag
68 
69  LOGICAL :: defined(6)
70 
71  REAL(RFREAL) :: vals(6)
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_ReadBcInjectAPNSection',&
81  'RFLO_ReadBcInjectAPNSection.F90' )
82 
83 ! specify keywords and search for them ----------------------------------------
84 
85  keys(1) = 'SDENS'
86  keys(2) = 'ACOEFF'
87  keys(3) = 'NPOWER'
88  keys(4) = 'TEMP'
89  keys(5) = 'EXTRAPOL'
90  keys(6) = 'MAXCHANGE'
91 
92  CALL readpatchsection( global,if_input,6,keys,vals,brbeg,brend, &
93  prbeg,prend,distrib,fname,defined )
94 
95 ! check if all values defined -------------------------------------------------
96 
97  IF (distrib==bcdat_constant .AND. &
98  (.NOT. (defined(1).eqv..true.) .OR. &
99  .NOT. (defined(2).eqv..true.) .OR. &
100  .NOT. (defined(3).eqv..true.) .OR. &
101  .NOT. (defined(4).eqv..true.))) CALL errorstop( global,err_bcval_missing,&
102  __line__ )
103 
104  IF (.NOT. (defined(5).eqv..true.) .OR. &
105  .NOT. (defined(6).eqv..true.)) CALL errorstop( global,err_bcval_missing,&
106  __line__ )
107 
108 ! copy values/distribution to variables ---------------------------------------
109 
110  DO ireg=brbeg,brend
111  DO ipatch=prbeg,min(prend,regions(ireg)%nPatches)
112 
113  patch => regions(ireg)%levels(1)%patches(ipatch)
114 
115  IF ((patch%bcType>=bc_injection .AND. &
116  patch%bcType<=bc_injection+bc_range) .AND. & ! my boundary type
117  regions(ireg)%procid==global%myProcid .AND. & ! region active and
118  regions(ireg)%active==active) THEN ! on my processor
119 
120  patch%bcType = bc_injection_apn
121 
122  IF (patch%mixt%bcSet.eqv..true.) &
123  CALL errorstop( global,err_patch_overspec,&
124  __line__,'Injection boundary.' )
125 
126  patch%mixt%nData = 8
127  patch%mixt%nSwitches = 1
128  patch%mixt%bcSet = .true.
129  IF (patch%bcCoupled == bc_external) THEN ! data from outside
130  patch%mixt%distrib = bcdat_distrib ! => always distribution
131  ELSE
132  patch%mixt%distrib = distrib
133  ENDIF
134 
135 ! ----- get value of switch
136 
137  ALLOCATE( patch%mixt%switches(patch%mixt%nSwitches), &
138  stat=errorflag )
139  global%error = errorflag
140  IF (global%error /= 0) CALL errorstop( global,err_allocate,&
141  __line__ )
142 
143  patch%mixt%switches(bcswi_inject_extrap) = extrapol_const
144  IF (vals(5) > 0.1) &
145  patch%mixt%switches(bcswi_inject_extrap) = extrapol_linear
146 
147  patch%mixt%maxChange = vals(6)
148 
149 ! ----- allocate memory for the values
150 
151  n1 = abs(patch%l1end-patch%l1beg)
152  n2 = abs(patch%l2end-patch%l2beg)
153  ioff = n1 + 1
154  ijbeg = indij( 0, 0,ioff)
155  ijend = indij(n1,n2,ioff)
156 
157  ALLOCATE( patch%mixt%vals(patch%mixt%nData,ijbeg:ijend), &
158  stat=errorflag )
159  global%error = errorflag
160  IF (global%error /= 0) CALL errorstop( global,err_allocate,&
161  __line__ )
162 
163 ! ----- distribution from file
164 
165  IF (patch%mixt%distrib==bcdat_distrib .AND. &
166  patch%bcCoupled /=bc_external ) THEN
167  patch%mixt%nData = 4
168  CALL rflo_readbcfromfile( global,fname,patch )
169  patch%mixt%nData = 8
170 
171 ! ----- distribution from external source / constant value
172 
173  ELSE
174  patch%mixt%vals(bcdat_inject_sdens ,:) = abs( vals(1) )
175  patch%mixt%vals(bcdat_inject_acoeff,:) = abs( vals(2) )
176  patch%mixt%vals(bcdat_inject_npower,:) = abs( vals(3) )
177  patch%mixt%vals(bcdat_inject_temp ,:) = abs( vals(4) )
178  ENDIF ! distribution?
179 
180 ! ----- patch%mixt%distrib for APN always non-constant for later use
181 
182  patch%mixt%distrib = bcdat_distrib
183 
184  ENDIF ! bcType, active region on my processor
185 
186  ENDDO ! iPatch
187  ENDDO ! iReg
188 
189 ! finalize --------------------------------------------------------------------
190 
191  CALL deregisterfunction( global )
192 
193 END SUBROUTINE rflo_readbcinjectapnsection
194 
195 !******************************************************************************
196 !
197 ! RCS Revision history:
198 !
199 ! $Log: RFLO_ReadBcInjectAPNSection.F90,v $
200 ! Revision 1.5 2008/12/06 08:44:07 mtcampbe
201 ! Updated license.
202 !
203 ! Revision 1.4 2008/11/19 22:17:20 mtcampbe
204 ! Added Illinois Open Source License/Copyright
205 !
206 ! Revision 1.3 2008/10/23 18:20:53 mtcampbe
207 ! Crazy number of changes to track and fix initialization and
208 ! restart bugs. Many improperly formed logical expressions
209 ! were fixed, and bug in allocation for data associated with
210 ! the BC_INFLOWVELTEMP boundary condition squashed in
211 ! RFLO_ReadBcInflowVelSection.F90.
212 !
213 ! Revision 1.2 2006/08/19 15:38:14 mparmar
214 ! Renamed patch variables
215 !
216 ! Revision 1.1 2006/01/20 06:17:54 wasistho
217 ! initial import
218 !
219 !
220 !******************************************************************************
221 
222 
223 
224 
225 
226 
227 
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 rflo_readbcinjectapnsection(regions)
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