Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PREP_InitializeFlowField.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 flow field in a region.
26 !
27 ! Description: none.
28 !
29 ! Input: iReg = region number
30 ! iLev = grid level
31 !
32 ! Output: region = region data (mixt%cv)
33 !
34 ! Notes: none.
35 !
36 !******************************************************************************
37 !
38 ! $Id: PREP_InitializeFlowField.F90,v 1.8 2008/12/06 08:44:50 mtcampbe Exp $
39 !
40 ! Copyright: (c) 2001 by the University of Illinois
41 !
42 !******************************************************************************
43 
44 SUBROUTINE initializeflowfield( iLev,region )
45 
46  USE moddatatypes
47  USE moderror
48  USE moddatastruct, ONLY : t_region
50  USE modmixture, ONLY : t_mixt, t_mixt_input
51  USE modparameters
53  IMPLICIT NONE
54 
55 #include "Indexing.h"
56 
57 ! ... parameters
58  INTEGER :: ilev
59 
60  TYPE(t_region), TARGET :: region
61 
62 ! ... loop variables
63  INTEGER :: i,j,k, ijk, ijkn(8)
64 
65 ! ... local variables
66  INTEGER :: icoff, ijcoff, inoff, ijnoff, ibc, iec, ndum, ijknbeg, ijknend
67  INTEGER :: idcbeg, idcend, jdcbeg, jdcend, kdcbeg, kdcend, errorflag
68 
69  REAL(RFREAL) :: gam1, qvel, xc, xb, xe, velx
70 
71  TYPE(t_mixt), POINTER :: mixt
72  TYPE(t_mixt_input) :: input
73 
74 !******************************************************************************
75 
76  CALL registerfunction( region%global,'InitializeFlowField',&
77  'PREP_InitializeFlowField.F90' )
78 
79 ! start
80 
81  mixt => region%levels(ilev)%mixt
82  input = region%mixtInput
83  ndum = region%nDumCells
84 
85  CALL rflo_getdimensdummy( region,ilev,idcbeg,idcend, &
86  jdcbeg,jdcend,kdcbeg,kdcend )
87  CALL rflo_getcelloffset( region,ilev,icoff,ijcoff )
88  CALL rflo_getnodeoffset( region,ilev,inoff,ijnoff )
89  ibc = indijk(idcbeg,jdcbeg,kdcbeg,icoff,ijcoff)
90  iec = indijk(idcend,jdcend,kdcend,icoff,ijcoff)
91 
92  ALLOCATE( mixt%cv(5,ibc:iec),stat=errorflag )
93  region%global%error = errorflag
94  IF (region%global%error /= 0) &
95  CALL errorstop( region%global,err_allocate,__line__ )
96 
97  IF (input%prepIniCase==initflo_uniform) THEN
98  IF (input%iniXsplit > 0.5_rfreal*huge(1._rfreal)) THEN
99  DO ijk = ibc,iec
100  gam1 = region%global%refGamma - 1._rfreal
101  qvel = 0.5_rfreal*(input%iniVelX*input%iniVelX+ &
102  input%iniVelY*input%iniVelY+ &
103  input%iniVelZ*input%iniVelZ)
104 
105  mixt%cv(cv_mixt_dens,ijk) = input%iniDens
106  mixt%cv(cv_mixt_xmom,ijk) = input%iniVelX*input%iniDens
107  mixt%cv(cv_mixt_ymom,ijk) = input%iniVelY*input%iniDens
108  mixt%cv(cv_mixt_zmom,ijk) = input%iniVelZ*input%iniDens
109  mixt%cv(cv_mixt_ener,ijk) = input%iniPress/gam1 + input%iniDens*qvel
110  ENDDO
111  ELSE
112  DO k=kdcbeg,kdcend
113  DO j=jdcbeg,jdcend
114  DO i=idcbeg,idcend
115 
116  ijk = indijk(i,j,k,icoff,ijcoff)
117  ijkn(1) = indijk(i ,j ,k ,inoff,ijnoff)
118  ijkn(2) = indijk(i+1,j ,k ,inoff,ijnoff)
119  ijkn(3) = indijk(i+1,j+1,k ,inoff,ijnoff)
120  ijkn(4) = indijk(i ,j+1,k ,inoff,ijnoff)
121  ijkn(5) = indijk(i ,j ,k+1,inoff,ijnoff)
122  ijkn(6) = indijk(i+1,j ,k+1,inoff,ijnoff)
123  ijkn(7) = indijk(i+1,j+1,k+1,inoff,ijnoff)
124  ijkn(8) = indijk(i ,j+1,k+1,inoff,ijnoff)
125 
126  gam1 = region%global%refGamma - 1._rfreal
127  xc = 0.125_rfreal* &
128  (region%levels(ilev)%grid%xyz(xcoord,ijkn(1)) + &
129  region%levels(ilev)%grid%xyz(xcoord,ijkn(2)) + &
130  region%levels(ilev)%grid%xyz(xcoord,ijkn(3)) + &
131  region%levels(ilev)%grid%xyz(xcoord,ijkn(4)) + &
132  region%levels(ilev)%grid%xyz(xcoord,ijkn(5)) + &
133  region%levels(ilev)%grid%xyz(xcoord,ijkn(6)) + &
134  region%levels(ilev)%grid%xyz(xcoord,ijkn(7)) + &
135  region%levels(ilev)%grid%xyz(xcoord,ijkn(8)))
136  IF (xc <= input%iniXsplit) THEN
137  qvel = 0.5_rfreal*(input%iniVelX*input%iniVelX+ &
138  input%iniVelY*input%iniVelY+ &
139  input%iniVelZ*input%iniVelZ)
140 
141  mixt%cv(cv_mixt_dens,ijk) = input%iniDens
142  mixt%cv(cv_mixt_xmom,ijk) = input%iniVelX*input%iniDens
143  mixt%cv(cv_mixt_ymom,ijk) = input%iniVelY*input%iniDens
144  mixt%cv(cv_mixt_zmom,ijk) = input%iniVelZ*input%iniDens
145  mixt%cv(cv_mixt_ener,ijk) = input%iniPress/gam1+input%iniDens*qvel
146  ELSE
147  qvel = 0.5_rfreal*(input%iniVelX2*input%iniVelX2+ &
148  input%iniVelY2*input%iniVelY2+ &
149  input%iniVelZ2*input%iniVelZ2)
150 
151  mixt%cv(cv_mixt_dens,ijk) = input%iniDens2
152  mixt%cv(cv_mixt_xmom,ijk) = input%iniVelX2*input%iniDens2
153  mixt%cv(cv_mixt_ymom,ijk) = input%iniVelY2*input%iniDens2
154  mixt%cv(cv_mixt_zmom,ijk) = input%iniVelZ2*input%iniDens2
155  mixt%cv(cv_mixt_ener,ijk) = input%iniPress2/gam1+input%iniDens2*qvel
156  ENDIF ! xc
157  ENDDO ! i
158  ENDDO ! j
159  ENDDO ! k
160  ENDIF ! iniXsplit
161  ENDIF ! prepIniCase
162 
163  IF (input%prepIniCase==initflo_piston_expan) THEN
164  DO k=kdcbeg,kdcend
165  DO j=jdcbeg,jdcend
166  DO i=idcbeg,idcend
167 
168  ijk = indijk(i,j,k,icoff,ijcoff)
169  ijkn(1) = indijk(i ,j ,k ,inoff,ijnoff)
170  ijkn(2) = indijk(i+1,j ,k ,inoff,ijnoff)
171  ijkn(3) = indijk(i+1,j+1,k ,inoff,ijnoff)
172  ijkn(4) = indijk(i ,j+1,k ,inoff,ijnoff)
173  ijkn(5) = indijk(i ,j ,k+1,inoff,ijnoff)
174  ijkn(6) = indijk(i+1,j ,k+1,inoff,ijnoff)
175  ijkn(7) = indijk(i+1,j+1,k+1,inoff,ijnoff)
176  ijkn(8) = indijk(i ,j+1,k+1,inoff,ijnoff)
177  ijknbeg = indijk(1 ,j ,k ,inoff,ijnoff)
178  ijknend = indijk(idcend-ndum+1,j ,k ,inoff,ijnoff)
179 
180  gam1 = region%global%refGamma - 1._rfreal
181  xc = 0.125_rfreal* &
182  (region%levels(ilev)%grid%xyz(xcoord,ijkn(1)) + &
183  region%levels(ilev)%grid%xyz(xcoord,ijkn(2)) + &
184  region%levels(ilev)%grid%xyz(xcoord,ijkn(3)) + &
185  region%levels(ilev)%grid%xyz(xcoord,ijkn(4)) + &
186  region%levels(ilev)%grid%xyz(xcoord,ijkn(5)) + &
187  region%levels(ilev)%grid%xyz(xcoord,ijkn(6)) + &
188  region%levels(ilev)%grid%xyz(xcoord,ijkn(7)) + &
189  region%levels(ilev)%grid%xyz(xcoord,ijkn(8)))
190  xb = region%levels(ilev)%grid%xyz(xcoord,ijknbeg)
191  xe = region%levels(ilev)%grid%xyz(xcoord,ijknend)
192 
193 ! velX = (xc-xb)/(xe-xb)*input%iniVelX ! 1-block
194  velx = (xc-input%iniXsplit)/ & ! multi-block
195  region%global%refLength*input%iniVelX
196 
197  qvel = 0.5_rfreal*(velx*velx+ &
198  input%iniVelY*input%iniVelY+ &
199  input%iniVelZ*input%iniVelZ)
200 
201  mixt%cv(cv_mixt_dens,ijk) = input%iniDens
202  mixt%cv(cv_mixt_xmom,ijk) = velx*input%iniDens
203  mixt%cv(cv_mixt_ymom,ijk) = input%iniVelY*input%iniDens
204  mixt%cv(cv_mixt_zmom,ijk) = input%iniVelZ*input%iniDens
205  mixt%cv(cv_mixt_ener,ijk) = input%iniPress/gam1+input%iniDens*qvel
206  ENDDO ! i
207  ENDDO ! j
208  ENDDO ! k
209  ENDIF ! iniCase
210 
211 ! finalize
212 
213  CALL deregisterfunction( region%global )
214 
215 END SUBROUTINE initializeflowfield
216 
217 !******************************************************************************
218 !
219 ! RCS Revision history:
220 !
221 ! $Log: PREP_InitializeFlowField.F90,v $
222 ! Revision 1.8 2008/12/06 08:44:50 mtcampbe
223 ! Updated license.
224 !
225 ! Revision 1.7 2008/11/19 22:18:00 mtcampbe
226 ! Added Illinois Open Source License/Copyright
227 !
228 ! Revision 1.6 2005/09/21 20:36:52 wasistho
229 ! added xsplit parameter in pistonExpand case
230 !
231 ! Revision 1.5 2005/09/21 19:04:15 wasistho
232 ! modified initial condition for expanding piston case
233 !
234 ! Revision 1.4 2005/09/09 03:30:45 wasistho
235 ! added Expanding-Piston case kernel
236 !
237 ! Revision 1.3 2005/08/03 17:51:31 wasistho
238 ! added domain-splitting feature to initial condition
239 !
240 ! Revision 1.2 2004/12/03 03:29:08 wasistho
241 ! rflo_modinterfacesprep to prep_modinterfaces
242 !
243 ! Revision 1.1 2004/12/03 02:20:08 wasistho
244 ! added prefix
245 !
246 ! Revision 1.1 2004/12/03 00:40:49 wasistho
247 ! lower to upper case
248 !
249 ! Revision 1.9 2003/05/15 02:57:07 jblazek
250 ! Inlined index function.
251 !
252 ! Revision 1.8 2003/04/23 22:51:43 olawlor
253 ! Added TARGET attribute to region variable, since
254 ! pointers are cached into it.
255 !
256 ! Revision 1.7 2003/03/20 22:27:56 haselbac
257 ! Renamed ModInterfaces
258 !
259 ! Revision 1.6 2003/03/20 19:44:22 haselbac
260 ! Corrected mistake in phased check-in
261 !
262 ! Revision 1.5 2003/03/20 19:35:43 haselbac
263 ! Modified RegFun call to avoid probs with long 'PREP_InitializeFlowField.F90' names
264 !
265 ! Revision 1.4 2002/10/12 03:20:51 jblazek
266 ! Replaced [io]stat=global%error with local errorFlag for Rocflo.
267 !
268 ! Revision 1.3 2002/09/05 17:40:22 jblazek
269 ! Variable global moved into regions().
270 !
271 ! Revision 1.2 2002/02/21 23:25:07 jblazek
272 ! Blocks renamed as regions.
273 !
274 ! Revision 1.1 2002/01/02 15:57:08 jblazek
275 ! Added flow initialization.
276 !
277 !******************************************************************************
278 
279 
280 
281 
282 
283 
284 
285 
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE idcend
j indices k indices k
Definition: Indexing.h:6
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
subroutine rflo_getnodeoffset(region, iLev, iNodeOffset, ijNodeOffset)
subroutine rflo_getdimensdummy(region, iLev, idcbeg, idcend, jdcbeg, jdcend, kdcbeg, kdcend)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE kdcbeg
subroutine input(X, NNODE, NDC, NCELL, NFCE, NBPTS, NBFACE, ITYP, NPROP, XBNDY, XFAR, YFAR, ZFAR)
blockLoc i
Definition: read.cpp:79
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE idcbeg
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE jdcend
j indices j
Definition: Indexing.h:6
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE jdcbeg
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
subroutine initializeflowfield(iLev, region)