Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ReadPostInfo.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 file with with post-processor information.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Pointer to region data
31 ! readMode Reading mode
32 !
33 ! Output: None.
34 !
35 ! Notes:
36 ! 1. Need to have two reading modes because for the activation flag to be
37 ! useful, need to do this before any quantities are read or allocated,
38 ! but this means that nCellsSpecial will be overwritten when grid is
39 ! created. So read twice, first for activation flag only, and then after
40 ! grid is created, read nCellsSpecial and the actual indices of the
41 ! special cells.
42 !
43 ! ******************************************************************************
44 !
45 ! $Id: RFLU_ReadPostInfo.F90,v 1.7 2008/12/06 08:45:06 mtcampbe Exp $
46 !
47 ! Copyright: (c) 2003-2004 by the University of Illinois
48 !
49 ! ******************************************************************************
50 
51 SUBROUTINE rflu_readpostinfo(pRegion,readMode)
52 
53  USE moddatatypes
54  USE moderror
55  USE moddatastruct, ONLY: t_region
56  USE modgrid, ONLY: t_grid
57  USE modglobal, ONLY: t_global
58  USE modparameters
59  USE modmpi
60 
61  IMPLICIT NONE
62 
63 ! ******************************************************************************
64 ! Definitions and declarations
65 ! ******************************************************************************
66 
67 ! ==============================================================================
68 ! Arguments
69 ! ==============================================================================
70 
71  INTEGER, INTENT(IN) :: readmode
72  TYPE(t_region), POINTER :: pregion
73 
74 ! ==============================================================================
75 ! Locals
76 ! ==============================================================================
77 
78  LOGICAL :: dummylogical
79  CHARACTER(CHRLEN) :: dummystring,dummystring2,iregionstring,rcsidentstring
80  INTEGER :: dummyinteger,dummyinteger2,ics,ifile,ifs,indx,ireg,iregionglobal, &
81  ncellsspecial
82  TYPE(t_global), POINTER :: global
83  TYPE(t_grid), POINTER :: pgrid
84 
85 ! ******************************************************************************
86 ! Start
87 ! ******************************************************************************
88 
89  rcsidentstring = '$RCSfile: RFLU_ReadPostInfo.F90,v $ $Revision: 1.7 $'
90 
91  global => pregion%global
92 
93  CALL registerfunction(global,'RFLU_ReadPostInfo',&
94  'RFLU_ReadPostInfo.F90')
95 
96  IF ( global%myProcid == masterproc .AND. &
97  global%verbLevel > verbose_none ) THEN
98  WRITE(stdout,'(A,1X,A)') solver_name,'Reading post-processor info...'
99  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
100  pregion%iRegionGlobal
101  END IF ! global%verbLevel
102 
103 ! ******************************************************************************
104 ! Set grid pointer and variables
105 ! ******************************************************************************
106 
107  pgrid => pregion%grid
108 
109  ifile = if_postinfo
110 
111 ! ******************************************************************************
112 ! Rewind file - must be done because stays open while read several times
113 ! ******************************************************************************
114 
115  rewind(ifile)
116 
117 ! ******************************************************************************
118 ! Read from file
119 ! ******************************************************************************
120 
121  DO ireg = 1,global%nRegionsLocal
122  READ(ifile,'(A)') dummystring
123 
124  WRITE(iregionstring,'(I5.5)') pregion%iRegionGlobal
125  indx = index(dummystring,trim(iregionstring))
126 
127  IF ( indx /= 0 ) THEN
128  dummystring2 = dummystring(indx:indx+len_trim(iregionstring)-1)
129  READ(dummystring2,*) iregionglobal
130  ELSE
131  iregionglobal = crazy_value_int ! Anything but pRegion%iRegionGlobal
132  END IF ! indx
133 
134 ! ==============================================================================
135 ! Found entry for my region
136 ! ==============================================================================
137 
138  IF ( iregionglobal == pregion%iRegionGlobal ) THEN
139 
140 ! ------------------------------------------------------------------------------
141 ! Read activation flag only
142 ! ------------------------------------------------------------------------------
143 
144  IF ( readmode == infofile_readmode_flag ) THEN
145  READ(ifile,'(L1)') pregion%postActiveFlag
146 
147  IF ( pregion%postActiveFlag .EQV. .true. ) THEN
148  IF ( global%myProcid == masterproc .AND. &
149  global%verbLevel > verbose_low ) THEN
150  WRITE(stdout,'(A,3X,A)') solver_name,'Region is active.'
151  END IF ! global%verbLevel
152 
153  READ(ifile,*) dummyinteger ! Special cells
154 
155  DO ics = 1,dummyinteger
156  READ(ifile,*) dummyinteger2
157  END DO ! ics
158 
159  READ(ifile,*) dummyinteger ! Special faces
160 
161  DO ifs = 1,dummyinteger
162  READ(ifile,*) dummyinteger2
163  END DO ! ifs
164  ELSE
165  IF ( global%myProcid == masterproc .AND. &
166  global%verbLevel > verbose_low ) THEN
167  WRITE(stdout,'(A,3X,A)') solver_name,'Region is not active.'
168  END IF ! global%verbLevel
169  END IF ! pRegion%postActiveFlag
170 
171 ! ------------------------------------------------------------------------------
172 ! Read special cells and faces only
173 ! ------------------------------------------------------------------------------
174 
175  ELSE IF ( readmode == infofile_readmode_data ) THEN
176  READ(ifile,'(L1)') dummylogical
177 
178  IF ( dummylogical .EQV. .true. ) THEN
179  READ(ifile,*) pgrid%nCellsSpecial
180 
181  IF ( global%myProcid == masterproc .AND. &
182  global%verbLevel > verbose_low ) THEN
183  WRITE(stdout,'(A,3X,A,1X,I3)') solver_name, &
184  'Number of special cells:', &
185  pgrid%nCellsSpecial
186  END IF ! global%verbLevel
187 
188  DO ics = 1,pgrid%nCellsSpecial
189  READ(ifile,*) pgrid%cellsSpecial(ics)
190  END DO ! ics
191 
192  READ(ifile,*) pgrid%nFacesSpecial
193 
194  IF ( global%myProcid == masterproc .AND. &
195  global%verbLevel > verbose_low ) THEN
196  WRITE(stdout,'(A,3X,A,1X,I3)') solver_name, &
197  'Number of special faces:', &
198  pgrid%nFacesSpecial
199  END IF ! global%verbLevel
200 
201  DO ifs = 1,pgrid%nFacesSpecial
202  READ(ifile,*) pgrid%facesSpecial(1,ifs), &
203  pgrid%facesSpecial(2,ifs)
204  END DO ! ifs
205  ELSE
206  pgrid%nCellsSpecial = 0
207  pgrid%nFacesSpecial = 0
208  END IF ! dummyLogical
209  ELSE
210  CALL errorstop(global,err_reached_default,__line__)
211  END IF ! readMode
212 
213 ! ==============================================================================
214 ! Found entry for other region(s) - skip by reading dummy variables
215 ! ==============================================================================
216 
217  ELSE
218  READ(ifile,'(L1)') dummylogical
219 
220  IF ( dummylogical .EQV. .true. ) THEN
221  READ(ifile,*) dummyinteger ! Special cells
222 
223  DO ics = 1,dummyinteger
224  READ(ifile,*) dummyinteger2
225  END DO ! ics
226 
227  READ(ifile,*) dummyinteger ! Special faces
228 
229  DO ifs = 1,dummyinteger
230  READ(ifile,*) dummyinteger2
231  END DO ! ifs
232  END IF ! dummyLogical
233  END IF ! iRegionGlobal
234  END DO ! iReg
235 
236 ! ******************************************************************************
237 ! End
238 ! ******************************************************************************
239 
240  IF ( global%myProcid == masterproc .AND. &
241  global%verbLevel > verbose_none ) THEN
242  WRITE(stdout,'(A,1X,A)') solver_name,'Reading post-processor info done.'
243  END IF ! global%verbLevel
244 
245  CALL deregisterfunction(global)
246 
247 END SUBROUTINE rflu_readpostinfo
248 
249 ! ******************************************************************************
250 !
251 ! RCS Revision history:
252 !
253 ! $Log: RFLU_ReadPostInfo.F90,v $
254 ! Revision 1.7 2008/12/06 08:45:06 mtcampbe
255 ! Updated license.
256 !
257 ! Revision 1.6 2008/11/19 22:18:17 mtcampbe
258 ! Added Illinois Open Source License/Copyright
259 !
260 ! Revision 1.5 2006/04/07 15:19:26 haselbac
261 ! Removed tabs
262 !
263 ! Revision 1.4 2004/09/27 01:43:50 haselbac
264 ! Modified to read info about special faces
265 !
266 ! Revision 1.3 2004/03/23 03:17:34 haselbac
267 ! Changed format statements
268 !
269 ! Revision 1.2 2003/08/07 15:37:16 haselbac
270 ! Changed var names
271 !
272 ! Revision 1.1 2003/06/04 22:44:14 haselbac
273 ! Initial revision
274 !
275 ! ******************************************************************************
276 
277 
278 
279 
280 
281 
282 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int index() const
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine rflu_readpostinfo(pRegion, readMode)
subroutine deregisterfunction(global)
Definition: ModError.F90:469