Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rfluinit.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: Driver routine for rfluinit.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! caseString String with casename
31 ! verbLevel Verbosity level
32 !
33 ! Output: None.
34 !
35 ! Notes: None.
36 !
37 ! ******************************************************************************
38 !
39 ! $Id: rfluinit.F90,v 1.21 2008/12/06 08:44:56 mtcampbe Exp $
40 !
41 ! Copyright: (c) 2004-2005 by the University of Illinois
42 !
43 ! ******************************************************************************
44 
45 SUBROUTINE rfluinit(caseString,verbLevel)
46 
47  USE moderror
48  USE moddatatypes
49  USE modparameters
50  USE modglobal, ONLY: t_global
51  USE moddatastruct, ONLY: t_level,t_region
52  USE modmpi
53 #ifdef PLAG
54  USE modpartlag, ONLY: t_plag
55 #endif
56 
74 
75 #ifdef GENX
78 #endif
79 
82  rflu_creategrid, &
104 
105 #ifdef GENX
106  USE modinterfaces, ONLY: rflu_setgasvars
107 #endif
108 
109 #ifdef PLAG
121 
126 #endif
127 
128  IMPLICIT NONE
129 
130 #ifdef GENX
131  include 'roccomf90.h'
132 #endif
133 
134 ! ******************************************************************************
135 ! Definitions and declarations
136 ! ******************************************************************************
137 
138 ! ==============================================================================
139 ! Arguments
140 ! ==============================================================================
141 
142  CHARACTER(*) :: casestring
143  INTEGER, INTENT(IN) :: verblevel
144 
145 ! ==============================================================================
146 ! Locals
147 ! ==============================================================================
148 
149  CHARACTER(CHRLEN) :: casename
150 #ifdef GENX
151  CHARACTER(CHRLEN) :: surfwinnameinput,volwinnameinput
152 #endif
153  INTEGER :: errorflag,ilev,ireg,ireglow,iregupp
154 #ifdef GENX
155  INTEGER :: handleobtain
156 #endif
157  TYPE(t_region), POINTER :: pregion,pregionserial
158  TYPE(t_global), POINTER :: global
159  TYPE(t_level), POINTER :: levels(:)
160 #ifdef PLAG
161  TYPE(t_plag), POINTER :: pplag,pplagserial
162 #endif
163 
164 ! ******************************************************************************
165 ! Initialize global data
166 ! ******************************************************************************
167  ALLOCATE(global,stat=errorflag)
168  IF ( errorflag /= err_none ) THEN
169  WRITE(stderr,'(A,1X,A)') solver_name,'ERROR - Pointer allocation failed.'
170  stop
171  END IF ! errorFlag
172 
173  casename = casestring(1:len(casestring))
174 
175  CALL rflu_initglobal(casename,verblevel,mpi_comm_world,global)
176 
177  CALL registerfunction(global,'rfluinit', &
178  'rfluinit.F90')
179 
180  CALL rflu_setmoduletype(global,module_type_init)
181 
182 #ifdef GENX
183 ! ******************************************************************************
184 ! Read GENX control file, store communicator and hardcode window name
185 ! ******************************************************************************
186 
187  CALL rflu_genx_readctrlfile(global)
188  CALL rflu_genx_storecommunicator(global,mpi_comm_world)
189  CALL rflu_genx_hardcodewindowname(global)
190 #endif
191 
192 ! ******************************************************************************
193 ! Print header and write version string
194 ! ******************************************************************************
195 
196  IF ( global%myProcid == masterproc ) THEN
197  CALL rflu_writeversionstring(global)
198  IF ( global%verbLevel /= verbose_none ) THEN
199  CALL rflu_printheader(global)
200  END IF ! global%verbLevel
201  END IF ! global%myProcid
202 
203 ! ******************************************************************************
204 ! Read mapping file, impose serial mapping, and build basic data structure
205 ! ******************************************************************************
206 
207  CALL rflu_readregionmappingfile(global,mapfile_readmode_peek,global%myProcId)
208  CALL rflu_setregionmappingserial(global)
209  CALL rflu_createregionmapping(global,maptype_reg)
210  CALL rflu_imposeregionmappingserial(global)
211 
212  CALL rflu_builddatastruct(global,levels)
213  CALL rflu_applyregionmapping(global,levels)
214  CALL rflu_destroyregionmapping(global,maptype_reg)
215 
216 #ifdef GENX
217 ! ******************************************************************************
218 ! Initialize Roccom and load Rocin and Rocout
219 ! ******************************************************************************
220 
221  CALL com_init
222 ! TEMPORARY
223 ! CALL COM_set_verbose(10)
224 ! END TEMPORARY
225 
226  surfwinnameinput = 'RocfluInputSurf'
227  volwinnameinput = 'RocfluInputVol TEMP'
228 
229  global%winNameIn = trim(global%winName)//'-IN'
230  global%winNameOut = trim(global%winName)//'-OUT'
231 
232  CALL rocin_load_module(trim(global%winNameIn))
233  CALL rocout_load_module(trim(global%winNameOut))
234 
235  handleobtain = com_get_function_handle(trim(global%winNameIn)// &
236  '.obtain_attribute')
237  CALL rflu_genx_storenameshandles(global,surfwinnameinput,volwinnameinput, &
238  handleobtain)
239 
240 ! ******************************************************************************
241 ! Create windows and attributes
242 ! ******************************************************************************
243 
244  pregionserial => levels(1)%regions(0)
245 
246  CALL rflu_genx_createwindows(pregionserial)
247  CALL rflu_genx_createattrgridsurf(pregionserial)
248  CALL rflu_genx_createattrflow(pregionserial)
249  CALL rflu_genx_createattrgspeeds(pregionserial)
250  CALL rflu_genx_createattrinterf(pregionserial)
251 #endif
252 
253 ! ******************************************************************************
254 ! Initialize random number generator. NOTE needed in order to write sensible
255 ! data when writing Rocpart solution files.
256 ! ******************************************************************************
257 
258  CALL rflu_randominit(levels(1)%regions)
259 
260 ! ******************************************************************************
261 ! Read input file and restart info. NOTE need restart info for GENX runs to
262 ! determine whether have a restart.
263 ! ******************************************************************************
264 
265  CALL rflu_getuserinput(levels(1)%regions,.true.)
266  CALL rflu_readrestartinfo(global)
267  CALL rflu_setrestarttimeflag(global)
268 
269 ! ******************************************************************************
270 ! Initialize solutions
271 ! ******************************************************************************
272 
273  IF ( global%nRegions == 1 ) THEN
274  ireglow = 0
275  iregupp = 0
276  ELSE
277  ireglow = 1
278  iregupp = global%nRegions
279  END IF ! global%nRegions
280 
281 #ifdef PLAG
282 ! ==============================================================================
283 ! Temporarily disable particles so can use wrapper routines to initialize only
284 ! Eulerian solution fields
285 ! ==============================================================================
286 
287  global%plagUsedSave = global%plagUsed
288 
289  global%plagUsed = .false.
290 #endif
291 
292 ! ==============================================================================
293 ! Initialize Eulerian solution fields
294 ! ==============================================================================
295 
296  SELECT CASE ( global%initFlowFlag )
297 
298 ! ------------------------------------------------------------------------------
299 ! Initialize from scratch
300 ! ------------------------------------------------------------------------------
301 
302  CASE ( initflow_fromscratch )
303  DO ireg = ireglow,iregupp
304  pregion => levels(1)%regions(ireg)
305 
306  CALL rflu_readdimensions(pregion)
307  CALL rflu_creategrid(pregion)
308 
309  IF ( pregion%grid%nPatches > 0 ) THEN
310  CALL rflu_readbcinputfilewrapper(pregion)
311  END IF ! pRegion%grid%nPatches
312 
313  IF ( rflu_nscbc_decidehavenscbc(pregion) .EQV. .true. ) THEN
314  CALL rflu_readgridwrapper(pregion)
315 
316  CALL rflu_createcellmapping(pregion)
317  CALL rflu_readloc2globcellmapping(pregion)
318  CALL rflu_buildglob2loccellmapping(pregion)
319 
320  CALL rflu_createbvertexlists(pregion)
321  CALL rflu_buildbvertexlists(pregion)
322 
323  CALL rflu_createfacelist(pregion)
324  CALL rflu_buildfacelist(pregion)
325  CALL rflu_renumberbfacelists(pregion)
326 
327  CALL rflu_creategeometry(pregion)
328  CALL rflu_buildgeometry(pregion)
329  END IF ! RFLU_NSCBC_DecideHaveNSCBC
330 
331  CALL rflu_allocmemsolwrapper(pregion)
332  CALL rflu_setvarinfowrapper(pregion)
333 
334  CALL rflu_initflowscratchwrapper(pregion)
335  CALL rflu_setdependentvars(pregion,1,pregion%grid%nCellsTot)
336 
337 ! Initializing boundary array would need solution in domain to be initialized first
338  IF ( rflu_nscbc_decidehavenscbc(pregion) .EQV. .true. ) THEN
339  CALL rflu_bxv_createvarscv(pregion)
340  CALL rflu_bxv_createvarsdv(pregion)
341  CALL rflu_bxv_initvars(pregion)
342  CALL rflu_bxv_writevarswrapper(pregion)
343  CALL rflu_bxv_destroyvarscv(pregion)
344  CALL rflu_bxv_destroyvarsdv(pregion)
345  END IF ! RFLU_NSCBC_DecideHaveNSCBC
346 
347  IF ( global%verbLevel > verbose_none ) THEN
348  CALL rflu_printflowinfowrapper(pregion)
349  END IF ! global%verbLevel
350 
351 #ifdef GENX
352  CALL rflu_genx_setconnsize(pregion)
353  CALL rflu_genx_registerdataflow(pregion)
354 #endif
355  CALL rflu_writeflowwrapper(pregion)
356 
357  IF ( rflu_nscbc_decidehavenscbc(pregion) .EQV. .true. ) THEN
358  CALL rflu_destroyfacelist(pregion)
359  CALL rflu_destroybvertexlists(pregion)
360  CALL rflu_destroycellmapping(pregion)
361  CALL rflu_destroygeometry(pregion)
362  END IF ! RFLU_NSCBC_DecideHaveNSCBC
363 
364  CALL rflu_deallocmemsolwrapper(pregion)
365  CALL rflu_destroygrid(pregion)
366  END DO ! iReg
367 
368 ! ------------------------------------------------------------------------------
369 ! Initialize parallel run by reading solution from serial file.
370 ! ------------------------------------------------------------------------------
371 
372  CASE ( initflow_fromfile )
373  IF ( global%nRegions > 1 ) THEN
374  pregionserial => levels(1)%regions(0)
375 
376 ! ----- Read serial solution ---------------------------------------------------
377 
378  CALL rflu_readdimensions(pregionserial)
379  CALL rflu_creategrid(pregionserial)
380 
381  IF ( pregionserial%grid%nPatches > 0 ) THEN
382  CALL rflu_readbcinputfilewrapper(pregionserial)
383  END IF ! pRegionSerial%grid%nPatches
384 
385  CALL rflu_allocmemsolwrapper(pregionserial)
386  CALL rflu_setvarinfowrapper(pregionserial)
387 
388  CALL rflu_readflowwrapper(pregionserial)
389 
390 ! ----- Loop over regions and initialize ---------------------------------------
391 
392  DO ireg = 1,global%nRegions
393  pregion => levels(1)%regions(ireg)
394 
395  CALL rflu_readdimensionswrapper(pregion)
396  CALL rflu_creategrid(pregion)
397 
398  IF ( pregion%grid%nPatches > 0 ) THEN
399  CALL rflu_readbcinputfilewrapper(pregion)
400  END IF ! pRegion%grid%nPatches
401 
402  CALL rflu_allocmemsolwrapper(pregion)
403  CALL rflu_setvarinfowrapper(pregion)
404 
405  CALL rflu_rnmb_createpc2scmap(pregion)
406  CALL rflu_rnmb_createpv2svmap(pregion)
407  CALL rflu_rnmb_createpbf2sbfmap(pregion)
408 
409  CALL rflu_rnmb_readpxx2sxxmaps(pregion)
410 
411  CALL rflu_rnmb_destroypv2svmap(pregion)
412  CALL rflu_rnmb_destroypbf2sbfmap(pregion)
413 
414  CALL rflu_initflowserialwrapper(pregion,pregionserial)
415 
416  IF ( global%verbLevel > verbose_none ) THEN
417  CALL rflu_printflowinfowrapper(pregion)
418  END IF ! global%verbLevel
419 
420 #ifdef GENX
421  CALL rflu_genx_registerdataflow(pregion)
422  CALL rflu_setgasvars(pregion,1,pregion%grid%nCellsTot)
423  CALL rflu_setdependentvars(pregion,1,pregion%grid%nCellsTot)
424 #endif
425  CALL rflu_writeflowwrapper(pregion)
426 
427  CALL rflu_rnmb_destroypc2scmap(pregion)
428  CALL rflu_deallocmemsolwrapper(pregion)
429  CALL rflu_destroygrid(pregion)
430  END DO ! iReg
431 
432 ! ----- Deallocate memory ------------------------------------------------------
433 
434  CALL rflu_deallocmemsolwrapper(pregionserial)
435  CALL rflu_destroygrid(pregionserial)
436  END IF ! global%nRegions
437 
438 ! ------------------------------------------------------------------------------
439 ! Initialize from hardcode
440 ! ------------------------------------------------------------------------------
441 
442  CASE ( initflow_fromhardcode )
443  DO ireg = ireglow,iregupp
444  pregion => levels(1)%regions(ireg)
445 
446  CALL rflu_readdimensions(pregion)
447  CALL rflu_creategrid(pregion)
448 
449  IF ( pregion%grid%nPatches > 0 ) THEN
450  CALL rflu_readbcinputfilewrapper(pregion)
451  END IF ! pRegion%grid%nPatches
452 
453 #ifdef GENX
454  CALL rflu_genx_readwindow(pregion,genx_window_type_surf)
455  CALL rflu_genx_readwindow(pregion,genx_window_type_vol)
456  CALL rflu_genx_getdimensionsderived(pregion)
457  CALL rflu_genx_creategridsurf(pregion)
458  CALL rflu_genx_registergridsurf(pregion)
459  CALL rflu_genx_registergridvol(pregion)
460 #endif
461 
462  CALL rflu_readgridwrapper(pregion)
463 
464  IF ( global%verbLevel > verbose_low ) THEN
465  CALL rflu_printgridinfo(pregion)
466  END IF ! global%verbLevel
467 
468 #ifdef GENX
469  CALL rflu_genx_destroygridsurf(pregion)
470 #endif
471 
472  CALL rflu_createcellmapping(pregion)
473  CALL rflu_readloc2globcellmapping(pregion)
474  CALL rflu_buildglob2loccellmapping(pregion)
475 
476  CALL rflu_createbvertexlists(pregion)
477  CALL rflu_buildbvertexlists(pregion)
478 
479  CALL rflu_createfacelist(pregion)
480  CALL rflu_buildfacelist(pregion)
481  CALL rflu_renumberbfacelists(pregion)
482 
483  CALL rflu_creategeometry(pregion)
484  CALL rflu_buildgeometry(pregion)
485 
486  CALL rflu_allocmemsolwrapper(pregion)
487  CALL rflu_setvarinfowrapper(pregion)
488 
489  CALL rflu_initflowhardcodewrapper(pregion)
490 
491  IF ( rflu_decidereadwritebcdatafile(pregion) .EQV. .true. ) THEN
492  CALL rflu_initbcdatahardcode(pregion)
493  END IF ! RFLU_DecideReadWriteBcDataFile
494 
495  CALL rflu_setdependentvars(pregion,1,pregion%grid%nCellsTot)
496 
497  IF ( rflu_nscbc_decidehavenscbc(pregion) .EQV. .true. ) THEN
498  CALL rflu_bxv_createvarscv(pregion)
499  CALL rflu_bxv_createvarsdv(pregion)
500  CALL rflu_bxv_initvars(pregion)
501  CALL rflu_bxv_writevarswrapper(pregion)
502  CALL rflu_bxv_destroyvarscv(pregion)
503  CALL rflu_bxv_destroyvarsdv(pregion)
504  END IF ! RFLU_NSCBC_DecideHaveNSCBC
505 
506  IF ( global%verbLevel > verbose_none ) THEN
507  CALL rflu_printflowinfowrapper(pregion)
508  END IF ! global%verbLevel
509 
510 #ifdef GENX
511  CALL rflu_genx_registerdataflow(pregion)
512  CALL rflu_setdependentvars(pregion,1,pregion%grid%nCellsTot)
513 #endif
514  CALL rflu_writeflowwrapper(pregion)
515 
516  IF ( rflu_decidereadwritebcdatafile(pregion) .EQV. .true. ) THEN
517  CALL rflu_writebcdatafile(pregion)
518  END IF ! RFLU_DecideReadWriteBcDataFile
519 
520  CALL rflu_destroygeometry(pregion)
521  CALL rflu_destroyfacelist(pregion)
522  CALL rflu_destroybvertexlists(pregion)
523  CALL rflu_destroycellmapping(pregion)
524  CALL rflu_deallocmemsolwrapper(pregion)
525  CALL rflu_destroygrid(pregion)
526  END DO ! iReg
527 
528 ! ------------------------------------------------------------------------------
529 ! Initialize parallel run from combo using serial solution
530 ! ------------------------------------------------------------------------------
531 
532  CASE ( initflow_fromcombo_serial )
533  IF ( global%nRegions > 1 ) THEN
534  pregionserial => levels(1)%regions(0)
535 
536 ! ----- Read serial solution ---------------------------------------------------
537 
538  CALL rflu_readdimensions(pregionserial)
539  CALL rflu_creategrid(pregionserial)
540 
541  IF ( pregionserial%grid%nPatches > 0 ) THEN
542  CALL rflu_readbcinputfilewrapper(pregionserial)
543  END IF ! pRegionSerial%grid%nPatches
544 
545  CALL rflu_allocmemsolwrapper(pregionserial)
546  CALL rflu_setvarinfowrapper(pregionserial)
547 
548  CALL rflu_readflowwrapper(pregionserial)
549 
550 ! ----- Loop over regions and initialize ---------------------------------------
551 
552  DO ireg = 1,global%nRegions
553  pregion => levels(1)%regions(ireg)
554 
555  CALL rflu_readdimensionswrapper(pregion)
556  CALL rflu_creategrid(pregion)
557 
558  IF ( pregion%grid%nPatches > 0 ) THEN
559  CALL rflu_readbcinputfilewrapper(pregion)
560  END IF ! pRegion%grid%nPatches
561 
562  CALL rflu_readgridwrapper(pregion)
563 
564  IF ( global%verbLevel > verbose_low ) THEN
565  CALL rflu_printgridinfo(pregion)
566  END IF ! global%verbLevel
567 
568  CALL rflu_allocmemsolwrapper(pregion)
569  CALL rflu_setvarinfowrapper(pregion)
570 
571  CALL rflu_rnmb_createpc2scmap(pregion)
572  CALL rflu_rnmb_createpv2svmap(pregion)
573  CALL rflu_rnmb_createpbf2sbfmap(pregion)
574 
575  CALL rflu_rnmb_readpxx2sxxmaps(pregion)
576 
577  CALL rflu_rnmb_destroypv2svmap(pregion)
578  CALL rflu_rnmb_destroypbf2sbfmap(pregion)
579 
580  CALL rflu_initflowserialwrapper(pregion,pregionserial)
581 
582  CALL rflu_createcellmapping(pregion)
583  CALL rflu_readloc2globcellmapping(pregion)
584  CALL rflu_buildglob2loccellmapping(pregion)
585 
586  CALL rflu_createbvertexlists(pregion)
587  CALL rflu_buildbvertexlists(pregion)
588 
589  CALL rflu_createfacelist(pregion)
590  CALL rflu_buildfacelist(pregion)
591  CALL rflu_renumberbfacelists(pregion)
592 
593  CALL rflu_creategeometry(pregion)
594  CALL rflu_buildgeometry(pregion)
595 
596  CALL rflu_initflowhardcodelimwrapper(pregion)
597 
598  CALL rflu_destroygeometry(pregion)
599  CALL rflu_destroyfacelist(pregion)
600  CALL rflu_destroybvertexlists(pregion)
601  CALL rflu_destroycellmapping(pregion)
602 
603  IF ( global%verbLevel > verbose_none ) THEN
604  CALL rflu_printflowinfowrapper(pregion)
605  END IF ! global%verbLevel
606 
607 #ifdef GENX
608  CALL rflu_genx_registerdataflow(pregion)
609  CALL rflu_setdependentvars(pregion,1,pregion%grid%nCellsTot)
610 #endif
611  CALL rflu_writeflowwrapper(pregion)
612 
613  CALL rflu_rnmb_destroypc2scmap(pregion)
614  CALL rflu_deallocmemsolwrapper(pregion)
615  CALL rflu_destroygrid(pregion)
616  END DO ! iReg
617 
618 ! ----- Deallocate memory ------------------------------------------------------
619 
620  CALL rflu_deallocmemsolwrapper(pregionserial)
621  CALL rflu_destroygrid(pregionserial)
622  END IF ! global%nRegions
623 
624 ! ------------------------------------------------------------------------------
625 ! Initialize parallel run from combo using parallel solution
626 ! ------------------------------------------------------------------------------
627 
628  CASE ( initflow_fromcombo_parallel )
629 
630 ! --- Loop over regions and initialize -----------------------------------------
631 
632  DO ireg = 1,global%nRegions
633  pregion => levels(1)%regions(ireg)
634 
635  CALL rflu_readdimensionswrapper(pregion)
636  CALL rflu_creategrid(pregion)
637 
638  IF ( pregion%grid%nPatches > 0 ) THEN
639  CALL rflu_readbcinputfilewrapper(pregion)
640  END IF ! pRegion%grid%nPatches
641 
642  CALL rflu_readgridwrapper(pregion)
643 
644  IF ( global%verbLevel > verbose_low ) THEN
645  CALL rflu_printgridinfo(pregion)
646  END IF ! global%verbLevel
647 
648  CALL rflu_allocmemsolwrapper(pregion)
649  CALL rflu_setvarinfowrapper(pregion)
650 
651  CALL rflu_readflowwrapper(pregion)
652 
653  CALL rflu_createcellmapping(pregion)
654  CALL rflu_readloc2globcellmapping(pregion)
655  CALL rflu_buildglob2loccellmapping(pregion)
656 
657  CALL rflu_createbvertexlists(pregion)
658  CALL rflu_buildbvertexlists(pregion)
659 
660  CALL rflu_createfacelist(pregion)
661  CALL rflu_buildfacelist(pregion)
662  CALL rflu_renumberbfacelists(pregion)
663 
664  CALL rflu_creategeometry(pregion)
665  CALL rflu_buildgeometry(pregion)
666 
667  CALL rflu_initflowhardcodelimwrapper(pregion)
668 
669  CALL rflu_destroygeometry(pregion)
670  CALL rflu_destroyfacelist(pregion)
671  CALL rflu_destroybvertexlists(pregion)
672  CALL rflu_destroycellmapping(pregion)
673 
674  IF ( global%verbLevel > verbose_none ) THEN
675  CALL rflu_printflowinfowrapper(pregion)
676  END IF ! global%verbLevel
677 
678 #ifdef GENX
679  CALL rflu_genx_registerdataflow(pregion)
680  CALL rflu_setdependentvars(pregion,1,pregion%grid%nCellsTot)
681 #endif
682  CALL rflu_writeflowwrapper(pregion)
683 
684  CALL rflu_deallocmemsolwrapper(pregion)
685  CALL rflu_destroygrid(pregion)
686  END DO ! iReg
687 
688 ! ------------------------------------------------------------------------------
689 ! Default
690 ! ------------------------------------------------------------------------------
691 
692  CASE default
693  CALL errorstop(global,err_reached_default,__line__)
694  END SELECT ! global%initFlowFlag
695 
696 #ifdef PLAG
697 ! ==============================================================================
698 ! Re-enable particles
699 ! ==============================================================================
700 
701  global%plagUsed = global%plagUsedSave
702 
703 ! ==============================================================================
704 ! Initialize particle solution
705 ! ==============================================================================
706 
707  IF ( global%plagUsed .EQV. .true. ) THEN
708  pregionserial => levels(1)%regions(0)
709  pplagserial => pregionserial%plag
710 
711  CALL rflu_readdimensions(pregionserial)
712  CALL rflu_creategrid(pregionserial)
713 
714  IF ( pregionserial%grid%nPatches > 0 ) THEN
715  CALL rflu_readbcinputfilewrapper(pregionserial)
716  END IF ! pRegionSerial%grid%nPatches
717 
718 ! ------------------------------------------------------------------------------
719 ! Initialize particle data
720 ! ------------------------------------------------------------------------------
721 
722  CALL plag_setdimensions(pregionserial,pregionserial%plagInput%nPclsIni)
723  CALL plag_setmaxdimensions(pregionserial)
724  CALL plag_rflu_allocmemsol(pregionserial,pplagserial)
725  CALL plag_rflu_allocmemsoltile(pregionserial)
726 
727  SELECT CASE ( global%initPlagFlag )
728  CASE ( plag_init_fromscratch )
729  CALL plag_rflu_initsolutionscratch(pregionserial)
730  CASE ( plag_init_fromrandomstate )
731  CALL plag_rflu_initsolutionrandom(pregionserial)
732  CASE ( plag_init_fromfile )
733 ! TO DO
734 ! Read particle dimension file
735 ! Read solution from file - needed for restart on diff number of procs
736  CALL errorstop(global,err_reached_default,__line__)
737 ! END TO DO
738  CASE default
739  CALL errorstop(global,err_reached_default,__line__)
740  END SELECT ! global%initPlagFlag
741 
742  CALL rflu_readgridwrapper(pregionserial)
743 
744  CALL rflu_createcellmapping(pregionserial)
745  CALL rflu_readloc2globcellmapping(pregionserial)
746  CALL rflu_buildglob2loccellmapping(pregionserial)
747 
748  CALL rflu_createbvertexlists(pregionserial)
749  CALL rflu_buildbvertexlists(pregionserial)
750 
751  CALL rflu_createfacelist(pregionserial)
752  CALL rflu_buildfacelist(pregionserial)
753  CALL rflu_renumberbfacelists(pregionserial)
754 
755  CALL rflu_creategeometry(pregionserial)
756  CALL rflu_buildgeometry(pregionserial)
757 
758  CALL plag_rflu_initsolserialwrapper(pregionserial)
759  CALL plag_initpatchdata(pregionserial)
760 
761  CALL plag_rflu_writedimensions(pregionserial)
762 
763  IF ( global%nRegions == 1 ) THEN
764 ! TO DO Call wrapper routine eventually
765  IF ( global%solutFormat == format_ascii ) THEN
766  CALL plag_rflu_writesolutionascii(pregionserial)
767  ELSE IF ( global%solutFormat == format_binary ) THEN
768  CALL plag_rflu_writesolutionbinary(pregionserial)
769  ELSE
770  CALL errorstop(global,err_reached_default,__line__)
771  END IF ! global%solutFormat
772 ! END TO DO Call wrapper routine eventually
773 
774  CALL rflu_destroygeometry(pregionserial)
775  CALL rflu_destroyfacelist(pregionserial)
776  CALL rflu_destroybvertexlists(pregionserial)
777  CALL rflu_destroycellmapping(pregionserial)
778  END IF ! global%nRegions
779 
780 ! ------------------------------------------------------------------------------
781 ! Initialize parallel regions and write solution files
782 ! ------------------------------------------------------------------------------
783 
784  IF ( global%nRegions > 1 ) THEN
785  CALL plag_dstr_createpcllistcsr(pregionserial)
786  CALL plag_dstr_buildcell2pcllist(pregionserial)
787 
788  DO ireg = 1,global%nRegions
789  pregion => levels(1)%regions(ireg)
790  pplag => pregion%plag
791 
792  CALL rflu_readdimensions(pregion)
793  CALL rflu_creategrid(pregion)
794 
795  IF ( pregion%grid%nPatches > 0 ) THEN
796  CALL rflu_readbcinputfilewrapper(pregion)
797  END IF ! pRegion%grid%nPatches
798 
799  CALL rflu_readgridwrapper(pregion)
800 
801  IF ( global%verbLevel > verbose_low ) THEN
802  CALL rflu_printgridinfo(pregion)
803  END IF ! global%verbLevel
804 
805  CALL plag_setdimensions(pregion,pregion%plagInput%nPclsIni)
806  CALL plag_setmaxdimensions(pregion)
807  CALL plag_rflu_allocmemsol(pregion,pplag)
808  CALL plag_rflu_allocmemsoltile(pregion)
809 
810  CALL plag_rflu_initsolfromserial(pregion,pregionserial)
811  CALL plag_initpatchdata(pregion)
812 
813  CALL plag_setmaxdimensions(pregion)
814  CALL plag_rflu_writedimensions(pregion)
815 
816 ! TO DO Call wrapper routine eventually
817  IF ( global%solutFormat == format_ascii ) THEN
818  CALL plag_rflu_writesolutionascii(pregion)
819  ELSE IF ( global%solutFormat == format_binary ) THEN
820  CALL plag_rflu_writesolutionbinary(pregion)
821  ELSE
822  CALL errorstop(global,err_reached_default,__line__)
823  END IF ! global%solutFormat
824 ! END TO DO Call wrapper routine eventually
825 
826  CALL plag_rflu_deallocmemsoltile(pregion)
827  CALL plag_rflu_deallocmemsol(pregion,pplag)
828 
829  CALL rflu_destroygrid(pregion)
830  END DO ! iReg
831 
832  CALL plag_dstr_destroypcllistcsr(pregionserial)
833  CALL plag_dstr_destroycell2pcllist(pregionserial)
834 
835 ! TO DO
836 ! CALL PLAG_RFLU_GetPclsSizeSumLocal(regions)
837 ! CALL PLAG_RFLU_CheckPclsSize(regions)
838 ! END TO DO
839  END IF ! global%nRegions
840 
841 ! ------------------------------------------------------------------------------
842 ! Deallocate memory for serial region
843 ! ------------------------------------------------------------------------------
844 
845  CALL plag_rflu_deallocmemsoltile(pregionserial)
846  CALL plag_rflu_deallocmemsol(pregionserial,pplagserial)
847 
848  CALL rflu_destroygrid(pregionserial)
849  END IF ! global%plagUsed
850 #endif
851 
852 ! ******************************************************************************
853 ! Write grid speed files. NOTE separated from above because need number of
854 ! faces, which is not always known above.
855 ! ******************************************************************************
856 
857  DO ireg = ireglow,iregupp
858  pregion => levels(1)%regions(ireg)
859 
860  IF ( rflu_decideneedgridspeeds(pregion) .EQV. .true. ) THEN
861  CALL rflu_readdimensions(pregion)
862  CALL rflu_creategrid(pregion)
863 
864  IF ( pregion%grid%nPatches > 0 ) THEN
865  CALL rflu_readbcinputfilewrapper(pregion)
866  END IF ! pRegion%grid%nPatches
867 
868 #ifdef GENX
869  CALL rflu_genx_readwindow(pregion,genx_window_type_surf)
870  CALL rflu_genx_readwindow(pregion,genx_window_type_vol)
871  CALL rflu_genx_getdimensionsderived(pregion)
872  CALL rflu_genx_creategridsurf(pregion)
873  CALL rflu_genx_registergridsurf(pregion)
874  CALL rflu_genx_registergridvol(pregion)
875 #endif
876 
877  CALL rflu_readgridwrapper(pregion)
878 
879 #ifdef GENX
880  CALL rflu_genx_destroygridsurf(pregion)
881 #endif
882 
883  CALL rflu_createcellmapping(pregion)
884  CALL rflu_readloc2globcellmapping(pregion)
885  CALL rflu_buildglob2loccellmapping(pregion)
886 
887  CALL rflu_createbvertexlists(pregion)
888  CALL rflu_buildbvertexlists(pregion)
889 
890  CALL rflu_createfacelist(pregion)
891  CALL rflu_buildfacelist(pregion)
892  CALL rflu_renumberbfacelists(pregion)
893 
894  CALL rflu_allocatememorygspeeds(pregion)
895 #ifdef GENX
896  CALL rflu_genx_registerdatagspeeds(pregion)
897 #endif
898  CALL rflu_writegridspeedswrapper(pregion)
899 
900  CALL rflu_deallocatememorygspeeds(pregion)
901 
902  CALL rflu_destroyfacelist(pregion)
903  CALL rflu_destroybvertexlists(pregion)
904  CALL rflu_destroycellmapping(pregion)
905  CALL rflu_destroygrid(pregion)
906 
907 #ifdef GENX
908  CALL com_delete_window(trim(global%volWinNameInput))
909  CALL com_delete_window(trim(global%surfWinNameInput))
910 #endif
911  END IF ! RFLU_DecideNeedGridSpeeds
912  END DO ! iReg
913 
914 ! ******************************************************************************
915 ! Print info about warnings
916 ! ******************************************************************************
917 
918  CALL rflu_printwarninfo(global)
919 
920 ! ******************************************************************************
921 ! End
922 ! ******************************************************************************
923 
924  CALL deregisterfunction(global)
925  WRITE (*,*) "rfluinit finished sucessfully"
926 
927 END SUBROUTINE rfluinit
928 
929 ! ******************************************************************************
930 !
931 ! RCS Revision history:
932 !
933 ! $Log: rfluinit.F90,v $
934 ! Revision 1.21 2008/12/06 08:44:56 mtcampbe
935 ! Updated license.
936 !
937 ! Revision 1.20 2008/11/19 22:18:06 mtcampbe
938 ! Added Illinois Open Source License/Copyright
939 !
940 ! Revision 1.19 2007/03/27 01:31:45 haselbac
941 ! Remove superfluous USE PLAG_ModParameters statement (bad check-in)
942 !
943 ! Revision 1.18 2007/03/27 00:46:14 haselbac
944 ! Adapted to changes in RFLU_SetDimensions call
945 !
946 ! Revision 1.17 2007/03/27 00:23:23 haselbac
947 ! PLAG init completely revamped to speed up 1d cases substantially
948 !
949 ! Revision 1.16 2007/03/20 17:35:16 fnajjar
950 ! Modified USE call to streamline with new module PLAG_ModDimensions
951 !
952 ! Revision 1.15 2007/03/15 22:00:58 haselbac
953 ! Adapted to changes in PLAG init for serial runs
954 !
955 ! Revision 1.14 2006/08/19 15:41:13 mparmar
956 ! Added calls to create, init, write, and destroy patch arrays
957 !
958 ! Revision 1.13 2006/05/05 18:23:47 haselbac
959 ! Changed PLAG init so do not need serial region anymore
960 !
961 ! Revision 1.12 2006/02/06 23:55:55 haselbac
962 ! Added comm argument to RFLU_InitGlobal
963 !
964 ! Revision 1.11 2005/11/10 02:44:45 haselbac
965 ! Added support for variable properties
966 !
967 ! Revision 1.10 2005/09/23 19:00:45 haselbac
968 ! Bug fix: When init PLAG, did not know about bc
969 !
970 ! Revision 1.9 2005/09/13 21:37:30 haselbac
971 ! Added new init option
972 !
973 ! Revision 1.8 2005/05/18 22:23:59 fnajjar
974 ! Added capability of init particles
975 !
976 ! Revision 1.7 2005/05/05 18:38:39 haselbac
977 ! Removed MPI calls after bug in Rocin/out fixed
978 !
979 ! Revision 1.6 2005/05/04 03:37:50 haselbac
980 ! Commented out COM_set_verbose call
981 !
982 ! Revision 1.5 2005/05/04 03:35:58 haselbac
983 ! Added init and finalize MPI when running within GENX
984 !
985 ! Revision 1.4 2005/05/03 03:10:06 haselbac
986 ! Converted to C++ reading of command-line
987 !
988 ! Revision 1.3 2005/04/22 15:20:24 haselbac
989 ! Fixed bug in combo init: grid and geom was missing; added grid info calls
990 !
991 ! Revision 1.2 2005/04/18 20:33:27 haselbac
992 ! Removed USE RFLU_ModCommLists
993 !
994 ! Revision 1.1 2005/04/15 15:08:15 haselbac
995 ! Initial revision
996 !
997 ! ******************************************************************************
998 
999 
1000 
1001 
1002 
1003 
1004 
subroutine rfluinit(caseString, verbLevel)
Definition: rfluinit.F90:45
subroutine rflu_creategrid(pRegion)
subroutine, public plag_setdimensions(pRegion, nPcls)
subroutine, public plag_dstr_destroypcllistcsr(pRegion)
subroutine plag_rflu_deallocmemsol(pRegion, pPlag)
subroutine, public rflu_buildbvertexlists(pRegion)
subroutine, public rflu_rnmb_readpxx2sxxmaps(pRegion)
subroutine, public rflu_genx_creategridsurf(pRegion)
subroutine, public rflu_genx_createattrflow(pRegion)
subroutine rflu_initflowhardcodelimwrapper(pRegion)
subroutine, public rflu_writebcdatafile(pRegion)
subroutine, public rflu_genx_destroygridsurf(pRegion)
subroutine, public rflu_genx_hardcodewindowname(global)
subroutine rflu_destroygrid(pRegion)
subroutine rflu_printwarninfo(global)
subroutine plag_initpatchdata(pRegion)
subroutine, public rflu_deallocatememorygspeeds(pRegion)
subroutine, public rflu_destroyregionmapping(global, mapType)
LOGICAL function, public rflu_decidereadwritebcdatafile(pRegion)
subroutine, public rflu_genx_registergridsurf(pRegion)
subroutine, public rflu_genx_createattrgridsurf(pRegion)
subroutine, public rflu_readdimensionswrapper(pRegion)
subroutine, public rflu_destroyfacelist(pRegion)
subroutine rflu_setdependentvars(pRegion, icgBeg, icgEnd)
subroutine, public rflu_rnmb_destroypbf2sbfmap(pRegion)
subroutine, public rflu_writeflowwrapper(pRegion)
subroutine plag_rflu_allocmemsol(pRegion, pPlag)
subroutine, public rflu_writegridspeedswrapper(pRegion)
subroutine, public rflu_destroygeometry(pRegion)
subroutine plag_rflu_initsolfromserial(pRegion, pRegionSerial)
subroutine rflu_getuserinput(regions, inPrep)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine, public rflu_bxv_destroyvarsdv(pRegion)
subroutine, public rflu_genx_storenameshandles(global, surfWinNameInput, volWinNameInput, handleObtain)
subroutine, public rflu_genx_createattrinterf(pRegion)
subroutine, public rflu_readgridwrapper(pRegion)
subroutine rflu_printheader(global)
subroutine rflu_setrestarttimeflag(global)
subroutine plag_rflu_deallocmemsoltile(pRegion)
subroutine, public rflu_buildgeometry(pRegion, sypeFaceFlag)
subroutine, public rflu_readbcinputfilewrapper(pRegion)
subroutine, public rflu_rnmb_destroypc2scmap(pRegion)
LOGICAL function, public rflu_decideneedgridspeeds(pRegion)
subroutine, public plag_dstr_createpcllistcsr(pRegion)
subroutine scalerotatevector(global, vect)
subroutine rflu_setvarinfowrapper(pRegion)
subroutine, public rflu_setregionmappingserial(global)
subroutine plag_rflu_writesolutionascii(pRegion)
subroutine rflu_initflowhardcodewrapper(pRegion)
subroutine, public rflu_readloc2globcellmapping(pRegion)
LOGICAL function, public rflu_nscbc_decidehavenscbc(pRegion)
subroutine, public rflu_genx_createwindows(pRegion, communicator)
subroutine rflu_initflowscratchwrapper(pRegion)
subroutine, public rflu_createfacelist(pRegion)
subroutine, public rflu_genx_setconnsize(pRegion)
subroutine, public rflu_bxv_destroyvarscv(pRegion)
subroutine, public rflu_bxv_createvarsdv(pRegion)
subroutine, public rflu_buildglob2loccellmapping(pRegion)
subroutine, public rflu_genx_registerdataflow(pRegion)
subroutine, public rflu_genx_createattrgspeeds(pRegion)
subroutine rflu_deallocmemsolwrapper(pRegion)
subroutine, public plag_dstr_buildcell2pcllist(pRegion)
subroutine, public rflu_buildfacelist(pRegion)
subroutine, public rflu_bxv_initvars(pRegion)
subroutine, public rflu_renumberbfacelists(pRegion)
subroutine, public rflu_genx_getdimensionsderived(pRegion)
subroutine, public rflu_rnmb_destroypv2svmap(pRegion)
subroutine, public rflu_genx_storecommunicator(global, communicator)
subroutine rflu_setgasvars(pRegion, icgBeg, icgEnd)
subroutine, public rflu_readregionmappingfile(global, readMode, myProcId)
subroutine, public rflu_destroycellmapping(pRegion)
subroutine rflu_builddatastruct(global, levels)
subroutine, public rflu_readflowwrapper(pRegion)
subroutine rflu_allocmemsolwrapper(pRegion)
subroutine, public rflu_rnmb_createpc2scmap(pRegion)
subroutine, public rflu_destroybvertexlists(pRegion)
subroutine, public rflu_createbvertexlists(pRegion)
subroutine rflu_setmoduletype(global, moduleType)
subroutine rflu_randominit(regions)
subroutine, public plag_setmaxdimensions(pRegion)
subroutine rflu_initflowserialwrapper(pRegion, pRegionSerial)
subroutine rflu_printgridinfo(pRegion)
subroutine, public rflu_readdimensions(pRegion)
subroutine, public rflu_genx_registergridvol(pRegion)
subroutine, public rflu_rnmb_createpv2svmap(pRegion)
subroutine, public rflu_genx_readctrlfile(global)
subroutine plag_rflu_allocmemsoltile(pRegion)
subroutine, public rflu_genx_readwindow(pRegion, windowType)
subroutine, public rflu_genx_registerdatagspeeds(pRegion)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine, public plag_dstr_destroycell2pcllist(pRegion)
subroutine rflu_initbcdatahardcode(pRegion)
subroutine, public rflu_createcellmapping(pRegion)
subroutine plag_rflu_initsolserialwrapper(pRegion)
subroutine, public rflu_allocatememorygspeeds(pRegion)
subroutine, public plag_rflu_writedimensions(pRegion)
subroutine, public rflu_rnmb_createpbf2sbfmap(pRegion)
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine plag_rflu_writesolutionbinary(pRegion)
subroutine plag_rflu_initsolutionrandom(pRegion)
subroutine, public rflu_creategeometry(pRegion)
subroutine rflu_writeversionstring(global)
subroutine, public rflu_applyregionmapping(global, levels)
subroutine rflu_initglobal(casename, verbLevel, communicator, global)
subroutine rflu_readrestartinfo(global)
subroutine, public rflu_bxv_writevarswrapper(pRegion)
subroutine, public rflu_imposeregionmappingserial(global)
subroutine, public rflu_createregionmapping(global, mapType)
subroutine rflu_printflowinfowrapper(pRegion)
subroutine plag_rflu_initsolutionscratch(pRegion)
subroutine, public rflu_bxv_createvarscv(pRegion)