Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ReadProbeSection.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 position of a probe.
26 !
27 ! Description: none.
28 !
29 ! Input: user input file.
30 !
31 ! Output: global = location of probe, dump intervall.
32 !
33 ! Notes: none.
34 !
35 !******************************************************************************
36 !
37 ! $Id: ReadProbeSection.F90,v 1.5 2008/12/06 08:44:10 mtcampbe Exp $
38 !
39 ! Copyright: (c) 2001 by the University of Illinois
40 !
41 !******************************************************************************
42 
43 SUBROUTINE readprobesection( global )
44 
45  USE moddatatypes
46  USE modglobal, ONLY : t_global
48  USE moderror
49  USE modparameters
50  IMPLICIT NONE
51 
52 ! ... parameters
53  TYPE(t_global), POINTER :: global
54 
55 ! ... loop variables
56  INTEGER :: ival, n
57 
58 ! ... local variables
59  CHARACTER(10) :: keys(3)
60  LOGICAL :: defined(3)
61  INTEGER :: errorflag, ncols, nrows
62  REAL(RFREAL) :: valsdump(3)
63  REAL(RFREAL), POINTER :: valsloc(:,:)
64 
65 !******************************************************************************
66 
67  CALL registerfunction( global,'ReadProbeSection',&
68  'ReadProbeSection.F90' )
69 
70 ! do not read probes a second time
71 
72 ! TEMPORARY - Will be fixed properly later, when we will have routines to
73 ! create and destroy probes. Error trapping apparently only needed
74 ! because reading this again will cause allocation to be executed
75 ! again. This is a problem for rflumap.
76 ! IF ( global%nProbes > 0 ) THEN
77 ! CALL ErrorStop(global,ERR_PROBE_SPECIFIED,__LINE__)
78 ! END IF ! global%nProbes
79 
80  IF ( global%nProbes == 0 ) THEN
81 ! END TEMPORARY
82 
83 ! specify keywords and search for them
84 
85 #ifdef RFLO
86  defined(:) = .false.
87 
88  keys(1) = 'NUMBER'
89  ncols = 4
90 
91  CALL readlistsection( global,if_input,keys(1),ncols,nrows,valsloc,defined(1) )
92 
93  IF (defined(1).eqv..true.) THEN
94  global%nProbes = nrows
95  ALLOCATE( global%probePos(nrows,ncols),stat=errorflag )
96  errorflag = global%error
97  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
98 
99 ! - support entering 0 for the block and the x, y, z coordinates
100 ! instead of the block number and indeces.
101 
102  ALLOCATE( global%probeXYZ(nrows,ncols),stat=errorflag )
103  errorflag = global%error
104  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
105  DO ival=1,global%nProbes
106  IF (valsloc(ival,1) /= 0.) THEN
107  DO n=1,ncols
108  global%probePos(ival,n) = int(abs(valsloc(ival,n))+0.5_rfreal)
109  ENDDO
110  ELSE
111 
112 ! ----- they have entered coordinates. Assign probePos in writeProbe.
113  DO n=1,ncols
114  global%probePos(ival,n) = 0
115  global%probeXYZ(ival,n) = valsloc(ival,n)
116  ENDDO
117  ENDIF
118  ENDDO
119  ENDIF
120 
121  IF (defined(1).eqv..true.) THEN
122  DEALLOCATE( valsloc,stat=errorflag )
123  global%error = errorflag
124  IF (global%error /= 0) CALL errorstop( global,err_deallocate,__line__ )
125  ENDIF
126 
127 ! get dump interval
128 
129  defined(:) = .false.
130 
131  keys(1) = 'WRITIME'
132  keys(2) = 'WRIITER'
133  keys(3) = 'OPENCLOSE'
134 
135  CALL readsection( global,if_input,3,keys,valsdump,defined )
136 
137  IF (defined(1).eqv..true.) global%probeSaveTime = abs(valsdump(1))
138  IF (defined(2).eqv..true.) THEN
139  global%probeSaveIter = int(abs(valsdump(2))+0.5_rfreal)
140  global%probeSaveIter = max(1,global%probeSaveIter)
141  ENDIF
142  IF (defined(3).eqv..true.) THEN
143  IF (valsdump(3) < 0.5_rfreal) THEN
144  global%probeOpenClose = .false.
145  ELSE
146  global%probeOpenClose = .true.
147  ENDIF
148  ENDIF
149  IF ((.NOT.(defined(1).eqv..true.)).AND. &
150  (.NOT.(defined(2).eqv..true.)).AND. &
151  (.NOT.(defined(3).eqv..true.))) THEN
152  backspace(if_input, iostat=errorflag)
153  global%error = errorflag
154  IF (global%error /= err_none) &
155  CALL errorstop( global,err_file_read,__line__, &
156  'while backspacing after reading probe section' )
157  ENDIF ! not defined
158 #endif
159 
160 
161 #ifdef RFLU
162  defined = .false.
163 
164  keys(1) = 'NUMBER'
165  ncols = 3
166 
167  CALL readlistsection(global,if_input,keys(1),ncols,nrows,valsloc,defined(1))
168 
169  IF ( defined(1) .EQV. .true. ) THEN
170  global%nProbes = nrows
171 
172  ALLOCATE(global%probePos(nrows,probe_region:probe_cell),stat=errorflag)
173  global%error = errorflag
174  IF (global%error /= 0) THEN
175  CALL errorstop(global,err_allocate,__line__)
176  END IF ! global%error
177 
178  DO ival = 1,global%nProbes
179  DO n = probe_region,probe_cell
180  global%probePos(ival,n) = crazy_value_int
181  END DO ! n
182  END DO ! ival
183 
184  ALLOCATE(global%probeXYZ(nrows,ncols),stat=errorflag)
185  global%error = errorflag
186  IF (global%error /= 0) THEN
187  CALL errorstop(global,err_allocate,__line__)
188  END IF ! global%error
189 
190  DO ival = 1,global%nProbes
191  DO n = 1,ncols
192  global%probeXYZ(ival,n) = valsloc(ival,n)
193  END DO ! n
194  END DO ! ival
195  END IF ! defined
196 
197  IF ( defined(1) .EQV. .true. ) THEN
198  DEALLOCATE(valsloc,stat=errorflag)
199  global%error = errorflag
200  IF (global%error /= 0) THEN
201  CALL errorstop(global,err_deallocate,__line__)
202  END IF ! global%error
203  END IF ! defined
204 
205 ! get dump interval
206 
207  defined(:) = .false.
208 
209  keys(1) = 'WRITIME'
210  keys(2) = 'WRIITER'
211  keys(3) = 'OPENCLOSE'
212 
213  CALL readsection(global,if_input,3,keys,valsdump,defined)
214 
215  IF ( defined(1) .EQV. .true. ) THEN
216  global%probeSaveTime = abs(valsdump(1))
217  END IF ! defined
218  IF ( defined(2) .EQV. .true. ) THEN
219  global%probeSaveIter = int(abs(valsdump(2))+0.5_rfreal)
220  global%probeSaveIter = max(1,global%probeSaveIter)
221  END IF ! defined
222  IF ( defined(3) .EQV. .true. ) THEN
223  IF ( valsdump(3) < 0.5_rfreal ) THEN
224  global%probeOpenClose = .false.
225  ELSE
226  global%probeOpenClose = .true.
227  END IF ! valsDump
228  END IF ! defined
229 #endif
230 
231 ! TEMPORARY - See comment above
232  END IF ! global%nProbes
233 ! END TEMPORARY
234 
235 ! finalize
236 
237  CALL deregisterfunction( global )
238 
239 END SUBROUTINE readprobesection
240 
241 !******************************************************************************
242 !
243 ! RCS Revision history:
244 !
245 ! $Log: ReadProbeSection.F90,v $
246 ! Revision 1.5 2008/12/06 08:44:10 mtcampbe
247 ! Updated license.
248 !
249 ! Revision 1.4 2008/11/19 22:17:23 mtcampbe
250 ! Added Illinois Open Source License/Copyright
251 !
252 ! Revision 1.3 2008/10/23 18:20:55 mtcampbe
253 ! Crazy number of changes to track and fix initialization and
254 ! restart bugs. Many improperly formed logical expressions
255 ! were fixed, and bug in allocation for data associated with
256 ! the BC_INFLOWVELTEMP boundary condition squashed in
257 ! RFLO_ReadBcInflowVelSection.F90.
258 !
259 ! Revision 1.2 2006/03/25 02:17:57 wasistho
260 ! added safety when certain params not exist
261 !
262 ! Revision 1.1 2004/12/01 16:50:44 haselbac
263 ! Initial revision after changing case
264 !
265 ! Revision 1.17 2004/11/11 14:49:56 haselbac
266 ! Commented out error check for probes, bypass for now
267 !
268 ! Revision 1.16 2004/08/09 22:14:42 fnajjar
269 ! Changed apostrophe in comment line since SUN compiler breaks
270 !
271 ! Revision 1.15 2004/07/21 21:11:42 wasistho
272 ! allow probes input by coordinates
273 !
274 ! Revision 1.14.2.1 2004/07/02 04:09:27 rfiedler
275 ! Allows Rocflo probes to be specified by coordinates. Use 0 for the block ID.
276 !
277 ! Revision 1.14 2003/11/20 16:40:35 mdbrandy
278 ! Backing out RocfluidMP changes from 11-17-03
279 !
280 ! Revision 1.11 2003/05/15 02:57:02 jblazek
281 ! Inlined index function.
282 !
283 ! Revision 1.10 2003/04/07 14:18:40 haselbac
284 ! Added new options for RFLU
285 !
286 ! Revision 1.9 2003/01/23 17:48:53 jblazek
287 ! Changed algorithm to dump convergence, solution and probe data.
288 !
289 ! Revision 1.8 2002/10/08 15:48:35 haselbac
290 ! {IO}STAT=global%error replaced by {IO}STAT=errorFlag - SGI problem
291 !
292 ! Revision 1.7 2002/10/05 18:37:11 haselbac
293 ! Added allocation of probeXyz
294 !
295 ! Revision 1.6 2002/09/05 17:40:20 jblazek
296 ! Variable global moved into regions().
297 !
298 ! Revision 1.5 2002/03/26 19:07:20 haselbac
299 ! Added ROCFLU functionality
300 !
301 ! Revision 1.4 2002/02/09 01:47:01 jblazek
302 ! Added multi-probe option, residual smoothing, physical time step.
303 !
304 ! Revision 1.3 2002/01/11 17:18:31 jblazek
305 ! Updated description of I/O variables.
306 !
307 ! Revision 1.2 2001/12/22 00:09:38 jblazek
308 ! Added routines to store grid and solution.
309 !
310 ! Revision 1.1 2001/12/07 16:54:31 jblazek
311 ! Added files to read user input.
312 !
313 !******************************************************************************
314 
315 
316 
317 
318 
319 
320 
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine readlistsection(global, fileID, key, nCols, nRows, vals, defined)
subroutine readprobesection(global)
const NT & n
subroutine readsection(global, fileID, nvals, keys, vals, defined)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469