Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModReadWriteFlow.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: Suite of routines to read and write mixture solution files.
26 !
27 ! Description: None.
28 !
29 ! Notes: None.
30 !
31 ! ******************************************************************************
32 !
33 ! $Id: RFLU_ModReadWriteFlow.F90,v 1.13 2008/12/06 08:44:23 mtcampbe Exp $
34 !
35 ! Copyright: (c) 2004-2006 by the University of Illinois
36 !
37 ! ******************************************************************************
38 
40 
41  USE modparameters
42  USE moddatatypes
43  USE moderror
44  USE modglobal, ONLY: t_global
45  USE modbndpatch, ONLY: t_patch
46  USE moddatastruct, ONLY: t_region
47  USE modgrid, ONLY: t_grid
48  USE modmpi
49 
52 
53  USE modinterfaces, ONLY: rflu_getcvloc
54 
55  IMPLICIT NONE
56  include 'roccomf90.h'
57 
58  PRIVATE
59  PUBLIC :: rflu_readflowwrapper, &
61 
62 ! ******************************************************************************
63 ! Declarations and definitions
64 ! ******************************************************************************
65 
66  CHARACTER(CHRLEN) :: RCSIdentString = &
67  '$RCSfile: RFLU_ModReadWriteFlow.F90,v $ $Revision: 1.13 $'
68 
69 ! ******************************************************************************
70 ! Routines
71 ! ******************************************************************************
72 
73  CONTAINS
74 
75 
76 
77 
78 
79 
80 ! ******************************************************************************
81 !
82 ! Purpose: Read flow file for mixture in ASCII ROCFLU format.
83 !
84 ! Description: None.
85 !
86 ! Input:
87 ! pRegion Pointer to region
88 !
89 ! Output: None.
90 !
91 ! Notes:
92 ! 1. Read initial residual and physical time for both steady and unsteady
93 ! flows so that could use steady solution as input for unsteady run and
94 ! vice versa.
95 !
96 ! ******************************************************************************
97 
98  SUBROUTINE rflu_readflowascii(pRegion)
99 
100  IMPLICIT NONE
101 
102 ! ******************************************************************************
103 ! Declarations and definitions
104 ! ******************************************************************************
105 
106 ! ==============================================================================
107 ! Arguments
108 ! ==============================================================================
109 
110  TYPE(t_region), POINTER :: pregion
111 
112 ! ==============================================================================
113 ! Local variables
114 ! ==============================================================================
115 
116  LOGICAL :: fileexists
117  CHARACTER(CHRLEN) :: errorstring,ifilename,ifilenameold,sectionstring, &
118  timestring1,timestring2
119  INTEGER :: cvmixtdens,cvmixtener,cvmixtpres,cvmixtxmom,cvmixtxvel, &
120  cvmixtymom,cvmixtyvel,cvmixtzmom,cvmixtzvel,errorflag,i, &
121  ifile,ivars,j,loopcounter,ncellstot,ncellsexpected,nvars, &
122  nvarsexpected,precactual,precexpected,rangeactual, &
123  rangeexpected
124  REAL(RFREAL) :: currenttime
125  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcv
126  TYPE(t_grid), POINTER :: pgrid
127  TYPE(t_global), POINTER :: global
128 
129 ! ******************************************************************************
130 ! Start, open file
131 ! ******************************************************************************
132 
133  global => pregion%global
134 
135  CALL registerfunction(global,'RFLU_ReadFlowASCII',&
136  'RFLU_ModReadWriteFlow.F90')
137 
138  IF ( global%myProcid == masterproc .AND. &
139  global%verbLevel > verbose_none ) THEN
140  WRITE(stdout,'(A,1X,A)') solver_name,'Reading ASCII flow file...'
141  END IF ! global%verbLevel
142 
143  IF ( global%flowType == flow_unsteady ) THEN
144  CALL buildfilenameunsteady(global,filedest_indir,'.mixt.cva', &
145  pregion%iRegionGlobal,global%currentTime, &
146  ifilename)
147  CALL buildfilenameunsteady(global,filedest_indir,'.floa', &
148  pregion%iRegionGlobal,global%currentTime, &
149  ifilenameold)
150 
151  IF ( global%myProcid == masterproc .AND. &
152  global%verbLevel > verbose_none ) THEN
153  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
154  pregion%iRegionGlobal
155  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
156  global%currentTime
157  END IF ! global%verbLevel
158  ELSE
159  CALL buildfilenamesteady(global,filedest_indir,'.mixt.cva', &
160  pregion%iRegionGlobal,global%currentIter, &
161  ifilename)
162  CALL buildfilenamesteady(global,filedest_indir,'.floa', &
163  pregion%iRegionGlobal,global%currentIter, &
164  ifilenameold)
165 
166  IF ( global%myProcid == masterproc .AND. &
167  global%verbLevel > verbose_none ) THEN
168  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
169  pregion%iRegionGlobal
170  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name,'Current iteration '// &
171  'number:',global%currentIter
172  END IF ! global%verbLevel
173  ENDIF ! global%flowType
174 
175  ifile = if_solut
176 
177  INQUIRE(file=ifilename,exist=fileexists)
178 
179  IF ( fileexists .EQV. .true. ) THEN
180  OPEN(ifile,file=ifilename,form="FORMATTED",status="OLD", &
181  iostat=errorflag)
182  global%error = errorflag
183  IF ( global%error /= err_none ) THEN
184  CALL errorstop(global,err_file_open,__line__,ifilename)
185  END IF ! global%error
186  ELSE
187  OPEN(ifile,file=ifilenameold,form="FORMATTED",status="OLD", &
188  iostat=errorflag)
189  global%error = errorflag
190  IF ( global%error /= err_none ) THEN
191  CALL errorstop(global,err_file_open,__line__,ifilenameold)
192  END IF ! global%error
193  END IF ! fileExists
194 
195 ! ==============================================================================
196 ! Set state vector state depending on fluid model
197 ! ==============================================================================
198 
199  SELECT CASE ( pregion%mixtInput%fluidModel )
200  CASE ( fluid_model_comp )
201  pregion%mixt%cvState = cv_mixt_state_cons
202  CASE ( fluid_model_incomp )
203  pregion%mixt%cvState = cv_mixt_state_prim
204  CASE default
205  CALL errorstop(global,err_reached_default,__line__)
206  END SELECT ! pRegion%mixtInput%fluidModel
207 
208 ! ==============================================================================
209 ! Header and general information
210 ! ==============================================================================
211 
212  IF ( global%myProcid == masterproc .AND. &
213  global%verbLevel > verbose_low ) THEN
214  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
215  END IF ! global%verbLevel
216 
217  READ(ifile,'(A)') sectionstring
218  IF ( trim(sectionstring) /= '# ROCFLU flow file' ) THEN
219  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
220  END IF ! TRIM
221 
222 ! -----------------------------------------------------------------------------
223 ! Precision and range
224 ! -----------------------------------------------------------------------------
225 
226  READ(ifile,'(A)') sectionstring
227  IF ( trim(sectionstring) /= '# Precision and range' ) THEN
228  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
229  END IF ! TRIM
230 
231  precexpected = precision(1.0_rfreal)
232  rangeexpected = range(1.0_rfreal)
233 
234  READ(ifile,'(2(I8))') precactual,rangeactual
235  IF ( precactual < precexpected .OR. rangeactual < rangeexpected ) THEN
236  CALL errorstop(global,err_prec_range,__line__)
237  END IF ! precActual
238 
239 ! -----------------------------------------------------------------------------
240 ! Initial residual and physical time
241 ! -----------------------------------------------------------------------------
242 
243  READ(ifile,'(A)') sectionstring
244  IF ( trim(sectionstring) /= '# Initial residual' ) THEN
245  CALL errorstop(global,err_invalid_marker,__line__,ifilename)
246  END IF ! TRIM
247 
248  READ(ifile,'(E23.16)') global%resInit
249 
250  READ(ifile,'(A)') sectionstring
251  IF ( trim(sectionstring) /= '# Physical time' ) THEN
252  CALL errorstop(global,err_invalid_marker,__line__,ifilename)
253  END IF ! TRIM
254 
255  READ(ifile,'(E23.16)') currenttime
256 
257  IF ( global%flowType == flow_unsteady ) THEN
258  IF ( global%currentTime < 0.0_rfreal ) THEN
259  global%currentTime = currenttime
260  ELSE
261  WRITE(timestring1,'(1PE11.5)') global%currentTime
262  WRITE(timestring2,'(1PE11.5)') currenttime
263 
264  IF ( trim(timestring1) /= trim(timestring2) ) THEN
265  WRITE(stdout,'(A,4(1X,A))') solver_name, &
266  '*** WARNING *** Time mismatch:', &
267  trim(timestring1),'vs.',trim(timestring2)
268 
269  global%warnCounter = global%warnCounter + 1
270  END IF ! global%currentTime
271  END IF ! global%currentTime
272  END IF ! global%flowType
273 
274 ! ==============================================================================
275 ! Dimensions
276 ! ==============================================================================
277 
278  pgrid => pregion%grid
279 
280  nvarsexpected = pregion%mixtInput%nCv
281  ncellsexpected = pgrid%nCellsTot
282 
283  READ(ifile,'(A)') sectionstring
284  IF ( trim(sectionstring) /= '# Dimensions' ) THEN
285  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
286  END IF ! TRIM
287 
288  READ(ifile,'(2(I8))') ncellstot,nvars
289  IF ( ncellstot /= ncellsexpected ) THEN
290  WRITE(errorstring,'(A,1X,I6,1X,A,1X,I6)') 'Specified:',ncellstot, &
291  'but expected:',ncellsexpected
292  CALL errorstop(global,err_invalid_ncells,__line__,errorstring)
293  END IF ! nCellsExpected
294 
295  IF ( nvars /= nvarsexpected ) THEN
296  WRITE(errorstring,'(A,1X,I6,1X,A,1X,I6)') 'Specified:',nvars, &
297  'but expected:',nvarsexpected
298  CALL errorstop(global,err_invalid_nvars,__line__)
299  END IF ! nVarsExpected
300 
301 ! ==============================================================================
302 ! Rest of file
303 ! ==============================================================================
304 
305  ivars = 0
306  loopcounter = 0
307 
308  DO ! set up infinite loop
309  loopcounter = loopcounter + 1
310 
311  READ(ifile,'(A)') sectionstring
312 
313  SELECT CASE ( trim(sectionstring) )
314 
315 ! ------------------------------------------------------------------------------
316 ! Mixture density - compressible solver
317 ! ------------------------------------------------------------------------------
318 
319  CASE ( '# Mixture density' )
320  IF ( global%myProcid == masterproc .AND. &
321  global%verbLevel > verbose_low ) THEN
322  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture density...'
323  END IF ! global%verbLevel
324 
325  pcv => pregion%mixt%cv
326 
327  ivars = ivars + 1
328 
329  cvmixtdens = rflu_getcvloc(global,fluid_model_comp,cv_mixt_dens)
330 
331  READ(ifile,'(5(E23.16))') (pcv(cvmixtdens,j),j=1,pgrid%nCellsTot)
332 
333 ! ------------------------------------------------------------------------------
334 ! Mixture x-momentum - compressible solver
335 ! ------------------------------------------------------------------------------
336 
337  CASE ( '# Mixture x-momentum' )
338  IF ( global%myProcid == masterproc .AND. &
339  global%verbLevel > verbose_low ) THEN
340  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture x-momentum...'
341  END IF ! global%verbLevel
342 
343  pcv => pregion%mixt%cv
344 
345  ivars = ivars + 1
346 
347  cvmixtxmom = rflu_getcvloc(global,fluid_model_comp,cv_mixt_xmom)
348 
349  READ(ifile,'(5(E23.16))') (pcv(cvmixtxmom,j),j=1,pgrid%nCellsTot)
350 
351 ! ------------------------------------------------------------------------------
352 ! Mixture x-velocity - incompressible solver
353 ! ------------------------------------------------------------------------------
354 
355  CASE ( '# Mixture x-velocity' )
356  IF ( global%myProcid == masterproc .AND. &
357  global%verbLevel > verbose_low ) THEN
358  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture x-velocity...'
359  END IF ! global%verbLevel
360 
361  pcv => pregion%mixt%cv
362 
363  ivars = ivars + 1
364 
365  cvmixtxvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_xvel)
366 
367  READ(ifile,'(5(E23.16))') (pcv(cvmixtxvel,j),j=1,pgrid%nCellsTot)
368 
369 ! ------------------------------------------------------------------------------
370 ! Mixture y-momentum - compressible solver
371 ! ------------------------------------------------------------------------------
372 
373  CASE ( '# Mixture y-momentum' )
374  IF ( global%myProcid == masterproc .AND. &
375  global%verbLevel > verbose_low ) THEN
376  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture y-momentum...'
377  END IF ! global%verbLevel
378 
379  pcv => pregion%mixt%cv
380 
381  ivars = ivars + 1
382 
383  cvmixtymom = rflu_getcvloc(global,fluid_model_comp,cv_mixt_ymom)
384 
385  READ(ifile,'(5(E23.16))') (pcv(cvmixtymom,j),j=1,pgrid%nCellsTot)
386 
387 ! ------------------------------------------------------------------------------
388 ! Mixture y-velocity - incompressible solver
389 ! ------------------------------------------------------------------------------
390 
391  CASE ( '# Mixture y-velocity' )
392  IF ( global%myProcid == masterproc .AND. &
393  global%verbLevel > verbose_low ) THEN
394  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture y-velocity...'
395  END IF ! global%verbLevel
396 
397  pcv => pregion%mixt%cv
398 
399  ivars = ivars + 1
400 
401  cvmixtyvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_yvel)
402 
403  READ(ifile,'(5(E23.16))') (pcv(cvmixtyvel,j),j=1,pgrid%nCellsTot)
404 
405 ! ------------------------------------------------------------------------------
406 ! Mixture z-momentum - compressible solver
407 ! ------------------------------------------------------------------------------
408 
409  CASE ( '# Mixture z-momentum' )
410  IF ( global%myProcid == masterproc .AND. &
411  global%verbLevel > verbose_low ) THEN
412  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture z-momentum...'
413  END IF ! global%verbLevel
414 
415  pcv => pregion%mixt%cv
416 
417  ivars = ivars + 1
418 
419  cvmixtzmom = rflu_getcvloc(global,fluid_model_comp,cv_mixt_zmom)
420 
421  READ(ifile,'(5(E23.16))') (pcv(cvmixtzmom,j),j=1,pgrid%nCellsTot)
422 
423 ! ------------------------------------------------------------------------------
424 ! Mixture z-velocity - incompressible solver
425 ! ------------------------------------------------------------------------------
426 
427  CASE ( '# Mixture z-velocity' )
428  IF ( global%myProcid == masterproc .AND. &
429  global%verbLevel > verbose_low ) THEN
430  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture z-velocity...'
431  END IF ! global%verbLevel
432 
433  pcv => pregion%mixt%cv
434 
435  ivars = ivars + 1
436 
437  cvmixtzvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_zvel)
438 
439  READ(ifile,'(5(E23.16))') (pcv(cvmixtzvel,j),j=1,pgrid%nCellsTot)
440 
441 ! ------------------------------------------------------------------------------
442 ! Mixture total internal energy - compressible solver
443 ! ------------------------------------------------------------------------------
444 
445  CASE ( '# Mixture total internal energy' )
446  IF ( global%myProcid == masterproc .AND. &
447  global%verbLevel > verbose_low ) THEN
448  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture total internal '// &
449  'energy...'
450  END IF ! global%verbLevel
451 
452  pcv => pregion%mixt%cv
453 
454  ivars = ivars + 1
455 
456  cvmixtener = rflu_getcvloc(global,fluid_model_comp,cv_mixt_ener)
457 
458  READ(ifile,'(5(E23.16))') (pcv(cvmixtener,j),j=1,pgrid%nCellsTot)
459 
460 ! ------------------------------------------------------------------------------
461 ! Mixture pressure - incompressible solver
462 ! ------------------------------------------------------------------------------
463 
464  CASE ( '# Mixture pressure' )
465  IF ( global%myProcid == masterproc .AND. &
466  global%verbLevel > verbose_low ) THEN
467  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture pressure...'
468  END IF ! global%verbLevel
469 
470  pcv => pregion%mixt%cv
471 
472  ivars = ivars + 1
473 
474  cvmixtpres = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_pres)
475 
476  READ(ifile,'(5(E23.16))') (pcv(cvmixtpres,j),j=1,pgrid%nCellsTot)
477 
478 ! ------------------------------------------------------------------------------
479 ! End marker
480 ! ------------------------------------------------------------------------------
481 
482  CASE ( '# End' )
483  IF ( global%myProcid == masterproc .AND. &
484  global%verbLevel > verbose_low ) THEN
485  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
486  END IF ! global%verbLevel
487 
488  EXIT
489 
490 ! ------------------------------------------------------------------------------
491 ! Invalid section string
492 ! ------------------------------------------------------------------------------
493 
494  CASE default
495  IF ( global%verbLevel > verbose_low ) THEN
496  WRITE(stdout,'(A,3X,A)') solver_name,sectionstring
497  END IF ! verbosityLevel
498 
499  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
500 
501  END SELECT ! TRIM
502 
503 ! ------------------------------------------------------------------------------
504 ! Guard against infinite loop - might be unnecessary because of read errors?
505 ! ------------------------------------------------------------------------------
506 
507  IF ( loopcounter >= limit_infinite_loop ) THEN
508  CALL errorstop(global,err_infinite_loop,__line__)
509  END IF ! loopCounter
510  END DO ! <empty>
511 
512 ! ==============================================================================
513 ! Check and information about number of variables read
514 ! ==============================================================================
515 
516  IF ( ivars /= nvars ) THEN
517  CALL errorstop(global,err_invalid_nvars,__line__)
518  END IF ! iVar
519 
520 ! ==============================================================================
521 ! Close file
522 ! ==============================================================================
523 
524  CLOSE(ifile,iostat=errorflag)
525  global%error = errorflag
526  IF ( global%error /= err_none ) THEN
527  CALL errorstop(global,err_file_close,__line__,ifilename)
528  END IF ! global%error
529 
530 ! ******************************************************************************
531 ! End
532 ! ******************************************************************************
533 
534  IF ( global%myProcid == masterproc .AND. &
535  global%verbLevel > verbose_none ) THEN
536  WRITE(stdout,'(A,1X,A)') solver_name,'Reading ASCII flow file done.'
537  END IF ! global%verbLevel
538 
539  CALL deregisterfunction(global)
540 
541  END SUBROUTINE rflu_readflowascii
542 
543 
544 
545 
546 
547 
548 
549 ! ******************************************************************************
550 !
551 ! Purpose: Read flow file for mixture in binary ROCFLU format.
552 !
553 ! Description: None.
554 !
555 ! Input:
556 ! pRegion Pointer to region
557 !
558 ! Output: None.
559 !
560 ! Notes:
561 ! 1. Read initial residual and physical time for both steady and unsteady
562 ! flows so that could use steady solution as input for unsteady run and
563 ! vice versa.
564 !
565 ! ******************************************************************************
566 
567  SUBROUTINE rflu_readflowbinary(pRegion)
568 
569  IMPLICIT NONE
570 
571 ! ******************************************************************************
572 ! Declarations and definitions
573 ! ******************************************************************************
574 
575 ! ==============================================================================
576 ! Arguments
577 ! ==============================================================================
578 
579  TYPE(t_region), POINTER :: pregion
580 
581 ! ==============================================================================
582 ! Local variables
583 ! ==============================================================================
584 
585  LOGICAL :: fileexists
586  CHARACTER(CHRLEN) :: errorstring,ifilename,ifilenameold,sectionstring, &
587  timestring1,timestring2
588  INTEGER :: cvmixtdens,cvmixtener,cvmixtpres,cvmixtxmom,cvmixtxvel, &
589  cvmixtymom,cvmixtyvel,cvmixtzmom,cvmixtzvel,errorflag,i, &
590  ifile,ivars,j,loopcounter,ncellstot,ncellsexpected,nvars, &
591  nvarsexpected,precactual,precexpected,rangeactual, &
592  rangeexpected
593  REAL(RFREAL) :: currenttime
594  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcv
595  TYPE(t_grid), POINTER :: pgrid
596  TYPE(t_global), POINTER :: global
597 
598 ! ******************************************************************************
599 ! Start, open file
600 ! ******************************************************************************
601 
602  global => pregion%global
603 
604  CALL registerfunction(global,'RFLU_ReadFlowBinary',&
605  'RFLU_ModReadWriteFlow.F90')
606 
607  IF ( global%myProcid == masterproc .AND. &
608  global%verbLevel > verbose_none ) THEN
609  WRITE(stdout,'(A,1X,A)') solver_name,'Reading binary flow file...'
610  END IF ! global%verbLevel
611 
612  IF ( global%flowType == flow_unsteady ) THEN
613  CALL buildfilenameunsteady(global,filedest_indir,'.mixt.cv', &
614  pregion%iRegionGlobal,global%currentTime, &
615  ifilename)
616  CALL buildfilenameunsteady(global,filedest_indir,'.flo', &
617  pregion%iRegionGlobal,global%currentTime, &
618  ifilenameold)
619 
620  IF ( global%myProcid == masterproc .AND. &
621  global%verbLevel > verbose_none ) THEN
622  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
623  pregion%iRegionGlobal
624  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
625  global%currentTime
626  END IF ! global%verbLevel
627  ELSE
628  CALL buildfilenamesteady(global,filedest_indir,'.mixt.cv', &
629  pregion%iRegionGlobal,global%currentIter, &
630  ifilename)
631  CALL buildfilenamesteady(global,filedest_indir,'.flo', &
632  pregion%iRegionGlobal,global%currentIter, &
633  ifilenameold)
634 
635  IF ( global%myProcid == masterproc .AND. &
636  global%verbLevel > verbose_none ) THEN
637  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
638  pregion%iRegionGlobal
639  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name,'Current iteration '// &
640  'number:',global%currentIter
641  END IF ! global%verbLevel
642  ENDIF ! global%flowType
643 
644  ifile = if_solut
645 
646  INQUIRE(file=ifilename,exist=fileexists)
647 
648  IF ( fileexists .EQV. .true. ) THEN
649  OPEN(ifile,file=ifilename,form="UNFORMATTED",status="OLD", &
650  iostat=errorflag)
651  global%error = errorflag
652  IF ( global%error /= err_none ) THEN
653  CALL errorstop(global,err_file_open,__line__,ifilename)
654  END IF ! global%error
655  ELSE
656  OPEN(ifile,file=ifilenameold,form="UNFORMATTED",status="OLD", &
657  iostat=errorflag)
658  global%error = errorflag
659  IF ( global%error /= err_none ) THEN
660  CALL errorstop(global,err_file_open,__line__,ifilenameold)
661  END IF ! global%error
662  END IF ! fileExists
663 
664 ! ==============================================================================
665 ! Set state vector state depending on fluid model
666 ! ==============================================================================
667 
668  SELECT CASE ( pregion%mixtInput%fluidModel )
669  CASE ( fluid_model_incomp )
670  pregion%mixt%cvState = cv_mixt_state_prim
671  CASE ( fluid_model_comp )
672  pregion%mixt%cvState = cv_mixt_state_cons
673  CASE default
674  CALL errorstop(global,err_reached_default,__line__)
675  END SELECT ! pRegion%mixtInput%fluidModel
676 
677 ! ==============================================================================
678 ! Header and general information
679 ! ==============================================================================
680 
681  IF ( global%myProcid == masterproc .AND. &
682  global%verbLevel > verbose_low ) THEN
683  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
684  END IF ! global%verbLevel
685 
686  READ(ifile) sectionstring
687  IF ( trim(sectionstring) /= '# ROCFLU flow file' ) THEN
688  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
689  END IF ! TRIM
690 
691 ! -----------------------------------------------------------------------------
692 ! Precision and range
693 ! -----------------------------------------------------------------------------
694 
695  READ(ifile) sectionstring
696  IF ( trim(sectionstring) /= '# Precision and range' ) THEN
697  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
698  END IF ! TRIM
699 
700  precexpected = precision(1.0_rfreal)
701  rangeexpected = range(1.0_rfreal)
702 
703  READ(ifile) precactual,rangeactual
704  IF ( precactual < precexpected .OR. rangeactual < rangeexpected ) THEN
705  CALL errorstop(global,err_prec_range,__line__)
706  END IF ! precActual
707 
708 ! -----------------------------------------------------------------------------
709 ! Initial residual and physical time
710 ! -----------------------------------------------------------------------------
711 
712  READ(ifile) sectionstring
713  IF ( trim(sectionstring) /= '# Initial residual' ) THEN
714  CALL errorstop(global,err_invalid_marker,__line__,ifilename)
715  END IF ! TRIM
716 
717  READ(ifile) global%resInit
718 
719  READ(ifile) sectionstring
720  IF ( trim(sectionstring) /= '# Physical time' ) THEN
721  CALL errorstop(global,err_invalid_marker,__line__,ifilename)
722  END IF ! TRIM
723 
724  READ(ifile) currenttime
725 
726  IF ( global%flowType == flow_unsteady ) THEN
727  IF ( global%currentTime < 0.0_rfreal ) THEN
728  global%currentTime = currenttime
729  ELSE
730  WRITE(timestring1,'(1PE11.5)') global%currentTime
731  WRITE(timestring2,'(1PE11.5)') currenttime
732 
733  IF ( trim(timestring1) /= trim(timestring2) ) THEN
734  WRITE(stdout,'(A,4(1X,A))') solver_name, &
735  '*** WARNING *** Time mismatch:', &
736  trim(timestring1),'vs.',trim(timestring2)
737 
738  global%warnCounter = global%warnCounter + 1
739  END IF ! global%currentTime
740  END IF ! global%currentTime
741  END IF ! global%flowType
742 
743 ! ==============================================================================
744 ! Dimensions
745 ! ==============================================================================
746 
747  pgrid => pregion%grid
748 
749  nvarsexpected = pregion%mixtInput%nCv
750  ncellsexpected = pgrid%nCellsTot
751 
752  READ(ifile) sectionstring
753  IF ( trim(sectionstring) /= '# Dimensions' ) THEN
754  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
755  END IF ! TRIM
756 
757  READ(ifile) ncellstot,nvars
758 
759  IF ( ncellstot /= ncellsexpected ) THEN
760  WRITE(errorstring,'(A,1X,I6,1X,A,1X,I6)') 'Specified:',ncellstot, &
761  'but expected:',ncellsexpected
762  CALL errorstop(global,err_invalid_ncells,__line__,errorstring)
763  END IF ! nCellsExpected
764 
765  IF ( nvars /= nvarsexpected ) THEN
766  WRITE(errorstring,'(A,1X,I6,1X,A,1X,I6)') 'Specified:',nvars, &
767  'but expected:',nvarsexpected
768  CALL errorstop(global,err_invalid_nvars,__line__)
769  END IF ! nVarsExpected
770 
771 ! ==============================================================================
772 ! Rest of file
773 ! ==============================================================================
774 
775  ivars = 0
776  loopcounter = 0
777 
778  DO ! set up infinite loop
779  loopcounter = loopcounter + 1
780 
781  READ(ifile) sectionstring
782 
783  SELECT CASE ( trim(sectionstring) )
784 
785 ! ------------------------------------------------------------------------------
786 ! Mixture density - compressible solver
787 ! ------------------------------------------------------------------------------
788 
789  CASE ( '# Mixture density' )
790  IF ( global%myProcid == masterproc .AND. &
791  global%verbLevel > verbose_low ) THEN
792  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture density...'
793  END IF ! global%verbLevel
794 
795  pcv => pregion%mixt%cv
796 
797  ivars = ivars + 1
798 
799  cvmixtdens = rflu_getcvloc(global,fluid_model_comp,cv_mixt_dens)
800 
801  READ(ifile) (pcv(cvmixtdens,j),j=1,pgrid%nCellsTot)
802 
803 ! ------------------------------------------------------------------------------
804 ! Mixture x-momentum - compressible solver
805 ! ------------------------------------------------------------------------------
806 
807  CASE ( '# Mixture x-momentum' )
808  IF ( global%myProcid == masterproc .AND. &
809  global%verbLevel > verbose_low ) THEN
810  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture x-momentum...'
811  END IF ! global%verbLevel
812 
813  pcv => pregion%mixt%cv
814 
815  ivars = ivars + 1
816 
817  cvmixtxmom = rflu_getcvloc(global,fluid_model_comp,cv_mixt_xmom)
818 
819  READ(ifile) (pcv(cvmixtxmom,j),j=1,pgrid%nCellsTot)
820 
821 ! ------------------------------------------------------------------------------
822 ! Mixture x-velocity - incompressible solver
823 ! ------------------------------------------------------------------------------
824 
825  CASE ( '# Mixture x-velocity' )
826  IF ( global%myProcid == masterproc .AND. &
827  global%verbLevel > verbose_low ) THEN
828  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture x-velocity...'
829  END IF ! global%verbLevel
830 
831  pcv => pregion%mixt%cv
832 
833  ivars = ivars + 1
834 
835  cvmixtxvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_xvel)
836 
837  READ(ifile) (pcv(cvmixtxvel,j),j=1,pgrid%nCellsTot)
838 
839 ! ------------------------------------------------------------------------------
840 ! Mixture y-momentum - compressible solver
841 ! ------------------------------------------------------------------------------
842 
843  CASE ( '# Mixture y-momentum' )
844  IF ( global%myProcid == masterproc .AND. &
845  global%verbLevel > verbose_low ) THEN
846  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture y-momentum...'
847  END IF ! global%verbLevel
848 
849  pcv => pregion%mixt%cv
850 
851  ivars = ivars + 1
852 
853  cvmixtymom = rflu_getcvloc(global,fluid_model_comp,cv_mixt_ymom)
854 
855  READ(ifile) (pcv(cvmixtymom,j),j=1,pgrid%nCellsTot)
856 
857 ! ------------------------------------------------------------------------------
858 ! Mixture y-velocity - incompressible solver
859 ! ------------------------------------------------------------------------------
860 
861  CASE ( '# Mixture y-velocity' )
862  IF ( global%myProcid == masterproc .AND. &
863  global%verbLevel > verbose_low ) THEN
864  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture y-velocity...'
865  END IF ! global%verbLevel
866 
867  pcv => pregion%mixt%cv
868 
869  ivars = ivars + 1
870 
871  cvmixtyvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_yvel)
872 
873  READ(ifile) (pcv(cvmixtyvel,j),j=1,pgrid%nCellsTot)
874 
875 ! ------------------------------------------------------------------------------
876 ! Mixture z-momentum - compressible solver
877 ! ------------------------------------------------------------------------------
878 
879  CASE ( '# Mixture z-momentum' )
880  IF ( global%myProcid == masterproc .AND. &
881  global%verbLevel > verbose_low ) THEN
882  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture z-momentum...'
883  END IF ! global%verbLevel
884 
885  pcv => pregion%mixt%cv
886 
887  ivars = ivars + 1
888 
889  cvmixtzmom = rflu_getcvloc(global,fluid_model_comp,cv_mixt_zmom)
890 
891  READ(ifile) (pcv(cvmixtzmom,j),j=1,pgrid%nCellsTot)
892 
893 ! ------------------------------------------------------------------------------
894 ! Mixture z-velocity - incompressible solver
895 ! ------------------------------------------------------------------------------
896 
897  CASE ( '# Mixture z-velocity' )
898  IF ( global%myProcid == masterproc .AND. &
899  global%verbLevel > verbose_low ) THEN
900  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture z-velocity...'
901  END IF ! global%verbLevel
902 
903  pcv => pregion%mixt%cv
904 
905  ivars = ivars + 1
906 
907  cvmixtzvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_zvel)
908 
909  READ(ifile) (pcv(cvmixtzvel,j),j=1,pgrid%nCellsTot)
910 
911 ! ------------------------------------------------------------------------------
912 ! Mixture total internal energy - compressible solver
913 ! ------------------------------------------------------------------------------
914 
915  CASE ( '# Mixture total internal energy' )
916  IF ( global%myProcid == masterproc .AND. &
917  global%verbLevel > verbose_low ) THEN
918  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture total internal '// &
919  'energy...'
920  END IF ! global%verbLevel
921 
922  pcv => pregion%mixt%cv
923 
924  ivars = ivars + 1
925 
926  cvmixtener = rflu_getcvloc(global,fluid_model_comp,cv_mixt_ener)
927 
928  READ(ifile) (pcv(cvmixtener,j),j=1,pgrid%nCellsTot)
929 
930 ! ------------------------------------------------------------------------------
931 ! Mixture pressure - incompressible solver
932 ! ------------------------------------------------------------------------------
933 
934  CASE ( '# Mixture pressure' )
935  IF ( global%myProcid == masterproc .AND. &
936  global%verbLevel > verbose_low ) THEN
937  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture pressure...'
938  END IF ! global%verbLevel
939 
940  pcv => pregion%mixt%cv
941 
942  ivars = ivars + 1
943 
944  cvmixtpres = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_pres)
945 
946  READ(ifile) (pcv(cvmixtpres,j),j=1,pgrid%nCellsTot)
947 
948 ! ------------------------------------------------------------------------------
949 ! End marker
950 ! ------------------------------------------------------------------------------
951 
952  CASE ( '# End' )
953  IF ( global%myProcid == masterproc .AND. &
954  global%verbLevel > verbose_low ) THEN
955  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
956  END IF ! global%verbLevel
957 
958  EXIT
959 
960 ! ------------------------------------------------------------------------------
961 ! Invalid section string
962 ! ------------------------------------------------------------------------------
963 
964  CASE default
965  IF ( global%verbLevel > verbose_low ) THEN
966  WRITE(stdout,'(A,3X,A)') solver_name,sectionstring
967  END IF ! verbosityLevel
968 
969  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
970 
971  END SELECT ! TRIM
972 
973 ! ------------------------------------------------------------------------------
974 ! Guard against infinite loop - might be unnecessary because of read errors?
975 ! ------------------------------------------------------------------------------
976 
977  IF ( loopcounter >= limit_infinite_loop ) THEN
978  CALL errorstop(global,err_infinite_loop,__line__)
979  END IF ! loopCounter
980 
981  END DO ! <empty>
982 
983 ! ==============================================================================
984 ! Check and information about number of variables read
985 ! ==============================================================================
986 
987  IF ( ivars /= nvars ) THEN
988  CALL errorstop(global,err_invalid_nvars,__line__)
989  END IF ! iVar
990 
991 ! ==============================================================================
992 ! Close file
993 ! ==============================================================================
994 
995  CLOSE(ifile,iostat=errorflag)
996  global%error = errorflag
997  IF ( global%error /= err_none ) THEN
998  CALL errorstop(global,err_file_close,__line__,ifilename)
999  END IF ! global%error
1000 
1001 ! ******************************************************************************
1002 ! End
1003 ! ******************************************************************************
1004 
1005  IF ( global%myProcid == masterproc .AND. &
1006  global%verbLevel > verbose_none ) THEN
1007  WRITE(stdout,'(A,1X,A)') solver_name,'Reading binary flow file done.'
1008  END IF ! global%verbLevel
1009 
1010  CALL deregisterfunction(global)
1011 
1012  END SUBROUTINE rflu_readflowbinary
1013 
1014 
1015 
1016 
1017 
1018 
1019 
1020 
1021 ! ******************************************************************************
1022 !
1023 ! Purpose: Wrapper for reading of flow files in ROCFLU format.
1024 !
1025 ! Description: None.
1026 !
1027 ! Input:
1028 ! pRegion Pointer to region
1029 !
1030 ! Output: None.
1031 !
1032 ! Notes: None.
1033 !
1034 ! ******************************************************************************
1035 
1036  SUBROUTINE rflu_readflowwrapper(pRegion)
1037 
1038 #ifdef GENX
1041 #endif
1042 
1043 #ifdef PLAG
1046 #endif
1047 
1048 #ifdef SPEC
1053 #endif
1054 
1055 #ifdef TURB
1059 #ifdef GENX
1061 #endif
1062 #endif
1063 
1064  IMPLICIT NONE
1065 
1066 ! ******************************************************************************
1067 ! Declarations and definitions
1068 ! ******************************************************************************
1069 
1070 ! ==============================================================================
1071 ! Arguments
1072 ! ==============================================================================
1073 
1074  TYPE(t_region), POINTER :: pregion
1075 
1076 ! ==============================================================================
1077 ! Local variables
1078 ! ==============================================================================
1079 
1080  TYPE(t_global), POINTER :: global
1081 
1082 ! ******************************************************************************
1083 ! Start
1084 ! ******************************************************************************
1085 
1086  global => pregion%global
1087 
1088  CALL registerfunction(global,'RFLU_ReadFlowWrapper',&
1089  'RFLU_ModReadWriteFlow.F90')
1090 
1091 ! ******************************************************************************
1092 ! Read mixture solution files
1093 ! ******************************************************************************
1094 
1095 #ifdef GENX
1096  IF ( rflu_genx_decidereadfile(global) .EQV. .false. ) THEN
1097 #endif
1098  IF ( global%solutFormat == format_ascii ) THEN
1099  CALL rflu_readflowascii(pregion)
1100  ELSE IF ( global%solutFormat == format_binary ) THEN
1101  CALL rflu_readflowbinary(pregion)
1102  ELSE
1103  CALL errorstop(global,err_reached_default,__line__)
1104  END IF ! global%solutFormat
1105 #ifdef GENX
1106  ELSE
1107  CALL rflu_genx_getdataflow(pregion)
1108  END IF ! RFLU_GENX_DecideReadFile
1109 #endif
1110 
1111 ! ******************************************************************************
1112 ! Read physical module solution files
1113 ! ******************************************************************************
1114 
1115 #ifdef PLAG
1116 ! ==============================================================================
1117 ! Particles
1118 ! ==============================================================================
1119 
1120  IF ( global%plagUsed .EQV. .true. ) THEN
1121  IF ( global%solutFormat == format_ascii ) THEN
1122  CALL plag_rflu_readsolutionascii(pregion)
1123  ELSE IF ( global%solutFormat == format_binary ) THEN
1124  CALL plag_rflu_readsolutionbinary(pregion)
1125  ELSE
1126  CALL errorstop(global,err_reached_default,__line__)
1127  END IF ! global%solutFormat
1128  END IF ! plagUsed
1129 #endif
1130 
1131 #ifdef SPEC
1132 ! ==============================================================================
1133 ! Species
1134 ! ==============================================================================
1135 
1136  IF ( global%specUsed .EQV. .true. ) THEN
1137  IF ( global%solutFormat == format_ascii ) THEN
1138  CALL spec_rflu_readcvascii(pregion)
1139 
1140  IF ( global%moduleType == module_type_postproc ) THEN
1141  IF ( pregion%specInput%nSpeciesEE > 0 ) THEN
1142  CALL spec_rflu_readeevascii(pregion)
1143  END IF ! pRegion%specInput%nSpeciesEE
1144  END IF ! global%moduleType
1145  ELSE IF ( global%solutFormat == format_binary ) THEN
1146  CALL spec_rflu_readcvbinary(pregion)
1147 
1148  IF ( global%moduleType == module_type_postproc ) THEN
1149  IF ( pregion%specInput%nSpeciesEE > 0 ) THEN
1150  CALL spec_rflu_readeevbinary(pregion)
1151  END IF ! pRegion%specInput%nSpeciesEE
1152  END IF ! global%moduleType
1153  ELSE
1154  CALL errorstop(global,err_reached_default,__line__)
1155  END IF ! global%solutFormat
1156  END IF ! global%specUsed
1157 #endif
1158 
1159 #ifdef TURB
1160 ! ==============================================================================
1161 ! Turbulence
1162 ! ==============================================================================
1163 
1164  IF ( pregion%mixtInput%flowModel == flow_navst .AND. &
1165  pregion%mixtInput%turbModel /= turb_model_none ) THEN
1166  IF ( (global%flowType == flow_unsteady .AND. &
1167  global%currentTime > 0._rfreal) .OR. &
1168  (global%flowType == flow_steady .AND. &
1169  global%currentIter > 0) ) THEN
1170 #ifndef GENX
1171  IF ( global%solutFormat == format_ascii ) THEN
1172  CALL turb_rflu_readsolutionascii(pregion)
1173  ELSE IF ( global%solutFormat == format_binary ) THEN
1174  CALL turb_rflu_readsolutionbinary(pregion)
1175  ELSE
1176  CALL errorstop(global,err_reached_default,__line__)
1177  END IF ! global%solutFormat
1178 #else
1179  CALL turb_rflu_genxgetdata(pregion)
1180 #endif
1181  END IF ! global%flowType
1182  CALL turb_initsolution(pregion) ! temporary
1183  END IF ! pRegion%mixtInput%flowModel
1184 #endif
1185 
1186 ! ******************************************************************************
1187 ! End
1188 ! ******************************************************************************
1189 
1190  CALL deregisterfunction(global)
1191 
1192  END SUBROUTINE rflu_readflowwrapper
1193 
1194 
1195 
1196 
1197 
1198 
1199 
1200 
1201 ! ******************************************************************************
1202 !
1203 ! Purpose: Write flow file for mixture in ASCII ROCFLU format.
1204 !
1205 ! Description: None.
1206 !
1207 ! Input:
1208 ! pRegion Pointer to region
1209 !
1210 ! Output: None.
1211 !
1212 ! Notes:
1213 ! 1. Write initial residual and physical time for both steady and unsteady
1214 ! flows so that could use steady solution as input for unsteady run and
1215 ! vice versa.
1216 !
1217 ! ******************************************************************************
1218 
1219  SUBROUTINE rflu_writeflowascii(pRegion)
1220 
1221  IMPLICIT NONE
1222 
1223 ! ******************************************************************************
1224 ! Declarations and definitions
1225 ! ******************************************************************************
1226 
1227 ! ==============================================================================
1228 ! Arguments
1229 ! ==============================================================================
1230 
1231  TYPE(t_region), POINTER :: pregion
1232 
1233 ! ==============================================================================
1234 ! Local variables
1235 ! ==============================================================================
1236 
1237  CHARACTER(CHRLEN) :: ifilename,sectionstring
1238  INTEGER :: cvmixtdens,cvmixtener,cvmixtpres,cvmixtxmom,cvmixtxvel, &
1239  cvmixtymom,cvmixtyvel,cvmixtzmom,cvmixtzvel,errorflag,i,ifile,j
1240  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcv
1241  TYPE(t_grid), POINTER :: pgrid
1242  TYPE(t_global), POINTER :: global
1243 
1244 ! ******************************************************************************
1245 ! Start, open file
1246 ! ******************************************************************************
1247 
1248  global => pregion%global
1249 
1250  CALL registerfunction(global,'RFLU_WriteFlowASCII',&
1251  'RFLU_ModReadWriteFlow.F90')
1252 
1253  IF ( global%myProcid == masterproc .AND. &
1254  global%verbLevel > verbose_none ) THEN
1255  WRITE(stdout,'(A,1X,A)') solver_name,'Writing ASCII flow file...'
1256  END IF ! global%verbLevel
1257 
1258  IF ( global%flowType == flow_unsteady ) THEN
1259  CALL buildfilenameunsteady(global,filedest_outdir,'.mixt.cva', &
1260  pregion%iRegionGlobal,global%currentTime, &
1261  ifilename)
1262 
1263  IF ( global%myProcid == masterproc .AND. &
1264  global%verbLevel > verbose_none ) THEN
1265  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
1266  pregion%iRegionGlobal
1267  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
1268  global%currentTime
1269  END IF ! global%verbLevel
1270  ELSE
1271  CALL buildfilenamesteady(global,filedest_outdir,'.mixt.cva', &
1272  pregion%iRegionGlobal,global%currentIter, &
1273  ifilename)
1274 
1275  IF ( global%myProcid == masterproc .AND. &
1276  global%verbLevel > verbose_none ) THEN
1277  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
1278  pregion%iRegionGlobal
1279  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name,'Current iteration '// &
1280  'number:',global%currentIter
1281  END IF ! global%verbLevel
1282  ENDIF ! global%flowType
1283 
1284  ifile = if_solut
1285  OPEN(ifile,file=ifilename,form="FORMATTED",status="UNKNOWN", &
1286  iostat=errorflag)
1287  global%error = errorflag
1288  IF ( global%error /= err_none ) THEN
1289  CALL errorstop(global,err_file_open,__line__,ifilename)
1290  END IF ! global%error
1291 
1292 ! ==============================================================================
1293 ! Header and general information
1294 ! ==============================================================================
1295 
1296  IF ( global%myProcid == masterproc .AND. &
1297  global%verbLevel > verbose_low ) THEN
1298  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
1299  END IF ! global%verbLevel
1300 
1301  sectionstring = '# ROCFLU flow file'
1302  WRITE(ifile,'(A)') sectionstring
1303 
1304  sectionstring = '# Precision and range'
1305  WRITE(ifile,'(A)') sectionstring
1306  WRITE(ifile,'(2(I8))') precision(1.0_rfreal),range(1.0_rfreal)
1307 
1308  sectionstring = '# Initial residual'
1309  WRITE(ifile,'(A)') sectionstring
1310  WRITE(ifile,'(E23.16)') global%resInit
1311 
1312  sectionstring = '# Physical time'
1313  WRITE(ifile,'(A)') sectionstring
1314  WRITE(ifile,'(E23.16)') global%currentTime
1315 
1316 ! ==============================================================================
1317 ! Dimensions
1318 ! ==============================================================================
1319 
1320  pgrid => pregion%grid
1321 
1322  sectionstring = '# Dimensions'
1323  WRITE(ifile,'(A)') sectionstring
1324  WRITE(ifile,'(2(I8))') pgrid%nCellsTot,pregion%mixtInput%nCv
1325 
1326 ! ==============================================================================
1327 ! Data
1328 ! ==============================================================================
1329 
1330  pcv => pregion%mixt%cv
1331 
1332  SELECT CASE ( pregion%mixtInput%fluidModel )
1333 
1334 ! ------------------------------------------------------------------------------
1335 ! Compressible fluid
1336 ! ------------------------------------------------------------------------------
1337 
1338  CASE ( fluid_model_comp )
1339 
1340 ! ----- Density ----------------------------------------------------------------
1341 
1342  IF ( global%myProcid == masterproc .AND. &
1343  global%verbLevel > verbose_low ) THEN
1344  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture density...'
1345  END IF ! global%verbLevel
1346 
1347  cvmixtdens = rflu_getcvloc(global,fluid_model_comp,cv_mixt_dens)
1348 
1349  sectionstring = '# Mixture density'
1350  WRITE(ifile,'(A)') sectionstring
1351  WRITE(ifile,'(5(E23.16))') (pcv(cvmixtdens,j),j=1,pgrid%nCellsTot)
1352 
1353 ! ----- X-momentum -------------------------------------------------------------
1354 
1355  IF ( global%myProcid == masterproc .AND. &
1356  global%verbLevel > verbose_low ) THEN
1357  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture x-momentum...'
1358  END IF ! global%verbLevel
1359 
1360  cvmixtxmom = rflu_getcvloc(global,fluid_model_comp,cv_mixt_xmom)
1361 
1362  sectionstring = '# Mixture x-momentum'
1363  WRITE(ifile,'(A)') sectionstring
1364  WRITE(ifile,'(5(E23.16))') (pcv(cvmixtxmom,j),j=1,pgrid%nCellsTot)
1365 
1366 ! ----- Y-momentum -------------------------------------------------------------
1367 
1368  IF ( global%myProcid == masterproc .AND. &
1369  global%verbLevel > verbose_low ) THEN
1370  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture y-momentum...'
1371  END IF ! global%verbLevel
1372 
1373  cvmixtymom = rflu_getcvloc(global,fluid_model_comp,cv_mixt_ymom)
1374 
1375  sectionstring = '# Mixture y-momentum'
1376  WRITE(ifile,'(A)') sectionstring
1377  WRITE(ifile,'(5(E23.16))') (pcv(cvmixtymom,j),j=1,pgrid%nCellsTot)
1378 
1379 ! ----- Z-momentum -------------------------------------------------------------
1380 
1381  IF ( global%myProcid == masterproc .AND. &
1382  global%verbLevel > verbose_low ) THEN
1383  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture z-momentum...'
1384  END IF ! global%verbLevel
1385 
1386  cvmixtzmom = rflu_getcvloc(global,fluid_model_comp,cv_mixt_zmom)
1387 
1388  sectionstring = '# Mixture z-momentum'
1389  WRITE(ifile,'(A)') sectionstring
1390  WRITE(ifile,'(5(E23.16))') (pcv(cvmixtzmom,j),j=1,pgrid%nCellsTot)
1391 
1392 ! ----- Total internal energy --------------------------------------------------
1393 
1394  IF ( global%myProcid == masterproc .AND. &
1395  global%verbLevel > verbose_low ) THEN
1396  WRITE(stdout,'(A,3X,A)') solver_name, &
1397  'Mixture total internal energy...'
1398  END IF ! global%verbLevel
1399 
1400  cvmixtener = rflu_getcvloc(global,fluid_model_comp,cv_mixt_ener)
1401 
1402  sectionstring = '# Mixture total internal energy'
1403  WRITE(ifile,'(A)') sectionstring
1404  WRITE(ifile,'(5(E23.16))') (pcv(cvmixtener,j),j=1,pgrid%nCellsTot)
1405 
1406 ! ------------------------------------------------------------------------------
1407 ! Incompressible fluid
1408 ! ------------------------------------------------------------------------------
1409 
1410  CASE ( fluid_model_incomp )
1411 
1412 ! ----- X-velocity -------------------------------------------------------------
1413 
1414  IF ( global%myProcid == masterproc .AND. &
1415  global%verbLevel > verbose_low ) THEN
1416  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture x-velocity...'
1417  END IF ! global%verbLevel
1418 
1419  cvmixtxvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_xvel)
1420 
1421  sectionstring = '# Mixture x-velocity'
1422  WRITE(ifile,'(A)') sectionstring
1423  WRITE(ifile,'(5(E23.16))') (pcv(cvmixtxvel,j),j=1,pgrid%nCellsTot)
1424 
1425 ! ----- Y-velocity -------------------------------------------------------------
1426 
1427  IF ( global%myProcid == masterproc .AND. &
1428  global%verbLevel > verbose_low ) THEN
1429  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture y-velocity...'
1430  END IF ! global%verbLevel
1431 
1432  cvmixtyvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_yvel)
1433 
1434  sectionstring = '# Mixture y-velocity'
1435  WRITE(ifile,'(A)') sectionstring
1436  WRITE(ifile,'(5(E23.16))') (pcv(cvmixtyvel,j),j=1,pgrid%nCellsTot)
1437 
1438 ! ----- Z-velocity -------------------------------------------------------------
1439 
1440  IF ( global%myProcid == masterproc .AND. &
1441  global%verbLevel > verbose_low ) THEN
1442  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture z-velocity...'
1443  END IF ! global%verbLevel
1444 
1445  cvmixtzvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_zvel)
1446 
1447  sectionstring = '# Mixture z-velocity'
1448  WRITE(ifile,'(A)') sectionstring
1449  WRITE(ifile,'(5(E23.16))') (pcv(cvmixtzvel,j),j=1,pgrid%nCellsTot)
1450 
1451 ! ----- Pressure ---------------------------------------------------------------
1452 
1453  IF ( global%myProcid == masterproc .AND. &
1454  global%verbLevel > verbose_low ) THEN
1455  WRITE(stdout,'(A,3X,A)') solver_name, &
1456  'Mixture pressure...'
1457  END IF ! global%verbLevel
1458 
1459  cvmixtpres = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_pres)
1460 
1461  sectionstring = '# Mixture pressure'
1462  WRITE(ifile,'(A)') sectionstring
1463  WRITE(ifile,'(5(E23.16))') (pcv(cvmixtpres,j),j=1,pgrid%nCellsTot)
1464 
1465 ! ------------------------------------------------------------------------------
1466 ! Default
1467 ! ------------------------------------------------------------------------------
1468 
1469  CASE default
1470  CALL errorstop(global,err_reached_default,__line__)
1471  END SELECT ! pRegion%mixtInput%fluidModel
1472 
1473 ! ==============================================================================
1474 ! End marker
1475 ! ==============================================================================
1476 
1477  IF ( global%myProcid == masterproc .AND. &
1478  global%verbLevel > verbose_low ) THEN
1479  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
1480  END IF ! global%verbLevel
1481 
1482  sectionstring = '# End'
1483  WRITE(ifile,'(A)') sectionstring
1484 
1485 ! ==============================================================================
1486 ! Close file
1487 ! ==============================================================================
1488 
1489  CLOSE(ifile,iostat=errorflag)
1490  global%error = errorflag
1491  IF ( global%error /= err_none ) THEN
1492  CALL errorstop(global,err_file_close,__line__,ifilename)
1493  END IF ! global%error
1494 
1495 ! ******************************************************************************
1496 ! End
1497 ! ******************************************************************************
1498 
1499  IF ( global%myProcid == masterproc .AND. &
1500  global%verbLevel > verbose_none ) THEN
1501  WRITE(stdout,'(A,1X,A)') solver_name,'Writing ASCII flow file done.'
1502  END IF ! global%verbLevel
1503 
1504  CALL deregisterfunction(global)
1505 
1506  END SUBROUTINE rflu_writeflowascii
1507 
1508 
1509 
1510 
1511 
1512 
1513 
1514 ! ******************************************************************************
1515 !
1516 ! Purpose: Write flow file for mixture in binary ROCFLU format.
1517 !
1518 ! Description: None.
1519 !
1520 ! Input:
1521 ! pRegion Pointer to region
1522 !
1523 ! Output: None.
1524 !
1525 ! Notes:
1526 ! 1. Write initial residual and physical time for both steady and unsteady
1527 ! flows so that could use steady solution as input for unsteady run and
1528 ! vice versa.
1529 !
1530 ! ******************************************************************************
1531 
1532  SUBROUTINE rflu_writeflowbinary(pRegion)
1533 
1534  IMPLICIT NONE
1535 
1536 ! ******************************************************************************
1537 ! Declarations and definitions
1538 ! ******************************************************************************
1539 
1540 ! ==============================================================================
1541 ! Local variables
1542 ! ==============================================================================
1543 
1544  CHARACTER(CHRLEN) :: ifilename,sectionstring
1545  INTEGER :: cvmixtdens,cvmixtener,cvmixtpres,cvmixtxmom,cvmixtxvel, &
1546  cvmixtymom,cvmixtyvel,cvmixtzmom,cvmixtzvel,errorflag,i,ifile,j
1547  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcv
1548  TYPE(t_grid), POINTER :: pgrid
1549  TYPE(t_global), POINTER :: global
1550 
1551 ! ==============================================================================
1552 ! Arguments
1553 ! ==============================================================================
1554 
1555  TYPE(t_region), POINTER :: pregion
1556 
1557 ! ******************************************************************************
1558 ! Start, open file
1559 ! ******************************************************************************
1560 
1561  global => pregion%global
1562 
1563  CALL registerfunction(global,'RFLU_WriteFlowBinary',&
1564  'RFLU_ModReadWriteFlow.F90')
1565 
1566  IF ( global%myProcid == masterproc .AND. &
1567  global%verbLevel > verbose_none ) THEN
1568  WRITE(stdout,'(A,1X,A)') solver_name,'Writing binary flow file...'
1569  END IF ! global%verbLevel
1570 
1571  IF ( global%flowType == flow_unsteady ) THEN
1572  CALL buildfilenameunsteady(global,filedest_outdir,'.mixt.cv', &
1573  pregion%iRegionGlobal,global%currentTime, &
1574  ifilename)
1575 
1576  IF ( global%myProcid == masterproc .AND. &
1577  global%verbLevel > verbose_none ) THEN
1578  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
1579  pregion%iRegionGlobal
1580  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
1581  global%currentTime
1582  END IF ! global%verbLevel
1583  ELSE
1584  CALL buildfilenamesteady(global,filedest_outdir,'.mixt.cv', &
1585  pregion%iRegionGlobal,global%currentIter, &
1586  ifilename)
1587 
1588  IF ( global%myProcid == masterproc .AND. &
1589  global%verbLevel > verbose_none ) THEN
1590  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
1591  pregion%iRegionGlobal
1592  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name,'Current iteration '// &
1593  'number:',global%currentIter
1594  END IF ! global%verbLevel
1595  ENDIF ! global%flowType
1596 
1597  ifile = if_solut
1598  OPEN(ifile,file=ifilename,form="UNFORMATTED",status="UNKNOWN", &
1599  iostat=errorflag)
1600  global%error = errorflag
1601  IF ( global%error /= err_none ) THEN
1602  CALL errorstop(global,err_file_open,__line__,ifilename)
1603  END IF ! global%error
1604 
1605 ! ==============================================================================
1606 ! Header and general information
1607 ! ==============================================================================
1608 
1609  IF ( global%myProcid == masterproc .AND. &
1610  global%verbLevel > verbose_low ) THEN
1611  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
1612  END IF ! global%verbLevel
1613 
1614  sectionstring = '# ROCFLU flow file'
1615  WRITE(ifile) sectionstring
1616 
1617  sectionstring = '# Precision and range'
1618  WRITE(ifile) sectionstring
1619  WRITE(ifile) precision(1.0_rfreal),range(1.0_rfreal)
1620 
1621  sectionstring = '# Initial residual'
1622  WRITE(ifile) sectionstring
1623  WRITE(ifile) global%resInit
1624 
1625  sectionstring = '# Physical time'
1626  WRITE(ifile) sectionstring
1627  WRITE(ifile) global%currentTime
1628 
1629 ! ==============================================================================
1630 ! Dimensions
1631 ! ==============================================================================
1632 
1633  pgrid => pregion%grid
1634 
1635  sectionstring = '# Dimensions'
1636  WRITE(ifile) sectionstring
1637  WRITE(ifile) pgrid%nCellsTot,pregion%mixtInput%nCv
1638 
1639 ! ==============================================================================
1640 ! Data
1641 ! ==============================================================================
1642 
1643  pcv => pregion%mixt%cv
1644 
1645  SELECT CASE ( pregion%mixtInput%fluidModel )
1646 
1647 ! ------------------------------------------------------------------------------
1648 ! Compressible fluid
1649 ! ------------------------------------------------------------------------------
1650 
1651  CASE ( fluid_model_comp )
1652 
1653 ! ----- Density ----------------------------------------------------------------
1654 
1655  IF ( global%myProcid == masterproc .AND. &
1656  global%verbLevel > verbose_low ) THEN
1657  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture density...'
1658  END IF ! global%verbLevel
1659 
1660  cvmixtdens = rflu_getcvloc(global,fluid_model_comp,cv_mixt_dens)
1661 
1662  sectionstring = '# Mixture density'
1663  WRITE(ifile) sectionstring
1664  WRITE(ifile) (pcv(cvmixtdens,j),j=1,pgrid%nCellsTot)
1665 
1666 ! ----- X-momentum -------------------------------------------------------------
1667 
1668  IF ( global%myProcid == masterproc .AND. &
1669  global%verbLevel > verbose_low ) THEN
1670  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture x-momentum...'
1671  END IF ! global%verbLevel
1672 
1673  cvmixtxmom = rflu_getcvloc(global,fluid_model_comp,cv_mixt_xmom)
1674 
1675  sectionstring = '# Mixture x-momentum'
1676  WRITE(ifile) sectionstring
1677  WRITE(ifile) (pcv(cvmixtxmom,j),j=1,pgrid%nCellsTot)
1678 
1679 ! ----- Y-momentum -------------------------------------------------------------
1680 
1681  IF ( global%myProcid == masterproc .AND. &
1682  global%verbLevel > verbose_low ) THEN
1683  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture y-momentum...'
1684  END IF ! global%verbLevel
1685 
1686  cvmixtymom = rflu_getcvloc(global,fluid_model_comp,cv_mixt_ymom)
1687 
1688  sectionstring = '# Mixture y-momentum'
1689  WRITE(ifile) sectionstring
1690  WRITE(ifile) (pcv(cvmixtymom,j),j=1,pgrid%nCellsTot)
1691 
1692 ! ----- Z-momentum -------------------------------------------------------------
1693 
1694  IF ( global%myProcid == masterproc .AND. &
1695  global%verbLevel > verbose_low ) THEN
1696  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture z-momentum...'
1697  END IF ! global%verbLevel
1698 
1699  cvmixtzmom = rflu_getcvloc(global,fluid_model_comp,cv_mixt_zmom)
1700 
1701  sectionstring = '# Mixture z-momentum'
1702  WRITE(ifile) sectionstring
1703  WRITE(ifile) (pcv(cvmixtzmom,j),j=1,pgrid%nCellsTot)
1704 
1705 ! ----- Total internal energy --------------------------------------------------
1706 
1707  IF ( global%myProcid == masterproc .AND. &
1708  global%verbLevel > verbose_low ) THEN
1709  WRITE(stdout,'(A,3X,A)') solver_name, &
1710  'Mixture total internal energy...'
1711  END IF ! global%verbLevel
1712 
1713  cvmixtener = rflu_getcvloc(global,fluid_model_comp,cv_mixt_ener)
1714 
1715  sectionstring = '# Mixture total internal energy'
1716  WRITE(ifile) sectionstring
1717  WRITE(ifile) (pcv(cvmixtener,j),j=1,pgrid%nCellsTot)
1718 
1719 ! ------------------------------------------------------------------------------
1720 ! Incompressible fluid
1721 ! ------------------------------------------------------------------------------
1722 
1723  CASE ( fluid_model_incomp )
1724 
1725 ! ----- X-velocity -------------------------------------------------------------
1726 
1727  IF ( global%myProcid == masterproc .AND. &
1728  global%verbLevel > verbose_low ) THEN
1729  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture x-velocity...'
1730  END IF ! global%verbLevel
1731 
1732  cvmixtxvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_xvel)
1733 
1734  sectionstring = '# Mixture x-velocity'
1735  WRITE(ifile) sectionstring
1736  WRITE(ifile) (pcv(cvmixtxvel,j),j=1,pgrid%nCellsTot)
1737 
1738 ! ----- Y-velocity -------------------------------------------------------------
1739 
1740  IF ( global%myProcid == masterproc .AND. &
1741  global%verbLevel > verbose_low ) THEN
1742  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture y-velocity...'
1743  END IF ! global%verbLevel
1744 
1745  cvmixtyvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_yvel)
1746 
1747  sectionstring = '# Mixture y-velocity'
1748  WRITE(ifile) sectionstring
1749  WRITE(ifile) (pcv(cvmixtyvel,j),j=1,pgrid%nCellsTot)
1750 
1751 ! ----- Z-velocity -------------------------------------------------------------
1752 
1753  IF ( global%myProcid == masterproc .AND. &
1754  global%verbLevel > verbose_low ) THEN
1755  WRITE(stdout,'(A,3X,A)') solver_name,'Mixture z-velocity...'
1756  END IF ! global%verbLevel
1757 
1758  cvmixtzvel = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_zvel)
1759 
1760  sectionstring = '# Mixture z-velocity'
1761  WRITE(ifile) sectionstring
1762  WRITE(ifile) (pcv(cvmixtzvel,j),j=1,pgrid%nCellsTot)
1763 
1764 ! ----- Pressure ---------------------------------------------------------------
1765 
1766  IF ( global%myProcid == masterproc .AND. &
1767  global%verbLevel > verbose_low ) THEN
1768  WRITE(stdout,'(A,3X,A)') solver_name, &
1769  'Mixture pressure...'
1770  END IF ! global%verbLevel
1771 
1772  cvmixtpres = rflu_getcvloc(global,fluid_model_incomp,cv_mixt_pres)
1773 
1774  sectionstring = '# Mixture pressure'
1775  WRITE(ifile) sectionstring
1776  WRITE(ifile) (pcv(cvmixtpres,j),j=1,pgrid%nCellsTot)
1777 
1778 ! ------------------------------------------------------------------------------
1779 ! Default
1780 ! ------------------------------------------------------------------------------
1781 
1782  CASE default
1783  CALL errorstop(global,err_reached_default,__line__)
1784  END SELECT ! pRegion%mixtInput%fluidModel
1785 
1786 ! ==============================================================================
1787 ! End marker
1788 ! ==============================================================================
1789 
1790  IF ( global%myProcid == masterproc .AND. &
1791  global%verbLevel > verbose_low ) THEN
1792  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
1793  END IF ! global%verbLevel
1794 
1795  sectionstring = '# End'
1796  WRITE(ifile) sectionstring
1797 
1798 ! ==============================================================================
1799 ! Close file
1800 ! ==============================================================================
1801 
1802  CLOSE(ifile,iostat=errorflag)
1803  global%error = errorflag
1804  IF ( global%error /= err_none ) THEN
1805  CALL errorstop(global,err_file_close,__line__,ifilename)
1806  END IF ! global%error
1807 
1808 ! ******************************************************************************
1809 ! End
1810 ! ******************************************************************************
1811 
1812  IF ( global%myProcid == masterproc .AND. &
1813  global%verbLevel > verbose_none ) THEN
1814  WRITE(stdout,'(A,1X,A)') solver_name,'Writing binary flow file done.'
1815  END IF ! global%verbLevel
1816 
1817  CALL deregisterfunction(global)
1818 
1819  END SUBROUTINE rflu_writeflowbinary
1820 
1821 
1822 
1823 
1824 
1825 
1826 
1827 
1828 ! ******************************************************************************
1829 !
1830 ! Purpose: Wrapper for writing of flow files in ROCFLU format.
1831 !
1832 ! Description: None.
1833 !
1834 ! Input:
1835 ! pRegion Pointer to region
1836 !
1837 ! Output: None.
1838 !
1839 ! Notes: None.
1840 !
1841 ! ******************************************************************************
1842 
1843  SUBROUTINE rflu_writeflowwrapper(pRegion)
1844 
1845 #ifdef GENX
1848 #endif
1849 
1850 #ifdef PLAG
1853 #endif
1854 
1855 #ifdef SPEC
1860 #endif
1861 
1862 #ifdef TURB
1865 #endif
1866 
1867  IMPLICIT NONE
1868 
1869 ! ******************************************************************************
1870 ! Declarations and definitions
1871 ! ******************************************************************************
1872 
1873 ! ==============================================================================
1874 ! Arguments
1875 ! ==============================================================================
1876 
1877  TYPE(t_region), POINTER :: pregion
1878 
1879 ! ==============================================================================
1880 ! Local variables
1881 ! ==============================================================================
1882 
1883  TYPE(t_global), POINTER :: global
1884  INTEGER :: sz, ng
1885 
1886 ! ******************************************************************************
1887 ! Start
1888 ! ******************************************************************************
1889 
1890  global => pregion%global
1891 
1892  CALL registerfunction(global,'RFLU_WriteFlowWrapper',&
1893  'RFLU_ModReadWriteFlow.F90')
1894 
1895 ! ******************************************************************************
1896 ! Write mixture solution files
1897 ! ******************************************************************************
1898 
1899 #ifdef GENX
1900  IF ( rflu_genx_decidewritefile(global) .EQV. .false. ) THEN
1901 #endif
1902  IF ( global%solutFormat == format_ascii ) THEN
1903  CALL rflu_writeflowascii(pregion)
1904  ELSE IF ( global%solutFormat == format_binary ) THEN
1905  CALL rflu_writeflowbinary(pregion)
1906  ELSE
1907  CALL errorstop(global,err_reached_default,__line__)
1908  END IF ! global%solutFormat
1909 #ifdef GENX
1910  ELSE
1911  CALL com_get_size(trim(global%volWinName)//'.rhof', 101, sz, ng)
1912  CALL rflu_genx_putdataflow(pregion)
1913  END IF ! RFLU_GENX_DecideReadFile
1914 #endif
1915 
1916 ! ******************************************************************************
1917 ! Write physical module solution files
1918 ! ******************************************************************************
1919 
1920 #ifdef PLAG
1921 ! ==============================================================================
1922 ! Particles
1923 ! ==============================================================================
1924 
1925  IF ( global%plagUsed .EQV. .true. ) THEN
1926  IF ( global%solutFormat == format_ascii ) THEN
1927  CALL plag_rflu_writesolutionascii(pregion)
1928  ELSE IF ( global%solutFormat == format_binary ) THEN
1929  CALL plag_rflu_writesolutionbinary(pregion)
1930  ELSE
1931  CALL errorstop(global,err_reached_default,__line__)
1932  END IF ! global%solutFormat
1933  END IF ! plagUsed
1934 #endif
1935 
1936 #ifdef SPEC
1937 ! ==============================================================================
1938 ! Species
1939 ! ==============================================================================
1940 
1941  IF ( global%specUsed .EQV. .true. ) THEN
1942  IF ( global%solutFormat == format_ascii ) THEN
1943  CALL spec_rflu_writecvascii(pregion)
1944 
1945  IF ( pregion%specInput%nSpeciesEE > 0 ) THEN
1946  CALL spec_rflu_writeeevascii(pregion)
1947  END IF ! pRegion%specInput%nSpeciesEE
1948  ELSE IF ( global%solutFormat == format_binary ) THEN
1949  CALL spec_rflu_writecvbinary(pregion)
1950 
1951  IF ( pregion%specInput%nSpeciesEE > 0 ) THEN
1952  CALL spec_rflu_writeeevbinary(pregion)
1953  END IF ! pRegion%specInput%nSpeciesEE
1954  ELSE
1955  CALL errorstop(global,err_reached_default,__line__)
1956  END IF ! global%solutFormat
1957  END IF ! global%specUsed
1958 #endif
1959 
1960 #ifdef TURB
1961 ! ==============================================================================
1962 ! Turbulence
1963 ! ==============================================================================
1964 
1965  IF ( pregion%mixtInput%flowModel == flow_navst .AND. &
1966  pregion%mixtInput%turbModel /= turb_model_none ) THEN
1967  IF ( global%solutFormat == format_ascii ) THEN
1968  CALL turb_rflu_writesolutionascii(pregion)
1969  ELSE IF ( global%solutFormat == format_binary ) THEN
1970  CALL turb_rflu_writesolutionbinary(pregion)
1971  ELSE
1972  CALL errorstop(global,err_reached_default,__line__)
1973  END IF ! global%solutFormat
1974  END IF ! NS-turb
1975 #endif
1976 
1977 ! ******************************************************************************
1978 ! End
1979 ! ******************************************************************************
1980 
1981  CALL deregisterfunction(global)
1982 
1983  END SUBROUTINE rflu_writeflowwrapper
1984 
1985 
1986 
1987 
1988 
1989 
1990 
1991 ! ******************************************************************************
1992 ! End
1993 ! ******************************************************************************
1994 
1995 END MODULE rflu_modreadwriteflow
1996 
1997 
1998 ! ******************************************************************************
1999 !
2000 ! RCS Revision history:
2001 !
2002 ! $Log: RFLU_ModReadWriteFlow.F90,v $
2003 ! Revision 1.13 2008/12/06 08:44:23 mtcampbe
2004 ! Updated license.
2005 !
2006 ! Revision 1.12 2008/11/19 22:17:34 mtcampbe
2007 ! Added Illinois Open Source License/Copyright
2008 !
2009 ! Revision 1.11 2006/12/15 13:25:27 haselbac
2010 ! Fixed bug in format statement, found by ifort
2011 !
2012 ! Revision 1.10 2006/03/26 20:22:07 haselbac
2013 ! Removed error traps for GL model
2014 !
2015 ! Revision 1.9 2006/01/12 09:40:50 wasistho
2016 ! timeStamp to currentTime in turb readFlow
2017 !
2018 ! Revision 1.8 2006/01/10 05:04:23 wasistho
2019 ! Get turbulence data from Genx
2020 !
2021 ! Revision 1.7 2005/12/29 19:54:51 wasistho
2022 ! modified Rocturb part in ReadFlowWrapper
2023 !
2024 ! Revision 1.6 2005/11/27 01:51:39 haselbac
2025 ! Added calls to EEv routines, changed extensions in backw-compatible way
2026 !
2027 ! Revision 1.5 2004/11/06 03:18:26 haselbac
2028 ! Substantial additions to allow reading/writing of data for other fluid models
2029 !
2030 ! Revision 1.4 2004/10/19 19:28:24 haselbac
2031 ! Adapted to changes in GENX logic
2032 !
2033 ! Revision 1.3 2004/08/23 23:08:43 fnajjar
2034 ! Activated binary IO routine calls
2035 !
2036 ! Revision 1.2 2004/07/28 15:29:20 jferry
2037 ! created global variable for spec use
2038 !
2039 ! Revision 1.1 2004/07/06 15:14:31 haselbac
2040 ! Initial revision
2041 !
2042 ! ******************************************************************************
2043 
2044 
2045 
2046 
2047 
2048 
2049 
2050 
2051 
2052 
2053 
2054 
INTEGER function rflu_getcvloc(global, fluidModel, var)
subroutine, public spec_rflu_readcvbinary(pRegion)
subroutine, public rflu_genx_getdataflow(pRegion)
subroutine, public rflu_writeflowwrapper(pRegion)
subroutine rflu_writeflowbinary(pRegion)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
subroutine turb_rflu_writesolutionbinary(region)
subroutine turb_rflu_writesolutionascii(region)
subroutine rflu_readflowascii(pRegion)
subroutine plag_rflu_writesolutionascii(pRegion)
subroutine rflu_readflowbinary(pRegion)
subroutine, public spec_rflu_writeeevbinary(pRegion)
subroutine, public spec_rflu_readeevbinary(pRegion)
subroutine, public spec_rflu_writecvbinary(pRegion)
subroutine plag_rflu_readsolutionbinary(pRegion)
blockLoc i
Definition: read.cpp:79
**********************************************************************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, public rflu_genx_putdataflow(pRegion)
subroutine, public rflu_readflowwrapper(pRegion)
subroutine rflu_writeflowascii(pRegion)
subroutine, public spec_rflu_readcvascii(pRegion)
LOGICAL function, public rflu_genx_decidereadfile(global)
subroutine turb_rflu_readsolutionascii(region)
j indices j
Definition: Indexing.h:6
subroutine, public spec_rflu_writeeevascii(pRegion)
subroutine plag_rflu_readsolutionascii(pRegion)
subroutine, public turb_rflu_genxgetdata(pRegion)
subroutine turb_initsolution(region)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine, public spec_rflu_writecvascii(pRegion)
subroutine, public spec_rflu_readeevascii(pRegion)
subroutine turb_rflu_readsolutionbinary(region)
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine plag_rflu_writesolutionbinary(pRegion)
LOGICAL function, public rflu_genx_decidewritefile(global)
subroutine buildfilenamesteady(global, dest, ext, id, it, fileName)
subroutine buildfilenameunsteady(global, dest, ext, id, tm, fileName)