Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_SetDerivedUserInput.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: Set values derived from user input of ALL modules.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! regions Data for regions
31 !
32 ! Output: None.
33 !
34 ! Notes: None.
35 !
36 ! ******************************************************************************
37 !
38 ! $Id: RFLU_SetDerivedUserInput.F90,v 1.12 2008/12/06 08:44:13 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2004-2006 by the University of Illinois
41 !
42 ! ******************************************************************************
43 
44 SUBROUTINE rflu_setderiveduserinput(regions)
45 
46  USE moddatatypes
47  USE moderror
48  USE modparameters
49  USE modmpi
50  USE modglobal, ONLY: t_global
51  USE modmixture, ONLY: t_mixt_input
52  USE modspecies, ONLY: t_spec_input
53  USE moddatastruct, ONLY: t_region
54 
55 #ifdef SPEC
56  USE modspecies, ONLY: t_spec_type
57 #endif
58 
59  IMPLICIT NONE
60 
61 ! *****************************************************************************
62 ! Declarations and definitions
63 ! *****************************************************************************
64 
65 ! =============================================================================
66 ! Arguments
67 ! =============================================================================
68 
69  TYPE(t_region), DIMENSION(:), POINTER :: regions
70 
71 ! =============================================================================
72 ! Locals
73 ! =============================================================================
74 
75  CHARACTER(CHRLEN) :: rcsidentstring
76  INTEGER :: ireg
77  TYPE(t_mixt_input), POINTER :: pmixtinput
78  TYPE(t_spec_input), POINTER :: pspecinput
79  TYPE(t_global), POINTER :: global
80  TYPE(t_region), POINTER :: pregion
81 
82 #ifdef SPEC
83  INTEGER :: contcntr,ispec
84  TYPE(t_spec_type), POINTER :: pspectype
85 #endif
86 
87 ! *****************************************************************************
88 ! Start
89 ! *****************************************************************************
90 
91  rcsidentstring = '$RCSfile: RFLU_SetDerivedUserInput.F90,v $ $Revision: 1.12 $'
92 
93  global => regions(1)%global
94 
95  CALL registerfunction(global,'RFLU_SetDerivedUserInput',&
96  'RFLU_SetDerivedUserInput.F90')
97 
98 ! ******************************************************************************
99 ! Region-dependent values
100 ! ******************************************************************************
101 
102  DO ireg = lbound(regions,1),ubound(regions,1)
103  pregion => regions(ireg)
104  pmixtinput => pregion%mixtInput
105  pspecinput => pregion%specInput
106 
107 ! ==============================================================================
108 ! Gas model
109 ! ==============================================================================
110 
111 ! ------------------------------------------------------------------------------
112 ! Mixture of thermally and perfect gases: Must not have any discrete species
113 ! ------------------------------------------------------------------------------
114 
115  IF ( pmixtinput%gasModel == gas_model_mixt_tcperf ) THEN
116  IF ( global%specUsed .EQV. .false. ) THEN
117  CALL errorstop(global,err_gasmodel_invalid,__line__, &
118  'Species module must be active.')
119  ELSE
120 #ifdef SPEC
121  IF ( pspecinput%nSpecies <= 1 ) THEN
122  CALL errorstop(global,err_gasmodel_invalid,__line__, &
123  'Must have at least one species.')
124  END IF ! pSpecInput%nSpecies
125 
126  DO ispec = 1,pspecinput%nSpecies
127  pspectype => pregion%specInput%specType(ispec)
128 
129  IF ( pspectype%discreteFlag .EQV. .true. ) THEN
130  CALL errorstop(global,err_gasmodel_invalid,__line__, &
131  'Can only have gaseous species.')
132  END IF ! pSpecType%discreteFlag
133  END DO ! iSpec
134 #else
135  CALL errorstop(global,err_gasmodel_invalid,__line__, &
136  'Can only be used with species module.')
137 #endif
138  END IF ! global%specUsed
139 
140 ! ------------------------------------------------------------------------------
141 ! Pseudogas: Must not have only discrete species
142 ! ------------------------------------------------------------------------------
143 
144  ELSE IF ( pmixtinput%gasModel == gas_model_mixt_pseudo ) THEN
145  IF ( global%specUsed .EQV. .false. ) THEN
146  CALL errorstop(global,err_gasmodel_invalid,__line__, &
147  'Species module must be active.')
148  ELSE
149 #ifdef SPEC
150  IF ( pspecinput%nSpecies <= 1 ) THEN
151  CALL errorstop(global,err_gasmodel_invalid,__line__, &
152  'Must have at least one species.')
153  END IF ! pSpecInput%nSpecies
154 
155  contcntr = 0
156 
157  DO ispec = 1,pspecinput%nSpecies
158  pspectype => pregion%specInput%specType(ispec)
159 
160  IF ( pspectype%discreteFlag .EQV. .false. ) THEN
161  contcntr = contcntr + 1
162  END IF ! pSpecType%discreteFlag
163  END DO ! iSpec
164 
165  IF ( contcntr == 0 ) THEN
166  CALL errorstop(global,err_gasmodel_invalid,__line__, &
167  'Must have at least one gaseous species.')
168  END IF ! contCntr
169 #else
170  CALL errorstop(global,err_gasmodel_invalid,__line__, &
171  'Can only be used with species module.')
172 #endif
173  END IF ! global%specUsed
174 
175 ! ------------------------------------------------------------------------------
176 ! Gas-liquid mixture: Must not have any discrete species
177 ! ------------------------------------------------------------------------------
178 
179  ELSE IF ( pmixtinput%gasModel == gas_model_mixt_gasliq ) THEN
180  IF ( global%specUsed .EQV. .false. ) THEN
181  CALL errorstop(global,err_gasmodel_invalid,__line__, &
182  'Species module must be active.')
183  ELSE
184 #ifdef SPEC
185  IF ( pspecinput%nSpecies <= 1 ) THEN
186  CALL errorstop(global,err_gasmodel_invalid,__line__, &
187  'Must have two species.')
188  END IF ! pSpecInput%nSpecies
189 
190  DO ispec = 1,pspecinput%nSpecies
191  pspectype => pregion%specInput%specType(ispec)
192 
193  IF ( pspectype%discreteFlag .EQV. .true. ) THEN
194  CALL errorstop(global,err_gasmodel_invalid,__line__, &
195  'Can only have gaseous species.')
196  END IF ! pSpecType%discreteFlag
197  END DO ! iSpec
198 #else
199  CALL errorstop(global,err_gasmodel_invalid,__line__, &
200  'Can only be used with species module.')
201 #endif
202  END IF ! global%specUsed
203  END IF ! pMixtInput%gasModel
204 
205 ! ==============================================================================
206 ! Mass fluxes
207 ! ==============================================================================
208 
209  IF ( global%specUsed .EQV. .true. ) THEN
210  pmixtinput%indMfMixt = 1
211  ELSE
212  pmixtinput%indMfMixt = 0
213  END IF ! global%specUsed
214 
215 ! ==============================================================================
216 ! Substantial derivative
217 ! ==============================================================================
218 
219 #ifdef SPEC
220  IF ( global%specUsed .EQV. .true. ) THEN
221  DO ispec = 1,pspecinput%nSpecies
222  IF ( pspecinput%specType(ispec)%velocityMethod == &
223  spec_methv_eqeul ) THEN
224  pmixtinput%indSd = 1
225  END IF ! velocityMethod
226  END DO ! iSpec
227  END IF ! global%specUsed
228 #endif
229 
230 ! ==============================================================================
231 ! Source terms
232 ! ==============================================================================
233 
234 #ifdef SPEC
235  IF ( global%specUsed .EQV. .true. ) THEN
236  IF ( (pmixtinput%gasModel == gas_model_mixt_gasliq) .AND. &
237  (pspecinput%sourceFlag .EQV. .true.) ) THEN
238  DO ispec = 1,pspecinput%nSpecies
239  IF ( pspecinput%specType(ispec)%sourceType /= &
240  spec_source_type_cavi ) THEN
241  CALL errorstop(global,err_spec_source_type_invalid,__line__)
242  END IF ! sourceType
243  END DO ! iSpec
244  END IF ! pMixtInput%gasModel
245  END IF ! global%specUsed
246 #endif
247  END DO ! iReg
248 
249 ! ******************************************************************************
250 ! End
251 ! ******************************************************************************
252 
253  CALL deregisterfunction(global)
254 
255 END SUBROUTINE rflu_setderiveduserinput
256 
257 ! ******************************************************************************
258 !
259 ! RCS Revision history:
260 !
261 ! $Log: RFLU_SetDerivedUserInput.F90,v $
262 ! Revision 1.12 2008/12/06 08:44:13 mtcampbe
263 ! Updated license.
264 !
265 ! Revision 1.11 2008/11/19 22:17:26 mtcampbe
266 ! Added Illinois Open Source License/Copyright
267 !
268 ! Revision 1.10 2006/04/07 15:19:16 haselbac
269 ! Removed tabs
270 !
271 ! Revision 1.9 2006/03/30 20:48:12 haselbac
272 ! Added check of src term for gasliq model
273 !
274 ! Revision 1.8 2006/03/26 20:21:42 haselbac
275 ! Added support for GL model
276 !
277 ! Revision 1.7 2005/11/14 16:55:41 haselbac
278 ! Added support for pseudo-gas model
279 !
280 ! Revision 1.6 2005/11/10 02:55:56 haselbac
281 ! Added check for gas model
282 !
283 ! Revision 1.5 2005/03/31 16:52:04 haselbac
284 ! Removed setting of nSd
285 !
286 ! Revision 1.4 2004/10/19 19:25:30 haselbac
287 ! Bug fix: Should only access species data if SPEC == 1
288 !
289 ! Revision 1.3 2004/07/30 22:47:35 jferry
290 ! Implemented Equilibrium Eulerian method for Rocflu
291 !
292 ! Revision 1.2 2004/07/28 15:29:19 jferry
293 ! created global variable for spec use
294 !
295 ! Revision 1.1 2004/01/29 22:56:19 haselbac
296 ! Initial revision
297 !
298 ! ******************************************************************************
299 
300 
301 
302 
303 
304 
305 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflu_setderiveduserinput(regions)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469