Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BLCK_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: write out numbers of blocks being contained in a given
26 ! box in the physical space.
27 !
28 ! Description: none.
29 !
30 ! Input: case name from the list of arguments
31 !
32 ! Output: to screen.
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: BLCK_Main.F90,v 1.3 2008/12/06 08:44:46 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2002 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 #ifdef CHARM
45 SUBROUTINE mpi_main
46 #else
48 #endif
49 
50  USE moddatatypes
51  USE moderror
52  USE moddatastruct, ONLY : t_region
53  USE modglobal, ONLY : t_global
54  USE modgrid, ONLY : t_grid
55  USE modmixture, ONLY : t_mixt
59  USE modmpi
60  USE modparameters
61  IMPLICIT NONE
62 
63 #include "Indexing.h"
64 
65 ! ... loop variables
66  INTEGER :: ireg, i, j, k, ijkn
67 
68 ! ... local variables
69  CHARACTER(CHRLEN) :: gridfmt, msg, xmin, xmax, ymin, ymax, &
70  zmin, zmax, versionstring, headerstring
71 
72  INTEGER :: ibn, ien, inoff, ijnoff, regnum, regnumbeg, regnumend
73  INTEGER :: idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend
74  INTEGER :: ipnbeg, ipnend, jpnbeg, jpnend, kpnbeg, kpnend
75  INTEGER :: margin, versionwidth, errorflag
76  INTEGER, PARAMETER :: headerwidth = 53
77 
78  REAL(RFREAL) :: xminbox, xmaxbox, yminbox, ymaxbox, zminbox, zmaxbox
79  REAL(RFREAL), POINTER :: xyz(:,:)
80 
81  TYPE(t_global), POINTER :: global
82  TYPE(t_region), POINTER :: regions(:)
83 
84 !******************************************************************************
85 
86  ALLOCATE( global )
87 
88  global%nFunTree = 0
89  CALL registerfunction( global,'ROCFLO_Blocks',&
90  'BLCK_Main.F90' )
91 
92 ! initialize global parameters ------------------------------------------------
93 
94  global%verbLevel = verbose_none
95 
96  global%flowType = flow_steady ! stationary flow
97  global%currentTime = -1._rfreal ! no physical time set
98  global%currentIter = -1 ! no iteration
99  global%startLevel = 1 ! always finest grid only
100 
101  global%inDir = './' ! directory path
102  global%outDir = './'
103 
104  global%nProcAlloc = 1
105  global%myProcid = masterproc ! default process number (not an MPI code)
106  global%mpierr = err_none
107  global%error = err_none
108 
109  global%pi = 4._rfreal*atan(1._rfreal)
110  global%rad = global%pi/180._rfreal
111 
112 ! print header ----------------------------------------------------------------
113 
114 #ifdef MPI
115  CALL mpi_init( global%mpierr )
116  IF (global%mpierr /=0 ) CALL errorstop( global,err_mpi_trouble,__line__ )
117 #endif
118 
119  CALL buildversionstring( versionstring )
120 
121  headerstring = ' '
122  versionwidth = len_trim(versionstring)
123  margin = (headerwidth-versionwidth)/2
124  headerstring(margin+1:margin+versionwidth) = versionstring(1:versionwidth)
125  headerstring(1:1) = '*'
126  headerstring(headerwidth:headerwidth) = '*'
127 
128  WRITE(stdout,'(/,A)') solver_name//' *****************************************************'
129  WRITE(stdout, '(A)') solver_name//' * *'
130  WRITE(stdout, '(A)') solver_name//' * ROCFLO-MP: Block Counting Utility *'
131  WRITE(stdout, '(A)') solver_name//' * ================================= *'
132  WRITE(stdout, '(A)') solver_name//' * *'
133  WRITE(stdout, '(A)') solver_name//' '//trim(headerstring)
134  WRITE(stdout, '(A)') solver_name//' * Copyright (c) by the University of Illinois *'
135  WRITE(stdout, '(A)') solver_name//' * *'
136  WRITE(stdout,'(A,/)') solver_name//' *****************************************************'
137 
138 ! read user input ----------------------------------------------------------
139 
140  CALL getarg(1,global%casename)
141  CALL getarg(2,gridfmt)
142  CALL getarg(3,xmin)
143  CALL getarg(4,xmax)
144  CALL getarg(5,ymin)
145  CALL getarg(6,ymax)
146  CALL getarg(7,zmin)
147  CALL getarg(8,zmax)
148 
149  IF (len_trim(global%casename)==0 .OR. &
150  len_trim(gridfmt)==0 .OR. &
151  len_trim(xmin)==0 .OR. &
152  len_trim(xmax)==0 .OR. &
153  len_trim(ymin)==0 .OR. &
154  len_trim(ymax)==0 .OR. &
155  len_trim(zmin)==0 .OR. &
156  len_trim(zmax)==0) THEN
157  WRITE(stdout,'(/,A,/,A,/,2(A,/))') &
158  solver_name//' Usage: rfloblocks <casename> <format> <xmin xmax> <ymin ymax> <zmin zmax>', &
159  solver_name, &
160  solver_name//' format = 0 - ASCII grid', &
161  solver_name//' 1 - binary grid'
162 #ifdef MPI
163  CALL mpi_finalize( global%mpierr )
164 #endif
165  stop
166  ENDIF
167 
168  READ(gridfmt ,*) global%gridFormat
169  READ(xmin ,*) xminbox
170  READ(xmax ,*) xmaxbox
171  READ(ymin ,*) yminbox
172  READ(ymax ,*) ymaxbox
173  READ(zmin ,*) zminbox
174  READ(zmax ,*) zmaxbox
175 
176  IF (global%gridFormat <= 0) THEN
177  global%gridFormat = format_ascii
178  ELSE
179  global%gridFormat = format_binary
180  ENDIF
181 
182 ! read region topology --------------------------------------------------------
183 
184  WRITE(stdout,'(/,A)') solver_name//' Reading region topology ...'
185 
186  CALL rflo_readregiontopology( global,regions )
187 
188  DO ireg=1,global%nRegions
189  regions(ireg)%startLevel = global%startLevel
190  regions(ireg)%currLevel = global%startLevel
191  ENDDO
192 
193 ! loop over regions -----------------------------------------------------------
194 
195  WRITE(stdout,'(/,A,/)') solver_name//' Searching for blocks ...'
196 
197  regnumbeg = -99
198  regnumend = -99
199 
200  DO ireg=1,global%nRegions
201 
202 ! - allocate memory for the grid (all grid levels)
203 
204  CALL rflo_getdimensdummynodes( regions(ireg),1,idnbeg,idnend, &
205  jdnbeg,jdnend,kdnbeg,kdnend )
206  CALL rflo_getdimensphysnodes( regions(ireg),1,ipnbeg,ipnend, &
207  jpnbeg,jpnend,kpnbeg,kpnend )
208  CALL rflo_getnodeoffset( regions(ireg),1,inoff,ijnoff )
209  ibn = indijk(idnbeg,jdnbeg,kdnbeg,inoff,ijnoff)
210  ien = indijk(idnend,jdnend,kdnend,inoff,ijnoff)
211  ALLOCATE( regions(ireg)%levels(1)%grid%xyz(3,ibn:ien),stat=errorflag )
212  global%error = errorflag
213  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
214 
215 ! - read grid
216 
217  CALL rflo_readgridregion( ireg,regions )
218 
219 ! - find regions contained in the box
220 
221  xyz => regions(ireg)%levels(1)%grid%xyz
222 
223  regnum = 0
224  DO k=kpnbeg,kpnend
225  DO j=jpnbeg,jpnend
226  DO i=ipnbeg,ipnend
227  ijkn = indijk(i,j,k,inoff,ijnoff)
228  IF ((xyz(xcoord,ijkn)>xminbox .AND. xyz(xcoord,ijkn)<xmaxbox) .AND. &
229  (xyz(ycoord,ijkn)>yminbox .AND. xyz(ycoord,ijkn)<ymaxbox) .AND. &
230  (xyz(zcoord,ijkn)>zminbox .AND. xyz(zcoord,ijkn)<zmaxbox)) THEN
231  regnum = ireg
232  ENDIF
233  ENDDO
234  ENDDO
235  ENDDO
236 
237  IF (regnum == regnumend+1) THEN
238  regnumend = regnum
239  ELSE
240  IF (regnum/=0 .AND. regnumend<0) THEN
241  regnumbeg = regnum
242  regnumend = regnum
243  ELSE IF (regnum/=0 .AND. regnumend>0) THEN
244  WRITE(stdout,1000) solver_name,regnumbeg,regnumend
245  regnumbeg = regnum
246  regnumend = regnum
247  ENDIF
248  ENDIF
249 
250 ! - deallocate memory
251 
252  DEALLOCATE( regions(ireg)%levels(1)%grid%xyz,stat=errorflag )
253  global%error = errorflag
254  IF (global%error /= 0) CALL errorstop( global,err_deallocate,__line__ )
255 
256  ENDDO ! iReg
257 
258  IF (regnumbeg>0 .AND. regnumend>0) THEN
259  WRITE(stdout,1000) solver_name,regnumbeg,regnumend
260  ELSE
261  WRITE(stdout,1005) solver_name
262  ENDIF
263 
264 ! finalize --------------------------------------------------------------------
265 
266  CALL deregisterfunction( global )
267 
268  WRITE(stdout,'(/,A)') solver_name//' Finished.'
269 
270 #ifdef MPI
271  CALL mpi_finalize( global%mpierr )
272 #endif
273 
274 1000 FORMAT(a,' From block ',i5,' to ',i5)
275 1005 FORMAT(a,' No blocks found.')
276 
277 #ifdef CHARM
278 END SUBROUTINE mpi_main
279 #else
280 END PROGRAM rocflo_blocks
281 #endif
282 
283 !******************************************************************************
284 !
285 ! RCS Revision history:
286 !
287 ! $Log: BLCK_Main.F90,v $
288 ! Revision 1.3 2008/12/06 08:44:46 mtcampbe
289 ! Updated license.
290 !
291 ! Revision 1.2 2008/11/19 22:17:57 mtcampbe
292 ! Added Illinois Open Source License/Copyright
293 !
294 ! Revision 1.1 2004/12/03 03:13:06 wasistho
295 ! bloc to blck
296 !
297 ! Revision 1.1 2004/12/03 01:55:08 wasistho
298 ! add prefix
299 !
300 ! Revision 1.1 2004/12/03 00:26:14 wasistho
301 ! lower to upper case
302 !
303 ! Revision 1.6 2003/05/25 18:11:30 jiao
304 ! Added support for Charm.
305 !
306 ! Revision 1.5 2003/05/15 02:57:06 jblazek
307 ! Inlined index function.
308 !
309 ! Revision 1.4 2003/03/20 22:20:21 haselbac
310 ! Renamed ModInterfaces
311 !
312 ! Revision 1.3 2003/03/20 19:39:01 haselbac
313 ! Corrected mistake in phased check-in
314 !
315 ! Revision 1.2 2003/03/20 19:33:08 haselbac
316 ! Modified RegFun call to avoid probs with long 'BLCK_Main.F90' names
317 !
318 ! Revision 1.1 2002/12/20 19:38:02 jblazek
319 ! Added tool to count blocks in a box.
320 !
321 !******************************************************************************
322 
323 
324 
325 
326 
327 
328 
329 
**********************************************************************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 jpnbeg
double ymin() const
double xmax() const
j indices k indices k
Definition: Indexing.h:6
**********************************************************************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 kpnbeg
double xmin() const
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
double zmin() const
**********************************************************************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 jdnbeg
**********************************************************************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 jpnend
**********************************************************************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 idnend
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
**********************************************************************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 jdnend
subroutine rflo_readgridregion(iReg, regions)
**********************************************************************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 idnbeg
subroutine buildversionstring(versionString)
blockLoc i
Definition: read.cpp:79
**********************************************************************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 ipnbeg
double zmax() const
double ymax() const
subroutine rflo_getdimensphysnodes(region, iLev, ipnbeg, ipnend, jpnbeg, jpnend, kpnbeg, kpnend)
j indices j
Definition: Indexing.h:6
subroutine rflo_getdimensdummynodes(region, iLev, idnbeg, idnend, jdnbeg, jdnend, kdnbeg, kdnend)
program rocflo_blocks
Definition: BLCK_Main.F90:47
subroutine rflo_readregiontopology(global, regions)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
**********************************************************************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 ipnend
**********************************************************************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 kdnbeg
RT a() const
Definition: Line_2.h:140