Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
INRT_ReadInputFile.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 for INRT information (done on all processors).
26 !
27 ! Description: none.
28 !
29 ! Input: user input file.
30 !
31 ! Output: regions = INRT information
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: INRT_ReadInputFile.F90,v 1.3 2008/12/06 08:44:32 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2003 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE inrt_readinputfile( regions )
44 
45  USE moddatatypes
46  USE moddatastruct, ONLY : t_region
47  USE modglobal, ONLY : t_global
48  USE moderror
49  USE modparameters
50 
54  IMPLICIT NONE
55 
56 ! ... parameters
57  TYPE(t_region), POINTER :: regions(:)
58 
59 ! ... loop variables
60  INTEGER :: iread,ireg
61 
62 ! ... local variables
63  CHARACTER(CHRLEN) :: rcsidentstring
64  CHARACTER(CHRLEN+4) :: fname
65  CHARACTER(256) :: line
66 
67  LOGICAL :: usedsomewhere, unusedsomewhere
68 
69  INTEGER :: errorflag
70 
71  TYPE(t_global), POINTER :: global
72 
73 !******************************************************************************
74 
75  rcsidentstring = '$RCSfile: INRT_ReadInputFile.F90,v $ $Revision: 1.3 $'
76 
77  global => regions(1)%global
78 
79  CALL registerfunction( global,'INRT_ReadInputFile',&
80  'INRT_ReadInputFile.F90' )
81 
82 ! begin -----------------------------------------------------------------------
83 
84  fname = trim(global%inDir)//trim(global%casename)//'.inp'
85 
86  DO iread = 1,2
87 
88 ! - open file
89 
90  OPEN(if_input,file=fname,form='formatted',status='old',iostat=errorflag)
91  global%error = errorflag
92  IF (global%error /= 0) &
93  CALL errorstop( global,err_file_open,__line__,'File: '//trim(fname) )
94 
95 ! - read file looking for keywords
96 
97  SELECT CASE (iread)
98 
99  CASE (1) ! on first pass, look for INRT_DEFAULT sections
100 
101  DO
102  READ(if_input,'(A256)',err=10,end=86) line
103 
104  SELECT CASE(trim(line))
105 
106  CASE ('# INRT_DEFAULT')
107  CALL inrt_readdefaultsection( regions )
108 
109  END SELECT ! line
110  END DO
111 
112 86 CONTINUE
113 
114  CASE (2) ! on second pass, look for all other INRT sections
115 
116  DO
117  READ(if_input,'(A256)',err=10,end=87) line
118 
119  SELECT CASE(trim(line))
120 
121  CASE ('# INRT_DRAG')
122  CALL inrt_readdrag( regions )
123 
124  CASE ('# INRT_HEAT_TRANSFER_NONBURN')
125  CALL inrt_readheattransfernonburn( regions )
126 
127  CASE ('# INRT_SCOURING')
128  CALL inrt_readscouring( regions )
129 
130  CASE ('# INRT_BURNING')
131  CALL inrt_readburning( regions )
132 
133  CASE ('# INRT_BOILING_REGULATION')
134  CALL inrt_readboilingregulation( regions )
135 
136  END SELECT ! line
137  END DO
138 
139 87 CONTINUE
140 
141  CASE default
142  CALL errorstop( global,err_reached_default,__line__ )
143 
144  END SELECT ! iRead
145 
146 ! - close file ----------------------------------------------------------------
147 
148  CLOSE(if_input,iostat=errorflag)
149  global%error = errorflag
150  IF (global%error /= 0) &
151  CALL errorstop( global,err_file_close,__line__,'File: '//trim(fname) )
152 
153  END DO ! iRead
154 
155 ! set global%inrtUsed -------------------------------------------------------
156 
157  usedsomewhere = .false.
158  unusedsomewhere = .false.
159 
160  DO ireg = lbound(regions,1),ubound(regions,1)
161  usedsomewhere = usedsomewhere .OR. &
162  regions(ireg)%inrtInput%defaultRead
163  unusedsomewhere = unusedsomewhere .OR. &
164  .NOT.regions(ireg)%inrtInput%defaultRead
165  END DO ! iReg
166 
167  IF (usedsomewhere.AND.unusedsomewhere) THEN
168  CALL errorstop( global,err_mp_allornone,__line__ )
169  END IF ! usedSomewhere.AND.unusedSomewhere
170 
171  global%inrtUsed = usedsomewhere
172 
173 ! finalization & error handling -----------------------------------------------
174 
175  CALL deregisterfunction( global )
176  goto 999
177 
178 10 CONTINUE
179  CALL errorstop( global,err_file_read,__line__,'File: '//trim(fname) )
180 
181 999 CONTINUE
182 
183 END SUBROUTINE inrt_readinputfile
184 
185 !******************************************************************************
186 !
187 ! RCS Revision history:
188 !
189 ! $Log: INRT_ReadInputFile.F90,v $
190 ! Revision 1.3 2008/12/06 08:44:32 mtcampbe
191 ! Updated license.
192 !
193 ! Revision 1.2 2008/11/19 22:17:44 mtcampbe
194 ! Added Illinois Open Source License/Copyright
195 !
196 ! Revision 1.1 2004/12/01 21:56:37 fnajjar
197 ! Initial revision after changing case
198 !
199 ! Revision 1.9 2004/07/28 15:42:13 jferry
200 ! deleted defunct constructs: useDetangle, useSmokeDrag, useSmokeHeatTransfer
201 !
202 ! Revision 1.8 2004/07/23 22:43:17 jferry
203 ! Integrated rocspecies into rocinteract
204 !
205 ! Revision 1.7 2004/04/15 16:04:21 jferry
206 ! minor formatting (removed trailing spaces)
207 !
208 ! Revision 1.6 2004/03/02 21:48:09 jferry
209 ! First phase of replacing Detangle interaction
210 !
211 ! Revision 1.5 2003/09/25 15:48:43 jferry
212 ! implemented Boiling Regulation interaction
213 !
214 ! Revision 1.4 2003/04/02 22:32:04 jferry
215 ! codified Activeness and Permission structures for rocinteract
216 !
217 ! Revision 1.3 2003/03/24 23:30:52 jferry
218 ! overhauled rocinteract to allow interaction design to use user input
219 !
220 ! Revision 1.2 2003/03/11 16:09:39 jferry
221 ! Added comments
222 !
223 ! Revision 1.1 2003/03/04 22:12:35 jferry
224 ! Initial import of Rocinteract
225 !
226 !******************************************************************************
227 
228 
229 
230 
231 
232 
233 
CImg< T > & line(const unsigned int y0)
Get a line.
Definition: CImg.h:18421
subroutine inrt_readburning(regions)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
subroutine inrt_readscouring(regions)
subroutine inrt_readboilingregulation(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 SUBROUTINE form
subroutine inrt_readdefaultsection(regions)
subroutine inrt_readheattransfernonburn(regions)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine inrt_readinputfile(regions)
subroutine inrt_readdrag(regions)