Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
main.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 to extract special cells for postprocessor.
26 !
27 ! Description: None.
28 !
29 ! Input: None.
30 !
31 ! Output: None.
32 !
33 ! Notes:
34 ! 1. This utility is needed because rflupost_charm cannot accept input
35 ! from the command-line. Hence extract the information here and write to
36 ! text file.
37 !
38 !*******************************************************************************
39 !
40 ! $Id: main.F90,v 1.5 2008/12/06 08:44:54 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2003 by the University of Illinois
43 !
44 !*******************************************************************************
45 
46 PROGRAM rflucells
47 
48  USE moddatatypes
49  USE modglobal, ONLY: t_global
50  USE moderror
51  USE moddatastruct, ONLY: t_level,t_region
52  USE modparameters
53 
56  USE rflu_modfem
57 
59  rflu_assignregionmapping,rflu_builddatastruct, &
60  rflu_closespecialcellsfile, &
61  rflu_computedimensions, &
63  rflu_getuserinput,rflu_imposeserialmapping, &
64  rflu_initglobal,rflu_openspecialcellsfile, &
67  rflu_readinputfile,rflu_readmappingfile, &
69 
70  IMPLICIT NONE
71 
72 ! ******************************************************************************
73 ! Declarations and definitions
74 ! ******************************************************************************
75 
76 ! ==============================================================================
77 ! Local variables
78 ! ==============================================================================
79 
80  LOGICAL :: specialcellfileexists
81  CHARACTER(CHRLEN) :: casename,nregions,rcsidentstring,stampstr,verbosity
82  INTEGER :: errorflag,ireg,verblevel
83  TYPE(t_region), POINTER :: pregion
84  TYPE(t_global), POINTER :: global
85  TYPE(t_level), POINTER :: levels(:)
86 
87 ! ******************************************************************************
88 ! Start
89 ! ******************************************************************************
90 
91  rcsidentstring = '$RCSfile: main.F90,v $ $Revision: 1.5 $'
92 
93 ! ******************************************************************************
94 ! Get command-line options
95 ! ******************************************************************************
96 
97  CALL getarg(1,casename)
98  CALL getarg(2,stampstr)
99  CALL getarg(3,verbosity)
100 
101  IF ( len_trim(casename) == 0 .OR. &
102  len_trim(stampstr) == 0 .OR. &
103  len_trim(verbosity) == 0 ) THEN
104  WRITE(stdout,'(A )') solver_name
105  WRITE(stdout,'(A,1X,A)') solver_name,'Usage: rflucells <casename> <stamp> <verb>'
106  WRITE(stdout,'(A,1X,A)') solver_name,' stamp = iteration (steady flow)'
107  WRITE(stdout,'(A,1X,A)') solver_name,' time (unsteady flow)'
108  WRITE(stdout,'(A,1X,A)') solver_name,' verb = 0 - no verbose output'
109  WRITE(stdout,'(A,1X,A)') solver_name,' 1 - some verbose output'
110  WRITE(stdout,'(A,1X,A)') solver_name,' 2 - a lot of verbose output'
111  WRITE(stdout,'(A )') solver_name
112  stop
113  END IF ! LEN_TRIM
114 
115  READ(verbosity,*) verblevel
116 
117 ! ******************************************************************************
118 ! Initialize global data
119 ! ******************************************************************************
120 
121  ALLOCATE(global,stat=errorflag)
122  IF ( errorflag /= err_none ) THEN
123  WRITE(stderr,'(A,1X,A)') solver_name,'ERROR - Pointer allocation failed.'
124  stop
125  END IF ! errorFlag
126 
127  CALL rflu_initglobal(casename,verblevel,global)
128 
129  CALL registerfunction(global,'driver', &
130  'main.F90')
131 
132 ! ******************************************************************************
133 ! Print header and write version string
134 ! ******************************************************************************
135 
136  IF ( global%myProcid == masterproc ) THEN
137  CALL rflu_writeversionstring(global)
138  IF ( global%verbLevel /= verbose_none ) THEN
139  CALL rflu_printheader(global)
140  END IF ! global%verbLevel
141  END IF ! global%myProcid
142 
143 ! ******************************************************************************
144 ! Read mapping file and impose serial mapping
145 ! ******************************************************************************
146 
147  CALL rflu_readmappingfile(global,mapfile_readmode_peek)
148  CALL rflu_imposeserialmapping(global)
149 
150 ! ******************************************************************************
151 ! Prepare data structure
152 ! ******************************************************************************
153 
154  CALL rflu_builddatastruct(global,levels)
155  CALL rflu_assignregionmapping(global,levels)
156 
157 ! ******************************************************************************
158 ! Read input file
159 ! ******************************************************************************
160 
161  CALL rflu_getuserinput(levels(1)%regions)
162 
163  IF ( global%flowType == flow_steady ) THEN
164  READ(stampstr,*) global%currentIter
165  ELSE
166  READ(stampstr,*) global%currentTime
167  END IF ! global%flowType
168 
169 ! ******************************************************************************
170 ! Read dimensions file, allocate memory, and read bc file
171 ! ******************************************************************************
172 
173  IF ( global%nRegions == 1 ) THEN ! single region
174  pregion => levels(1)%regions(0)
175 
176  CALL rflu_readdimensions(pregion)
177  CALL rflu_allocatememorywrapper(pregion,alloc_mode_all)
178 
179  CALL rflu_createcellmapping(pregion)
180  CALL rflu_createfacelist(pregion)
181  ELSE ! multiple regions
182  DO ireg = 1,global%nRegionsLocal
183  pregion => levels(1)%regions(ireg)
184 
185  CALL rflu_readdimensions(pregion)
186  CALL rflu_allocatememorywrapper(pregion,alloc_mode_all)
187 
188  CALL rflu_createcellmapping(pregion)
189  CALL rflu_createfacelist(pregion)
190  END DO ! iReg
191  END IF ! global%nRegions
192 
193 ! ******************************************************************************
194 ! Read grid
195 ! ******************************************************************************
196 
197  IF ( global%nRegions == 1 ) THEN ! single region
198  pregion => levels(1)%regions(0)
199  CALL rflu_readgridwrapper(pregion)
200 
201  IF ( global%verbLevel > verbose_none ) THEN
202  CALL rflu_printgridinfo(pregion)
203  END IF ! global%verbLevel
204  ELSE ! multiple regions
205  DO ireg = 1,global%nRegionsLocal
206  pregion => levels(1)%regions(ireg)
207  CALL rflu_readgridwrapper(pregion)
208 
209  IF ( global%verbLevel > verbose_none ) THEN
210  CALL rflu_printgridinfo(pregion)
211  END IF ! global%verbLevel
212  END DO ! iReg
213  END IF ! global%nRegions
214 
215 ! ******************************************************************************
216 ! Build data structure
217 ! ******************************************************************************
218 
219  IF ( global%nRegions == 1 ) THEN ! single region
220  pregion => levels(1)%regions(0)
221  CALL rflu_buildcellmapping(pregion)
222  CALL rflu_buildfacelist(pregion)
223  ELSE ! multiple regions
224  DO ireg = 1,global%nRegionsLocal
225  pregion => levels(1)%regions(ireg)
226  CALL rflu_buildcellmapping(pregion)
227  CALL rflu_buildfacelist(pregion)
228  END DO ! iReg
229  END IF ! global%nRegions
230 
231 ! ******************************************************************************
232 ! Get special cells and write to file
233 ! ******************************************************************************
234 
235  IF ( global%nRegions == 1 ) THEN ! single region
236  pregion => levels(1)%regions(0)
237  CALL rflu_getspecialcells(pregion)
238  ELSE ! multiple regions
239  DO ireg = 1,global%nRegionsLocal
240  pregion => levels(1)%regions(ireg)
241  CALL rflu_getspecialcells(pregion)
242  END DO ! iReg
243  END IF ! global%nRegions
244 
245  CALL rflu_openspecialcellsfile(global,file_status_unknown, &
246  specialcellfileexists)
247 
248  IF ( global%nRegions == 1 ) THEN ! single region
249  pregion => levels(1)%regions(0)
250  CALL rflu_writespecialcells(pregion)
251  ELSE ! multiple regions
252  DO ireg = 1,global%nRegionsLocal
253  pregion => levels(1)%regions(ireg)
254  CALL rflu_writespecialcells(pregion)
255  END DO ! iReg
256  END IF ! global%nRegions
257 
258  CALL rflu_closespecialcellsfile(global)
259 
260 ! ******************************************************************************
261 ! Deallocate memory
262 ! ******************************************************************************
263 
264  IF ( global%nRegions == 1 ) THEN
265  pregion => levels(1)%regions(0)
266  CALL rflu_deallocatememorywrapper(pregion)
267  ELSE
268  DO ireg = 1,global%nRegions
269  pregion => levels(1)%regions(ireg)
270  CALL rflu_deallocatememorywrapper(pregion)
271  END DO ! iReg
272  END IF ! global%nRegions
273 
274 ! ******************************************************************************
275 ! End
276 ! ******************************************************************************
277 
278  WRITE(stdout,'(A)') solver_name
279  WRITE(stdout,'(A,1X,A)') solver_name,'Finished.'
280  WRITE(stdout,'(A)') solver_name
281 
282  CALL deregisterfunction(global)
283 
284 END PROGRAM rflucells
285 
286 !*******************************************************************************
287 !
288 ! RCS Revision history:
289 !
290 ! $Log: main.F90,v $
291 ! Revision 1.5 2008/12/06 08:44:54 mtcampbe
292 ! Updated license.
293 !
294 ! Revision 1.4 2008/11/19 22:18:04 mtcampbe
295 ! Added Illinois Open Source License/Copyright
296 !
297 ! Revision 1.3 2003/04/07 14:28:34 haselbac
298 ! Fixed bug: Deleted superfluous call
299 !
300 ! Revision 1.2 2003/04/01 19:39:20 haselbac
301 ! Changed call to open special cells file
302 !
303 ! Revision 1.1 2003/04/01 17:02:46 haselbac
304 ! Initial revision
305 !
306 !*******************************************************************************
307 
308 
309 
310 
311 
312 
313 
subroutine rflu_allocatememorywrapper(pRegion)
subroutine rflu_getuserinput(regions, inPrep)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine, public rflu_readgridwrapper(pRegion)
subroutine rflu_printheader(global)
subroutine rflu_getspecialcells(pRegion)
subroutine rflu_deallocatememorywrapper(pRegion)
subroutine rflu_writespecialcells(pRegion)
subroutine, public rflu_createfacelist(pRegion)
program rflucells
Definition: main.F90:46
subroutine, public rflu_buildfacelist(pRegion)
subroutine rflu_builddatastruct(global, levels)
subroutine rflu_printgridinfo(pRegion)
subroutine, public rflu_readdimensions(pRegion)
subroutine, public rflu_createcellmapping(pRegion)
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflu_writeversionstring(global)
subroutine rflu_initglobal(casename, verbLevel, communicator, global)