Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_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 values derived from user input.
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_DerivedInputValues.F90,v 1.21 2008/12/06 08:44:12 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2002-2006 by the University of Illinois
41 !
42 ! ******************************************************************************
43 
44 SUBROUTINE rflu_derivedinputvalues(regions)
45 
46  USE moddatatypes
47  USE modglobal, ONLY: t_global
48  USE modmixture, ONLY: t_mixt_input
49  USE moddatastruct, ONLY: t_region
50  USE moderror
51  USE modparameters
52  USE modmpi
53 
54  IMPLICIT NONE
55 
56 ! ******************************************************************************
57 ! Declarations and definitions
58 ! ******************************************************************************
59 
60 ! ==============================================================================
61 ! Arguments
62 ! ==============================================================================
63 
64  TYPE(t_region), DIMENSION(:), POINTER :: regions
65 
66 ! ==============================================================================
67 ! Locals
68 ! ==============================================================================
69 
70  CHARACTER(CHRLEN) :: rcsidentstring
71  INTEGER :: ireg
72  TYPE(t_mixt_input), POINTER :: pmixtinput
73  TYPE(t_global), POINTER :: global
74  TYPE(t_region), POINTER :: pregion
75 
76 ! ******************************************************************************
77 ! Start
78 ! ******************************************************************************
79 
80  rcsidentstring = &
81  '$RCSfile: RFLU_DerivedInputValues.F90,v $ $Revision: 1.21 $'
82 
83  global => regions(1)%global
84 
85  CALL registerfunction(global,'RFLU_DerivedInputValues',&
86  'RFLU_DerivedInputValues.F90')
87 
88  IF ( global%myProcid == masterproc .AND. &
89  global%verbLevel >= verbose_high ) THEN
90  WRITE(stdout,'(A,1X,A)') solver_name,'Setting derived input variables...'
91  END IF ! global%verbLevel
92 
93 ! ******************************************************************************
94 ! Region-independent values
95 ! ******************************************************************************
96 
97  IF ( global%refREnum > 0.0_rfreal ) THEN
98  global%refVisc = global%refDensity*global%RefVelocity*global%refLength/ &
99  global%refREnum
100  ELSE
101  global%refVisc = 0.0_rfreal
102  END IF ! global%refREnum
103 
104 ! ******************************************************************************
105 ! Region-dependent values
106 ! ******************************************************************************
107 
108  DO ireg = lbound(regions,1),ubound(regions,1)
109  pregion => regions(ireg)
110  pmixtinput => pregion%mixtInput
111 
112 ! ==============================================================================
113 ! General
114 ! ==============================================================================
115 
116  SELECT CASE ( pmixtinput%fluidModel )
117  CASE ( fluid_model_incomp )
118  pmixtinput%nCv = 4
119  pmixtinput%nDv = 0 ! TEMPORARY
120  pmixtinput%nGv = 0 ! TEMPORARY
121  CASE ( fluid_model_comp )
122  pmixtinput%nCv = 5
123  pmixtinput%nDv = 3
124  pmixtinput%nGv = 2
125 
126  SELECT CASE ( pmixtinput%gasModel )
127  CASE ( gas_model_tcperf )
128  pmixtinput%nGvAct = 0
129 
130  pmixtinput%indCp = 0
131  pmixtinput%indMol = 0
132  CASE ( gas_model_mixt_tcperf )
133  pmixtinput%nGvAct = 2
134 
135  pmixtinput%indCp = 1
136  pmixtinput%indMol = 1
137  CASE ( gas_model_mixt_pseudo )
138  pmixtinput%nGvAct = 2
139 
140  pmixtinput%indCp = 1
141  pmixtinput%indMol = 1
142  CASE ( gas_model_mixt_gasliq )
143  pmixtinput%nGvAct = 0
144 
145  pmixtinput%indCp = 1
146  pmixtinput%indMol = 1
147  CASE default
148  CALL errorstop(global,err_reached_default,__line__)
149  END SELECT ! pMixtInput%gasModel
150  CASE default
151  CALL errorstop(global,err_reached_default,__line__)
152  END SELECT ! pMixtInput%fluidModel
153 
154  IF ( pmixtinput%flowModel == flow_navst ) THEN
155  pmixtinput%computeTv = .true.
156  ELSE
157  pmixtinput%computeTv = .false.
158  END IF ! pMixtInput%flowModel
159 
160  IF ( pmixtinput%computeTv ) THEN ! transport variables
161  pmixtinput%nTv = 2
162  ELSE
163  pmixtinput%nTv = 0
164  END IF ! pMixtInput
165 
166 ! ==============================================================================
167 ! Transport coefficients and dimensionless numbers
168 ! ==============================================================================
169 
170  IF ( pmixtinput%refVisc < 0.0_rfreal ) THEN ! Was not specified
171  pmixtinput%refVisc = global%refVisc
172  END IF ! pMixtInput%refVisc
173 
174  pmixtinput%prLam = global%prLam
175  pmixtinput%prTurb = global%prTurb
176  pmixtinput%scnLam = global%scnLam
177  pmixtinput%scnTurb = global%scnTurb
178 
179 ! ==============================================================================
180 ! Stencil dimensionality. NOTE if not using one-dimensional stencils, then
181 ! set stencil dimensionality to be equal to dimensionality.
182 ! ==============================================================================
183 
184  IF ( pmixtinput%stencilDimensCells > 1 ) THEN
185  pmixtinput%stencilDimensCells = pmixtinput%dimens
186  END IF ! pMixtInput%stencilDimensCells
187 
188  IF ( pmixtinput%stencilDimensFaces > 1 ) THEN
189  pmixtinput%stencilDimensFaces = pmixtinput%dimens
190  END IF ! pMixtInput%stencilDimensFaces
191 
192  IF ( pmixtinput%stencilDimensBFaces > 1 ) THEN
193  pmixtinput%stencilDimensBFaces = pmixtinput%dimens
194  END IF ! pMixtInput%stencilDimensBFaces
195 
196 ! ==============================================================================
197 ! Grid speeds
198 ! ==============================================================================
199 
200  IF ( pmixtinput%moveGrid .EQV. .true. ) THEN
201  pregion%grid%indGs = 1
202  ELSE
203  pregion%grid%indGs = 0
204  END IF ! pMixtInput
205 
206 ! ==============================================================================
207 ! Time-stepping scheme
208 ! ==============================================================================
209 
210  IF ( global%flowType == flow_steady ) THEN ! steady flow
211  global%nrkSteps = 5
212  ELSE ! unsteady flow
213  SELECT CASE ( global%rkScheme )
214  CASE ( rk_scheme_4_classical )
215  global%nrkSteps = 4
216  CASE ( rk_scheme_3_wray )
217  global%nrkSteps = 3
218  CASE default
219  CALL errorstop(global,err_reached_default,__line__)
220  END SELECT ! global%rkScheme
221  END IF ! global%flowType
222 
223  IF ( global%flowType == flow_steady ) THEN ! steady, upwind scheme
224  pmixtinput%ark(1) = 0.0695_rfreal
225  pmixtinput%ark(2) = 0.1602_rfreal
226  pmixtinput%ark(3) = 0.2898_rfreal
227  pmixtinput%ark(4) = 0.5060_rfreal
228  pmixtinput%ark(5) = 1.0000_rfreal
229 
230  pmixtinput%betrk(1) = 1.0000_rfreal
231  pmixtinput%betrk(2) = 0.0000_rfreal
232  pmixtinput%betrk(3) = 0.5600_rfreal
233  pmixtinput%betrk(4) = 0.0000_rfreal
234  pmixtinput%betrk(5) = 0.4400_rfreal
235 
236  pmixtinput%ldiss(1) = 1
237  pmixtinput%ldiss(2) = 0
238  pmixtinput%ldiss(3) = 1
239  pmixtinput%ldiss(4) = 0
240  pmixtinput%ldiss(5) = 1
241  ELSE ! unsteady
242  SELECT CASE ( global%rkScheme )
243  CASE ( rk_scheme_4_classical )
244  pmixtinput%ark(1) = 0.5_rfreal
245  pmixtinput%ark(2) = 0.5_rfreal
246  pmixtinput%ark(3) = 1.0_rfreal
247  pmixtinput%ark(4) = 1.0_rfreal/6.0_rfreal
248 
249  pmixtinput%betrk(1) = 1.0_rfreal
250  pmixtinput%betrk(2) = 1.0_rfreal
251  pmixtinput%betrk(3) = 1.0_rfreal
252  pmixtinput%betrk(4) = 1.0_rfreal
253 
254  pmixtinput%grk(1) = 1.0_rfreal
255  pmixtinput%grk(2) = 2.0_rfreal
256  pmixtinput%grk(3) = 2.0_rfreal
257  pmixtinput%grk(4) = 1.0_rfreal
258 
259  pmixtinput%trk(1) = 0.0_rfreal
260  pmixtinput%trk(2) = 0.5_rfreal
261  pmixtinput%trk(3) = 0.5_rfreal
262  pmixtinput%trk(4) = 1.0_rfreal
263 
264  pmixtinput%ldiss(1) = 1
265  pmixtinput%ldiss(2) = 1
266  pmixtinput%ldiss(3) = 1
267  pmixtinput%ldiss(4) = 1
268 
269  pmixtinput%cfl = min(pmixtinput%cfl,3.0_rfreal) ! stability margin
270  CASE ( rk_scheme_3_wray )
271  pmixtinput%ark(1) = 8.0_rfreal/15.0_rfreal
272  pmixtinput%ark(2) = 5.0_rfreal/12.0_rfreal
273  pmixtinput%ark(3) = 0.75_rfreal
274 
275  pmixtinput%betrk(1) = 0.0_rfreal
276  pmixtinput%betrk(2) = 0.0_rfreal
277  pmixtinput%betrk(3) = 0.0_rfreal
278 
279  pmixtinput%grk(1) = 0.0_rfreal
280  pmixtinput%grk(2) = 17.0_rfreal/25.0_rfreal
281  pmixtinput%grk(3) = 5.0_rfreal/ 9.0_rfreal
282 
283  pmixtinput%trk(1) = 0.0_rfreal
284  pmixtinput%trk(2) = 8.0_rfreal/15.0_rfreal
285  pmixtinput%trk(3) = 2.0_rfreal/3.0_rfreal
286 
287  pmixtinput%ldiss(1) = 1
288  pmixtinput%ldiss(2) = 1
289  pmixtinput%ldiss(3) = 1
290 
291  pmixtinput%cfl = min(pmixtinput%cfl,2.0_rfreal) ! stability margin
292  CASE default
293  CALL errorstop(global,err_reached_default,__line__)
294  END SELECT ! global%rkScheme
295  END IF ! pMixtInput
296  END DO ! iReg
297 
298 ! ******************************************************************************
299 ! End
300 ! ******************************************************************************
301 
302  IF ( global%myProcid == masterproc .AND. &
303  global%verbLevel >= verbose_high ) THEN
304  WRITE(stdout,'(A,1X,A)') solver_name,'Setting derived input variables done.'
305  END IF ! global%verbLevel
306 
307  CALL deregisterfunction(global)
308 
309 END SUBROUTINE rflu_derivedinputvalues
310 
311 ! ******************************************************************************
312 !
313 ! RCS Revision history:
314 !
315 ! $Log: RFLU_DerivedInputValues.F90,v $
316 ! Revision 1.21 2008/12/06 08:44:12 mtcampbe
317 ! Updated license.
318 !
319 ! Revision 1.20 2008/11/19 22:17:25 mtcampbe
320 ! Added Illinois Open Source License/Copyright
321 !
322 ! Revision 1.19 2006/04/13 18:07:09 haselbac
323 ! Bug fix: Changed indCp and indMol for GASLIQ model
324 !
325 ! Revision 1.18 2006/04/07 14:42:20 haselbac
326 ! Added setting of stencilDimens params
327 !
328 ! Revision 1.17 2006/03/26 20:21:32 haselbac
329 ! Added support for GL model
330 !
331 ! Revision 1.16 2006/01/06 22:06:12 haselbac
332 ! Added setting of stencilDimens
333 !
334 ! Revision 1.15 2005/11/14 16:54:30 haselbac
335 ! Added setting of variables for pseudo-gas model
336 !
337 ! Revision 1.14 2005/11/10 02:01:30 haselbac
338 ! Added setting of nGvAct, indCp, indMol depending on gasModel
339 !
340 ! Revision 1.13 2004/11/17 16:27:36 haselbac
341 ! Added setting of RK3 coeffs
342 !
343 ! Revision 1.12 2004/11/14 19:38:24 haselbac
344 ! Changed nDv and nGv for incompressible fluid model temporarily
345 !
346 ! Revision 1.11 2004/11/02 02:27:58 haselbac
347 ! Added setting of nCv etc for various fluid models
348 !
349 ! Revision 1.10 2004/10/19 19:37:30 haselbac
350 ! Cosmetics only
351 !
352 ! Revision 1.9 2004/04/15 20:18:47 haselbac
353 ! Major bug fix: Accidentally deleted setting of nrkSteps for unsteady flow
354 !
355 ! Revision 1.8 2004/04/14 02:07:39 haselbac
356 ! Clean-up
357 !
358 ! Revision 1.7 2004/03/05 22:09:01 jferry
359 ! created global variables for peul, plag, and inrt use
360 !
361 ! Revision 1.6 2004/01/29 23:03:32 haselbac
362 ! Removed unnecessary iLev loop and cosmetic changes
363 !
364 ! Revision 1.5 2003/12/04 03:23:50 haselbac
365 ! Clean-up
366 !
367 ! Revision 1.4 2003/11/25 21:02:45 haselbac
368 ! Cosmetic changes only
369 !
370 ! Revision 1.3 2003/07/03 21:48:45 jblazek
371 ! Implemented dual-time stepping.
372 !
373 ! Revision 1.2 2003/06/19 22:43:59 haselbac
374 ! Changed trk to correspond to different use in rungeKutta
375 !
376 ! Revision 1.1 2003/01/28 15:53:31 haselbac
377 ! Initial revision, moved from rocflu, use LBOUND and UBOUND
378 !
379 ! Revision 1.7 2002/10/12 14:56:24 haselbac
380 ! Initialize trk
381 !
382 ! Revision 1.6 2002/09/09 15:49:00 haselbac
383 ! global now under regions, set nTv for NS, delete nGrad
384 !
385 ! Revision 1.5 2002/07/25 14:27:43 haselbac
386 ! Added MASTERPROC distinction for output
387 !
388 ! Revision 1.4 2002/06/17 13:34:12 haselbac
389 ! Prefixed SOLVER_NAME to all screen output
390 !
391 ! Revision 1.3 2002/06/14 20:21:26 haselbac
392 ! Cosmetic changes and prepared addition of grid speed stuff
393 !
394 ! Revision 1.2 2002/05/04 17:06:31 haselbac
395 ! Minor changes
396 !
397 ! Revision 1.1 2002/03/26 19:27:52 haselbac
398 ! Initial revision
399 !
400 ! ******************************************************************************
401 
402 
403 
404 
405 
406 
407 
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine rflu_derivedinputvalues(regions)