Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ReadStatisticSection.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 time averaging statistics
26 !
27 ! Description: read-in procedure makes use of utility string reader
28 ! ReadStringSection for flexible number of statistics variables
29 !
30 ! Input: user input file
31 !
32 ! Output: global = statistics parameters and variable indices:
33 ! global%doStat = do-statistics switch
34 ! global%reStat = statistics restart switch
35 ! global%mixtNStat = number of mixture statistics variable
36 ! global%turbNStat = number of TURB statistics variable
37 ! global%mixtStatId= mixture statistics variable ID
38 ! global%turbStatId= TURB statistics variable ID
39 !
40 ! Notes: none.
41 !
42 !******************************************************************************
43 !
44 ! $Id: ReadStatisticSection.F90,v 1.9 2008/12/06 08:44:10 mtcampbe Exp $
45 !
46 ! Copyright: (c) 2001 by the University of Illinois
47 !
48 !******************************************************************************
49 
50 SUBROUTINE readstatisticsection( global )
51 
52  USE moddatatypes
53  USE modglobal, ONLY : t_global
55  USE moderror
56  USE modparameters
57  IMPLICIT NONE
58 
59 ! ... parameters
60  TYPE(t_global), POINTER :: global
61 
62 ! ... local variables
63  INTEGER :: errorflag,l, ival, nvals
64  INTEGER, PARAMETER :: nvals_max = 10
65  CHARACTER(10) :: keys(nvals_max)
66  LOGICAL :: defined(nvals_max)
67  CHARACTER(256) :: line(nvals_max)
68  INTEGER :: vals(nvals_max)
69 
70 !******************************************************************************
71 
72  CALL registerfunction( global,'ReadStatisticSection',&
73  'ReadStatisticSection.F90' )
74 
75 ! specify keywords and search for them --------------------------------------
76 
77  nvals = nvals_max
78 
79  keys( 1) = 'DOSTAT'
80  keys( 2) = 'RESTART'
81  keys( 3) = 'MIXTNSTAT'
82  keys( 4) = 'MIXTSTATID'
83  keys( 5) = 'TURBNSTAT'
84  keys( 6) = 'TURBSTATID'
85  keys( 7) = 'PLAGNSTAT'
86  keys( 8) = 'PLAGSTATID'
87  keys( 9) = 'PEULNSTAT'
88  keys(10) = 'PEULSTATID'
89 
90  CALL readstringsection( global,if_input,nvals,keys,line,defined )
91 
92  IF (defined( 1).eqv..true.) READ (line(1),*) global%doStat
93  IF (defined( 2).eqv..true.) READ (line(2),*) global%reStat
94  IF (defined( 3).eqv..true.) READ (line(3),*) global%mixtNStat
95 #ifdef TURB
96  IF (defined( 5).eqv..true.) READ (line(5),*) global%turbNStat
97 #endif
98 #ifdef PLAG
99  IF (defined( 7).eqv..true.) READ (line(7),*) global%plagNStat
100 #endif
101 #ifdef PEUL
102  IF (defined( 9).eqv..true.) READ (line(9),*) global%peulNStat
103 #endif
104 
105 ! specific mixture
106 
107  IF ((defined( 1).eqv..true.).AND.(global%doStat==active).AND. &
108  (defined( 3).eqv..true.).AND.(global%mixtNStat > 0) .AND. &
109  (defined( 4).eqv..true.)) THEN
110  ALLOCATE( global%mixtStatId(2,global%mixtNStat),stat=errorflag )
111  global%error = errorflag
112  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
113  READ(line(4),*) (global%mixtStatId(1,l),l=1,global%mixtNStat)
114  ELSE
115  nullify( global%mixtStatId )
116  ENDIF ! doStat
117 
118  IF ((defined(4).eqv..true.).AND.(global%doStat==active).AND.(global%mixtNStat > 0)) THEN
119  global%mixtStatId(2,:)= mod(global%mixtStatId(1,:),10)
120  global%mixtStatId(1,:)= (global%mixtStatId(1,:)-global%mixtStatId(2,:))/10
121  ENDIF
122 
123 ! specific turbulence
124 
125 #ifdef TURB
126  IF ((defined( 1).eqv..true.).AND.(global%doStat==active).AND. &
127  (defined( 5).eqv..true.).AND.(global%turbNStat > 0) .AND. &
128  (defined( 6).eqv..true.)) THEN
129  ALLOCATE( global%turbStatId(2,global%turbNStat),stat=errorflag )
130  global%error = errorflag
131  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
132  READ(line(6),*) (global%turbStatId(1,l),l=1,global%turbNStat)
133  ELSE
134  nullify( global%turbStatId )
135  ENDIF ! doStat
136 
137  IF ((defined(6).eqv..true.).AND.(global%doStat==active).AND.(global%turbNStat > 0)) THEN
138  global%turbStatId(2,:)= mod(global%turbStatId(1,:),10)
139  global%turbStatId(1,:)= (global%turbStatId(1,:)-global%turbStatId(2,:))/10
140  ENDIF
141 #endif
142 
143 ! specific PLAG
144 
145 #ifdef PLAG
146  IF ((defined( 1).eqv..true.).AND.(global%doStat==active).AND. &
147  (defined( 7).eqv..true.).AND.(global%plagNStat > 0) .AND. &
148  (defined( 8).eqv..true.)) THEN
149  ALLOCATE( global%plagStatId(2,global%plagNStat),stat=errorflag )
150  global%error = errorflag
151  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
152  READ(line(8),*) (global%plagStatId(1,l),l=1,global%plagNStat)
153  ELSE
154  nullify( global%plagStatId )
155  ENDIF ! doStat
156 
157  IF ((defined(8).eqv..true.).AND.(global%doStat==active).AND.(global%plagNStat > 0)) THEN
158  global%plagStatId(2,:)= mod(global%plagStatId(1,:),10)
159  global%plagStatId(1,:)= (global%plagStatId(1,:)-global%plagStatId(2,:))/10
160  ENDIF
161 #endif
162 
163 ! specific PEUL
164 
165 #ifdef PEUL
166  IF ((defined( 1).eqv..true.).AND.(global%doStat==active).AND. &
167  (defined( 9).eqv..true.).AND.(global%peulNStat > 0) .AND. &
168  (defined(10).eqv..true.)) THEN
169  ALLOCATE( global%peulStatId(2,global%peulNStat),stat=errorflag )
170  global%error = errorflag
171  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
172  READ(line(10),*) (global%peulStatId(1,l),l=1,global%peulNStat)
173  ELSE
174  nullify( global%peulStatId )
175  ENDIF ! doStat
176 
177  IF ((defined(10).eqv..true.).AND.(global%doStat==active).AND.(global%peulNStat > 0)) THEN
178  global%peulStatId(2,:)= mod(global%peulStatId(1,:),10)
179  global%peulStatId(1,:)= (global%peulStatId(1,:)-global%peulStatId(2,:))/10
180  ENDIF
181 #endif
182 
183 ! check input parameters ------------------------------------------------------
184 
185  IF (global%doStat == active) THEN
186 
187 ! - general
188 
189  ival=2
190  IF (.NOT. (defined(ival).eqv..true.)) THEN
191  CALL errorstop( global,err_stats_input,__line__,keys(ival) )
192  ENDIF
193  IF ((.NOT. (defined(3).eqv..true.)) .AND. &
194  (.NOT. (defined(5).eqv..true.))) THEN
195  CALL errorstop( global,err_stats_input,__line__, &
196  'mixture or module NSTAT not defined' )
197  ENDIF
198 
199 #ifndef STATS
200  CALL errorstop( global,err_stats_input,__line__, &
201  'DOSTAT=1 but executable is not compiled with STATS=1' )
202 #endif
203 
204 ! - mixture
205 
206  ival=3
207  IF (defined(ival).eqv..true.) THEN
208  IF (global%mixtNStat > 0) THEN
209  ival=4
210  IF (.NOT. (defined(ival).eqv..true.)) THEN
211  CALL errorstop( global,err_stats_input,__line__,keys(ival) )
212  ENDIF
213  ELSEIF (global%mixtNStat < 0) THEN
214  CALL errorstop( global,err_stats_input,__line__,'mixtNSTAT < 0' )
215  ENDIF
216  ENDIF
217 
218 ! - turbulence
219 
220 #ifdef TURB
221  ival=5
222  IF (defined(ival).eqv..true.) THEN
223  IF (global%turbNStat > 0) THEN
224  ival=6
225  IF (.NOT. (defined(ival).eqv..true.)) THEN
226  CALL errorstop( global,err_stats_input,__line__,keys(ival) )
227  ENDIF
228  ELSEIF (global%turbNStat < 0) THEN
229  CALL errorstop( global,err_stats_input,__line__,'turbNSTAT < 0' )
230  ENDIF
231  ENDIF
232 #endif
233 
234 ! - lagrangian particles
235 
236 #ifdef PLAG
237  ival=7
238  IF (defined(ival).eqv..true.) THEN
239  IF (global%plagNStat > 0) THEN
240  ival=8
241  IF (.NOT. (defined(ival).eqv..true.)) THEN
242  CALL errorstop( global,err_stats_input,__line__,keys(ival) )
243  ENDIF
244  ELSEIF (global%plagNStat < 0) THEN
245  CALL errorstop( global,err_stats_input,__line__,'plagNSTAT < 0' )
246  ENDIF
247  ENDIF
248 #endif
249 
250 ! - eulerian particles
251 
252 #ifdef PEUL
253  ival=9
254  IF (defined(ival).eqv..true.) THEN
255  IF (global%peulNStat > 0) THEN
256  ival=10
257  IF (.NOT. (defined(ival).eqv..true.)) THEN
258  CALL errorstop( global,err_stats_input,__line__,keys(ival) )
259  ENDIF
260  ELSEIF (global%peulNStat < 0) THEN
261  CALL errorstop( global,err_stats_input,__line__,'peulNSTAT < 0' )
262  ENDIF
263  ENDIF
264 #endif
265  ENDIF
266 
267 ! finalize --------------------------------------------------------------------
268 
269  CALL deregisterfunction( global )
270 
271 END SUBROUTINE readstatisticsection
272 
273 !******************************************************************************
274 !
275 ! RCS Revision history:
276 !
277 ! $Log: ReadStatisticSection.F90,v $
278 ! Revision 1.9 2008/12/06 08:44:10 mtcampbe
279 ! Updated license.
280 !
281 ! Revision 1.8 2008/11/19 22:17:23 mtcampbe
282 ! Added Illinois Open Source License/Copyright
283 !
284 ! Revision 1.7 2008/10/23 18:20:55 mtcampbe
285 ! Crazy number of changes to track and fix initialization and
286 ! restart bugs. Many improperly formed logical expressions
287 ! were fixed, and bug in allocation for data associated with
288 ! the BC_INFLOWVELTEMP boundary condition squashed in
289 ! RFLO_ReadBcInflowVelSection.F90.
290 !
291 ! Revision 1.6 2006/01/14 23:00:22 wasistho
292 ! added safety if read but dostat=0
293 !
294 ! Revision 1.5 2005/03/07 18:45:58 wasistho
295 ! check if stats module is compiled
296 !
297 ! Revision 1.4 2005/01/08 20:34:05 fnajjar
298 ! Bug fix of line for PLAG and PEUL
299 !
300 ! Revision 1.3 2004/12/30 19:35:46 wasistho
301 ! set NVALS_MAX to 10
302 !
303 ! Revision 1.2 2004/12/29 23:28:38 wasistho
304 ! prepared statistics for PLAG and PEUL
305 !
306 ! Revision 1.1 2004/12/01 16:50:50 haselbac
307 ! Initial revision after changing case
308 !
309 ! Revision 1.12 2004/11/29 17:14:06 wasistho
310 ! use ModInterfacesStatistics
311 !
312 ! Revision 1.11 2003/11/20 16:40:35 mdbrandy
313 ! Backing out RocfluidMP changes from 11-17-03
314 !
315 ! Revision 1.8 2003/05/15 02:57:02 jblazek
316 ! Inlined index function.
317 !
318 ! Revision 1.7 2002/11/02 01:50:25 wasistho
319 ! Added TURB statistics
320 !
321 ! Revision 1.6 2002/10/08 15:48:35 haselbac
322 ! {IO}STAT=global%error replaced by {IO}STAT=errorFlag - SGI problem
323 !
324 ! Revision 1.5 2002/09/05 17:40:20 jblazek
325 ! Variable global moved into regions().
326 !
327 ! Revision 1.4 2002/07/22 22:59:10 jblazek
328 ! Some more clean up.
329 !
330 ! Revision 1.3 2002/07/22 15:47:53 wasistho
331 ! Cleaned-up conforming Coding Rule
332 !
333 ! Revision 1.2 2002/06/14 23:33:08 wasistho
334 ! update error msg
335 !
336 ! Revision 1.1 2002/06/14 21:17:01 wasistho
337 ! Added time avg statistics
338 !
339 !
340 !******************************************************************************
341 
342 
343 
344 
345 
346 
347 
CImg< T > & line(const unsigned int y0)
Get a line.
Definition: CImg.h:18421
subroutine readstringsection(global, fileID, nvals, keys, vals, defined)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine readstatisticsection(global)
**********************************************************************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 nvals
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469