Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rflumap.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 rflumap.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! caseString String with casename
31 ! mapOption Mapping mode
32 ! nRegions Number of regions
33 ! nProcs Number of processes
34 ! verbLevel Verbosity level
35 !
36 ! Output: None.
37 !
38 ! Notes: None.
39 !
40 ! ******************************************************************************
41 !
42 ! $Id: rflumap.F90,v 1.6 2008/12/06 08:44:57 mtcampbe Exp $
43 !
44 ! Copyright: (c) 2002-2005 by the University of Illinois
45 !
46 ! ******************************************************************************
47 
48 SUBROUTINE rflumap(caseString,mapOption,nRegions,nProcs,verbLevel)
49 
50  USE moddatatypes
51  USE modparameters
52  USE moderror
53  USE modglobal, ONLY: t_global
54  USE moddatastruct, ONLY: t_level,t_region
55 
58 
59 #ifdef GENX
65 #endif
66 
71  rflu_initglobal, &
77 
78  IMPLICIT NONE
79 
80 ! ******************************************************************************
81 ! Definitions and declarations
82 ! ******************************************************************************
83 
84 ! ==============================================================================
85 ! Arguments
86 ! ==============================================================================
87 
88  CHARACTER(*) :: casestring
89  INTEGER, INTENT(IN) :: nprocs,nregions,mapoption,verblevel
90 
91 ! ==============================================================================
92 ! Locals
93 ! ==============================================================================
94 
95  CHARACTER(CHRLEN) :: casename,panestringsurf,panestringvol,rcsidentstring
96  INTEGER, PARAMETER :: map_initial = 1, &
97  map_final = 2
98  INTEGER :: errorflag,ifile,ireg,iproc,nregionslocal
99  TYPE(t_global), POINTER :: global
100  TYPE(t_level), POINTER :: levels(:)
101  TYPE(t_region), POINTER :: pregion
102 
103 ! ******************************************************************************
104 ! Start
105 ! ******************************************************************************
106 
107  rcsidentstring = '$RCSfile: rflumap.F90,v $ $Revision: 1.6 $'
108 
109 ! ******************************************************************************
110 ! Initialize global data
111 ! ******************************************************************************
112 
113  ALLOCATE(global,stat=errorflag)
114  IF ( errorflag /= err_none ) THEN
115  WRITE(stderr,'(A,1X,A)') solver_name,'ERROR - Pointer allocation failed.'
116  stop
117  END IF ! errorFlag
118 
119  casename = casestring(1:len(casestring))
120 
121  CALL rflu_initglobal(casename,verblevel,crazy_value_int,global)
122 
123 #ifdef GENX
124  CALL rflu_genx_readctrlfile(global)
125 #endif
126 
127 ! ******************************************************************************
128 ! Print header
129 ! ******************************************************************************
130 
131  CALL rflu_printheader(global)
132  CALL rflu_writeversionstring(global)
133 
134 ! ******************************************************************************
135 ! Build region-to-process mapping and write mapping to file
136 ! ******************************************************************************
137 
138 ! ==============================================================================
139 ! Initial mapping
140 ! ==============================================================================
141 
142  IF ( mapoption == map_initial ) THEN
143  global%nRegions = nregions
144  global%nProcs = nprocs
145 
146  CALL rflu_createregionmapping(global,maptype_proc2reg)
147  CALL rflu_buildregionmappingsimple(global)
148  CALL rflu_checkregionmapping(global)
149  CALL rflu_openregionmappingfile(global)
150  CALL rflu_writeregionmappingfile(global)
151  CALL rflu_closeregionmappingfile(global)
152  CALL rflu_destroyregionmapping(global,maptype_proc2reg)
153 
154 ! ==============================================================================
155 ! Final mapping
156 ! ==============================================================================
157 
158  ELSE IF ( mapoption == map_final ) THEN
159  CALL rflu_readregionmappingfile(global,mapfile_readmode_peek,-1)
160 
161 #ifdef GENX
162  CALL rflu_genx_openrocinctrlfiles(global)
163 #endif
164 
165 ! ------------------------------------------------------------------------------
166 ! Loop over processes
167 ! ------------------------------------------------------------------------------
168 
169  DO iproc = 1,global%nProcs
170  CALL rflu_createregionmapping(global,maptype_reg)
171  CALL rflu_readregionmappingfile(global,mapfile_readmode_all,iproc-1)
172 
173  CALL rflu_builddatastruct(global,levels)
174  CALL rflu_applyregionmapping(global,levels)
175 
176  CALL rflu_getuserinput(levels(1)%regions)
177  CALL rflu_readrestartinfo(global)
178  CALL rflu_setrestarttimeflag(global)
179 
180 ! --- Loop over regions --------------------------------------------------------
181 
182  panestringvol = ''
183  panestringsurf = ''
184 
185  DO ireg = 1,global%nRegionsLocal
186  pregion => levels(1)%regions(ireg)
187 
188  CALL rflu_readdimensions(pregion)
189  CALL rflu_creategrid(pregion)
190 
191 #ifdef GENX
192  CALL rflu_genx_buildrocinpanestrings(pregion,panestringvol, &
193  panestringsurf)
194 #endif
195 
196  CALL rflu_destroygrid(pregion)
197  END DO ! iReg
198 
199 #ifdef GENX
200  CALL rflu_genx_writerocinctrlfiles(global,iproc,panestringvol, &
201  panestringsurf)
202 #endif
203 
204  CALL rflu_destroyregionmapping(global,maptype_reg)
205  END DO ! iProc
206 
207 #ifdef GENX
208  CALL rflu_genx_closerocinctrlfiles(global)
209 #endif
210 
211 ! ==============================================================================
212 ! Invalid mapping option
213 ! ==============================================================================
214 
215  ELSE
216  CALL errorstop(global,err_reached_default,__line__)
217  END IF ! mapOption
218 
219 ! ******************************************************************************
220 ! Print info about warnings
221 ! ******************************************************************************
222 
223  CALL rflu_printwarninfo(global)
224 
225 ! ******************************************************************************
226 ! End
227 ! ******************************************************************************
228 
229 END SUBROUTINE rflumap
230 
231 ! ******************************************************************************
232 !
233 ! RCS Revision history:
234 !
235 ! $Log: rflumap.F90,v $
236 ! Revision 1.6 2008/12/06 08:44:57 mtcampbe
237 ! Updated license.
238 !
239 ! Revision 1.5 2008/11/19 22:18:12 mtcampbe
240 ! Added Illinois Open Source License/Copyright
241 !
242 ! Revision 1.4 2006/04/07 15:19:25 haselbac
243 ! Removed tabs
244 !
245 ! Revision 1.3 2006/02/06 23:55:55 haselbac
246 ! Added comm argument to RFLU_InitGlobal
247 !
248 ! Revision 1.2 2005/05/03 03:11:01 haselbac
249 ! Converted to C++ reading of command-line
250 !
251 ! Revision 1.1 2005/04/18 14:57:56 haselbac
252 ! Initial revision
253 !
254 ! ******************************************************************************
255 
256 
257 
258 
259 
260 
subroutine, public rflu_genx_buildrocinpanestrings(pRegion, paneStringVol, paneStringSurf)
subroutine rflu_creategrid(pRegion)
subroutine, public rflu_openregionmappingfile(global)
subroutine rflu_destroygrid(pRegion)
subroutine rflu_printwarninfo(global)
subroutine, public rflu_destroyregionmapping(global, mapType)
subroutine rflu_getuserinput(regions, inPrep)
subroutine rflu_printheader(global)
subroutine rflu_setrestarttimeflag(global)
subroutine, public rflu_genx_closerocinctrlfiles(global)
subroutine, public rflu_closeregionmappingfile(global)
subroutine, public rflu_buildregionmappingsimple(global)
subroutine, public rflu_genx_openrocinctrlfiles(global)
subroutine, public rflu_readregionmappingfile(global, readMode, myProcId)
subroutine rflu_builddatastruct(global, levels)
subroutine, public rflu_writeregionmappingfile(global)
subroutine rflumap(caseString, mapOption, nRegions, nProcs, verbLevel)
Definition: rflumap.F90:48
subroutine, public rflu_readdimensions(pRegion)
subroutine, public rflu_genx_readctrlfile(global)
subroutine, public rflu_checkregionmapping(global)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine rflu_writeversionstring(global)
subroutine, public rflu_applyregionmapping(global, levels)
subroutine rflu_initglobal(casename, verbLevel, communicator, global)
subroutine rflu_readrestartinfo(global)
subroutine, public rflu_genx_writerocinctrlfiles(global, iProc, paneStringVol, paneStringSurf)
subroutine, public rflu_createregionmapping(global, mapType)