Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SPEC_RFLU_InitFlowHardCode.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: Initialize species flow field in a region using hard-coded values.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Pointer to region
31 !
32 ! Output: None.
33 !
34 ! Notes:
35 ! 1. Initialize state vector in primitive form. This is done so can compute
36 ! gas properties based on species mass fractions.
37 !
38 ! ******************************************************************************
39 !
40 ! $Id: SPEC_RFLU_InitFlowHardCode.F90,v 1.17 2008/12/06 08:44:40 mtcampbe Exp $
41 !
42 ! Copyright: (c) 2003-2006 by the University of Illinois
43 !
44 ! ******************************************************************************
45 
46 SUBROUTINE spec_rflu_initflowhardcode(pRegion)
47 
48  USE moddatatypes
49  USE moderror
50  USE modparameters
51  USE moddatastruct, ONLY: t_region
52  USE modglobal, ONLY: t_global
53  USE modgrid, ONLY: t_grid
54  USE modmixture, ONLY: t_mixt_input
55 
56  IMPLICIT NONE
57 
58 ! ******************************************************************************
59 ! Declarations and definitions
60 ! ******************************************************************************
61 
62 ! ==============================================================================
63 ! Arguments
64 ! ==============================================================================
65 
66  TYPE(t_region), POINTER :: pregion
67 
68 ! ==============================================================================
69 ! Locals
70 ! ==============================================================================
71 
72  CHARACTER(CHRLEN) :: errorstring,rcsidentstring
73  INTEGER :: icg,ispec
74  REAL(RFREAL) :: x,y,z
75  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcvmixt,pcvspec
76  TYPE(t_global), POINTER :: global
77  TYPE(t_grid), POINTER :: pgrid
78  TYPE(t_mixt_input), POINTER :: pmixtinput
79 
80 ! ******************************************************************************
81 ! Start
82 ! ******************************************************************************
83 
84  rcsidentstring = &
85  '$RCSfile: SPEC_RFLU_InitFlowHardCode.F90,v $ $Revision: 1.17 $'
86 
87  global => pregion%global
88 
89  CALL registerfunction(global,'SPEC_RFLU_InitFlowHardCode', &
90  'SPEC_RFLU_InitFlowHardCode.F90')
91 
92  IF ( global%verbLevel > verbose_none ) THEN
93  WRITE(stdout,'(A,1X,A)') solver_name, &
94  'Initializing species flow field from hard code...'
95 
96  IF ( global%verbLevel > verbose_low ) THEN
97  WRITE(stdout,'(A,3X,A,A)') solver_name,'Case: ',trim(global%casename)
98  END IF ! global%verbLevel
99  END IF ! global%verbLevel
100 
101 ! ******************************************************************************
102 ! Set pointers and variables
103 ! ******************************************************************************
104 
105  pgrid => pregion%grid
106  pcvmixt => pregion%mixt%cv
107  pcvspec => pregion%spec%cv
108  pmixtinput => pregion%mixtInput
109 
110  pregion%spec%cvState = cv_mixt_state_prim
111 
112 ! ******************************************************************************
113 ! Initialize flow field based on user input
114 ! ******************************************************************************
115 
116  SELECT CASE ( global%casename )
117 
118 ! ==============================================================================
119 ! Generic compressible gravity current
120 ! ==============================================================================
121 
122  CASE ( "gcgc" )
123  IF ( pregion%specInput%nSpecies /= 2 ) THEN
124  WRITE(errorstring,'(A,1X,I2)') 'Should be:',pregion%specInput%nSpecies
125  CALL errorstop(global,err_spec_nspec_invalid,__line__,trim(errorstring))
126  END IF ! pRegion%specInput%nSpecies
127 
128  DO icg = 1,pgrid%nCellsTot
129  x = pgrid%cofg(xcoord,icg)
130  y = pgrid%cofg(ycoord,icg)
131 
132  IF ( (x < pmixtinput%prepRealVal1) .AND. &
133  (y < pmixtinput%prepRealVal2) ) THEN
134  pcvspec(1,icg) = 0.04_rfreal
135  pcvspec(2,icg) = 0.96_rfreal
136  ELSE
137  pcvspec(1,icg) = 1.0_rfreal
138  pcvspec(2,icg) = 0.0_rfreal
139  END IF ! x
140  END DO ! icg
141 
142 ! ==============================================================================
143 ! Generic multiphase jet
144 ! ==============================================================================
145 
146  CASE ( "gmpjet" )
147  IF ( pregion%specInput%nSpecies /= 2 ) THEN
148  WRITE(errorstring,'(A,1X,I2)') 'Should be:',pregion%specInput%nSpecies
149  CALL errorstop(global,err_spec_nspec_invalid,__line__,trim(errorstring))
150  END IF ! pRegion%specInput%nSpecies
151 
152  DO icg = 1,pgrid%nCellsTot
153  x = pgrid%cofg(xcoord,icg)
154 
155  IF ( x < 0.0_rfreal ) THEN
156  pcvspec(1,icg) = 0.5_rfreal
157  pcvspec(2,icg) = 0.5_rfreal
158  ELSE
159  pcvspec(1,icg) = 1.0_rfreal
160  pcvspec(2,icg) = 0.0_rfreal
161  END IF ! x
162  END DO ! icg
163 
164 ! ==============================================================================
165 ! Kieffer jet
166 ! ==============================================================================
167 
168  CASE ( "kjet2v3mp","kjet2v4mp","kjet2v5mp" )
169  IF ( pregion%specInput%nSpecies /= 2 ) THEN
170  WRITE(errorstring,'(A,1X,I2)') 'Should be:',pregion%specInput%nSpecies
171  CALL errorstop(global,err_spec_nspec_invalid,__line__,trim(errorstring))
172  END IF ! pRegion%specInput%nSpecies
173 
174  DO icg = 1,pgrid%nCellsTot
175  x = pgrid%cofg(xcoord,icg)
176 
177  IF ( x < pmixtinput%prepRealVal8 ) THEN
178  pcvspec(1,icg) = pmixtinput%prepRealVal9
179  pcvspec(2,icg) = 1.0_rfreal - pmixtinput%prepRealVal9
180  ELSE
181  pcvspec(1,icg) = pmixtinput%prepRealVal10
182  pcvspec(2,icg) = 1.0_rfreal - pmixtinput%prepRealVal10
183  END IF ! x
184  END DO ! icg
185 
186 ! ==============================================================================
187 ! Multiphase Shocktube: Water-Air
188 ! ==============================================================================
189 
190  CASE ( "MShock_H2O_Air001", &
191  "MShock_H2O_Air002" )
192  IF ( pregion%mixtInput%gasModel /= gas_model_mixt_gasliq ) THEN
193  CALL errorstop(global,err_gasmodel_invalid,__line__, &
194  'Case initialization only valid with gas-liq model.')
195  END IF ! pRegion%mixtInput%gasModel
196 
197  IF ( pregion%specInput%nSpecies /= 2 ) THEN
198  WRITE(errorstring,'(A,1X,I2)') 'Should be:',pregion%specInput%nSpecies
199  CALL errorstop(global,err_spec_nspec_invalid,__line__,trim(errorstring))
200  END IF ! pRegion%specInput%nSpecies
201 
202  DO icg = 1,pgrid%nCellsTot
203  x = pgrid%cofg(xcoord,icg)
204 
205  IF ( x < 0.7_rfreal ) THEN
206  pcvspec(1,icg) = 0.0_rfreal
207  pcvspec(2,icg) = 0.0_rfreal
208  ELSE
209  pcvspec(1,icg) = 1.0_rfreal
210  pcvspec(2,icg) = 0.0_rfreal
211  END IF ! x
212  END DO ! icg
213 
214 ! ==============================================================================
215 ! Multiphase Shocktube: Air-Air-He
216 ! ==============================================================================
217 
218  CASE ( "MShock_Air_Air_He001" )
219  IF ( pregion%mixtInput%gasModel /= gas_model_mixt_gasliq ) THEN
220  CALL errorstop(global,err_gasmodel_invalid,__line__, &
221  'Case initialization only valid with gas-liq model.')
222  END IF ! pRegion%mixtInput%gasModel
223 
224  IF ( pregion%specInput%nSpecies /= 2 ) THEN
225  WRITE(errorstring,'(A,1X,I2)') 'Should be:',pregion%specInput%nSpecies
226  CALL errorstop(global,err_spec_nspec_invalid,__line__,trim(errorstring))
227  END IF ! pRegion%specInput%nSpecies
228 
229  DO icg = 1,pgrid%nCellsTot
230  x = pgrid%cofg(xcoord,icg)
231 
232  IF ( x < 0.25_rfreal ) THEN
233  pcvspec(1,icg) = 1.0_rfreal
234  pcvspec(2,icg) = 0.0_rfreal
235  ELSE IF ( x > 0.25_rfreal .AND. x < 0.5_rfreal ) THEN
236  pcvspec(1,icg) = 1.0_rfreal
237  pcvspec(2,icg) = 0.0_rfreal
238  ELSE
239  pcvspec(1,icg) = 0.0_rfreal
240  pcvspec(2,icg) = 1.0_rfreal
241  END IF ! x
242  END DO ! icg
243 
244 
245 ! ==============================================================================
246 ! Nozzle cavity
247 ! ==============================================================================
248 
249  CASE ( "ncavity" )
250  IF ( pregion%mixtInput%gasModel /= gas_model_mixt_gasliq ) THEN
251  CALL errorstop(global,err_gasmodel_invalid,__line__, &
252  'Case initialization only valid with gas-liq model.')
253  END IF ! pRegion%mixtInput%gasModel
254 
255  IF ( pregion%specInput%nSpecies /= 2 ) THEN
256  WRITE(errorstring,'(A,1X,I2)') 'Should be:',pregion%specInput%nSpecies
257  CALL errorstop(global,err_spec_nspec_invalid,__line__,trim(errorstring))
258  END IF ! pRegion%specInput%nSpecies
259 
260  DO icg = 1,pgrid%nCellsTot
261  x = pgrid%cofg(xcoord,icg)
262 
263  IF ( x <= 3.0e-03_rfreal ) THEN
264  pcvspec(1,icg) = 0.0_rfreal
265  pcvspec(2,icg) = 0.0_rfreal
266  ELSE
267  pcvspec(1,icg) = 1.0_rfreal
268  pcvspec(2,icg) = 0.0_rfreal
269  END IF ! x
270  END DO ! icg
271 
272 ! ==============================================================================
273 ! Shock-bubble interaction: Quirk and Karni (1996)
274 ! ==============================================================================
275 
276  CASE ( "ShockBubble" )
277  IF ( pregion%mixtInput%gasModel /= gas_model_mixt_gasliq ) THEN
278  CALL errorstop(global,err_gasmodel_invalid,__line__, &
279  'Case initialization only valid with gas-liq model.')
280  END IF ! pRegion%mixtInput%gasModel
281 
282  IF ( pregion%specInput%nSpecies /= 2 ) THEN
283  WRITE(errorstring,'(A,1X,I2)') 'Should be:',pregion%specInput%nSpecies
284  CALL errorstop(global,err_spec_nspec_invalid,__line__,trim(errorstring))
285  END IF ! pRegion%specInput%nSpecies
286 
287  DO icg = 1,pgrid%nCellsTot
288  x = pgrid%cofg(xcoord,icg)
289  y = pgrid%cofg(ycoord,icg)
290 
291  IF ( ((x-0.085_rfreal)**2 + y**2) <= 6.25e-04_rfreal ) THEN
292  pcvspec(1,icg) = 0.0_rfreal
293  pcvspec(2,icg) = 1.0_rfreal
294  ELSE IF ( x < 0.050_rfreal ) THEN
295  pcvspec(1,icg) = 1.0_rfreal
296  pcvspec(2,icg) = 0.0_rfreal
297  ELSE
298  pcvspec(1,icg) = 1.0_rfreal
299  pcvspec(2,icg) = 0.0_rfreal
300  END IF ! x
301  END DO ! icg
302 
303 ! ==============================================================================
304 ! Shocktube
305 ! ==============================================================================
306 
307 ! ------------------------------------------------------------------------------
308 ! Generic
309 ! ------------------------------------------------------------------------------
310 
311  CASE ( "stg1d","stg2d" )
312  IF ( pregion%specInput%nSpecies /= 2 ) THEN
313  WRITE(errorstring,'(A,1X,I2)') 'Should be:',pregion%specInput%nSpecies
314  CALL errorstop(global,err_spec_nspec_invalid,__line__,trim(errorstring))
315  END IF ! pRegion%specInput%nSpecies
316 
317  DO icg = 1,pgrid%nCellsTot
318  x = pgrid%cofg(xcoord,icg)
319 
320  IF ( x < pmixtinput%prepRealVal8 ) THEN
321  pcvspec(1,icg) = pmixtinput%prepRealVal9
322  pcvspec(2,icg) = 1.0_rfreal - pmixtinput%prepRealVal9
323  ELSE IF ( (x >= pmixtinput%prepRealVal8 ) .AND. &
324  (x < pmixtinput%prepRealVal15) ) THEN
325  pcvspec(1,icg) = pmixtinput%prepRealVal10
326  pcvspec(2,icg) = 1.0_rfreal - pmixtinput%prepRealVal10
327  ELSE
328  pcvspec(1,icg) = pmixtinput%prepRealVal16
329  pcvspec(2,icg) = 1.0_rfreal - pmixtinput%prepRealVal16
330  END IF ! x
331  END DO ! icg
332 
333 ! ------------------------------------------------------------------------------
334 ! Sod
335 ! ------------------------------------------------------------------------------
336 
337  CASE ( "st_sod1_mp2","st_sod2_mp2" )
338  IF ( pregion%specInput%nSpecies /= 2 ) THEN
339  WRITE(errorstring,'(A,1X,I2)') 'Should be:',pregion%specInput%nSpecies
340  CALL errorstop(global,err_spec_nspec_invalid,__line__,trim(errorstring))
341  END IF ! pRegion%specInput%nSpecies
342 
343  DO icg = 1,pgrid%nCellsTot
344  x = pgrid%cofg(xcoord,icg)
345 
346  IF ( x < 0.0_rfreal ) THEN
347  pcvspec(1,icg) = pmixtinput%prepRealVal1
348  pcvspec(2,icg) = 1.0_rfreal - pmixtinput%prepRealVal1
349  ELSE
350  pcvspec(1,icg) = pmixtinput%prepRealVal2
351  pcvspec(2,icg) = 1.0_rfreal - pmixtinput%prepRealVal2
352  END IF ! x
353  END DO ! icg
354 
355 ! ==============================================================================
356 ! Multiphase Riemann problem: Two rarefactions (Toro Case 1)
357 ! ==============================================================================
358 
359  CASE ( "Two_Rarefaction" )
360  IF ( pregion%mixtInput%gasModel /= gas_model_mixt_gasliq ) THEN
361  CALL errorstop(global,err_gasmodel_invalid,__line__, &
362  'Case initialization only valid with gas-liq model.')
363  END IF ! pRegion%mixtInput%gasModel
364 
365  IF ( pregion%specInput%nSpecies /= 2 ) THEN
366  WRITE(errorstring,'(A,1X,I2)') 'Should be:',pregion%specInput%nSpecies
367  CALL errorstop(global,err_spec_nspec_invalid,__line__,trim(errorstring))
368  END IF ! pRegion%specInput%nSpecies
369 
370  DO icg = 1,pgrid%nCellsTot
371  x = pgrid%cofg(xcoord,icg)
372 
373  IF ( x < 0.5_rfreal ) THEN
374  pcvspec(1,icg) = 0.01098577_rfreal
375  pcvspec(2,icg) = 0.0_rfreal
376  ELSE
377  pcvspec(1,icg) = 0.01098577_rfreal
378  pcvspec(2,icg) = 0.0_rfreal
379  END IF ! x
380  END DO ! icg
381 
382 ! ==============================================================================
383 ! Simple volcano model
384 ! ==============================================================================
385 
386  CASE ( "volcmod2dv3" )
387  IF ( pregion%mixtInput%gasModel == gas_model_mixt_tcperf .OR. &
388  pregion%mixtInput%gasModel == gas_model_mixt_pseudo ) THEN
389  CALL errorstop(global,err_gasmodel_invalid,__line__, &
390  'Case initialization not valid with mixture gas model.')
391  END IF ! pRegion%mixtInput%gasModel
392 
393  DO icg = 1,pgrid%nCellsTot
394  y = pgrid%cofg(ycoord,icg)
395 
396  IF ( y < -500.0_rfreal ) THEN
397  DO ispec = 1,pregion%specInput%nSpecies
398  pcvspec(ispec,icg) = 1.0_rfreal
399  END DO ! iSpec
400  ELSE
401  DO ispec = 1,pregion%specInput%nSpecies
402  pcvspec(ispec,icg) = 0.0_rfreal
403  END DO ! iSpec
404  END IF ! y
405  END DO ! icg
406 
407 ! ==============================================================================
408 ! Compressible Shocktube: Air-Air
409 ! ==============================================================================
410 
411  CASE ( "2DShock001" )
412  IF ( pregion%mixtInput%gasModel /= gas_model_mixt_gasliq ) THEN
413  CALL errorstop(global,err_gasmodel_invalid,__line__, &
414  'Case initialization only valid with gas-liq model.')
415  END IF ! pRegion%mixtInput%gasModel
416 
417  IF ( pregion%specInput%nSpecies /= 2 ) THEN
418  WRITE(errorstring,'(A,1X,I2)') 'Should be:',pregion%specInput%nSpecies
419  CALL errorstop(global,err_spec_nspec_invalid,__line__,trim(errorstring))
420  END IF ! pRegion%specInput%nSpecies
421 
422  DO icg = 1,pgrid%nCellsTot
423  x = pgrid%cofg(xcoord,icg)
424 
425  IF ( x < 0.5_rfreal ) THEN
426  pcvspec(1,icg) = 1.0_rfreal
427  pcvspec(2,icg) = 0.0_rfreal
428  ELSE
429  pcvspec(1,icg) = 1.0_rfreal
430  pcvspec(2,icg) = 0.0_rfreal
431  END IF ! x
432  END DO ! icg
433 
434 ! ==============================================================================
435 ! Default
436 ! ==============================================================================
437 
438  CASE default
439  CALL errorstop(global,err_reached_default,__line__)
440  END SELECT ! global%casename
441 
442 ! ******************************************************************************
443 ! End
444 ! ******************************************************************************
445 
446  IF ( global%verbLevel > verbose_none ) THEN
447  WRITE(stdout,'(A,1X,A)') solver_name, &
448  'Initializing species flow field from hard code done.'
449  END IF ! global%verbLevel
450 
451  CALL deregisterfunction(global)
452 
453 END SUBROUTINE spec_rflu_initflowhardcode
454 
455 ! ******************************************************************************
456 !
457 ! RCS Revision history:
458 !
459 ! $Log: SPEC_RFLU_InitFlowHardCode.F90,v $
460 ! Revision 1.17 2008/12/06 08:44:40 mtcampbe
461 ! Updated license.
462 !
463 ! Revision 1.16 2008/11/19 22:17:53 mtcampbe
464 ! Added Illinois Open Source License/Copyright
465 !
466 ! Revision 1.15 2007/04/05 01:12:43 haselbac
467 ! Added stg1d, modified code to allow 2nd interface
468 !
469 ! Revision 1.14 2006/05/06 16:51:19 haselbac
470 ! Added kjet2 cases
471 !
472 ! Revision 1.13 2006/04/07 15:19:24 haselbac
473 ! Removed tabs
474 !
475 ! Revision 1.12 2006/03/30 20:52:16 haselbac
476 ! Changed ShockBubble hard-code, cosmetics
477 !
478 ! Revision 1.11 2006/03/26 20:22:18 haselbac
479 ! Added cases for GL model
480 !
481 ! Revision 1.10 2005/11/17 22:32:32 haselbac
482 ! Added section for gmpjet
483 !
484 ! Revision 1.9 2005/11/17 14:41:01 haselbac
485 ! Added init for stg2d case
486 !
487 ! Revision 1.8 2005/11/14 17:02:46 haselbac
488 ! Added support for pseudo-gas model
489 !
490 ! Revision 1.7 2005/11/10 21:06:03 haselbac
491 ! Changed init for Sod shocktube
492 !
493 ! Revision 1.6 2005/11/10 02:37:02 haselbac
494 ! Added proper init for Sod shocktube, removed default
495 !
496 ! Revision 1.5 2005/03/31 17:18:57 haselbac
497 ! Cosmetics only
498 !
499 ! Revision 1.4 2005/01/30 20:01:05 haselbac
500 ! Added hardcode for Sod shocktube
501 !
502 ! Revision 1.3 2004/11/12 14:07:37 haselbac
503 ! Modified hard-code for volcano
504 !
505 ! Revision 1.2 2004/11/10 22:50:29 haselbac
506 ! Added volcano and writing of casename
507 !
508 ! Revision 1.1 2003/11/25 21:08:37 haselbac
509 ! Initial revision
510 !
511 ! ******************************************************************************
512 
513 
514 
515 
516 
517 
518 
void int int REAL REAL * y
Definition: read.cpp:74
subroutine spec_rflu_initflowhardcode(pRegion)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469