Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SPEC_DerivedInputValues.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 derived input values for species.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! regions Data associated with regions
31 !
32 ! Output: None.
33 !
34 ! Notes: None.
35 !
36 ! ******************************************************************************
37 !
38 ! $Id: SPEC_DerivedInputValues.F90,v 1.12 2008/12/06 08:44:40 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2003-2005 by the University of Illinois
41 !
42 ! ******************************************************************************
43 
44 SUBROUTINE spec_derivedinputvalues(regions)
45 
46  USE moddatatypes
47  USE moderror
48  USE modparameters
49  USE modglobal, ONLY: t_global
50  USE moddatastruct, ONLY: t_region
51  USE modspecies, ONLY: t_spec_type
52 
53  IMPLICIT NONE
54 
55 ! ******************************************************************************
56 ! Definitions and declarations
57 ! ******************************************************************************
58 
59 ! ==============================================================================
60 ! Arguments
61 ! ==============================================================================
62 
63  TYPE(t_region), DIMENSION(:), POINTER :: regions
64 
65 ! ==============================================================================
66 ! Locals
67 ! ==============================================================================
68 
69  CHARACTER(CHRLEN) :: rcsidentstring
70  INTEGER :: ireg,ispec
71  TYPE(t_global), POINTER :: global
72  TYPE(t_spec_type), POINTER :: pspectype
73 
74 ! ******************************************************************************
75 ! Start
76 ! ******************************************************************************
77 
78  rcsidentstring = '$RCSfile: SPEC_DerivedInputValues.F90,v $ $Revision: 1.12 $'
79 
80  global => regions(1)%global
81 
82  CALL registerfunction(global,'SPEC_DerivedInputValues',&
83  'SPEC_DerivedInputValues.F90')
84 
85 ! ******************************************************************************
86 ! Loop over regions
87 ! ******************************************************************************
88 
89  DO ireg = lbound(regions,1),ubound(regions,1)
90  regions(ireg)%spec%nSpecEqs = regions(ireg)%specInput%nSpecies
91 
92 ! ==============================================================================
93 ! Loop over species
94 ! ==============================================================================
95 
96  regions(ireg)%specInput%nSpeciesEE = 0
97 
98  DO ispec = 1,regions(ireg)%specInput%nSpecies
99  pspectype => regions(ireg)%specInput%specType(ispec)
100 
101 ! ------------------------------------------------------------------------------
102 ! Set source flag
103 ! ------------------------------------------------------------------------------
104 
105  SELECT CASE ( pspectype%sourceType )
106  CASE ( spec_source_type_none )
107  regions(ireg)%specInput%sourceFlag = .false.
108  CASE ( spec_source_type_chem )
109  regions(ireg)%specInput%sourceFlag = .true.
110  CASE ( spec_source_type_cavi )
111  regions(ireg)%specInput%sourceFlag = .true.
112  CASE default
113  CALL errorstop(global,err_reached_default,__line__, &
114  'Invalid input value for SOURCETYPE')
115  END SELECT ! sourceType
116 
117 ! ------------------------------------------------------------------------------
118 ! Set discreteFlag and related variables
119 ! ------------------------------------------------------------------------------
120 
121  pspectype%discreteFlag = (pspectype%pMaterial%phase /= 1) ! i.e., not Gas
122 
123  IF ( pspectype%discreteFlag .EQV. .false. ) THEN
124  pspectype%iCont = 1
125  ELSE
126  pspectype%iCont = 0
127  END IF ! pSpecType%discreteFlag
128 
129 ! --- Discrete species ---------------------------------------------------------
130 
131  IF ( pspectype%discreteFlag .EQV. .true. ) THEN
132  pspectype%effectiveDensity = pspectype%pMaterial%dens/ &
133  pspectype%puffFactor
134  pspectype%effectiveVolume = global%pi*pspectype%diameter**3/ &
135  6.0_rfreal
136  pspectype%materialVolume = pspectype%effectiveVolume/ &
137  pspectype%puffFactor
138 
139 ! ----- Include pressure correction: (1 - beta) factor. We have chosen *not*
140 ! to set this to 0 for the fluid vel case
141 
142  pspectype%tauCoefficient = pspectype%diameter**2* &
143  (pspectype%effectiveDensity-1.0_rfreal)/18.0_rfreal
144 
145 ! ----- Do not waste Eq Eul method on cases with tau *exactly* equal to 0
146 
147  IF ( pspectype%tauCoefficient == 0.0_rfreal ) THEN
148  pspectype%velocityMethod = spec_methv_fluidvel
149  END IF ! pSpecType%tauCoefficient
150 
151 ! --- Continuous species -------------------------------------------------------
152 
153  ELSE
154  pspectype%diameter = REAL(crazy_value_int,kind=rfreal)
155  pspectype%puffFactor = REAL(crazy_value_int,kind=rfreal)
156  pspectype%effectiveDensity = REAL(crazy_value_int,kind=rfreal)
157  pspectype%effectiveVolume = REAL(crazy_value_int,kind=rfreal)
158  pspectype%materialVolume = REAL(crazy_value_int,kind=rfreal)
159  pspectype%tauCoefficient = REAL(crazy_value_int,kind=rfreal)
160 
161  IF ( pspectype%velocityMethod /= spec_methv_fluidvel ) THEN
162  CALL errorstop(global,err_illegal_value,__line__, &
163  'Continuum species must use fluid velocity for advection')
164  END IF ! velocityMethod
165  END IF ! discreteFlag
166 
167 ! ------------------------------------------------------------------------------
168 ! Set indSd to address substantial derivative
169 ! ------------------------------------------------------------------------------
170 
171  SELECT CASE ( pspectype%velocityMethod )
172  CASE ( spec_methv_fluidvel )
173  regions(ireg)%mixtInput%indSd = 0
174  CASE ( spec_methv_eqeul )
175  regions(ireg)%mixtInput%indSd = 1
176 
177  regions(ireg)%specInput%nSpeciesEE = &
178  regions(ireg)%specInput%nSpeciesEE + 1
179  pspectype%iSpec2iSpecEEv = regions(ireg)%specInput%nSpeciesEE
180  pspectype%iSpecEEv2iSpec = ispec
181  CASE default
182  CALL errorstop(global,err_reached_default,__line__, &
183  'Invalid input value for VELOCITYMETHOD')
184  END SELECT ! velocityMethod
185  END DO ! iSpec
186 
187 ! - require viscosity to be computed if Equilibrium Eulerian velocity is used
188 
189  IF ( regions(ireg)%mixtInput%indSd == 1 ) THEN
190  regions(ireg)%mixtInput%computeTv = .true.
191 
192  IF ( regions(ireg)%mixtInput%nTv < 2 ) THEN
193  regions(ireg)%mixtInput%nTv = 2
194  END IF ! nTv
195  END IF ! indSd
196  END DO ! iReg
197 
198 ! ******************************************************************************
199 ! End
200 ! ******************************************************************************
201 
202  CALL deregisterfunction(global)
203 
204 END SUBROUTINE spec_derivedinputvalues
205 
206 ! ******************************************************************************
207 !
208 ! RCS Revision history:
209 !
210 ! $Log: SPEC_DerivedInputValues.F90,v $
211 ! Revision 1.12 2008/12/06 08:44:40 mtcampbe
212 ! Updated license.
213 !
214 ! Revision 1.11 2008/11/19 22:17:52 mtcampbe
215 ! Added Illinois Open Source License/Copyright
216 !
217 ! Revision 1.10 2006/04/07 15:19:24 haselbac
218 ! Removed tabs
219 !
220 ! Revision 1.9 2006/03/30 20:50:41 haselbac
221 ! Added setting of sourceFlag for cavitation src term
222 !
223 ! Revision 1.8 2005/11/27 01:53:40 haselbac
224 ! Added setting of EEv-related variables
225 !
226 ! Revision 1.7 2005/11/14 17:02:17 haselbac
227 ! Clean-up, added setting of iCont
228 !
229 ! Revision 1.6 2004/08/02 16:38:40 jferry
230 ! Added pressure correction to tau coefficient
231 !
232 ! Revision 1.5 2004/07/30 22:47:37 jferry
233 ! Implemented Equilibrium Eulerian method for Rocflu
234 !
235 ! Revision 1.4 2004/07/28 15:31:34 jferry
236 ! added USED field to SPECIES input section
237 !
238 ! Revision 1.3 2004/07/23 22:43:17 jferry
239 ! Integrated rocspecies into rocinteract
240 !
241 ! Revision 1.2 2004/04/01 21:31:18 haselbac
242 ! Added setting of sourceFlag
243 !
244 ! Revision 1.1 2003/11/25 21:08:37 haselbac
245 ! Initial revision
246 !
247 ! ******************************************************************************
248 
249 
250 
251 
252 
253 
254 
subroutine spec_derivedinputvalues(regions)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469