Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rflupick.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 rflupick.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! caseString String with casename
31 ! stampString String with iteration or time stamp
32 ! verbLevel Verbosity level
33 !
34 ! Output: None.
35 !
36 ! Notes: None.
37 !
38 ! ******************************************************************************
39 !
40 ! $Id: rflupick.F90,v 1.14 2008/12/06 08:45:04 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2003-2006 by the University of Illinois
43 !
44 ! ******************************************************************************
45 
46 SUBROUTINE rflupick(caseString,stampString,verbLevel)
47 
48  USE moddatatypes
49  USE modglobal, ONLY: t_global
50  USE moderror
51  USE moddatastruct, ONLY: t_level,t_region
52  USE modbndpatch, ONLY: t_patch
53  USE modmixture, ONLY: t_mixt_input
54  USE modbndpatch, ONLY: t_patch
55  USE modparameters
56  USE modmpi
57 
72 
91 
92  IMPLICIT NONE
93 
94 ! ******************************************************************************
95 ! Declarations and definitions
96 ! ******************************************************************************
97 
98 ! ==============================================================================
99 ! Arguments
100 ! ==============================================================================
101 
102  CHARACTER(*) :: casestring,stampstring
103  INTEGER, INTENT(IN) :: verblevel
104 
105 ! ==============================================================================
106 ! Local variables
107 ! ==============================================================================
108 
109  LOGICAL :: fileexists
110  CHARACTER(CHRLEN) :: casename,choice,nregions,rcsidentstring,stamp
111  INTEGER :: errorflag,ipatch,ireg
112  TYPE(t_global), POINTER :: global
113  TYPE(t_mixt_input), POINTER :: pmixtinput
114  TYPE(t_level), DIMENSION(:), POINTER :: levels
115  TYPE(t_patch), POINTER :: ppatch
116  TYPE(t_region), POINTER :: pregion
117 
118 ! ******************************************************************************
119 ! Start
120 ! ******************************************************************************
121 
122  rcsidentstring = '$RCSfile: rflupick.F90,v $ $Revision: 1.14 $'
123 
124 ! ******************************************************************************
125 ! Initialize global data
126 ! ******************************************************************************
127 
128  ALLOCATE(global,stat=errorflag)
129  IF ( errorflag /= err_none ) THEN
130  WRITE(stderr,'(A,1X,A)') solver_name,'ERROR - Pointer allocation failed.'
131  stop
132  END IF ! errorFlag
133 
134  casename = casestring(1:len(casestring))
135  stamp = stampstring(1:len(stampstring))
136 
137  CALL rflu_initglobal(casename,verblevel,crazy_value_int,global)
138 
139  CALL registerfunction(global,'rflupick', &
140  'rflupick.F90')
141 
142 ! ******************************************************************************
143 ! Print header and write version string
144 ! ******************************************************************************
145 
146  IF ( global%myProcid == masterproc ) THEN
147  CALL rflu_writeversionstring(global)
148  IF ( global%verbLevel /= verbose_none ) THEN
149  CALL rflu_printheader(global)
150  END IF ! global%verbLevel
151  END IF ! global%myProcid
152 
153 ! ******************************************************************************
154 ! Read mapping file and impose serial mapping
155 ! ******************************************************************************
156 
157  CALL rflu_readregionmappingfile(global,mapfile_readmode_peek,global%myProcId)
158  CALL rflu_setregionmappingserial(global)
159  CALL rflu_createregionmapping(global,maptype_reg)
160  CALL rflu_imposeregionmappingserial(global)
161 
162 ! ******************************************************************************
163 ! Prepare data structure
164 ! ******************************************************************************
165 
166  CALL rflu_builddatastruct(global,levels)
167  CALL rflu_applyregionmapping(global,levels)
168  CALL rflu_destroyregionmapping(global,maptype_reg)
169 
170 ! ******************************************************************************
171 ! Read input file
172 ! ******************************************************************************
173 
174  CALL rflu_getuserinput(levels(1)%regions)
175 
176  IF ( global%flowType == flow_steady ) THEN
177  READ(stamp,*) global%currentIter
178  ELSE
179  READ(stamp,*) global%currentTime
180  END IF ! global%flowType
181 
182 ! ******************************************************************************
183 ! Get additional input
184 ! ******************************************************************************
185 
186  WRITE(stdout,'(A,1X,A)') solver_name,'Picking regions based on bounding box?'
187  WRITE(stdout,'(A,3X,A)') solver_name,'n - No'
188  WRITE(stdout,'(A,3X,A)') solver_name,'y - Yes'
189  WRITE(stdout,'(A,3X,A)') solver_name,'Enter choice:'
190  READ(stdin,'(A)') choice
191 
192  SELECT CASE ( trim(choice) )
193  CASE ( 'y' )
194  global%pickCoordFlag = .true.
195 
196  WRITE(stdout,'(A,3X,A)') solver_name,'Enter coordinates of bounding box:'
197  WRITE(stdout,'(A,5X,A)') solver_name,'Enter x-coordinate range (low,high):'
198  READ(stdin,*) global%pickXCoordLow,global%pickXCoordUpp
199  WRITE(stdout,'(A,5X,A)') solver_name,'Enter y-coordinate range (low,high):'
200  READ(stdin,*) global%pickYCoordLow,global%pickYCoordUpp
201  WRITE(stdout,'(A,5X,A)') solver_name,'Enter z-coordinate range (low,high):'
202  READ(stdin,*) global%pickZCoordLow,global%pickZCoordUpp
203  CASE ( 'n' )
204  global%pickCoordFlag = .false.
205  CASE default
206  global%warnCounter = global%warnCounter + 1
207 
208  WRITE(stdout,'(A,3X,A)') solver_name,'*** WARNING *** Invalid input.'
209  WRITE(stdout,'(A,17X,A)') solver_name,'Continuing assuming choice of no.'
210 
211  global%pickCoordFlag = .false.
212  END SELECT ! TRIM(choice)
213 
214 ! ******************************************************************************
215 ! Pick regions based on bounding box
216 ! ******************************************************************************
217 
218  IF ( global%nRegionsLocal > 1 ) THEN
219  IF ( global%pickCoordFlag .EQV. .true. ) THEN
220  DO ireg = 1,global%nRegionsLocal
221  pregion => levels(1)%regions(ireg)
222 
223  CALL rflu_readdimensions(pregion)
224  CALL rflu_creategrid(pregion)
225 
226  IF ( pregion%grid%nPatches > 0 ) THEN
227  CALL rflu_readbcinputfilewrapper(pregion)
228  END IF ! pRegion%grid%nPatches
229 
230  CALL rflu_readgridwrapper(pregion)
231 
232  IF ( global%verbLevel > verbose_none ) THEN
233  CALL rflu_printgridinfo(pregion)
234  END IF ! global%verbLevel
235 
236  CALL rflu_pickregionscoord(pregion)
237 
238  CALL rflu_destroygrid(pregion)
239  END DO ! iReg
240  END IF ! global%pickCoordFlag
241  END IF ! global%nRegionsLocal
242 
243 ! ******************************************************************************
244 ! Pick regions based on manual input
245 ! ******************************************************************************
246 
247  IF ( global%nRegionsLocal > 1 ) THEN
248  CALL rflu_pickregionsmanual(levels(1)%regions)
249  END IF ! global%nRegions
250 
251 ! ******************************************************************************
252 ! Open post-processing information file
253 ! ******************************************************************************
254 
255  CALL rflu_openpostinfo(global,file_status_unknown,fileexists)
256 
257 ! ******************************************************************************
258 ! Pick special cells and write to file
259 ! ******************************************************************************
260 
261  IF ( global%postSpecFlag .EQV. .true. ) THEN
262  DO ireg = 1,global%nRegionsLocal
263  IF ( global%nRegionsLocal /= 1 ) THEN
264  pregion => levels(1)%regions(ireg)
265  ELSE
266  pregion => levels(1)%regions(0)
267  END IF ! global%nRegionsLocal
268 
269  pmixtinput => pregion%mixtInput
270 
271 ! ==============================================================================
272 ! If region active, proceed to allow user to pick cells
273 ! ==============================================================================
274 
275  IF ( pregion%postActiveFlag .EQV. .true. ) THEN
276  CALL rflu_readdimensions(pregion) ! Must be done again
277  CALL rflu_creategrid(pregion)
278 
279  IF ( pregion%grid%nPatches > 0 ) THEN
280  CALL rflu_readbcinputfilewrapper(pregion)
281  END IF ! pRegion%grid%nPatches
282 
283  CALL rflu_readgridwrapper(pregion)
284 
285  IF ( global%verbLevel > verbose_none ) THEN
286  CALL rflu_printgridinfo(pregion)
287  END IF ! global%verbLevel
288 
289 ! ------------------------------------------------------------------------------
290 ! Build data structure
291 ! ------------------------------------------------------------------------------
292 
293  CALL rflu_createcellmapping(pregion)
294  CALL rflu_readloc2globcellmapping(pregion)
295  CALL rflu_buildglob2loccellmapping(pregion)
296 
297  CALL rflu_createbvertexlists(pregion)
298  CALL rflu_buildbvertexlists(pregion)
299 
300  CALL rflu_createfacelist(pregion)
301  CALL rflu_buildfacelist(pregion)
302  CALL rflu_renumberbfacelists(pregion)
303 
304 ! ------------------------------------------------------------------------------
305 ! Build stencils. NOTE: Need geometry.
306 ! ------------------------------------------------------------------------------
307 
308  CALL rflu_creategeometry(pregion)
309  CALL rflu_buildgeometry(pregion)
310 
311  CALL rflu_createvert2celllist(pregion)
312  CALL rflu_buildvert2celllist(pregion)
313 
314  CALL rflu_createcell2facelist(pregion)
315  CALL rflu_buildcell2facelist(pregion)
316 
317  IF ( pmixtinput%spaceOrder > 1 ) THEN
318  CALL rflu_setinfoc2cstencilwrapper(pregion,pmixtinput%spaceOrder-1)
319  CALL rflu_createc2cstencilwrapper(pregion)
320  CALL rflu_buildc2cstencilwrapper(pregion)
321  END IF ! pMixtInput%spaceOrder
322 
323  IF ( pmixtinput%flowModel == flow_navst ) THEN
324  CALL rflu_setinfof2cstencilwrapper(pregion,pmixtinput%spaceOrder-1)
325  CALL rflu_createf2cstencilwrapper(pregion)
326  CALL rflu_buildf2cstencilwrapper(pregion)
327  END IF ! pMixtInput%flowModel
328 
329  DO ipatch = 1,pregion%grid%nPatches
330  ppatch => pregion%patches(ipatch)
331 
332  IF ( rflu_decideneedbgradface(pregion,ppatch) .EQV. .true. ) THEN
333  CALL rflu_setinfobf2cstencilwrapper(pregion,ppatch,ppatch%spaceOrder)
334  CALL rflu_createbf2cstencilwrapper(pregion,ppatch)
335  CALL rflu_buildbf2cstencilwrapper(pregion,ppatch)
336  END IF ! RFLU_DecideNeedBGradFace
337 
338  END DO ! iPatch
339 
340  CALL rflu_setinfostencilvert2cell(pregion,global%postInterpOrder)
341  CALL rflu_createstencilvert2cell(pregion)
342  CALL rflu_buildstencilvert2cell(pregion)
343 
344  CALL rflu_destroycell2facelist(pregion)
345  CALL rflu_destroyvert2celllist(pregion)
346 
347  CALL rflu_destroygeometry(pregion)
348 
349 ! ------------------------------------------------------------------------------
350 ! Pick special cells and write to file
351 ! ------------------------------------------------------------------------------
352 
353  CALL rflu_pickspecialcells(pregion)
354  CALL rflu_pickspecialfaces(pregion)
355  CALL rflu_writepostinfo(pregion)
356 
357 ! ------------------------------------------------------------------------------
358 ! Deallocate memory
359 ! ------------------------------------------------------------------------------
360 
361  CALL rflu_destroystencilvert2cell(pregion)
362 
363  IF ( pmixtinput%flowModel == flow_navst ) THEN
364  CALL rflu_destroyf2cstencilwrapper(pregion)
365  END IF ! pMixtInput%flowModel
366 
367  DO ipatch = 1,pregion%grid%nPatches
368  ppatch => pregion%patches(ipatch)
369 
370  IF ( rflu_decideneedbgradface(pregion,ppatch) .EQV. .true. ) THEN
371  CALL rflu_destroybf2cstencilwrapper(pregion,ppatch)
372  END IF ! RFLU_DecideNeedBGradFace
373  END DO ! iPatch
374 
375  IF ( pmixtinput%spaceOrder > 1 ) THEN
376  CALL rflu_destroyc2cstencilwrapper(pregion)
377  END IF ! pMixtInput%spaceOrder
378 
379  CALL rflu_destroyfacelist(pregion)
380  CALL rflu_destroybvertexlists(pregion)
381  CALL rflu_destroycellmapping(pregion)
382  ELSE
383  CALL rflu_writepostinfo(pregion)
384  END IF ! pRegion%postActiveFlag
385  END DO ! iReg
386  ELSE
387  DO ireg = 1,global%nRegionsLocal
388  IF ( global%nRegionsLocal /= 1 ) THEN
389  pregion => levels(1)%regions(ireg)
390  ELSE
391  pregion => levels(1)%regions(0)
392  END IF ! global%nRegionsLocal
393 
394  CALL rflu_writepostinfo(pregion)
395  END DO ! iReg
396  END IF ! global%postSpecFlag
397 
398 ! ******************************************************************************
399 ! Close post-processing information file
400 ! ******************************************************************************
401 
402  CALL rflu_closepostinfo(global)
403 
404 ! *****************************************************************************
405 ! Print info about warnings
406 ! *****************************************************************************
407 
408  CALL rflu_printwarninfo(global)
409 
410 ! ******************************************************************************
411 ! End
412 ! ******************************************************************************
413 
414  CALL deregisterfunction(global)
415 
416 END SUBROUTINE rflupick
417 
418 ! ******************************************************************************
419 !
420 ! RCS Revision history:
421 !
422 ! $Log: rflupick.F90,v $
423 ! Revision 1.14 2008/12/06 08:45:04 mtcampbe
424 ! Updated license.
425 !
426 ! Revision 1.13 2008/11/19 22:18:15 mtcampbe
427 ! Added Illinois Open Source License/Copyright
428 !
429 ! Revision 1.12 2006/08/19 15:41:15 mparmar
430 ! Used pPatch%spaceOrder, RFLU_NSCBC_DecideNeedBGradFace
431 !
432 ! Revision 1.11 2006/04/07 14:57:17 haselbac
433 ! Adapted to changes in bface stencil routines
434 !
435 ! Revision 1.10 2006/03/09 14:11:06 haselbac
436 ! Now call wrapper routine for F2C stencils
437 !
438 ! Revision 1.9 2006/02/06 23:55:55 haselbac
439 ! Added comm argument to RFLU_InitGlobal
440 !
441 ! Revision 1.8 2006/01/06 22:18:36 haselbac
442 ! Adapted to name changes
443 !
444 ! Revision 1.7 2005/12/10 23:30:23 haselbac
445 ! Added user input for bbox
446 !
447 ! Revision 1.6 2005/10/27 19:21:49 haselbac
448 ! Adapted to changes in stencil routine names
449 !
450 ! Revision 1.5 2005/10/09 15:13:29 haselbac
451 ! Bug fix: Added bc reading, needed for bface stencils
452 !
453 ! Revision 1.4 2005/10/05 14:26:13 haselbac
454 ! Adapted to changes in stencil modules, added use of vertex list module
455 !
456 ! Revision 1.3 2005/07/19 19:17:48 haselbac
457 ! Bug fix: Added calls to build c2f list for picking stencils
458 !
459 ! Revision 1.2 2005/05/03 03:11:54 haselbac
460 ! Converted to C++ reading of command-line
461 !
462 ! Revision 1.1 2005/04/18 14:57:56 haselbac
463 ! Initial revision
464 !
465 ! ******************************************************************************
466 
467 
468 
469 
470 
471 
472 
subroutine, public rflu_buildcell2facelist(pRegion)
subroutine, public rflu_destroycell2facelist(pRegion)
subroutine rflu_creategrid(pRegion)
subroutine, public rflu_buildbf2cstencilwrapper(pRegion, pPatch, constrInput)
subroutine, public rflu_buildbvertexlists(pRegion)
subroutine, public rflu_createc2cstencilwrapper(pRegion)
subroutine rflu_pickspecialfaces(pRegion)
subroutine rflu_destroygrid(pRegion)
subroutine rflu_printwarninfo(global)
subroutine, public rflu_destroyregionmapping(global, mapType)
subroutine, public rflu_destroyfacelist(pRegion)
subroutine, public rflu_buildf2cstencilwrapper(pRegion, constrInput)
subroutine, public rflu_createbf2cstencilwrapper(pRegion, pPatch)
subroutine, public rflu_setinfof2cstencilwrapper(pRegion, orderNominal)
subroutine, public rflu_createcell2facelist(pRegion)
LOGICAL function rflu_decideneedbgradface(pRegion, pPatch)
subroutine, public rflu_destroygeometry(pRegion)
subroutine rflu_getuserinput(regions, inPrep)
subroutine, public rflu_setinfostencilvert2cell(pRegion, orderNominal)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflu_pickregionscoord(pRegion)
subroutine, public rflu_readgridwrapper(pRegion)
subroutine rflu_printheader(global)
subroutine, public rflu_createvert2celllist(pRegion)
subroutine, public rflu_buildgeometry(pRegion, sypeFaceFlag)
subroutine, public rflu_readbcinputfilewrapper(pRegion)
subroutine, public rflu_setregionmappingserial(global)
subroutine, public rflu_createstencilvert2cell(pRegion)
subroutine, public rflu_readloc2globcellmapping(pRegion)
subroutine rflupick(caseString, stampString, verbLevel)
Definition: rflupick.F90:46
subroutine, public rflu_buildstencilvert2cell(pRegion)
subroutine, public rflu_destroybf2cstencilwrapper(pRegion, pPatch)
subroutine, public rflu_destroyf2cstencilwrapper(pRegion)
subroutine, public rflu_createfacelist(pRegion)
subroutine, public rflu_buildglob2loccellmapping(pRegion)
subroutine, public rflu_destroyc2cstencilwrapper(pRegion)
subroutine, public rflu_buildfacelist(pRegion)
subroutine, public rflu_renumberbfacelists(pRegion)
subroutine, public rflu_destroystencilvert2cell(pRegion)
subroutine rflu_openpostinfo(global, fileStatus, fileExists)
subroutine rflu_closepostinfo(global)
subroutine, public rflu_readregionmappingfile(global, readMode, myProcId)
subroutine, public rflu_destroycellmapping(pRegion)
subroutine rflu_builddatastruct(global, levels)
subroutine, public rflu_destroyvert2celllist(pRegion)
subroutine, public rflu_destroybvertexlists(pRegion)
subroutine, public rflu_createbvertexlists(pRegion)
subroutine, public rflu_setinfoc2cstencilwrapper(pRegion, orderNominal)
subroutine, public rflu_buildc2cstencilwrapper(pRegion, icgInput, constrInput)
subroutine rflu_printgridinfo(pRegion)
subroutine, public rflu_readdimensions(pRegion)
subroutine rflu_pickspecialcells(pRegion)
subroutine rflu_writepostinfo(pRegion)
subroutine, public rflu_createcellmapping(pRegion)
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine, public rflu_creategeometry(pRegion)
subroutine rflu_writeversionstring(global)
subroutine, public rflu_applyregionmapping(global, levels)
subroutine rflu_initglobal(casename, verbLevel, communicator, global)
subroutine, public rflu_createf2cstencilwrapper(pRegion)
subroutine, public rflu_setinfobf2cstencilwrapper(pRegion, pPatch, orderNominal)
subroutine, public rflu_imposeregionmappingserial(global)
subroutine rflu_pickregionsmanual(regions)
subroutine, public rflu_buildvert2celllist(pRegion)
subroutine, public rflu_createregionmapping(global, mapType)