Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
INRT_Initialize.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: initializes data structures for interactions
26 !
27 ! Description: specifies data common to all interactions, then calls routines
28 ! specific to each interaction
29 !
30 ! Input: region = data of current region.
31 !
32 ! Output: fills in region%inrtInput
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: INRT_Initialize.F90,v 1.3 2008/12/06 08:44:31 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2003 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE inrt_initialize( region )
45 
46  USE moddatatypes
47  USE moddatastruct, ONLY : t_region
48  USE modglobal, ONLY : t_global
49  USE modinteract
50  USE moderror
52 
53  IMPLICIT NONE
54 
55 ! ... parameters
56  TYPE(t_region), INTENT(INOUT) :: region
57 
58 ! ... loop variables
59  INTEGER :: iinrt,ipeul
60 
61 ! ... local variables
62  CHARACTER(CHRLEN) :: rcsidentstring
63 
64  INTEGER :: nnodes,nplag,npeul
65  INTEGER :: indmixt,indplag0,indpeul0,indintl
66  INTEGER :: indplagjoint,indplagvapor,iplagjoint
67  INTEGER :: errorflag
68 
69  TYPE(t_inrt_input), POINTER :: input
70  TYPE(t_inrt_interact), POINTER :: inrt
71  TYPE(t_inrt_edge), POINTER :: edge
72  TYPE(t_global), POINTER :: global
73 
74 !******************************************************************************
75 
76  rcsidentstring = '$RCSfile: INRT_Initialize.F90,v $ $Revision: 1.3 $'
77 
78  global => region%global
79 
80  CALL registerfunction( global,'INRT_Initialize',&
81  'INRT_Initialize.F90' )
82 
83 ! begin -----------------------------------------------------------------------
84 
85  ALLOCATE( region%inrtInput,stat=errorflag )
86  global%error = errorflag
87  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
88 
89  input => region%inrtInput
90 
91 ! Determine the quantities needed to index the Activeness and Permission arrays
92 
93  nplag = 0
94 
95 #ifdef PLAG
96  IF (global%plagUsed) nplag = region%plagInput%nCont
97 #endif
98 
99 ! it does not matter which particle index is used to store momentum and energy
100 ! that is common to all particle constituents. We choose the first index:
101 
102  iplagjoint = 1
103 
104  npeul = 0
105 
106 #ifdef RFLO
107 #ifdef PEUL
108  IF (global%peulUsed) npeul = region%peulInput%nPtypes
109 #endif
110 #endif
111 
112 #ifdef RFLU
113 #ifdef SPEC
114  IF (global%specUsed) npeul = region%specInput%nSpecies
115 #endif
116 #endif
117 
118 ! Number of Nodes:
119 ! 1 for Gas
120 ! nPlag for particle constituent masses
121 ! 1 for particle vapor energy
122 ! nPeul for smoke masses
123 ! 1 for Internal Node
124 
125  nnodes = 1 + nplag + 1 + npeul + 1
126 
127 ! Indices for Nodes
128 
129  indmixt = 1
130  indplag0 = indmixt
131  indpeul0 = indplag0 + nplag + 1
132  indintl = indpeul0 + npeul + 1
133 
134  indplagjoint = indplag0 + iplagjoint
135  indplagvapor = indplag0 + nplag + 1
136 
137 ! Store all the above information in region%inrtInput
138 
139  input%nNodes = nnodes
140  input%nPlag = nplag
141  input%nPeul = npeul
142  input%indMixt = indmixt
143  input%indPlag0 = indplag0
144  input%indPeul0 = indpeul0
145  input%indIntl = indintl
146  input%indPlagJoint = indplagjoint
147  input%indPlagVapor = indplagvapor
148 
149 ! indicate that the maximum number of edges in a diagram is 0 so far
150 
151  input%maxConEdges = 0 ! max over diagrams indexed by cells
152  input%maxDisEdges = 0 ! max over diagrams indexed by particles
153 
154 ! indicate that an INRT_DEFAULT section has not yet been read
155 
156  input%defaultRead = .false.
157 
158 ! active phases are assumed to form a consistent system unless shown otherwise
159 
160  input%consistent = .true.
161 
162 ! compute auxillary quantities by default (allow User override for testing)
163 
164  input%computeAux = .true.
165 
166 ! allocate globActiveness and globPermission
167 
168  ALLOCATE( input%globActiveness(nnodes),stat=errorflag )
169  global%error = errorflag
170  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
171 
172  ALLOCATE( input%globPermission(nnodes),stat=errorflag )
173  global%error = errorflag
174  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
175 
176 ! give proper default values
177 
178  input%globActiveness = inrt_act_active
179  input%globPermission = inrt_perm_pall
180 
181  input%globActiveness(indintl) = inrt_act_bad ! undefined for Internal Node
182 
183 ! allocate interactions
184 
185  ALLOCATE( input%inrts(inrt_type_total),stat=errorflag )
186  global%error = errorflag
187  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
188 
189  DO iinrt = 1,inrt_type_total
190 
191  inrt => input%inrts(iinrt)
192 
193 ! - set default values for interactions
194 
195  inrt%name = 'Not defined yet'
196  inrt%used = .false.
197  inrt%pclsUsed = .true.
198  inrt%order = 0
199  inrt%nIntl = 0
200  inrt%nInputEdges = 0
201  inrt%nSwitches = 0
202  inrt%nData = 0
203  inrt%nEdges = 0
204 
205 ! - allocate activeness and permission
206 
207  ALLOCATE( inrt%activeness(nnodes),stat=errorflag )
208  global%error = errorflag
209  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
210 
211  ALLOCATE( inrt%permission(nnodes),stat=errorflag )
212  global%error = errorflag
213  IF (global%error /= 0) CALL errorstop( global,err_allocate,__line__ )
214 
215 ! - give proper default values
216 
217  inrt%activeness = inrt_act_bad ! require to be overwritten later
218  inrt%permission = inrt_perm_bad ! require to be overwritten later
219 
220 ! - nullify other pointers initially
221 
222  nullify( inrt%switches )
223  nullify( inrt%data )
224  nullify( inrt%edges )
225 
226  END DO ! iInrt
227 
228 ! finalize --------------------------------------------------------------------
229 
230  CALL deregisterfunction( global )
231 
232 END SUBROUTINE inrt_initialize
233 
234 !******************************************************************************
235 !
236 ! RCS Revision history:
237 !
238 ! $Log: INRT_Initialize.F90,v $
239 ! Revision 1.3 2008/12/06 08:44:31 mtcampbe
240 ! Updated license.
241 !
242 ! Revision 1.2 2008/11/19 22:17:44 mtcampbe
243 ! Added Illinois Open Source License/Copyright
244 !
245 ! Revision 1.1 2004/12/01 21:56:28 fnajjar
246 ! Initial revision after changing case
247 !
248 ! Revision 1.10 2004/07/28 15:29:20 jferry
249 ! created global variable for spec use
250 !
251 ! Revision 1.9 2004/07/27 21:30:00 jferry
252 ! integrated maxConEdges and maxDisEdges variables more fully
253 !
254 ! Revision 1.8 2004/07/23 22:43:16 jferry
255 ! Integrated rocspecies into rocinteract
256 !
257 ! Revision 1.7 2004/03/05 22:09:03 jferry
258 ! created global variables for peul, plag, and inrt use
259 !
260 ! Revision 1.6 2004/03/02 21:47:29 jferry
261 ! Added After Update interactions
262 !
263 ! Revision 1.5 2003/04/03 21:10:18 jferry
264 ! implemented additional safety checks for rocinteract
265 !
266 ! Revision 1.4 2003/04/02 22:32:04 jferry
267 ! codified Activeness and Permission structures for rocinteract
268 !
269 ! Revision 1.3 2003/03/24 23:30:52 jferry
270 ! overhauled rocinteract to allow interaction design to use user input
271 !
272 ! Revision 1.2 2003/03/11 16:09:39 jferry
273 ! Added comments
274 !
275 ! Revision 1.1 2003/03/04 22:12:35 jferry
276 ! Initial import of Rocinteract
277 !
278 !******************************************************************************
279 
280 
281 
282 
283 
284 
285 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine input(X, NNODE, NDC, NCELL, NFCE, NBPTS, NBFACE, ITYP, NPROP, XBNDY, XFAR, YFAR, ZFAR)
subroutine inrt_initialize(region)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469