Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_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 (done on all processors).
26 !
27 ! Description: none.
28 !
29 ! Input: user input file.
30 !
31 ! Output: regions = reference values, numerics, probe`s position.
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: PLAG_ReadInputFile.F90,v 1.4 2009/03/05 13:34:00 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2002 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE plag_readinputfile( regions )
44 
45  USE moddatatypes
46  USE moddatastruct, ONLY : t_region
47  USE modglobal, ONLY : t_global
51 
52  USE moderror
53  USE modparameters
54  USE modmpi
56  IMPLICIT NONE
57 
58 ! ... parameters
59  TYPE(t_region), POINTER :: regions(:)
60 
61 ! ... loop variables
62  INTEGER :: ireg
63 
64 ! ... local variables
65  CHARACTER(CHRLEN) :: rcsidentstring
66  CHARACTER(CHRLEN+4) :: fname
67  CHARACTER(256) :: line
68 
69  LOGICAL :: usedsomewhere, unusedsomewhere
70 
71  INTEGER :: errorflag, readstatus
72 
73  TYPE(t_global), POINTER :: global
74 
75 !******************************************************************************
76 
77  rcsidentstring = '$RCSfile: PLAG_ReadInputFile.F90,v $ $Revision: 1.4 $'
78 
79  global => regions(1)%global
80 
81  CALL registerfunction( global, 'PLAG_ReadInputFile',&
82  'PLAG_ReadInputFile.F90' )
83 
84 ! Open file -------------------------------------------------------------------
85 
86  fname = trim(global%inDir)//trim(global%casename)//'.inp'
87  OPEN(if_input,file=fname,form='formatted',status='old',iostat=errorflag )
88  global%error = errorflag
89  IF ( global%error /= err_none ) THEN
90  CALL errorstop( global, err_file_open,__line__,'File: '//trim(fname) )
91  END IF ! global%error
92 
93 ! Read file looking for keywords ----------------------------------------------
94 
95  DO
96  READ(if_input,'(A256)',err=10,end=86) line
97 
98  SELECT CASE(trim(line))
99  CASE ('# DISPART')
100  IF ( global%myProcid == masterproc .AND. &
101  global%verbLevel > verbose_none ) THEN
102  WRITE(stdout,'(A,3X,A)') solver_name, &
103  'Reading PLAG_ReadDisPartSection...'
104  END IF ! global%verbLevel
105  CALL plag_readdispartsection( regions )
106 
107  CASE ('# DISPART_NCONT')
108  IF ( global%myProcid == masterproc .AND. &
109  global%verbLevel > verbose_none ) THEN
110  WRITE(stdout,'(A,3X,A)') solver_name, &
111  'Reading PLAG_ReadDisPartnContSection...'
112  END IF ! global%verbLevel
113  CALL plag_readdispartncontsection( regions )
114 
115 #ifdef RFLU
116  CASE ('# DISPART_INIT')
117  IF ( global%myProcid == masterproc .AND. &
118  global%verbLevel > verbose_none ) THEN
119  WRITE(stdout,'(A,3X,A)') solver_name, &
120  'Reading PLAG_ReadDisPartInitSection...'
121  END IF ! global%verbLevel
122  CALL plag_readdispartinitsection( regions )
123 #endif
124  END SELECT
125  ENDDO
126 
127 86 CONTINUE
128 
129 ! close file ------------------------------------------------------------------
130 
131  CLOSE( if_input,iostat=errorflag )
132  global%error = errorflag
133  IF (global%error /= err_none) THEN
134  CALL errorstop( global, err_file_close,__line__,'File: '//trim(fname) )
135  END IF ! global%error
136 
137 ! set global%plagUsed ----------------------------------------------------------
138 
139  usedsomewhere = .false.
140  unusedsomewhere = .false.
141 
142  DO ireg = lbound(regions,1),ubound(regions,1)
143  readstatus = regions(ireg)%plagInput%readStatus
144  usedsomewhere = usedsomewhere .OR.(readstatus == 1)
145  unusedsomewhere = unusedsomewhere.OR.(readstatus /= 1) ! == 0 or -1
146  END DO ! iReg
147 
148  IF (usedsomewhere.AND.unusedsomewhere) THEN
149  CALL errorstop( global,err_mp_allornone,__line__ )
150  END IF ! usedSomewhere.AND.unusedSomewhere
151 
152  global%plagUsed = usedsomewhere
153 
154 ! finalization & error handling -----------------------------------------------
155 
156  CALL deregisterfunction( global )
157  goto 999
158 
159 10 CONTINUE
160  CALL errorstop( global, err_file_read,__line__,'File: '//trim(fname) )
161 
162 999 CONTINUE
163 
164 END SUBROUTINE plag_readinputfile
165 
166 !******************************************************************************
167 !
168 ! RCS Revision history:
169 !
170 ! $Log: PLAG_ReadInputFile.F90,v $
171 ! Revision 1.4 2009/03/05 13:34:00 mtcampbe
172 ! MPI tag shift in Pane_Communicator && ifdef disable of plag init portion
173 ! relevant only for Rocflu.
174 !
175 ! Revision 1.3 2008/12/06 08:44:35 mtcampbe
176 ! Updated license.
177 !
178 ! Revision 1.2 2008/11/19 22:17:48 mtcampbe
179 ! Added Illinois Open Source License/Copyright
180 !
181 ! Revision 1.1 2004/12/01 20:58:06 fnajjar
182 ! Initial revision after changing case
183 !
184 ! Revision 1.5 2004/08/20 23:27:13 fnajjar
185 ! Added Infrastructure for Plag prep tool
186 !
187 ! Revision 1.4 2004/03/05 22:09:03 jferry
188 ! created global variables for peul, plag, and inrt use
189 !
190 ! Revision 1.3 2003/03/17 18:42:45 jblazek
191 ! Added inDir to path of the input file.
192 !
193 ! Revision 1.2 2003/02/26 23:38:30 jferry
194 ! eliminated end=999 convention to ensure that files get closed
195 !
196 ! Revision 1.1 2002/10/25 14:19:16 f-najjar
197 ! Initial Import of Rocpart
198 !
199 !******************************************************************************
200 
201 
202 
203 
204 
205 
206 
subroutine plag_readdispartinitsection(regions)
CImg< T > & line(const unsigned int y0)
Get a line.
Definition: CImg.h:18421
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
**********************************************************************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 plag_readinputfile(regions)
subroutine plag_readdispartsection(regions)
subroutine plag_readdispartncontsection(regions)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469