Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PLAG_ModDimensions.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 compute, read, and write dimension files.
26 !
27 ! Description: None.
28 !
29 ! Notes: None.
30 !
31 ! ******************************************************************************
32 !
33 ! $Id: PLAG_ModDimensions.F90,v 1.7 2008/12/06 08:44:34 mtcampbe Exp $
34 !
35 ! Copyright: (c) 2007 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 modborder, ONLY: t_border
47  USE moddatastruct, ONLY: t_region
48  USE modgrid, ONLY: t_grid
49  USE modpartlag, ONLY: t_plag,t_plag_input
50  USE modmpi
51 
53 
54  IMPLICIT NONE
55 
56  PRIVATE
57  PUBLIC :: plag_calcnpclsglobal, &
64 
65 ! ******************************************************************************
66 ! Declarations and definitions
67 ! ******************************************************************************
68 
69 ! ==============================================================================
70 ! Private
71 ! ==============================================================================
72 
73  CHARACTER(CHRLEN), PRIVATE :: RCSIdentString = &
74  '$RCSfile: PLAG_ModDimensions.F90,v $ $Revision: 1.7 $'
75 
76 ! ******************************************************************************
77 ! Routines
78 ! ******************************************************************************
79 
80  CONTAINS
81 
82 
83 
84 
85 
86 ! ******************************************************************************
87 !
88 ! Purpose: Calculate the total number of particles for all regions.
89 !
90 ! Description: None.
91 !
92 ! Input:
93 ! regions Pointer to all regions
94 !
95 ! Output: None.
96 !
97 ! Notes: None.
98 !
99 ! ******************************************************************************
100 
101  SUBROUTINE plag_calcnpclsglobal(regions)
102 
103  IMPLICIT NONE
104 
105 ! ******************************************************************************
106 ! Declarations and definitions
107 ! ******************************************************************************
108 
109 ! ==============================================================================
110 ! Arguments
111 ! ==============================================================================
112 
113  TYPE(t_region), POINTER :: regions(:)
114 
115 ! ==============================================================================
116 ! Local variables
117 ! ==============================================================================
118 
119  INTEGER :: errorflag,ireg,iregglobal,npclsglobal,npclslocal
120 
121  TYPE(t_global), POINTER :: global
122  TYPE(t_region), POINTER :: pregion
123  TYPE(t_plag), POINTER :: pplag
124 
125 ! ******************************************************************************
126 ! Start
127 ! ******************************************************************************
128 
129  global => regions(0)%global
130 
131  CALL registerfunction(global,'PLAG_CalcNPclsGlobal',&
132  'PLAG_ModDimensions.F90')
133 
134 ! ******************************************************************************
135 ! Initialize variables
136 ! ******************************************************************************
137 
138  npclslocal = 0
139 
140  DO ireg = 0,global%nRegionsLocal
141  pregion => regions(ireg)
142 
143  pregion%plag%nPclsGlobal = 0
144  END DO ! iReg
145 
146 ! ******************************************************************************
147 ! Compute sum of particles for all regions on the same processor. NOTE cannot
148 ! include region 0 in this sum because it would pick up the CRAZY_VALUE_INT
149 ! value assigned below.
150 ! ******************************************************************************
151 
152  DO ireg = 1,global%nRegionsLocal
153  pregion => regions(ireg)
154 
155  npclslocal = npclslocal + pregion%plag%nPcls
156  END DO ! iReg
157 
158 ! ******************************************************************************
159 ! Determine global sum of particles over all processors
160 ! ******************************************************************************
161 
162 ! ==============================================================================
163 ! Perform reduction operation. NOTE need to include region index 0
164 ! to make sure that this works properly for serial runs.
165 ! ==============================================================================
166 
167  CALL mpi_allreduce(npclslocal,npclsglobal,1,mpi_integer,mpi_sum, &
168  global%mpiComm,errorflag )
169  global%error = errorflag
170  IF ( global%error /= err_none ) THEN
171  CALL errorstop(global,err_mpi_trouble,__line__)
172  END IF ! global%errorFlag
173 
174 ! ******************************************************************************
175 ! Store the global sum of particles. NOTE copy into serial nPcls for master
176 ! process, but for others set to CRAZY_VALUE_INT.
177 ! ******************************************************************************
178 
179  DO ireg = 0,global%nRegionsLocal
180  pregion => regions(ireg)
181 
182  pregion%plag%nPclsGlobal = npclsglobal
183  END DO ! iReg
184 
185  IF ( global%myProcid == masterproc ) THEN
186  regions(0)%plag%nPcls = regions(0)%plag%nPclsGlobal
187  ELSE
188  regions(0)%plag%nPcls = crazy_value_int
189  END IF ! global%myProcid
190 
191 ! ******************************************************************************
192 ! End
193 ! ******************************************************************************
194 
195  CALL deregisterfunction(global)
196 
197  END SUBROUTINE plag_calcnpclsglobal
198 
199 
200 
201 
202 
203 
204 
205 
206 ! ******************************************************************************
207 !
208 ! Purpose: Print the number of particles.
209 !
210 ! Description: None.
211 !
212 ! Input:
213 ! pRegion Pointer to region
214 !
215 ! Output: None.
216 !
217 ! Notes: None.
218 !
219 ! ******************************************************************************
220 
221  SUBROUTINE plag_printdimensions(pRegion)
222 
223  IMPLICIT NONE
224 
225 ! ******************************************************************************
226 ! Declarations and definitions
227 ! ******************************************************************************
228 
229 ! ==============================================================================
230 ! Arguments
231 ! ==============================================================================
232 
233  TYPE(t_region), POINTER :: pregion
234 
235 ! ==============================================================================
236 ! Local variables
237 ! ==============================================================================
238 
239  TYPE(t_global), POINTER :: global
240 
241 ! ******************************************************************************
242 ! Start
243 ! ******************************************************************************
244 
245  global => pregion%global
246 
247  CALL registerfunction(global,'PLAG_PrintDimensions',&
248  'PLAG_ModDimensions.F90')
249 
250 ! ******************************************************************************
251 ! Print information
252 ! ******************************************************************************
253 
254  IF ( global%verbLevel > verbose_none ) THEN
255  WRITE(stdout,'(A,1X,A)') solver_name,'Printing number of particles...'
256  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
257  pregion%iRegionGlobal
258  IF ( global%flowType == flow_unsteady ) THEN
259  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
260  global%currentTime
261  END IF ! global%flowType
262 
263  WRITE(stdout,'(A,3X,A,9X,I8)') solver_name,'Number of particles:', &
264  pregion%plag%nPcls
265  WRITE(stdout,'(A,3X,A,1X,I8)') solver_name,'Maximum number of '// &
266  'particles:',pregion%plag%nPclsMax
267 
268  WRITE(stdout,'(A,1X,A)') solver_name,'Printing number of particles done.'
269  END IF ! global%verbLevel
270 
271 ! ******************************************************************************
272 ! End
273 ! ******************************************************************************
274 
275  CALL deregisterfunction(global)
276 
277  END SUBROUTINE plag_printdimensions
278 
279 
280 
281 
282 
283 
284 
285 
286 ! ******************************************************************************
287 !
288 ! Purpose: Print the total number of particles in all regions.
289 !
290 ! Description: None.
291 !
292 ! Input:
293 ! pRegion Pointer to region
294 !
295 ! Output: None.
296 !
297 ! Notes: None.
298 !
299 ! ******************************************************************************
300 
301  SUBROUTINE plag_printnpclsglobal(pRegion)
302 
303  IMPLICIT NONE
304 
305 ! ******************************************************************************
306 ! Declarations and definitions
307 ! ******************************************************************************
308 
309 ! ==============================================================================
310 ! Arguments
311 ! ==============================================================================
312 
313  TYPE(t_region), POINTER :: pregion
314 
315 ! ==============================================================================
316 ! Local variables
317 ! ==============================================================================
318 
319  TYPE(t_global), POINTER :: global
320 
321 ! ******************************************************************************
322 ! Start
323 ! ******************************************************************************
324 
325  global => pregion%global
326 
327  CALL registerfunction(global,'PLAG_PrintNPclsGlobal',&
328  'PLAG_ModDimensions.F90')
329 
330 ! ******************************************************************************
331 ! Print information
332 ! ******************************************************************************
333 
334  IF ( global%verbLevel > verbose_none ) THEN
335  WRITE(stdout,'(A,1X,A)') solver_name,'Printing total number of '// &
336  'particles...'
337  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
338  pregion%iRegionGlobal
339  IF ( global%flowType == flow_unsteady ) THEN
340  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
341  global%currentTime
342  END IF ! global%flowType
343 
344  WRITE(stdout,'(A,3X,A,1X,I8)') solver_name,'Number of particles:', &
345  pregion%plag%nPclsGlobal
346 
347  WRITE(stdout,'(A,1X,A)') solver_name,'Printing total number of '// &
348  'particles done.'
349  END IF ! global%verbLevel
350 
351 ! ******************************************************************************
352 ! End
353 ! ******************************************************************************
354 
355  CALL deregisterfunction(global)
356 
357  END SUBROUTINE plag_printnpclsglobal
358 
359 
360 
361 
362 
363 
364 
365 ! ******************************************************************************
366 !
367 ! Purpose: Read dimensions for Lagrangian particles.
368 !
369 ! Description: None.
370 !
371 ! Input:
372 ! pRegion Pointer to region
373 !
374 ! Output: None.
375 !
376 ! Notes: None.
377 !
378 ! ******************************************************************************
379 
380  SUBROUTINE plag_rflu_readdimensions(pRegion)
381 
382  USE rflu_modgrid
383 
386 
387  IMPLICIT NONE
388 
389 ! ******************************************************************************
390 ! Declarations and definitions
391 ! ******************************************************************************
392 
393 ! ==============================================================================
394 ! Arguments
395 ! ==============================================================================
396 
397  TYPE(t_region), POINTER :: pregion
398 
399 ! ==============================================================================
400 ! Local variables
401 ! ==============================================================================
402 
403  CHARACTER(CHRLEN) :: errorstring,ifilename,rcsidentstring,sectionstring, &
404  timestring1,timestring2
405  INTEGER :: errorflag,dummy,ipatch,ifile,loopcounter,ncont,npclsmax
406  REAL(RFREAL) :: currenttime
407  TYPE(t_grid), POINTER :: pgrid
408  TYPE(t_global), POINTER :: global
409 
410 ! ******************************************************************************
411 ! Start
412 ! ******************************************************************************
413 
414  global => pregion%global
415 
416  CALL registerfunction(global,'PLAG_RFLU_ReadDimensions',&
417  'PLAG_ModDimensions.F90')
418 
419  IF ( global%myProcid == masterproc .AND. &
420  global%verbLevel > verbose_none ) THEN
421  WRITE(stdout,'(A,1X,A)') solver_name,'Reading particle dimensions...'
422  END IF ! global%verbLevel
423 
424 ! ==============================================================================
425 ! Build file name
426 ! ==============================================================================
427 
428  ifile = if_dims
429 
430  IF ( global%flowType == flow_unsteady ) THEN
431 #ifndef GENX
432  currenttime = global%currentTime
433 #else
434  IF ( global%timeStamp > 0.0_rfreal ) THEN
435  global%warnCounter = global%warnCounter + 1
436 
437  IF ( global%myProcid == masterproc .AND. &
438  global%verbLevel > verbose_none ) THEN
439  WRITE(stdout,'(A,3X,A,1X,A)') solver_name,'*** WARNING ***', &
440  'Hard-code - read file from time zero.'
441  END IF ! global%myProcid
442  END IF ! global%timeStamp
443 
444  currenttime = 0.0_rfreal ! Hard-code for GENX restart
445 #endif
446 
447 ! TEMPORARY
448  IF ( pregion%iRegionGlobal == 0 ) THEN
449  currenttime = 0.0_rfreal
450  END IF ! pRegion%iRegionGlobal
451 ! END TEMPORARY
452 
453  CALL buildfilenameunsteady(global,filedest_indir,'.pdim', &
454  pregion%iRegionGlobal,currenttime, &
455  ifilename)
456 
457  IF ( global%myProcid == masterproc .AND. &
458  global%verbLevel > verbose_none ) THEN
459  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
460  pregion%iRegionGlobal
461  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
462  global%currentTime
463  END IF ! global%verbLevel
464  ELSE
465  CALL buildfilenamebasic(global,filedest_indir,'.pdim', &
466  pregion%iRegionGlobal,ifilename)
467 
468  IF ( global%myProcid == masterproc .AND. &
469  global%verbLevel > verbose_none ) THEN
470  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
471  pregion%iRegionGlobal
472  END IF ! global%verbLevel
473  END IF ! global
474 
475 ! ==============================================================================
476 ! Open file
477 ! ==============================================================================
478 
479  OPEN(ifile,file=ifilename,form="FORMATTED",status="OLD", &
480  iostat=errorflag)
481  global%error = errorflag
482  IF ( global%error /= err_none ) THEN
483  CALL errorstop(global,err_file_open,__line__,ifilename)
484  END IF ! global%error
485 
486 ! ==============================================================================
487 ! Header and general information
488 ! ==============================================================================
489 
490  IF ( global%myProcid == masterproc .AND. &
491  global%verbLevel > verbose_low ) THEN
492  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
493  END IF ! global%verbLevel
494 
495  READ(ifile,'(A)') sectionstring
496  IF ( trim(sectionstring) /= '# ROCPART dimensions file' ) THEN
497  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
498  END IF ! TRIM
499 
500 ! ==============================================================================
501 ! Rest of file
502 ! ==============================================================================
503 
504  pgrid => pregion%grid
505 
506  loopcounter = 0
507 
508  DO ! set up infinite loop
509  loopcounter = loopcounter + 1
510 
511  READ(ifile,'(A)') sectionstring
512 
513  SELECT CASE ( trim(sectionstring) )
514 
515 ! ------------------------------------------------------------------------------
516 ! Actual number of particles
517 ! ------------------------------------------------------------------------------
518 
519  CASE ( '# Actual number of particles' )
520  IF ( global%myProcid == masterproc .AND. &
521  global%verbLevel > verbose_low ) THEN
522  WRITE(stdout,'(A,3X,A)') solver_name,'Actual number of particles...'
523  END IF ! global%verbLevel
524 
525  READ(ifile,'(I8)') pregion%plag%nPcls
526 
527 ! ------------------------------------------------------------------------------
528 ! Maximum number of particles
529 ! ------------------------------------------------------------------------------
530 
531  CASE ( '# Maximum number of particles' )
532  IF ( global%myProcid == masterproc .AND. &
533  global%verbLevel > verbose_low ) THEN
534  WRITE(stdout,'(A,3X,A)') solver_name,'Maximum number of particles...'
535  END IF ! global%verbLevel
536 
537  READ(ifile,'(I8)') pregion%plag%nPclsMax
538 
539 ! ------------------------------------------------------------------------------
540 ! Number of constituents
541 ! ------------------------------------------------------------------------------
542 
543  CASE ( '# Number of constituents' )
544  IF ( global%myProcid == masterproc .AND. &
545  global%verbLevel > verbose_low ) THEN
546  WRITE(stdout,'(A,3X,A)') solver_name,'Number of constituents...'
547  END IF ! global%verbLevel
548 
549  READ(ifile,'(I8)') ncont
550 
551  IF ( ncont /= pregion%plagInput%nCont ) THEN
552  WRITE(errorstring,'(A,1X,I2,1X,A,1X,I2)') 'Specified:',ncont, &
553  'but expected:',pregion%plagInput%nCont
554  CALL errorstop(global,err_plag_ncont_invalid,__line__)
555  END IF ! nCont
556 
557 ! ------------------------------------------------------------------------------
558 ! Next particle identifier
559 ! ------------------------------------------------------------------------------
560 
561  CASE ( '# Next particle identifier' )
562  IF ( global%myProcid == masterproc .AND. &
563  global%verbLevel > verbose_low ) THEN
564  WRITE(stdout,'(A,3X,A)') solver_name,'Next particle identifier...'
565  END IF ! global%verbLevel
566 
567  READ(ifile,'(I8)') pregion%plag%nextIdNumber
568 
569 ! ------------------------------------------------------------------------------
570 ! End marker
571 ! ------------------------------------------------------------------------------
572 
573  CASE ( '# End' )
574  IF ( global%myProcid == masterproc .AND. &
575  global%verbLevel > verbose_low ) THEN
576  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
577  END IF ! global%verbLevel
578 
579  EXIT
580 
581 ! ------------------------------------------------------------------------------
582 ! Invalid section string
583 ! ------------------------------------------------------------------------------
584 
585  CASE default
586  IF ( global%verbLevel > verbose_low ) THEN
587  WRITE(stdout,'(A,3X,A)') solver_name,sectionstring
588  END IF ! verbosityLevel
589 
590  CALL errorstop(global,err_invalid_marker,__line__,sectionstring)
591 
592  END SELECT ! TRIM
593 
594 ! ------------------------------------------------------------------------------
595 ! Guard against infinite loop - might be unnecessary because of read errors?
596 ! ------------------------------------------------------------------------------
597 
598  IF ( loopcounter >= limit_infinite_loop ) THEN
599  CALL errorstop(global,err_infinite_loop,__line__)
600  END IF ! loopCounter
601 
602  END DO ! <empty>
603 
604 ! ==============================================================================
605 ! Close file
606 ! ==============================================================================
607 
608  CLOSE(ifile,iostat=errorflag)
609  global%error = errorflag
610  IF ( global%myProcid == masterproc .AND. &
611  global%error /= err_none ) THEN
612  CALL errorstop(global,err_file_close,__line__,ifilename)
613  END IF ! global%error
614 
615 ! ******************************************************************************
616 ! End
617 ! ******************************************************************************
618 
619  IF ( global%myProcid == masterproc .AND. &
620  global%verbLevel > verbose_none ) THEN
621  WRITE(stdout,'(A,1X,A)') solver_name,'Reading particle dimensions done.'
622  END IF ! global%verbLevel
623 
624  CALL deregisterfunction(global)
625 
626  END SUBROUTINE plag_rflu_readdimensions
627 
628 
629 
630 
631 
632 
633 
634 
635 ! ******************************************************************************
636 !
637 ! Purpose: Set dimensions for Lagrangian particle datastructure
638 ! at initialization stage.
639 !
640 ! Description: None.
641 !
642 ! Input:
643 ! pRegion Pointer to region
644 ! nPcls Number of particles
645 !
646 ! Output: None.
647 !
648 ! Notes: None.
649 !
650 ! ******************************************************************************
651 
652  SUBROUTINE plag_setdimensions(pRegion,nPcls)
653 
654 ! ******************************************************************************
655 ! Definitions and declarations
656 ! ******************************************************************************
657 
658 ! ==============================================================================
659 ! Arguments
660 ! ==============================================================================
661 
662  INTEGER, INTENT(IN) :: npcls
663  TYPE(t_region), POINTER :: pregion
664 
665 ! ==============================================================================
666 ! Locals
667 ! ==============================================================================
668 
669  TYPE(t_global), POINTER :: global
670 
671 ! ******************************************************************************
672 ! Start
673 ! ******************************************************************************
674 
675  global => pregion%global
676 
677  CALL registerfunction(global,'PLAG_SetDimensions',&
678  'PLAG_ModDimensions.F90')
679 
680 ! ******************************************************************************
681 ! Set number of particles
682 ! ******************************************************************************
683 
684  pregion%plag%nPcls = npcls
685 
686 ! ******************************************************************************
687 ! End
688 ! ******************************************************************************
689 
690  CALL deregisterfunction(global)
691 
692  END SUBROUTINE plag_setdimensions
693 
694 
695 
696 
697 
698 
699 
700 
701 ! ******************************************************************************
702 !
703 ! Purpose: Set maximum dimensions for Lagrangian particle datastructure.
704 !
705 ! Description: None.
706 !
707 ! Input:
708 ! pRegion Region pointer
709 !
710 ! Output: None.
711 !
712 ! Notes: None.
713 !
714 ! ******************************************************************************
715 
716  SUBROUTINE plag_setmaxdimensions(pRegion)
717 
718  IMPLICIT NONE
719 
720 ! ******************************************************************************
721 ! Declarations and definitions
722 ! ******************************************************************************
723 
724 ! ==============================================================================
725 ! Arguments
726 ! ==============================================================================
727 
728  TYPE(t_region), POINTER :: pregion
729 
730 ! ==============================================================================
731 ! Locals
732 ! ==============================================================================
733 
734  INTEGER :: npcls,npclsmax
735  REAL(RFREAL), PARAMETER :: plag_realloc_fact = 1.20_rfreal
736  TYPE(t_global), POINTER :: global
737 
738 ! ******************************************************************************
739 ! Start
740 ! ******************************************************************************
741 
742  global => pregion%global
743 
744  CALL registerfunction(global,'PLAG_SetMaxDimensions',&
745  'PLAG_ModDimensions.F90')
746 
747 ! ******************************************************************************
748 ! Set variables
749 ! ******************************************************************************
750 
751  npcls = pregion%plag%nPcls
752  npclsmax = pregion%plag%nPclsMax
753 
754 ! ******************************************************************************
755 ! Set maximum dimension of particle datastructure. First ensure that
756 ! a minimum value is preserved for null particle field.
757 ! ******************************************************************************
758 
759  npclsmax = nint(plag_realloc_fact*REAL(npcls,kind=rfreal))
760 
761 ! ******************************************************************************
762 ! Update maximum value of particle datastructure
763 ! ******************************************************************************
764 
765  pregion%plag%nPclsMax = max(npclsmax,npcls_tot_min)
766 
767 ! ******************************************************************************
768 ! End
769 ! ******************************************************************************
770 
771  CALL deregisterfunction(global)
772 
773  END SUBROUTINE plag_setmaxdimensions
774 
775 
776 
777 
778 
779 
780 ! ******************************************************************************
781 !
782 ! Purpose: Write dimensions for Lagrangian particles.
783 !
784 ! Description: None.
785 !
786 ! Input:
787 ! pRegion Pointer to region
788 !
789 ! Output: None.
790 !
791 ! Notes: None.
792 !
793 ! ******************************************************************************
794 
795  SUBROUTINE plag_rflu_writedimensions(pRegion)
796 
799 
800  IMPLICIT NONE
801 
802 ! ******************************************************************************
803 ! Declarations and definitions
804 ! ******************************************************************************
805 
806 ! ==============================================================================
807 ! Arguments
808 ! ==============================================================================
809 
810  TYPE(t_region), POINTER :: pregion
811 
812 ! ==============================================================================
813 ! Local variables
814 ! ==============================================================================
815 
816  CHARACTER(CHRLEN) :: ifilename,rcsidentstring,sectionstring, &
817  timestring1,timestring2
818  INTEGER :: errorflag,dummy,ifile
819  REAL(RFREAL) :: currenttime
820  TYPE(t_grid), POINTER :: pgrid
821  TYPE(t_global), POINTER :: global
822 
823 ! ******************************************************************************
824 ! Start
825 ! ******************************************************************************
826 
827  global => pregion%global
828 
829  CALL registerfunction(global,'PLAG_RFLU_WriteDimensions',&
830  'PLAG_ModDimensions.F90')
831 
832  IF ( global%myProcid == masterproc .AND. &
833  global%verbLevel > verbose_none ) THEN
834  WRITE(stdout,'(A,1X,A)') solver_name,'Writing particle dimensions...'
835  END IF ! global%verbLevel
836 
837 ! ==============================================================================
838 ! Build file name
839 ! ==============================================================================
840 
841  ifile = if_dims
842 
843  IF ( global%flowType == flow_unsteady ) THEN
844 #ifndef GENX
845  currenttime = global%currentTime
846 #else
847  IF ( global%timeStamp > 0.0_rfreal ) THEN
848  global%warnCounter = global%warnCounter + 1
849 
850  IF ( global%myProcid == masterproc .AND. &
851  global%verbLevel > verbose_none ) THEN
852  WRITE(stdout,'(A,3X,A,1X,A)') solver_name,'*** WARNING ***', &
853  'Hard-code - read file from time zero.'
854  END IF ! global%myProcid
855  END IF ! global%timeStamp
856 
857  currenttime = 0.0_rfreal ! Hard-code for GENX restart
858 #endif
859  CALL buildfilenameunsteady(global,filedest_indir,'.pdim', &
860  pregion%iRegionGlobal,currenttime, &
861  ifilename)
862 
863  IF ( global%myProcid == masterproc .AND. &
864  global%verbLevel > verbose_none ) THEN
865  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
866  pregion%iRegionGlobal
867  WRITE(stdout,'(A,3X,A,1X,1PE11.5)') solver_name,'Current time:', &
868  global%currentTime
869  END IF ! global%verbLevel
870  ELSE
871  CALL buildfilenamebasic(global,filedest_indir,'.pdim', &
872  pregion%iRegionGlobal,ifilename)
873 
874  IF ( global%myProcid == masterproc .AND. &
875  global%verbLevel > verbose_none ) THEN
876  WRITE(stdout,'(A,3X,A,1X,I5.5)') solver_name,'Global region:', &
877  pregion%iRegionGlobal
878  END IF ! global%verbLevel
879  END IF ! global
880 
881 ! ==============================================================================
882 ! Open file
883 ! ==============================================================================
884 
885  OPEN(ifile,file=ifilename,form="FORMATTED",status="UNKNOWN", &
886  iostat=errorflag)
887  global%error = errorflag
888  IF ( global%error /= err_none ) THEN
889  CALL errorstop(global,err_file_open,__line__,ifilename)
890  END IF ! global%error
891 
892 ! ==============================================================================
893 ! Header and general information
894 ! ==============================================================================
895 
896  IF ( global%myProcid == masterproc .AND. &
897  global%verbLevel > verbose_low ) THEN
898  WRITE(stdout,'(A,3X,A)') solver_name,'Header information...'
899  END IF ! global%verbLevel
900 
901  sectionstring = '# ROCPART dimensions file'
902  WRITE(ifile,'(A)') trim(sectionstring)
903 
904 ! ==============================================================================
905 ! Write dimensions
906 ! ==============================================================================
907 
908  sectionstring = '# Actual number of particles'
909  WRITE(ifile,'(A)') trim(sectionstring)
910  WRITE(ifile,'(I8)') pregion%plag%nPcls
911 
912  sectionstring = '# Maximum number of particles'
913  WRITE(ifile,'(A)') trim(sectionstring)
914  WRITE(ifile,'(I8)') pregion%plag%nPclsMax
915 
916  sectionstring = '# Number of constituents'
917  WRITE(ifile,'(A)') trim(sectionstring)
918  WRITE(ifile,'(I8)') pregion%plagInput%nCont
919 
920  sectionstring = '# Next particle identifier'
921  WRITE(ifile,'(A)') trim(sectionstring)
922  WRITE(ifile,'(I8)') pregion%plag%nextIdNumber
923 
924 ! ==============================================================================
925 ! End marker
926 ! ==============================================================================
927 
928  IF ( global%myProcid == masterproc .AND. &
929  global%verbLevel > verbose_low ) THEN
930  WRITE(stdout,'(A,3X,A)') solver_name,'End marker...'
931  END IF ! global%verbLevel
932 
933  sectionstring = '# End'
934  WRITE(ifile,'(A)') trim(sectionstring)
935 
936 ! ==============================================================================
937 ! Close file
938 ! ==============================================================================
939 
940  CLOSE(ifile,iostat=errorflag)
941  global%error = errorflag
942  IF ( global%myProcid == masterproc .AND. &
943  global%error /= err_none ) THEN
944  CALL errorstop(global,err_file_close,__line__,ifilename)
945  END IF ! global%error
946 
947 ! ******************************************************************************
948 ! End
949 ! ******************************************************************************
950 
951  IF ( global%myProcid == masterproc .AND. &
952  global%verbLevel > verbose_none ) THEN
953  WRITE(stdout,'(A,1X,A)') solver_name,'Writing dimensions done.'
954  END IF ! global%verbLevel
955 
956  CALL deregisterfunction(global)
957 
958  END SUBROUTINE plag_rflu_writedimensions
959 
960 
961 
962 
963 
964 
965 
966 
967 ! ******************************************************************************
968 ! End
969 ! ******************************************************************************
970 
971 END MODULE plag_moddimensions
972 
973 
974 ! ******************************************************************************
975 !
976 ! RCS Revision history:
977 !
978 ! $Log: PLAG_ModDimensions.F90,v $
979 ! Revision 1.7 2008/12/06 08:44:34 mtcampbe
980 ! Updated license.
981 !
982 ! Revision 1.6 2008/11/19 22:17:46 mtcampbe
983 ! Added Illinois Open Source License/Copyright
984 !
985 ! Revision 1.5 2007/03/31 23:55:43 haselbac
986 ! Removed Tot from names, bug fix in CalcNPclsGlobal, removed tabs
987 !
988 ! Revision 1.4 2007/03/27 00:55:33 haselbac
989 ! Substantial changes and additions
990 !
991 ! Revision 1.3 2007/03/21 21:33:10 fnajjar
992 ! Activated IO of nPclsTotGlobal when doPrint is on
993 !
994 ! Revision 1.2 2007/03/20 22:03:27 fnajjar
995 ! Included PLAG_CalcnPclsTotGlobal routine
996 !
997 ! Revision 1.1 2007/03/20 17:39:12 fnajjar
998 ! Initial import
999 !
1000 ! ******************************************************************************
1001 
1002 
1003 
1004 
1005 
1006 
1007 
1008 
1009 
1010 
1011 
1012 
1013 
subroutine, public plag_setdimensions(pRegion, nPcls)
subroutine buildfilenamebasic(global, dest, ext, id, fileName)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
int status() const
Obtain the status of the attribute.
Definition: Attribute.h:240
subroutine, public plag_rflu_readdimensions(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 plag_setmaxdimensions(pRegion)
subroutine, public plag_printnpclsglobal(pRegion)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine, public plag_printdimensions(pRegion)
subroutine, public plag_rflu_writedimensions(pRegion)
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine, public plag_calcnpclsglobal(regions)
subroutine buildfilenameunsteady(global, dest, ext, id, tm, fileName)