Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_PrintFlowInfo.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: Display minimum and maximum values of state vector for given local
26 ! domain.
27 !
28 ! Description: None.
29 !
30 ! Input:
31 ! pRegion Pointer to region
32 !
33 ! Output: N/A.
34 !
35 ! Notes:
36 ! 1. Depending on where this routine is called, one may not be able to
37 ! switch to or from conservative variables because the arrays dv and gv
38 ! are not allocated. To avoid this problem, this routine checks whether
39 ! these arrays are allocated, and only carries out the conversion to
40 ! primitive variables if that is the case.
41 ! 2. IMPORTANT: At present, the conversion from and back to conserved
42 ! variables is commented out because it breaks perfect binary restart.
43 !
44 ! ******************************************************************************
45 !
46 ! $Id: RFLU_PrintFlowInfo.F90,v 1.18 2008/12/06 08:44:12 mtcampbe Exp $
47 !
48 ! Copyright: (c) 2002-2006 by the University of Illinois
49 !
50 ! ******************************************************************************
51 
52 SUBROUTINE rflu_printflowinfo(pRegion)
53 
54  USE modglobal, ONLY: t_global
55  USE moddatatypes
56  USE modparameters
57  USE moderror
58  USE modgrid, ONLY: t_grid
59  USE moddatastruct, ONLY: t_region
60 
62 
63  USE modinterfaces, ONLY: rflu_getcvloc, &
65 
66  IMPLICIT NONE
67 
68 ! ******************************************************************************
69 ! Declarations and definitions
70 ! ******************************************************************************
71 
72 ! ==============================================================================
73 ! Parameters
74 ! ==============================================================================
75 
76  TYPE(t_region), POINTER :: pregion
77 
78 ! ==============================================================================
79 ! Local variables
80 ! ==============================================================================
81 
82  CHARACTER(CHRLEN) :: rcsidentstring
83  INTEGER :: cvmixtpres,cvmixtxvel,cvmixtyvel,cvmixtzvel,errorflag,upplim
84  INTEGER :: dummy(1)
85  INTEGER, DIMENSION(:,:), ALLOCATABLE :: loc
86  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcv
87  TYPE(t_grid), POINTER :: pgrid
88  TYPE(t_global), POINTER :: global
89 
90  rcsidentstring = '$RCSfile: RFLU_PrintFlowInfo.F90,v $ $Revision: 1.18 $'
91 
92 ! ******************************************************************************
93 ! Start
94 ! ******************************************************************************
95 
96  global => pregion%global
97 
98  CALL registerfunction(global,'RFLU_PrintFlowInfo',&
99  'RFLU_PrintFlowInfo.F90')
100 
101  IF ( global%verbLevel >= verbose_high ) THEN
102  WRITE(stdout,'(A,1X,A)') solver_name,'Printing flow information...'
103  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
104  pregion%iRegionGlobal
105  IF ( global%flowType == flow_unsteady ) THEN
106  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
107  global%currentTime
108  END IF ! global%flowType
109  END IF ! global%verbLevel
110 
111 ! ******************************************************************************
112 ! Set pointers
113 ! ******************************************************************************
114 
115  pcv => pregion%mixt%cv
116  pgrid => pregion%grid
117 
118 ! ******************************************************************************
119 ! Set upper limit: useful for checking of cell/dummy cell values
120 ! ******************************************************************************
121 
122  upplim = pgrid%nCells ! Only internal cells
123 ! uppLim = pGrid%nCellsTot ! Also dummy cells
124 
125 ! ******************************************************************************
126 ! Convert to primitive state vector (only if dv and gv are allocated)
127 ! ******************************************************************************
128 
129 ! TEMPORARY: Converting to another state vector format for printing purposes
130 ! breaks perfect binary restart, because the cv values are overwritten, and on
131 ! converting back to the original conserved variuables, it is not guaranteed
132 ! that the values are identical to the original ones. Statement further down
133 ! to convert back is also commented out.
134 ! IF ( (ASSOCIATED(pRegion%mixt%dv) .EQV. .TRUE.) .AND. &
135 ! (ASSOCIATED(pRegion%mixt%gv) .EQV. .TRUE.) ) THEN
136 ! CALL RFLU_ConvertCvCons2Prim(pRegion,CV_MIXT_STATE_DUVWP)
137 ! END IF ! ASSOCIATED
138 ! END TEMPORARY
139 
140 ! ******************************************************************************
141 ! Allocate temporary memory
142 ! ******************************************************************************
143 
144  ALLOCATE(loc(pregion%mixtInput%nCv,min_val:max_val),stat=errorflag)
145  global%error = errorflag
146  IF ( global%error /= err_none ) THEN
147  CALL errorstop(global,err_allocate,__line__,'loc')
148  END IF ! global%error
149 
150 ! ******************************************************************************
151 ! Find locations of extrema: NOTE Asinine coding needed because of poor
152 ! FORTRAN interface for MINLOC and MAXLOC functions...
153 ! ******************************************************************************
154 
155  SELECT CASE ( pregion%mixtInput%fluidModel )
156 
157 ! ==============================================================================
158 ! Incompressible fluid model
159 ! ==============================================================================
160 
161  CASE ( fluid_model_incomp )
162  cvmixtxvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_xvel)
163  cvmixtyvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_yvel)
164  cvmixtzvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_zvel)
165  cvmixtpres = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_pres)
166 
167  dummy = minloc(pcv(cvmixtxvel,1:upplim))
168  loc(cvmixtxvel,min_val) = dummy(1)
169 
170  dummy = minloc(pcv(cvmixtyvel,1:upplim))
171  loc(cvmixtyvel,min_val) = dummy(1)
172 
173  dummy = minloc(pcv(cvmixtzvel,1:upplim))
174  loc(cvmixtzvel,min_val) = dummy(1)
175 
176  dummy = minloc(pcv(cvmixtpres,1:upplim))
177  loc(cvmixtpres,min_val) = dummy(1)
178 
179  dummy = maxloc(pcv(cvmixtxvel,1:upplim))
180  loc(cvmixtxvel,max_val) = dummy(1)
181 
182  dummy = maxloc(pcv(cvmixtyvel,1:upplim))
183  loc(cvmixtyvel,max_val) = dummy(1)
184 
185  dummy = maxloc(pcv(cvmixtzvel,1:upplim))
186  loc(cvmixtzvel,max_val) = dummy(1)
187 
188  dummy = maxloc(pcv(cvmixtpres,1:upplim))
189  loc(cvmixtpres,max_val) = dummy(1)
190 
191 ! ==============================================================================
192 ! Compressible fluid model
193 ! ==============================================================================
194 
195  CASE ( fluid_model_comp )
196  dummy = minloc(pcv(cv_mixt_dens,1:upplim))
197  loc(cv_mixt_dens,min_val) = dummy(1)
198 
199  dummy = minloc(pcv(cv_mixt_xmom,1:upplim))
200  loc(cv_mixt_xmom,min_val) = dummy(1)
201 
202  dummy = minloc(pcv(cv_mixt_ymom,1:upplim))
203  loc(cv_mixt_ymom,min_val) = dummy(1)
204 
205  dummy = minloc(pcv(cv_mixt_zmom,1:upplim))
206  loc(cv_mixt_zmom,min_val) = dummy(1)
207 
208  dummy = minloc(pcv(cv_mixt_ener,1:upplim))
209  loc(cv_mixt_ener,min_val) = dummy(1)
210 
211 
212  dummy = maxloc(pcv(cv_mixt_dens,1:upplim))
213  loc(cv_mixt_dens,max_val) = dummy(1)
214 
215  dummy = maxloc(pcv(cv_mixt_xmom,1:upplim))
216  loc(cv_mixt_xmom,max_val) = dummy(1)
217 
218  dummy = maxloc(pcv(cv_mixt_ymom,1:upplim))
219  loc(cv_mixt_ymom,max_val) = dummy(1)
220 
221  dummy = maxloc(pcv(cv_mixt_zmom,1:upplim))
222  loc(cv_mixt_zmom,max_val) = dummy(1)
223 
224  dummy = maxloc(pcv(cv_mixt_ener,1:upplim))
225  loc(cv_mixt_ener,max_val) = dummy(1)
226 
227 ! ==============================================================================
228 ! Default
229 ! ==============================================================================
230 
231  CASE default
232  CALL errorstop(global,err_reached_default,__line__)
233  END SELECT ! pRegion%mixtInput%fluidModel
234 
235 
236 ! ******************************************************************************
237 ! Print locations of extrema
238 ! ******************************************************************************
239 
240  SELECT CASE ( pregion%mixtInput%fluidModel )
241 
242 ! ==============================================================================
243 ! Incompressible fluid model
244 ! ==============================================================================
245 
246  CASE ( fluid_model_incomp )
247  cvmixtxvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_xvel)
248  cvmixtyvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_yvel)
249  cvmixtzvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_zvel)
250  cvmixtpres = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_pres)
251 
252  IF ( global%verbLevel >= verbose_high ) THEN
253  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
254  solver_name,'X-velocity (m/s):', &
255  minval(pcv(cvmixtxvel,1:upplim)), &
256  maxval(pcv(cvmixtxvel,1:upplim)), &
257  loc(cvmixtxvel,min_val),loc(cvmixtxvel,max_val)
258  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
259  solver_name,'Y-velocity (m/s):', &
260  minval(pcv(cvmixtyvel,1:upplim)), &
261  maxval(pcv(cvmixtyvel,1:upplim)), &
262  loc(cvmixtyvel,min_val),loc(cvmixtyvel,max_val)
263  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
264  solver_name,'Z-velocity (m/s):', &
265  minval(pcv(cvmixtzvel,1:upplim)), &
266  maxval(pcv(cvmixtzvel,1:upplim)), &
267  loc(cvmixtzvel,min_val),loc(cvmixtzvel,max_val)
268  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
269  solver_name,'Pressure (N/m^2):', &
270  minval(pcv(cvmixtpres,1:upplim)), &
271  maxval(pcv(cvmixtpres,1:upplim)), &
272  loc(cvmixtpres,min_val),loc(cvmixtpres,max_val)
273  END IF !global%verbLevel
274 
275 ! ==============================================================================
276 ! Compressible fluid model
277 ! ==============================================================================
278 
279  CASE ( fluid_model_comp )
280 
281 ! ------------------------------------------------------------------------------
282 ! Conservative state vector
283 ! ------------------------------------------------------------------------------
284 
285  SELECT CASE ( pregion%mixt%cvState )
286  CASE ( cv_mixt_state_cons )
287  IF ( global%verbLevel >= verbose_high ) THEN
288  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
289  solver_name,'Density (kg/m^3): ', &
290  minval(pcv(cv_mixt_dens,1:upplim)), &
291  maxval(pcv(cv_mixt_dens,1:upplim)), &
292  loc(cv_mixt_dens,min_val),loc(cv_mixt_dens,max_val)
293  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
294  solver_name,'X-momentum (kg/m^2s):', &
295  minval(pcv(cv_mixt_xmom,1:upplim)), &
296  maxval(pcv(cv_mixt_xmom,1:upplim)), &
297  loc(cv_mixt_xmom,min_val),loc(cv_mixt_xmom,max_val)
298  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
299  solver_name,'Y-momentum (kg/m^2s):', &
300  minval(pcv(cv_mixt_ymom,1:upplim)), &
301  maxval(pcv(cv_mixt_ymom,1:upplim)), &
302  loc(cv_mixt_ymom,min_val),loc(cv_mixt_ymom,max_val)
303  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
304  solver_name,'Z-momentum (kg/m^2s):', &
305  minval(pcv(cv_mixt_zmom,1:upplim)), &
306  maxval(pcv(cv_mixt_zmom,1:upplim)), &
307  loc(cv_mixt_zmom,min_val),loc(cv_mixt_zmom,max_val)
308  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
309  solver_name,'Energy (N/m^2): ', &
310  minval(pcv(cv_mixt_ener,1:upplim)), &
311  maxval(pcv(cv_mixt_ener,1:upplim)), &
312  loc(cv_mixt_ener,min_val),loc(cv_mixt_ener,max_val)
313  END IF !global%verbLevel
314 
315 ! ------------------------------------------------------------------------------
316 ! Primitive state vector
317 ! ------------------------------------------------------------------------------
318 
319  CASE ( cv_mixt_state_prim )
320  IF ( global%verbLevel >= verbose_high ) THEN
321  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
322  solver_name,'Density (kg/m^3):', &
323  minval(pcv(cv_mixt_dens,1:upplim)), &
324  maxval(pcv(cv_mixt_dens,1:upplim)), &
325  loc(cv_mixt_dens,min_val),loc(cv_mixt_dens,max_val)
326  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
327  solver_name,'X-velocity (m/s):', &
328  minval(pcv(cv_mixt_xvel,1:upplim)), &
329  maxval(pcv(cv_mixt_xvel,1:upplim)), &
330  loc(cv_mixt_xvel,min_val),loc(cv_mixt_xvel,max_val)
331  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
332  solver_name,'Y-velocity (m/s):', &
333  minval(pcv(cv_mixt_yvel,1:upplim)), &
334  maxval(pcv(cv_mixt_yvel,1:upplim)), &
335  loc(cv_mixt_yvel,min_val),loc(cv_mixt_yvel,max_val)
336  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
337  solver_name,'Z-velocity (m/s):', &
338  minval(pcv(cv_mixt_zvel,1:upplim)), &
339  maxval(pcv(cv_mixt_zvel,1:upplim)), &
340  loc(cv_mixt_zvel,min_val),loc(cv_mixt_zvel,max_val)
341  END IF !global%verbLevel
342 
343  SELECT CASE ( pregion%mixt%cvState )
344 
345 ! --------- Pressure as last entry ---------------------------------------------
346 
347  CASE ( cv_mixt_state_duvwp )
348  IF ( global%verbLevel >= verbose_high ) THEN
349  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
350  solver_name,'Pressure (N/m^2):', &
351  minval(pcv(cv_mixt_pres,1:upplim)), &
352  maxval(pcv(cv_mixt_pres,1:upplim)), &
353  loc(cv_mixt_pres,min_val), &
354  loc(cv_mixt_pres,max_val)
355  END IF !global%verbLevel
356 
357 ! --------- Temperature as last entry ------------------------------------------
358 
359  CASE ( cv_mixt_state_duvwt )
360  IF ( global%verbLevel >= verbose_high ) THEN
361  WRITE(stdout,'(A,3X,A,2(1X,E23.16),2(1X,I9))') &
362  solver_name,'Temperature (K): ', &
363  minval(pcv(cv_mixt_temp,1:upplim)), &
364  maxval(pcv(cv_mixt_temp,1:upplim)), &
365  loc(cv_mixt_temp,min_val), &
366  loc(cv_mixt_temp,max_val)
367  END IF !global%verbLevel
368  CASE default
369  CALL errorstop(global,err_reached_default,__line__)
370  END SELECT ! pRegion%mixt%cvState
371  CASE default
372  CALL errorstop(global,err_reached_default,__line__)
373  END SELECT ! pRegion%mixt%cvState
374 
375 ! ==============================================================================
376 ! Default
377 ! ==============================================================================
378 
379  CASE default
380  CALL errorstop(global,err_reached_default,__line__)
381  END SELECT ! pRegion%mixtInput%fluidModel
382 
383 ! ******************************************************************************
384 ! Print out locations of cells at which extrema occur and deallocate temporary
385 ! memory.
386 ! ******************************************************************************
387 
388  IF ( global%verbLevel >= verbose_med ) THEN
389  CALL rflu_printlocinfo(pregion,loc,pregion%mixtInput%nCv, &
390  locinfo_mode_silent,output_mode_master_only)
391  END IF ! global%verbLevel
392 
393  DEALLOCATE(loc,stat=errorflag)
394  global%error = errorflag
395  IF ( global%error /= err_none ) THEN
396  CALL errorstop(global,err_deallocate,__line__,'loc')
397  END IF ! global%error
398 
399 ! ******************************************************************************
400 ! Convert back to conservative state vector and Check that cv has the correct
401 ! state: Defensive programming - DO NOT ADD ANY STATEMENTS AFTER THESE, THEY
402 ! MIGHT SCREW UP ROCFLU
403 ! ******************************************************************************
404 
405 ! TEMPORARY: See comment above
406 ! IF ( pRegion%mixt%cvState /= CV_MIXT_STATE_CONS ) THEN
407 ! CALL RFLU_ConvertCvPrim2Cons(pRegion,CV_MIXT_STATE_CONS)
408 ! END IF ! pRegion%mixt%cvState
409 ! END TEMPORARY
410 
411 ! ******************************************************************************
412 ! End
413 ! ******************************************************************************
414 
415  IF ( global%verbLevel >= verbose_high ) THEN
416  WRITE(stdout,'(A,1X,A)') solver_name,'Printing flow information done.'
417  END IF ! global%verbLevel
418 
419  CALL deregisterfunction(global)
420 
421 END SUBROUTINE rflu_printflowinfo
422 
423 ! ******************************************************************************
424 !
425 ! RCS Revision history:
426 !
427 ! $Log: RFLU_PrintFlowInfo.F90,v $
428 ! Revision 1.18 2008/12/06 08:44:12 mtcampbe
429 ! Updated license.
430 !
431 ! Revision 1.17 2008/11/19 22:17:25 mtcampbe
432 ! Added Illinois Open Source License/Copyright
433 !
434 ! Revision 1.16 2006/03/26 20:21:37 haselbac
435 ! Removed error traps for GL model
436 !
437 ! Revision 1.15 2004/11/14 19:40:50 haselbac
438 ! Added printing of info for incompressible fluid model, cosmetics
439 !
440 ! Revision 1.14 2004/01/22 16:04:48 haselbac
441 ! Changed declaration to eliminate warning on ALC
442 !
443 ! Revision 1.13 2003/12/04 03:23:49 haselbac
444 ! Fixed bug in comment, cosmetic changes
445 !
446 ! Revision 1.12 2003/06/04 22:03:12 haselbac
447 ! Added argument to printing of locations
448 !
449 ! Revision 1.11 2003/03/15 17:01:56 haselbac
450 ! Increased precision, adapted subroutine call
451 !
452 ! Revision 1.10 2003/01/28 15:37:52 haselbac
453 ! Commented out calls to change state vector - see comments
454 !
455 ! Revision 1.9 2002/10/17 14:11:02 haselbac
456 ! Added writing out of iRegionGlobal
457 !
458 ! Revision 1.8 2002/10/16 21:12:06 haselbac
459 ! Only print time for unsteady flows
460 !
461 ! Revision 1.7 2002/10/12 14:50:05 haselbac
462 ! Added WRITE statement for currentTime (for GENX use)
463 !
464 ! Revision 1.6 2002/09/09 14:15:01 haselbac
465 ! global now under regions, distinguish between cons and prim cv
466 !
467 ! Revision 1.5 2002/07/25 14:43:12 haselbac
468 ! Added upper limit, useful for checking of dummy cells
469 !
470 ! Revision 1.4 2002/06/17 13:31:22 haselbac
471 ! Prefixed SOLVER_NAME to all screen output
472 !
473 ! Revision 1.3 2002/05/04 19:10:49 haselbac
474 ! Coded differently, did not compile on Turing
475 !
476 ! Revision 1.2 2002/05/04 16:13:31 haselbac
477 ! Added call to RFLU_PrintLocInfo
478 !
479 ! Revision 1.1 2002/04/11 18:42:25 haselbac
480 ! Initial revision
481 !
482 ! ******************************************************************************
483 
484 
485 
486 
487 
488 
489 
INTEGER function rflu_getcvloc(global, fluidModel, var)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflu_printflowinfo(pRegion)
subroutine rflu_printlocinfo(pRegion, locUnsorted, nLocUnsorted, locInfoMode, outputMode)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469