Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ModPatchCoeffs.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: Collection of routines for patch coefficients.
26 !
27 ! Description: None.
28 !
29 ! Notes: None.
30 !
31 ! ******************************************************************************
32 !
33 ! $Id: RFLU_ModPatchCoeffs.F90,v 1.6 2008/12/06 08:44:23 mtcampbe Exp $
34 !
35 ! Copyright: (c) 2004 by the University of Illinois
36 !
37 ! ******************************************************************************
38 
40 
41  USE modparameters
42  USE moddatatypes
43  USE modglobal, ONLY: t_global
44  USE modgrid, ONLY: t_grid
45  USE modbndpatch, ONLY: t_patch
46  USE moddatastruct, ONLY: t_region
47  USE moderror
48  USE modmpi
49 
52 
53  IMPLICIT NONE
54 
55 ! ******************************************************************************
56 ! Definitions and declarations
57 ! ******************************************************************************
58 
59 ! ==============================================================================
60 ! Private data
61 ! ==============================================================================
62 
63  CHARACTER(CHRLEN), PRIVATE :: &
64  RCSIdentString = '$RCSfile: RFLU_ModPatchCoeffs.F90,v $ $Revision: 1.6 $'
65 
66 ! ==============================================================================
67 ! Public functions
68 ! ==============================================================================
69 
70  PUBLIC :: rflu_createpatchcoeffs, &
74 
75 ! ==============================================================================
76 ! Private functions
77 ! ==============================================================================
78 
79  PRIVATE :: rflu_closepatchcoeffs, &
88 
89 ! ******************************************************************************
90 ! Routines
91 ! ******************************************************************************
92 
93  CONTAINS
94 
95 
96 
97 
98 
99 ! *******************************************************************************
100 !
101 ! Purpose: Close patch-coefficients file.
102 !
103 ! Description: None.
104 !
105 ! Input:
106 ! pRegion Pointer to region
107 !
108 ! Output: None.
109 !
110 ! Notes: None.
111 !
112 ! ******************************************************************************
113 
114  SUBROUTINE rflu_closepatchcoeffs(pRegion)
115 
116  IMPLICIT NONE
117 
118 ! ******************************************************************************
119 ! Declarations and definitions
120 ! ******************************************************************************
121 
122 ! ==============================================================================
123 ! Arguments
124 ! ==============================================================================
125 
126  TYPE(t_region), POINTER :: pregion
127 
128 ! ==============================================================================
129 ! Locals
130 ! ==============================================================================
131 
132  INTEGER :: errorflag
133  TYPE(t_global), POINTER :: global
134 
135 ! ******************************************************************************
136 ! Start, set pointers and variables
137 ! ******************************************************************************
138 
139  global => pregion%global
140 
141  CALL registerfunction(global,'RFLU_ClosePatchCoeffs',&
142  'RFLU_ModPatchCoeffs.F90')
143 
144  IF ( global%myProcid == masterproc .AND. &
145  global%verbLevel >= verbose_high ) THEN
146  WRITE(stdout,'(A,1X,A)') solver_name, &
147  'Closing patch-coefficients file...'
148  END IF ! global%verbLevel
149 
150 ! ******************************************************************************
151 ! Close file
152 ! ******************************************************************************
153 
154  CLOSE(if_patch_coef,iostat=errorflag)
155  global%error = errorflag
156  IF ( global%error /= err_none ) THEN
157  CALL errorstop(global,err_file_close,__line__)
158  END IF ! global%error
159 
160 ! ******************************************************************************
161 ! End
162 ! ******************************************************************************
163 
164  IF ( global%myProcid == masterproc .AND. &
165  global%verbLevel >= verbose_high ) THEN
166  WRITE(stdout,'(A,1X,A)') solver_name, &
167  'Closing patch-coefficients file done.'
168  END IF ! global%verbLevel
169 
170  CALL deregisterfunction(global)
171 
172  END SUBROUTINE rflu_closepatchcoeffs
173 
174 
175 
176 
177 
178 
179 ! *******************************************************************************
180 !
181 ! Purpose: Create patch coefficients.
182 !
183 ! Description: None.
184 !
185 ! Input:
186 ! pRegion Pointer to region
187 !
188 ! Output: None.
189 !
190 ! Notes: None.
191 !
192 ! ******************************************************************************
193 
194  SUBROUTINE rflu_createpatchcoeffs(pRegion)
195 
196  IMPLICIT NONE
197 
198 ! ******************************************************************************
199 ! Declarations and definitions
200 ! ******************************************************************************
201 
202 ! ==============================================================================
203 ! Arguments
204 ! ==============================================================================
205 
206  TYPE(t_region), POINTER :: pregion
207 
208 ! ==============================================================================
209 ! Locals
210 ! ==============================================================================
211 
212  INTEGER :: errorflag,ipatch
213  TYPE(t_global), POINTER :: global
214  TYPE(t_grid), POINTER :: pgrid
215  TYPE(t_patch), POINTER :: ppatch
216 
217 ! ******************************************************************************
218 ! Start, set pointers and variables
219 ! ******************************************************************************
220 
221  global => pregion%global
222 
223  CALL registerfunction(global,'RFLU_CreatePatchCoeffs',&
224  'RFLU_ModPatchCoeffs.F90')
225 
226  pgrid => pregion%grid
227 
228 ! ******************************************************************************
229 ! Allocate memory
230 ! ******************************************************************************
231 
232  DO ipatch = 1,pgrid%nPatches
233  ppatch => pregion%patches(ipatch)
234 
235  ALLOCATE(ppatch%cp(ppatch%nBFaces),stat=errorflag)
236  global%error = errorflag
237  IF ( global%error /= err_none ) THEN
238  CALL errorstop(global,err_allocate,__line__,'pPatch%cp')
239  END IF ! global%error
240 
241  ALLOCATE(ppatch%cf(xcoord:zcoord,ppatch%nBFaces),stat=errorflag)
242  global%error = errorflag
243  IF ( global%error /= err_none ) THEN
244  CALL errorstop(global,err_allocate,__line__,'pPatch%cf')
245  END IF ! global%error
246 
247  ALLOCATE(ppatch%ch(ppatch%nBFaces),stat=errorflag)
248  global%error = errorflag
249  IF ( global%error /= err_none ) THEN
250  CALL errorstop(global,err_allocate,__line__,'pPatch%ch')
251  END IF ! global%error
252 
253  ALLOCATE(ppatch%cmass(ppatch%nBFaces),stat=errorflag)
254  global%error = errorflag
255  IF ( global%error /= err_none ) THEN
256  CALL errorstop(global,err_allocate,__line__,'pPatch%cmass')
257  END IF ! global%error
258 
259  ALLOCATE(ppatch%cmom(xcoord:zcoord,ppatch%nBFaces),stat=errorflag)
260  global%error = errorflag
261  IF ( global%error /= err_none ) THEN
262  CALL errorstop(global,err_allocate,__line__,'pPatch%cmom')
263  END IF ! global%error
264  END DO ! iPatch
265 
266 ! ******************************************************************************
267 ! Initialize memory
268 ! ******************************************************************************
269 
270  CALL rflu_initpatchcoeffs(pregion)
271 
272 ! ******************************************************************************
273 ! End
274 ! ******************************************************************************
275 
276  CALL deregisterfunction(global)
277 
278  END SUBROUTINE rflu_createpatchcoeffs
279 
280 
281 
282 
283 
284 
285 
286 
287 
288 ! *******************************************************************************
289 !
290 ! Purpose: Destroy patch coefficients.
291 !
292 ! Description: None.
293 !
294 ! Input:
295 ! pRegion Pointer to region
296 !
297 ! Output: None.
298 !
299 ! Notes: None.
300 !
301 ! ******************************************************************************
302 
303  SUBROUTINE rflu_destroypatchcoeffs(pRegion)
304 
305  IMPLICIT NONE
306 
307 ! ******************************************************************************
308 ! Declarations and definitions
309 ! ******************************************************************************
310 
311 ! ==============================================================================
312 ! Arguments
313 ! ==============================================================================
314 
315  TYPE(t_region), POINTER :: pregion
316 
317 ! ==============================================================================
318 ! Locals
319 ! ==============================================================================
320 
321  INTEGER :: errorflag,ipatch
322  TYPE(t_global), POINTER :: global
323  TYPE(t_grid), POINTER :: pgrid
324  TYPE(t_patch), POINTER :: ppatch
325 
326 ! ******************************************************************************
327 ! Start, set pointers and variables
328 ! ******************************************************************************
329 
330  global => pregion%global
331 
332  CALL registerfunction(global,'RFLU_DestroyPatchCoeffs',&
333  'RFLU_ModPatchCoeffs.F90')
334 
335  pgrid => pregion%grid
336 
337 ! ******************************************************************************
338 ! Deallocate memory
339 ! ******************************************************************************
340 
341  DO ipatch = 1,pgrid%nPatches
342  ppatch => pregion%patches(ipatch)
343 
344  DEALLOCATE(ppatch%cp,stat=errorflag)
345  global%error = errorflag
346  IF ( global%error /= err_none ) THEN
347  CALL errorstop(global,err_deallocate,__line__,'pPatch%cp')
348  END IF ! global%error
349 
350  DEALLOCATE(ppatch%cf,stat=errorflag)
351  global%error = errorflag
352  IF ( global%error /= err_none ) THEN
353  CALL errorstop(global,err_deallocate,__line__,'pPatch%cf')
354  END IF ! global%error
355 
356  DEALLOCATE(ppatch%ch,stat=errorflag)
357  global%error = errorflag
358  IF ( global%error /= err_none ) THEN
359  CALL errorstop(global,err_deallocate,__line__,'pPatch%ch')
360  END IF ! global%error
361 
362  DEALLOCATE(ppatch%cmass,stat=errorflag)
363  global%error = errorflag
364  IF ( global%error /= err_none ) THEN
365  CALL errorstop(global,err_deallocate,__line__,'pPatch%cmass')
366  END IF ! global%error
367 
368  DEALLOCATE(ppatch%cmom,stat=errorflag)
369  global%error = errorflag
370  IF ( global%error /= err_none ) THEN
371  CALL errorstop(global,err_deallocate,__line__,'pPatch%cmom')
372  END IF ! global%error
373  END DO ! iPatch
374 
375 ! ******************************************************************************
376 ! Nullify memory
377 ! ******************************************************************************
378 
379  CALL rflu_nullifypatchcoeffs(pregion)
380 
381 ! ******************************************************************************
382 ! End
383 ! ******************************************************************************
384 
385  CALL deregisterfunction(global)
386 
387  END SUBROUTINE rflu_destroypatchcoeffs
388 
389 
390 
391 
392 
393 ! *******************************************************************************
394 !
395 ! Purpose: Initialize patch coefficients.
396 !
397 ! Description: None.
398 !
399 ! Input:
400 ! pRegion Pointer to region
401 !
402 ! Output: None.
403 !
404 ! Notes: None.
405 !
406 ! ******************************************************************************
407 
408  SUBROUTINE rflu_initpatchcoeffs(pRegion)
409 
410  IMPLICIT NONE
411 
412 ! ******************************************************************************
413 ! Declarations and definitions
414 ! ******************************************************************************
415 
416 ! ==============================================================================
417 ! Arguments
418 ! ==============================================================================
419 
420  TYPE(t_region), POINTER :: pregion
421 
422 ! ==============================================================================
423 ! Locals
424 ! ==============================================================================
425 
426  INTEGER :: errorflag,ifl,ipatch
427  TYPE(t_global), POINTER :: global
428  TYPE(t_grid), POINTER :: pgrid
429  TYPE(t_patch), POINTER :: ppatch
430 
431 ! ******************************************************************************
432 ! Start, set pointers and variables
433 ! ******************************************************************************
434 
435  global => pregion%global
436 
437  CALL registerfunction(global,'RFLU_InitPatchCoeffs',&
438  'RFLU_ModPatchCoeffs.F90')
439 
440  pgrid => pregion%grid
441 
442 ! ******************************************************************************
443 ! Allocate memory
444 ! ******************************************************************************
445 
446  DO ipatch = 1,pgrid%nPatches
447  ppatch => pregion%patches(ipatch)
448 
449  DO ifl = 1,ppatch%nBFaces
450  ppatch%cp(ifl) = 0.0_rfreal
451  ppatch%cf(xcoord,ifl) = 0.0_rfreal
452  ppatch%cf(ycoord,ifl) = 0.0_rfreal
453  ppatch%cf(zcoord,ifl) = 0.0_rfreal
454  ppatch%ch(ifl) = 0.0_rfreal
455  ppatch%cmass(ifl) = 0.0_rfreal
456  ppatch%cmom(xcoord,ifl) = 0.0_rfreal
457  ppatch%cmom(ycoord,ifl) = 0.0_rfreal
458  ppatch%cmom(zcoord,ifl) = 0.0_rfreal
459  END DO ! ifl
460  END DO ! iPatch
461 
462 ! ******************************************************************************
463 ! End
464 ! ******************************************************************************
465 
466  CALL deregisterfunction(global)
467 
468  END SUBROUTINE rflu_initpatchcoeffs
469 
470 
471 
472 
473 
474 
475 
476 ! *******************************************************************************
477 !
478 ! Purpose: Nullify patch coefficients.
479 !
480 ! Description: None.
481 !
482 ! Input:
483 ! pRegion Pointer to region
484 !
485 ! Output: None.
486 !
487 ! Notes: None.
488 !
489 ! ******************************************************************************
490 
491  SUBROUTINE rflu_nullifypatchcoeffs(pRegion)
492 
493  IMPLICIT NONE
494 
495 ! ******************************************************************************
496 ! Declarations and definitions
497 ! ******************************************************************************
498 
499 ! ==============================================================================
500 ! Arguments
501 ! ==============================================================================
502 
503  TYPE(t_region), POINTER :: pregion
504 
505 ! ==============================================================================
506 ! Locals
507 ! ==============================================================================
508 
509  INTEGER :: ipatch
510  TYPE(t_global), POINTER :: global
511  TYPE(t_grid), POINTER :: pgrid
512  TYPE(t_patch), POINTER :: ppatch
513 
514 ! ******************************************************************************
515 ! Start, set pointers and variables
516 ! ******************************************************************************
517 
518  global => pregion%global
519 
520  CALL registerfunction(global,'RFLU_NullifyPatchCoeffs',&
521  'RFLU_ModPatchCoeffs.F90')
522 
523  pgrid => pregion%grid
524 
525 ! ******************************************************************************
526 ! Deallocate memory
527 ! ******************************************************************************
528 
529  DO ipatch = 1,pgrid%nPatches
530  ppatch => pregion%patches(ipatch)
531 
532  nullify(ppatch%cp)
533  nullify(ppatch%cf)
534  nullify(ppatch%ch)
535  nullify(ppatch%cmass)
536  nullify(ppatch%cmom)
537  END DO ! iPatch
538 
539 ! ******************************************************************************
540 ! End
541 ! ******************************************************************************
542 
543  CALL deregisterfunction(global)
544 
545  END SUBROUTINE rflu_nullifypatchcoeffs
546 
547 
548 
549 
550 
551 
552 
553 ! *******************************************************************************
554 !
555 ! Purpose: Open patch-coefficient file in ASCII format.
556 !
557 ! Description: None.
558 !
559 ! Input:
560 ! pRegion Pointer to region
561 ! fileStatus File status
562 !
563 ! Output:
564 ! fileExists Flag indicating existence of file
565 !
566 ! Notes:
567 ! 1. File may not exist when it is opened in postprocessor before solver
568 ! was run, so need to deal with this gracefully.
569 !
570 ! ******************************************************************************
571 
572  SUBROUTINE rflu_openpatchcoeffsascii(pRegion,fileStatus,fileExists)
573 
574  IMPLICIT NONE
575 
576 ! ******************************************************************************
577 ! Declarations and definitions
578 ! ******************************************************************************
579 
580 ! ==============================================================================
581 ! Arguments
582 ! ==============================================================================
583 
584  INTEGER, INTENT(IN) :: filestatus
585  LOGICAL, INTENT(OUT), OPTIONAL :: fileexists
586  TYPE(t_region), POINTER :: pregion
587 
588 ! ==============================================================================
589 ! Locals
590 ! ==============================================================================
591 
592  CHARACTER(CHRLEN) :: ifilename
593  INTEGER :: errorflag,ifile
594  TYPE(t_global), POINTER :: global
595 
596 ! ******************************************************************************
597 ! Start, set pointers and variables
598 ! ******************************************************************************
599 
600  global => pregion%global
601 
602  CALL registerfunction(global,'RFLU_OpenPatchCoeffsASCII',&
603  'RFLU_ModPatchCoeffs.F90')
604 
605  IF ( global%myProcid == masterproc .AND. &
606  global%verbLevel >= verbose_high ) THEN
607  WRITE(stdout,'(A,1X,A)') solver_name, &
608  'Opening ASCII patch-coefficients file...'
609  END IF ! global%verbLevel
610 
611  ifile = if_patch_coef
612 
613 ! ******************************************************************************
614 ! Build file name
615 ! ******************************************************************************
616 
617  IF ( global%flowType == flow_unsteady ) THEN
618  CALL buildfilenameunsteady(global,filedest_outdir,'.pcoa', &
619  pregion%iRegionGlobal,global%currentTime, &
620  ifilename)
621 
622  IF ( global%myProcid == masterproc .AND. &
623  global%verbLevel >= verbose_high ) THEN
624  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
625  pregion%iRegionGlobal
626  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
627  global%currentTime
628  END IF ! global%verbLevel
629  ELSE
630  CALL buildfilenamesteady(global,filedest_outdir,'.pcoa', &
631  pregion%iRegionGlobal,global%currentIter, &
632  ifilename)
633 
634  IF ( global%myProcid == masterproc .AND. &
635  global%verbLevel >= verbose_high ) THEN
636  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
637  pregion%iRegionGlobal
638  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name,'Current iteration '// &
639  'number:',global%currentIter
640  END IF ! global%verbLevel
641  ENDIF ! global%flowType
642 
643 ! ******************************************************************************
644 ! Open file
645 ! ******************************************************************************
646 
647  IF ( filestatus == file_status_old ) THEN
648  INQUIRE(file=ifilename,exist=fileexists)
649 
650  IF ( fileexists .EQV. .true. ) THEN
651  OPEN(ifile,file=ifilename,form="FORMATTED",status="OLD", &
652  iostat=errorflag)
653  global%error = errorflag
654  IF ( global%error /= err_none ) THEN
655  CALL errorstop(global,err_file_open,__line__,ifilename)
656  END IF ! global%error
657  END IF ! fileExists
658  ELSE IF ( filestatus == file_status_unknown ) THEN
659  OPEN(ifile,file=ifilename,form="FORMATTED",status="UNKNOWN", &
660  iostat=errorflag)
661  global%error = errorflag
662  IF ( global%error /= err_none ) THEN
663  CALL errorstop(global,err_file_open,__line__,ifilename)
664  END IF ! global%error
665  ELSE
666  CALL errorstop(global,err_reached_default,__line__)
667  END IF ! fileStatus
668 
669 ! ******************************************************************************
670 ! End
671 ! ******************************************************************************
672 
673  IF ( global%myProcid == masterproc .AND. &
674  global%verbLevel >= verbose_high ) THEN
675  WRITE(stdout,'(A,1X,A)') solver_name, &
676  'Opening ASCII patch-coefficients file done.'
677  END IF ! global%verbLevel
678 
679  CALL deregisterfunction(global)
680 
681  END SUBROUTINE rflu_openpatchcoeffsascii
682 
683 
684 
685 
686 
687 
688 
689 ! *******************************************************************************
690 !
691 ! Purpose: Open patch-coefficient file in binary format.
692 !
693 ! Description: None.
694 !
695 ! Input:
696 ! pRegion Pointer to region
697 ! fileStatus File status
698 !
699 ! Output:
700 ! fileExists Flag indicating existence of file
701 !
702 ! Notes:
703 ! 1. File may not exist when it is opened in postprocessor before solver
704 ! was run, so need to deal with this gracefully.
705 !
706 ! ******************************************************************************
707 
708  SUBROUTINE rflu_openpatchcoeffsbinary(pRegion,fileStatus,fileExists)
709 
710  IMPLICIT NONE
711 
712 ! ******************************************************************************
713 ! Declarations and definitions
714 ! ******************************************************************************
715 
716 ! ==============================================================================
717 ! Arguments
718 ! ==============================================================================
719 
720  INTEGER, INTENT(IN) :: filestatus
721  LOGICAL, INTENT(OUT), OPTIONAL :: fileexists
722  TYPE(t_region), POINTER :: pregion
723 
724 ! ==============================================================================
725 ! Locals
726 ! ==============================================================================
727 
728  CHARACTER(CHRLEN) :: ifilename
729  INTEGER :: errorflag,ifile
730  TYPE(t_global), POINTER :: global
731 
732 ! ******************************************************************************
733 ! Start, set pointers and variables
734 ! ******************************************************************************
735 
736  global => pregion%global
737 
738  CALL registerfunction(global,'RFLU_OpenPatchCoeffsBinary',&
739  'RFLU_ModPatchCoeffs.F90')
740 
741  IF ( global%myProcid == masterproc .AND. &
742  global%verbLevel >= verbose_high ) THEN
743  WRITE(stdout,'(A,1X,A)') solver_name, &
744  'Opening binary patch-coefficients file...'
745  END IF ! global%verbLevel
746 
747  ifile = if_patch_coef
748 
749 ! ******************************************************************************
750 ! Build file name
751 ! ******************************************************************************
752 
753  IF ( global%flowType == flow_unsteady ) THEN
754  CALL buildfilenameunsteady(global,filedest_outdir,'.pco', &
755  pregion%iRegionGlobal,global%currentTime, &
756  ifilename)
757 
758  IF ( global%myProcid == masterproc .AND. &
759  global%verbLevel >= verbose_high ) THEN
760  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
761  pregion%iRegionGlobal
762  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
763  global%currentTime
764  END IF ! global%verbLevel
765  ELSE
766  CALL buildfilenamesteady(global,filedest_outdir,'.pco', &
767  pregion%iRegionGlobal,global%currentIter, &
768  ifilename)
769 
770  IF ( global%myProcid == masterproc .AND. &
771  global%verbLevel >= verbose_high ) THEN
772  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
773  pregion%iRegionGlobal
774  WRITE(stdout,'(A,3X,A,1X,I6.6)') solver_name,'Current iteration '// &
775  'number:',global%currentIter
776  END IF ! global%verbLevel
777  ENDIF ! global%flowType
778 
779 ! ******************************************************************************
780 ! Open file
781 ! ******************************************************************************
782 
783  IF ( filestatus == file_status_old ) THEN
784  INQUIRE(file=ifilename,exist=fileexists)
785 
786  IF ( fileexists .EQV. .true. ) THEN
787  OPEN(ifile,file=ifilename,form="UNFORMATTED",status="OLD", &
788  iostat=errorflag)
789  global%error = errorflag
790  IF ( global%error /= err_none ) THEN
791  CALL errorstop(global,err_file_open,__line__,ifilename)
792  END IF ! global%error
793  END IF ! fileExists
794  ELSE IF ( filestatus == file_status_unknown ) THEN
795  OPEN(ifile,file=ifilename,form="UNFORMATTED",status="UNKNOWN", &
796  iostat=errorflag)
797  global%error = errorflag
798  IF ( global%error /= err_none ) THEN
799  CALL errorstop(global,err_file_open,__line__,ifilename)
800  END IF ! global%error
801  ELSE
802  CALL errorstop(global,err_reached_default,__line__)
803  END IF ! fileStatus
804 
805 ! ******************************************************************************
806 ! End
807 ! ******************************************************************************
808 
809  IF ( global%myProcid == masterproc .AND. &
810  global%verbLevel >= verbose_high ) THEN
811  WRITE(stdout,'(A,1X,A)') solver_name, &
812  'Opening binary patch-coefficients file done.'
813  END IF ! global%verbLevel
814 
815  CALL deregisterfunction(global)
816 
817  END SUBROUTINE rflu_openpatchcoeffsbinary
818 
819 
820 
821 
822 
823 
824 
825 ! *******************************************************************************
826 !
827 ! Purpose: Read patch coefficients in ASCII format.
828 !
829 ! Description: None.
830 !
831 ! Input:
832 ! pRegion Pointer to region
833 !
834 ! Output: None.
835 !
836 ! Notes: None.
837 !
838 ! ******************************************************************************
839 
840  SUBROUTINE rflu_readpatchcoeffsascii(pRegion)
841 
842  IMPLICIT NONE
843 
844 ! ******************************************************************************
845 ! Declarations and definitions
846 ! ******************************************************************************
847 
848 ! ==============================================================================
849 ! Arguments
850 ! ==============================================================================
851 
852  TYPE(t_region), POINTER :: pregion
853 
854 ! ==============================================================================
855 ! Locals
856 ! ==============================================================================
857 
858  CHARACTER(CHRLEN) :: ifilename,sectionstring
859  INTEGER :: errorflag,ifile,ifl,ipatch,loopcounter
860  TYPE(t_global), POINTER :: global
861  TYPE(t_grid), POINTER :: pgrid
862  TYPE(t_patch), POINTER :: ppatch
863 
864 ! ******************************************************************************
865 ! Start, set pointers and variables
866 ! ******************************************************************************
867 
868  global => pregion%global
869 
870  CALL registerfunction(global,'RFLU_ReadPatchCoeffsASCII',&
871  'RFLU_ModPatchCoeffs.F90')
872 
873  IF ( global%myProcid == masterproc .AND. &
874  global%verbLevel >= verbose_med ) THEN
875  WRITE(stdout,'(A,1X,A)') solver_name
876  WRITE(stdout,'(A,1X,A)') solver_name, &
877  'Reading ASCII patch-coefficients file...'
878  END IF ! global%verbLevel
879 
880  pgrid => pregion%grid
881 
882  ifile = if_patch_coef
883 
884 ! ******************************************************************************
885 ! Header and general information
886 ! ******************************************************************************
887 
888  IF ( global%myProcid == masterproc .AND. &
889  global%verbLevel >= verbose_med) THEN
890  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
891  END IF ! global%verbLevel
892 
893  READ(ifile,'(A)') sectionstring
894  IF ( trim(sectionstring) /= '# ROCFLU patch-coefficients file' ) THEN
895  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
896  END IF ! TRIM
897 
898 ! ******************************************************************************
899 ! Read rest of file
900 ! ******************************************************************************
901 
902  loopcounter = 0
903 
904  DO ! set up infinite loop
905  loopcounter = loopcounter + 1
906 
907  READ(ifile,'(A)') sectionstring
908 
909  SELECT CASE ( trim(sectionstring) )
910 
911 ! ==============================================================================
912 ! Pressure coefficient
913 ! ==============================================================================
914 
915  CASE ( '# Pressure coefficient' )
916  IF ( global%myProcid == masterproc .AND. &
917  global%verbLevel >= verbose_med) THEN
918  WRITE(stdout,'(A,3X,A)') solver_name,'Pressure coefficient...'
919  END IF ! global%verbLevel
920 
921  DO ipatch = 1,pgrid%nPatches
922  ppatch => pregion%patches(ipatch)
923 
924  READ(ifile,'(5(E23.16))') (ppatch%cp(ifl),ifl=1,ppatch%nBFaces)
925  END DO ! iPatch
926 
927 ! ==============================================================================
928 ! Skin-friction coefficient
929 ! ==============================================================================
930 
931  CASE ( '# Skin-friction coefficient' )
932  IF ( global%myProcid == masterproc .AND. &
933  global%verbLevel >= verbose_med) THEN
934  WRITE(stdout,'(A,3X,A)') solver_name,'Skin-friction coefficient...'
935  END IF ! global%verbLevel
936 
937  DO ipatch = 1,pgrid%nPatches
938  ppatch => pregion%patches(ipatch)
939 
940  READ(ifile,'(5(E23.16))') (ppatch%cf(xcoord,ifl), &
941  ifl=1,ppatch%nBFaces)
942  READ(ifile,'(5(E23.16))') (ppatch%cf(ycoord,ifl), &
943  ifl=1,ppatch%nBFaces)
944  READ(ifile,'(5(E23.16))') (ppatch%cf(zcoord,ifl), &
945  ifl=1,ppatch%nBFaces)
946  END DO ! iPatch
947 
948 ! ==============================================================================
949 ! Heat-transfer coefficient
950 ! ==============================================================================
951 
952  CASE ( '# Heat-transfer coefficient' )
953  IF ( global%myProcid == masterproc .AND. &
954  global%verbLevel >= verbose_med) THEN
955  WRITE(stdout,'(A,3X,A)') solver_name,'Heat-transfer coefficient...'
956  END IF ! global%verbLevel
957 
958  DO ipatch = 1,pgrid%nPatches
959  ppatch => pregion%patches(ipatch)
960 
961  READ(ifile,'(5(E23.16))') (ppatch%ch(ifl),ifl=1,ppatch%nBFaces)
962  END DO ! iPatch
963 
964 ! ==============================================================================
965 ! End marker
966 ! ==============================================================================
967 
968  CASE ( '# End' )
969  IF ( global%myProcid == masterproc .AND. &
970  global%verbLevel >= verbose_med) THEN
971  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
972  END IF ! global%verbLevel
973 
974  EXIT
975 
976 ! ==============================================================================
977 ! Invalid section string
978 ! ==============================================================================
979 
980  CASE default
981  IF ( global%verbLevel >= verbose_med) THEN
982  WRITE(stdout,'(A,3X,A)') solver_name,sectionstring
983  END IF ! verbosityLevel
984 
985  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
986  END SELECT ! TRIM
987 
988 ! ==============================================================================
989 ! Guard against infinite loop - unnecessary because of read errors?
990 ! ==============================================================================
991 
992  IF ( loopcounter >= limit_infinite_loop ) THEN
993  CALL errorstop(global,err_infinite_loop,__line__)
994  END IF ! loopCounter
995  END DO ! <empty>
996 
997 ! ******************************************************************************
998 ! End
999 ! ******************************************************************************
1000 
1001  IF ( global%myProcid == masterproc .AND. &
1002  global%verbLevel >= verbose_med ) THEN
1003  WRITE(stdout,'(A,1X,A)') solver_name, &
1004  'Reading ASCII patch-coefficients file done.'
1005  WRITE(stdout,'(A,1X,A)') solver_name
1006  END IF ! global%verbLevel
1007 
1008  CALL deregisterfunction(global)
1009 
1010  END SUBROUTINE rflu_readpatchcoeffsascii
1011 
1012 
1013 
1014 
1015 
1016 
1017 ! *******************************************************************************
1018 !
1019 ! Purpose: Read patch coefficients in binary format.
1020 !
1021 ! Description: None.
1022 !
1023 ! Input:
1024 ! pRegion Pointer to region
1025 !
1026 ! Output: None.
1027 !
1028 ! Notes: None.
1029 !
1030 ! ******************************************************************************
1031 
1032  SUBROUTINE rflu_readpatchcoeffsbinary(pRegion)
1033 
1034  IMPLICIT NONE
1035 
1036 ! ******************************************************************************
1037 ! Declarations and definitions
1038 ! ******************************************************************************
1039 
1040 ! ==============================================================================
1041 ! Arguments
1042 ! ==============================================================================
1043 
1044  TYPE(t_region), POINTER :: pregion
1045 
1046 ! ==============================================================================
1047 ! Locals
1048 ! ==============================================================================
1049 
1050  CHARACTER(CHRLEN) :: ifilename,sectionstring
1051  INTEGER :: errorflag,ifile,ifl,ipatch,loopcounter
1052  TYPE(t_global), POINTER :: global
1053  TYPE(t_grid), POINTER :: pgrid
1054  TYPE(t_patch), POINTER :: ppatch
1055 
1056 ! ******************************************************************************
1057 ! Start, set pointers and variables
1058 ! ******************************************************************************
1059 
1060  global => pregion%global
1061 
1062  CALL registerfunction(global,'RFLU_ReadPatchCoeffsBinary',&
1063  'RFLU_ModPatchCoeffs.F90')
1064 
1065  IF ( global%myProcid == masterproc .AND. &
1066  global%verbLevel >= verbose_med ) THEN
1067  WRITE(stdout,'(A,1X,A)') solver_name
1068  WRITE(stdout,'(A,1X,A)') solver_name, &
1069  'Reading binary patch-coefficients file...'
1070  END IF ! global%verbLevel
1071 
1072  pgrid => pregion%grid
1073 
1074  ifile = if_patch_coef
1075 
1076 ! ******************************************************************************
1077 ! Header and general information
1078 ! ******************************************************************************
1079 
1080  IF ( global%myProcid == masterproc .AND. &
1081  global%verbLevel >= verbose_med) THEN
1082  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
1083  END IF ! global%verbLevel
1084 
1085  READ(ifile) sectionstring
1086  IF ( trim(sectionstring) /= '# ROCFLU patch-coefficients file' ) THEN
1087  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
1088  END IF ! TRIM
1089 
1090 ! ******************************************************************************
1091 ! Read rest of file
1092 ! ******************************************************************************
1093 
1094  loopcounter = 0
1095 
1096  DO ! set up infinite loop
1097  loopcounter = loopcounter + 1
1098 
1099  READ(ifile) sectionstring
1100 
1101  SELECT CASE ( trim(sectionstring) )
1102 
1103 ! ==============================================================================
1104 ! Pressure coefficient
1105 ! ==============================================================================
1106 
1107  CASE ( '# Pressure coefficient' )
1108  IF ( global%myProcid == masterproc .AND. &
1109  global%verbLevel >= verbose_med) THEN
1110  WRITE(stdout,'(A,3X,A)') solver_name,'Pressure coefficient...'
1111  END IF ! global%verbLevel
1112 
1113  DO ipatch = 1,pgrid%nPatches
1114  ppatch => pregion%patches(ipatch)
1115 
1116  READ(ifile) (ppatch%cp(ifl),ifl=1,ppatch%nBFaces)
1117  END DO ! iPatch
1118 
1119 ! ==============================================================================
1120 ! Skin-friction coefficient
1121 ! ==============================================================================
1122 
1123  CASE ( '# Skin-friction coefficient' )
1124  IF ( global%myProcid == masterproc .AND. &
1125  global%verbLevel >= verbose_med) THEN
1126  WRITE(stdout,'(A,3X,A)') solver_name,'Skin-friction coefficient...'
1127  END IF ! global%verbLevel
1128 
1129  DO ipatch = 1,pgrid%nPatches
1130  ppatch => pregion%patches(ipatch)
1131 
1132  READ(ifile) (ppatch%cf(xcoord,ifl),ifl=1,ppatch%nBFaces)
1133  READ(ifile) (ppatch%cf(ycoord,ifl),ifl=1,ppatch%nBFaces)
1134  READ(ifile) (ppatch%cf(zcoord,ifl),ifl=1,ppatch%nBFaces)
1135  END DO ! iPatch
1136 
1137 ! ==============================================================================
1138 ! Heat-transfer coefficient
1139 ! ==============================================================================
1140 
1141  CASE ( '# Heat-transfer coefficient' )
1142  IF ( global%myProcid == masterproc .AND. &
1143  global%verbLevel >= verbose_med) THEN
1144  WRITE(stdout,'(A,3X,A)') solver_name,'Heat-transfer coefficient...'
1145  END IF ! global%verbLevel
1146 
1147  DO ipatch = 1,pgrid%nPatches
1148  ppatch => pregion%patches(ipatch)
1149 
1150  READ(ifile) (ppatch%ch(ifl),ifl=1,ppatch%nBFaces)
1151  END DO ! iPatch
1152 
1153 ! ==============================================================================
1154 ! End marker
1155 ! ==============================================================================
1156 
1157  CASE ( '# End' )
1158  IF ( global%myProcid == masterproc .AND. &
1159  global%verbLevel >= verbose_med) THEN
1160  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
1161  END IF ! global%verbLevel
1162 
1163  EXIT
1164 
1165 ! ==============================================================================
1166 ! Invalid section string
1167 ! ==============================================================================
1168 
1169  CASE default
1170  IF ( global%verbLevel >= verbose_med) THEN
1171  WRITE(stdout,'(A,3X,A)') solver_name,sectionstring
1172  END IF ! verbosityLevel
1173 
1174  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
1175  END SELECT ! TRIM
1176 
1177 ! ==============================================================================
1178 ! Guard against infinite loop - unnecessary because of read errors?
1179 ! ==============================================================================
1180 
1181  IF ( loopcounter >= limit_infinite_loop ) THEN
1182  CALL errorstop(global,err_infinite_loop,__line__)
1183  END IF ! loopCounter
1184  END DO ! <empty>
1185 
1186 ! ******************************************************************************
1187 ! End
1188 ! ******************************************************************************
1189 
1190  IF ( global%myProcid == masterproc .AND. &
1191  global%verbLevel >= verbose_med ) THEN
1192  WRITE(stdout,'(A,1X,A)') solver_name, &
1193  'Reading binary patch-coefficients file done.'
1194  WRITE(stdout,'(A,1X,A)') solver_name
1195  END IF ! global%verbLevel
1196 
1197  CALL deregisterfunction(global)
1198 
1199  END SUBROUTINE rflu_readpatchcoeffsbinary
1200 
1201 
1202 
1203 
1204 
1205 ! *******************************************************************************
1206 !
1207 ! Purpose: Wrapper for reading patch coefficients.
1208 !
1209 ! Description: None.
1210 !
1211 ! Input:
1212 ! pRegion Pointer to region
1213 ! fileStatus File status
1214 !
1215 ! Output: None.
1216 !
1217 ! Notes: None.
1218 !
1219 ! ******************************************************************************
1220 
1221  SUBROUTINE rflu_readpatchcoeffswrapper(pRegion)
1222 
1223  IMPLICIT NONE
1224 
1225 ! ******************************************************************************
1226 ! Declarations and definitions
1227 ! ******************************************************************************
1228 
1229 ! ==============================================================================
1230 ! Arguments
1231 ! ==============================================================================
1232 
1233  TYPE(t_region), POINTER :: pregion
1234 
1235 ! ==============================================================================
1236 ! Locals
1237 ! ==============================================================================
1238 
1239  LOGICAL :: fileexists
1240  TYPE(t_global), POINTER :: global
1241 
1242 ! ******************************************************************************
1243 ! Start, set pointers and variables
1244 ! ******************************************************************************
1245 
1246  global => pregion%global
1247 
1248  CALL registerfunction(global,'RFLU_ReadPatchCoeffsWrapper',&
1249  'RFLU_ModPatchCoeffs.F90')
1250 
1251 ! ******************************************************************************
1252 ! Read file (if it exists)
1253 ! ******************************************************************************
1254 
1255  IF ( global%solutFormat == format_ascii ) THEN
1256  CALL rflu_openpatchcoeffsascii(pregion,file_status_old,fileexists)
1257 
1258  IF ( fileexists .EQV. .true. ) THEN
1259  CALL rflu_readpatchcoeffsascii(pregion)
1260  CALL rflu_closepatchcoeffs(pregion)
1261  END IF ! fileExists
1262  ELSE IF ( global%solutFormat == format_binary ) THEN
1263  CALL rflu_openpatchcoeffsbinary(pregion,file_status_old,fileexists)
1264 
1265  IF ( fileexists .EQV. .true. ) THEN
1266  CALL rflu_readpatchcoeffsbinary(pregion)
1267  CALL rflu_closepatchcoeffs(pregion)
1268  END IF ! fileExists
1269  ELSE
1270  CALL errorstop(global,err_reached_default,__line__)
1271  END IF ! global%solutFormat
1272 
1273 ! ******************************************************************************
1274 ! Write warning if file is missing
1275 ! ******************************************************************************
1276 
1277  IF ( fileexists .EQV. .false. ) THEN
1278  global%warnCounter = global%warnCounter + 1
1279 
1280  IF ( global%myProcid == masterproc .AND. &
1281  global%verbLevel >= verbose_none ) THEN
1282  WRITE(stdout,'(A,2(1X,A))') solver_name,'*** WARNING ***', &
1283  'Patch coefficient file missing, not read.'
1284  END IF ! global%myProcid
1285  END IF ! fileExists
1286 
1287 ! ******************************************************************************
1288 ! End
1289 ! ******************************************************************************
1290 
1291  CALL deregisterfunction(global)
1292 
1293  END SUBROUTINE rflu_readpatchcoeffswrapper
1294 
1295 
1296 
1297 
1298 
1299 
1300 ! *******************************************************************************
1301 !
1302 ! Purpose: Write patch coefficients in ASCII format.
1303 !
1304 ! Description: None.
1305 !
1306 ! Input:
1307 ! pRegion Pointer to region
1308 !
1309 ! Output: None.
1310 !
1311 ! Notes: None.
1312 !
1313 ! ******************************************************************************
1314 
1315  SUBROUTINE rflu_writepatchcoeffsascii(pRegion)
1316 
1317  IMPLICIT NONE
1318 
1319 ! ******************************************************************************
1320 ! Declarations and definitions
1321 ! ******************************************************************************
1322 
1323 ! ==============================================================================
1324 ! Arguments
1325 ! ==============================================================================
1326 
1327  TYPE(t_region), POINTER :: pregion
1328 
1329 ! ==============================================================================
1330 ! Locals
1331 ! ==============================================================================
1332 
1333  CHARACTER(CHRLEN) :: ifilename,sectionstring
1334  INTEGER :: errorflag,ifile,ifl,ipatch
1335  TYPE(t_global), POINTER :: global
1336  TYPE(t_grid), POINTER :: pgrid
1337  TYPE(t_patch), POINTER :: ppatch
1338 
1339 ! ******************************************************************************
1340 ! Start, set pointers and variables
1341 ! ******************************************************************************
1342 
1343  global => pregion%global
1344 
1345  CALL registerfunction(global,'RFLU_WritePatchCoeffsASCII',&
1346  'RFLU_ModPatchCoeffs.F90')
1347 
1348  IF ( global%myProcid == masterproc .AND. &
1349  global%verbLevel >= verbose_low ) THEN
1350  WRITE(stdout,'(A,1X,A)') solver_name
1351  WRITE(stdout,'(A,1X,A)') solver_name, &
1352  'Writing ASCII patch-coefficients file...'
1353  END IF ! global%verbLevel
1354 
1355  pgrid => pregion%grid
1356 
1357  ifile = if_patch_coef
1358 
1359 ! ******************************************************************************
1360 ! Header and general information
1361 ! ******************************************************************************
1362 
1363  IF ( global%myProcid == masterproc .AND. &
1364  global%verbLevel >= verbose_med) THEN
1365  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
1366  END IF ! global%verbLevel
1367 
1368  sectionstring = '# ROCFLU patch-coefficients file'
1369  WRITE(ifile,'(A)') sectionstring
1370 
1371 ! ******************************************************************************
1372 ! Write patch coefficients to file
1373 ! ******************************************************************************
1374 
1375 ! ==============================================================================
1376 ! Pressure coefficient
1377 ! ==============================================================================
1378 
1379  IF ( global%myProcid == masterproc .AND. &
1380  global%verbLevel >= verbose_med) THEN
1381  WRITE(stdout,'(A,3X,A)') solver_name,'Pressure coefficient...'
1382  END IF ! global%verbLevel
1383 
1384  sectionstring = '# Pressure coefficient'
1385  WRITE(ifile,'(A)') sectionstring
1386 
1387  DO ipatch = 1,pgrid%nPatches
1388  ppatch => pregion%patches(ipatch)
1389 
1390  WRITE(ifile,'(5(E23.16))') (ppatch%cp(ifl),ifl=1,ppatch%nBFaces)
1391  END DO ! iPatch
1392 
1393 ! ==============================================================================
1394 ! Skin-friction coefficient
1395 ! ==============================================================================
1396 
1397  IF ( global%myProcid == masterproc .AND. &
1398  global%verbLevel >= verbose_med) THEN
1399  WRITE(stdout,'(A,3X,A)') solver_name,'Skin-friction coefficient...'
1400  END IF ! global%verbLevel
1401 
1402  sectionstring = '# Skin-friction coefficient'
1403  WRITE(ifile,'(A)') sectionstring
1404 
1405  DO ipatch = 1,pgrid%nPatches
1406  ppatch => pregion%patches(ipatch)
1407 
1408  WRITE(ifile,'(5(E23.16))') (ppatch%cf(xcoord,ifl),ifl=1,ppatch%nBFaces)
1409  WRITE(ifile,'(5(E23.16))') (ppatch%cf(ycoord,ifl),ifl=1,ppatch%nBFaces)
1410  WRITE(ifile,'(5(E23.16))') (ppatch%cf(zcoord,ifl),ifl=1,ppatch%nBFaces)
1411  END DO ! iPatch
1412 
1413 ! ==============================================================================
1414 ! Heat-transfer coefficient
1415 ! ==============================================================================
1416 
1417  IF ( global%myProcid == masterproc .AND. &
1418  global%verbLevel >= verbose_med) THEN
1419  WRITE(stdout,'(A,3X,A)') solver_name,'Heat-transfer coefficient...'
1420  END IF ! global%verbLevel
1421 
1422  sectionstring = '# Heat-transfer coefficient'
1423  WRITE(ifile,'(A)') sectionstring
1424 
1425  DO ipatch = 1,pgrid%nPatches
1426  ppatch => pregion%patches(ipatch)
1427 
1428  WRITE(ifile,'(5(E23.16))') (ppatch%ch(ifl),ifl=1,ppatch%nBFaces)
1429  END DO ! iPatch
1430 
1431 ! ******************************************************************************
1432 ! End marker
1433 ! ******************************************************************************
1434 
1435  IF ( global%myProcid == masterproc .AND. &
1436  global%verbLevel >= verbose_med) THEN
1437  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
1438  END IF ! global%verbLevel
1439 
1440  sectionstring = '# End'
1441  WRITE(ifile,'(A)') sectionstring
1442 
1443 ! ******************************************************************************
1444 ! End
1445 ! ******************************************************************************
1446 
1447  IF ( global%myProcid == masterproc .AND. &
1448  global%verbLevel >= verbose_med ) THEN
1449  WRITE(stdout,'(A,1X,A)') solver_name, &
1450  'Writing ASCII patch-coefficients file done.'
1451  WRITE(stdout,'(A,1X,A)') solver_name
1452  END IF ! global%verbLevel
1453 
1454  CALL deregisterfunction(global)
1455 
1456  END SUBROUTINE rflu_writepatchcoeffsascii
1457 
1458 
1459 
1460 
1461 
1462 
1463 ! *******************************************************************************
1464 !
1465 ! Purpose: Write patch coefficients in binary format.
1466 !
1467 ! Description: None.
1468 !
1469 ! Input:
1470 ! pRegion Pointer to region
1471 !
1472 ! Output: None.
1473 !
1474 ! Notes: None.
1475 !
1476 ! ******************************************************************************
1477 
1478  SUBROUTINE rflu_writepatchcoeffsbinary(pRegion)
1479 
1480  IMPLICIT NONE
1481 
1482 ! ******************************************************************************
1483 ! Declarations and definitions
1484 ! ******************************************************************************
1485 
1486 ! ==============================================================================
1487 ! Arguments
1488 ! ==============================================================================
1489 
1490  TYPE(t_region), POINTER :: pregion
1491 
1492 ! ==============================================================================
1493 ! Locals
1494 ! ==============================================================================
1495 
1496  CHARACTER(CHRLEN) :: ifilename,sectionstring
1497  INTEGER :: errorflag,ifile,ifl,ipatch
1498  TYPE(t_global), POINTER :: global
1499  TYPE(t_grid), POINTER :: pgrid
1500  TYPE(t_patch), POINTER :: ppatch
1501 
1502 ! ******************************************************************************
1503 ! Start, set pointers and variables
1504 ! ******************************************************************************
1505 
1506  global => pregion%global
1507 
1508  CALL registerfunction(global,'RFLU_WritePatchCoeffsBinary',&
1509  'RFLU_ModPatchCoeffs.F90')
1510 
1511  IF ( global%myProcid == masterproc .AND. &
1512  global%verbLevel >= verbose_low ) THEN
1513  WRITE(stdout,'(A,1X,A)') solver_name
1514  WRITE(stdout,'(A,1X,A)') solver_name, &
1515  'Writing binary patch-coefficients file...'
1516  END IF ! global%verbLevel
1517 
1518  pgrid => pregion%grid
1519 
1520  ifile = if_patch_coef
1521 
1522 ! ******************************************************************************
1523 ! Header and general information
1524 ! ******************************************************************************
1525 
1526  IF ( global%myProcid == masterproc .AND. &
1527  global%verbLevel >= verbose_med ) THEN
1528  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
1529  END IF ! global%verbLevel
1530 
1531  sectionstring = '# ROCFLU patch-coefficients file'
1532  WRITE(ifile) sectionstring
1533 
1534 ! ******************************************************************************
1535 ! Write patch coefficients to file
1536 ! ******************************************************************************
1537 
1538 ! ==============================================================================
1539 ! Pressure coefficient
1540 ! ==============================================================================
1541 
1542  IF ( global%myProcid == masterproc .AND. &
1543  global%verbLevel >= verbose_med ) THEN
1544  WRITE(stdout,'(A,3X,A)') solver_name,'Pressure coefficient...'
1545  END IF ! global%verbLevel
1546 
1547  sectionstring = '# Pressure coefficient'
1548  WRITE(ifile) sectionstring
1549 
1550  DO ipatch = 1,pgrid%nPatches
1551  ppatch => pregion%patches(ipatch)
1552 
1553  WRITE(ifile) (ppatch%cp(ifl),ifl=1,ppatch%nBFaces)
1554  END DO ! iPatch
1555 
1556 ! ==============================================================================
1557 ! Skin-friction coefficient
1558 ! ==============================================================================
1559 
1560  IF ( global%myProcid == masterproc .AND. &
1561  global%verbLevel >= verbose_med ) THEN
1562  WRITE(stdout,'(A,3X,A)') solver_name,'Skin-friction coefficient...'
1563  END IF ! global%verbLevel
1564 
1565  sectionstring = '# Skin-friction coefficient'
1566  WRITE(ifile) sectionstring
1567 
1568  DO ipatch = 1,pgrid%nPatches
1569  ppatch => pregion%patches(ipatch)
1570 
1571  WRITE(ifile) (ppatch%cf(xcoord,ifl),ifl=1,ppatch%nBFaces)
1572  WRITE(ifile) (ppatch%cf(ycoord,ifl),ifl=1,ppatch%nBFaces)
1573  WRITE(ifile) (ppatch%cf(zcoord,ifl),ifl=1,ppatch%nBFaces)
1574  END DO ! iPatch
1575 
1576 ! ==============================================================================
1577 ! Heat-transfer coefficient
1578 ! ==============================================================================
1579 
1580  IF ( global%myProcid == masterproc .AND. &
1581  global%verbLevel >= verbose_med ) THEN
1582  WRITE(stdout,'(A,3X,A)') solver_name,'Heat-transfer coefficient...'
1583  END IF ! global%verbLevel
1584 
1585  sectionstring = '# Heat-transfer coefficient'
1586  WRITE(ifile) sectionstring
1587 
1588  DO ipatch = 1,pgrid%nPatches
1589  ppatch => pregion%patches(ipatch)
1590 
1591  WRITE(ifile) (ppatch%ch(ifl),ifl=1,ppatch%nBFaces)
1592  END DO ! iPatch
1593 
1594 ! ******************************************************************************
1595 ! End marker
1596 ! ******************************************************************************
1597 
1598  IF ( global%myProcid == masterproc .AND. &
1599  global%verbLevel >= verbose_med ) THEN
1600  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
1601  END IF ! global%verbLevel
1602 
1603  sectionstring = '# End'
1604  WRITE(ifile) sectionstring
1605 
1606 ! ******************************************************************************
1607 ! End
1608 ! ******************************************************************************
1609 
1610  IF ( global%myProcid == masterproc .AND. &
1611  global%verbLevel >= verbose_med ) THEN
1612  WRITE(stdout,'(A,1X,A)') solver_name, &
1613  'Writing binary patch-coefficients file done.'
1614  WRITE(stdout,'(A,1X,A)') solver_name
1615  END IF ! global%verbLevel
1616 
1617  CALL deregisterfunction(global)
1618 
1619  END SUBROUTINE rflu_writepatchcoeffsbinary
1620 
1621 
1622 
1623 
1624 
1625 
1626 ! *******************************************************************************
1627 !
1628 ! Purpose: Wrapper for writing patch coefficients.
1629 !
1630 ! Description: None.
1631 !
1632 ! Input:
1633 ! pRegion Pointer to region
1634 !
1635 ! Output: None.
1636 !
1637 ! Notes: None.
1638 !
1639 ! ******************************************************************************
1640 
1641  SUBROUTINE rflu_writepatchcoeffswrapper(pRegion)
1642 
1643  IMPLICIT NONE
1644 
1645 ! ******************************************************************************
1646 ! Declarations and definitions
1647 ! ******************************************************************************
1648 
1649 ! ==============================================================================
1650 ! Arguments
1651 ! ==============================================================================
1652 
1653  TYPE(t_region), POINTER :: pregion
1654 
1655 ! ==============================================================================
1656 ! Locals
1657 ! ==============================================================================
1658 
1659  TYPE(t_global), POINTER :: global
1660 
1661 ! ******************************************************************************
1662 ! Start, set pointers and variables
1663 ! ******************************************************************************
1664 
1665  global => pregion%global
1666 
1667  CALL registerfunction(global,'RFLU_WritePatchCoeffsWrapper',&
1668  'RFLU_ModPatchCoeffs.F90')
1669 
1670  IF ( global%solutFormat == format_ascii ) THEN
1671  CALL rflu_openpatchcoeffsascii(pregion,file_status_unknown)
1672  CALL rflu_writepatchcoeffsascii(pregion)
1673  CALL rflu_closepatchcoeffs(pregion)
1674  ELSE IF ( global%solutFormat == format_binary ) THEN
1675  CALL rflu_openpatchcoeffsbinary(pregion,file_status_unknown)
1676  CALL rflu_writepatchcoeffsbinary(pregion)
1677  CALL rflu_closepatchcoeffs(pregion)
1678  ELSE
1679  CALL errorstop(global,err_reached_default,__line__)
1680  END IF ! global%solutFormat
1681 
1682 ! ******************************************************************************
1683 ! End
1684 ! ******************************************************************************
1685 
1686  CALL deregisterfunction(global)
1687 
1688  END SUBROUTINE rflu_writepatchcoeffswrapper
1689 
1690 
1691 
1692 
1693 
1694 
1695 END MODULE rflu_modpatchcoeffs
1696 
1697 ! ******************************************************************************
1698 !
1699 ! RCS Revision history:
1700 !
1701 ! $Log: RFLU_ModPatchCoeffs.F90,v $
1702 ! Revision 1.6 2008/12/06 08:44:23 mtcampbe
1703 ! Updated license.
1704 !
1705 ! Revision 1.5 2008/11/19 22:17:34 mtcampbe
1706 ! Added Illinois Open Source License/Copyright
1707 !
1708 ! Revision 1.4 2006/10/20 21:18:56 mparmar
1709 ! Added allocation/deallocation of cmass and cmom
1710 !
1711 ! Revision 1.3 2006/04/07 15:19:20 haselbac
1712 ! Removed tabs
1713 !
1714 ! Revision 1.2 2004/12/07 19:39:14 haselbac
1715 ! Bug fix: Incorrect WRITE statements when writing binary data
1716 !
1717 ! Revision 1.1 2004/06/16 20:00:59 haselbac
1718 ! Initial revision
1719 !
1720 ! ******************************************************************************
1721 
1722 
1723 
1724 
1725 
1726 
1727 
1728 
1729 
1730 
1731 
1732 
1733 
1734 
1735 
1736 
1737 
1738 
1739 
subroutine, private rflu_openpatchcoeffsascii(pRegion, fileStatus, fileExists)
subroutine, private rflu_readpatchcoeffsascii(pRegion)
subroutine, public rflu_readpatchcoeffswrapper(pRegion)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
subroutine, private rflu_writepatchcoeffsascii(pRegion)
subroutine, public rflu_destroypatchcoeffs(pRegion)
subroutine, private rflu_writepatchcoeffsbinary(pRegion)
subroutine, private rflu_openpatchcoeffsbinary(pRegion, fileStatus, fileExists)
subroutine, public rflu_writepatchcoeffswrapper(pRegion)
**********************************************************************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_createpatchcoeffs(pRegion)
subroutine, private rflu_nullifypatchcoeffs(pRegion)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine, private rflu_closepatchcoeffs(pRegion)
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine, private rflu_initpatchcoeffs(pRegion)
subroutine, private rflu_readpatchcoeffsbinary(pRegion)
subroutine buildfilenamesteady(global, dest, ext, id, it, fileName)
subroutine buildfilenameunsteady(global, dest, ext, id, tm, fileName)