Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RVAV_ExtractVariables.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: extract that primitive and derived variables for a thermally and
26 ! calorically perfect gas mixture. the extracted variables (ev) are
27 ! stored in 3D arrays ev(ibeg:iend,jbeg:jend,kbeg:kend). for the
28 ! moment we have not incorporated the ijump, jjunp and kjump options
29 !
30 ! Description: this subroutine work with Stream1 & Stream2
31 !
32 ! Input: region ! the region from which we are extracting
33 ! ibeg, iend, ijump ! the dimensions of the subregion of the region
34 ! jbeg, jend, jjump !
35 ! kbeg, kend, kjump !
36 !
37 ! Output: ev = extracted variables (e.g.: rho, u, v, w, p, T, s, omega )
38 !
39 ! Notes: none.
40 !
41 !******************************************************************************
42 !
43 ! $Id: RVAV_ExtractVariables.F90,v 1.3 2008/12/06 08:45:08 mtcampbe Exp $
44 !
45 ! Copyright: (c) 2002 by the University of Illinois
46 !
47 !******************************************************************************
48 
49 SUBROUTINE rvav_extractvariables( global, region, &
50  ibeg, iend, ijump, &
51  jbeg, jend, jjump, &
52  kbeg, kend, kjump, &
53  icoff, ijcoff, &
54  variableindex, &
55  filetype, &
56  indcp, indmol, ev )
57 
58  USE modmpi
59  USE modparameters
60  USE moddatatypes
61  USE moddatastruct, ONLY : t_region
62  USE modglobal, ONLY : t_global
63  USE modgrid, ONLY : t_grid
64  USE modmixture, ONLY : t_mixt
65  USE moderror
68  USE rvav_modglobal
69  IMPLICIT NONE
70 
71 #include "Indexing.h"
72 
73 ! ... variables in the parameter list of the subroutine
74  TYPE(t_region) :: region
75  TYPE(t_global), POINTER :: global
76  INTEGER :: ibeg, iend, ijump, jbeg, jend, jjump, kbeg, kend, kjump
77  INTEGER :: icoff, ijcoff
78  INTEGER :: indcp, indmol
79  INTEGER :: variableindex
80  INTEGER :: filetype
81  REAL(RFREAL), POINTER :: ev(:,:,:) ! this is an array for a single extracted
82  ! variable with i,j,k dimensions
83 
84 ! ... local variables
85  CHARACTER(CHRLEN) :: msg
86 
87  INTEGER :: ipc, jpc, kpc ! the indices of the physical cells
88  INTEGER :: ic ! the cell index which is obtained from (ipc,jpc,kpc)
89  ! by using the IndIJK function in Indexing.h
90  INTEGER :: is, js, ks ! the indices of the shifted cells
91  INTEGER :: ilev, ioffset, ijoffset
92  TYPE(t_grid), POINTER :: grid
93  TYPE(t_mixt), POINTER :: mixt
94  REAL(RFREAL), POINTER :: cv(:,:), gv(:,:)
95 
96  REAL(RFREAL) :: rgas, gamma, rhoq, pressure, temperature, sound_speed, &
97  mach_number
98 
99 !******************************************************************************
100 
101  CALL registerfunction( global, 'RVAV_ExtractVariables',&
102  'RVAV_ExtractVariables.F90' )
103 
104 ! ... set local pointers to the global pointers
105 
106  ilev = global%startLevel
107  grid => region%levels(ilev)%grid
108  mixt => region%levels(ilev)%mixt
109  cv => mixt%cv
110  gv => mixt%gv
111 
112 ! ... get the offsets for the region
113 
114  IF ( global%verbLevel/=verbose_none ) THEN
115  WRITE(stdout,'(/,A)') 'RVAV Extract'
116  WRITE(stdout,'(A,3(I5,3X))') ' ibeg,iend,ijump',ibeg,iend,ijump
117  WRITE(stdout,'(A,3(I5,3X))') ' jbeg,jend,jjump',jbeg,jend,jjump
118  WRITE(stdout,'(A,3(I5,3X))') ' kbeg,kend,kjump',kbeg,kend,kjump
119  WRITE(stdout,'(A,3(I5,3X))') ' iLev,iCOff,ijCOff',ilev,icoff,ijcoff
120  END IF !verbLevel
121 
122  SELECT CASE ( filetype )
123 
124  CASE (file_computed)
125  ioffset = icoff
126  ijoffset = ijcoff
127 
128  CASE (file_analytical)
129  ioffset = iend-ibeg+1
130  ijoffset = ioffset* (jend-jbeg+1)
131  IF (globalrvav%SimilarityTypeS2==rvav_blasius) THEN
132  ioffset = icoff
133  ijoffset = icoff*(jend-jbeg+1)
134  ENDIF
135  CASE (file_experimental)
136  ioffset = iend-ibeg+1
137  ijoffset = ioffset* (jend-jbeg+1)
138 
139  END SELECT
140 
141  IF ( global%verbLevel/=verbose_none ) THEN
142  WRITE(stdout,'(A,3(I5,3X))') ' iLev,iOffset,ijOffset',ilev,ioffset,ijoffset
143  END IF !verbLevel
144 
145 ! ... loop over the ipc,jpc,kpc indices to get the extracted variable (ev)
146 
147  DO kpc = kbeg, kend, kjump
148  DO jpc = jbeg, jend, jjump
149  DO ipc = ibeg, iend, ijump
150 
151 ! ... convert the ipc, jpc, kpc indices to the cell index ic
152  ic = indijk( ipc, jpc, kpc, ioffset, ijoffset )
153 
154  is = int(REAL(ipc-ibeg,kind=rfreal)/REAL(ijump,kind=rfreal))+1
155  js = int(REAL(jpc-jbeg,kind=rfreal)/REAL(jjump,kind=rfreal))+1
156  ks = int(REAL(kpc-kbeg,kind=rfreal)/REAL(kjump,kind=rfreal))+1
157 
158 ! ... calculate some of the gas constants needed for variable extraction
159 
160  IF ( filetype == file_computed ) THEN
161 
162  rgas = 8314.3_rfreal/gv(gv_mixt_mol, ic*indmol)
163  gamma = gv(gv_mixt_cp,ic*indcp)/( gv(gv_mixt_cp,ic*indcp)-rgas )
164 
165 ! ... select appropriate cases
166 
167  SELECT CASE( variableindex )
168  CASE( rvav_rho )
169  ev( is, js, ks ) = cv(cv_mixt_dens, ic)
170 
171  CASE( rvav_rhou )
172  ev( is, js, ks ) = cv(cv_mixt_xmom, ic)
173 
174  CASE( rvav_rhov )
175  ev( is, js, ks ) = cv(cv_mixt_ymom, ic)
176 
177  CASE( rvav_rhow )
178  ev( is, js, ks ) = cv(cv_mixt_zmom, ic)
179 
180  CASE( rvav_rhoet )
181  ev( is, js, ks ) = cv(cv_mixt_ener, ic)
182 
183  CASE( rvav_u )
184  ev( is, js, ks ) = cv(cv_mixt_xmom, ic)/cv(cv_mixt_dens, ic)
185 
186  CASE( rvav_v )
187  ev( is, js, ks ) = cv(cv_mixt_ymom, ic)/cv(cv_mixt_dens, ic)
188 
189  CASE( rvav_w )
190  ev( is, js, ks ) = cv(cv_mixt_zmom, ic)/cv(cv_mixt_dens, ic)
191 
192  CASE( rvav_p )
193  rhoq = 0.5_rfreal* &
194  ( 1.0_rfreal/cv(cv_mixt_dens,ic) )* &
195  ( cv(cv_mixt_xmom,ic)*cv(cv_mixt_xmom,ic) + &
196  cv(cv_mixt_ymom,ic)*cv(cv_mixt_ymom,ic) + &
197  cv(cv_mixt_zmom,ic)*cv(cv_mixt_zmom,ic) )
198  ev( is, js, ks ) = ( gamma-1._rfreal )* &
199  ( cv(cv_mixt_ener, ic) - rhoq )
200 
201  CASE( rvav_t )
202  rhoq = 0.5_rfreal* &
203  ( 1.0_rfreal/cv(cv_mixt_dens,ic) )* &
204  ( cv(cv_mixt_xmom,ic)*cv(cv_mixt_xmom,ic) + &
205  cv(cv_mixt_ymom,ic)*cv(cv_mixt_ymom,ic) + &
206  cv(cv_mixt_zmom,ic)*cv(cv_mixt_zmom,ic) )
207  pressure = ( gamma-1._rfreal )* &
208  ( cv(cv_mixt_ener, ic) - rhoq )
209  ev( is, js, ks ) = pressure/( cv(cv_mixt_dens, ic)*rgas )
210 
211  CASE( rvav_tstag )
212  rhoq = 0.5_rfreal* &
213  ( 1.0_rfreal/cv(cv_mixt_dens,ic) )* &
214  ( cv(cv_mixt_xmom,ic)*cv(cv_mixt_xmom,ic) + &
215  cv(cv_mixt_ymom,ic)*cv(cv_mixt_ymom,ic) + &
216  cv(cv_mixt_zmom,ic)*cv(cv_mixt_zmom,ic) )
217  pressure = ( gamma-1._rfreal )* &
218  ( cv(cv_mixt_ener, ic) - rhoq )
219  temperature = pressure/( cv(cv_mixt_dens, ic)*rgas )
220  sound_speed = sqrt(gamma*rgas*temperature)
221  mach_number = sqrt(2.0_rfreal*rhoq/cv(cv_mixt_dens,ic))/sound_speed
222  ev( is, js, ks ) = (1.0_rfreal + &
223  0.5_rfreal*(gamma-1.0_rfreal)* &
224  mach_number*mach_number)*&
225  temperature
226 
227  CASE( rvav_pstag )
228  rhoq = 0.5_rfreal* &
229  ( 1.0_rfreal/cv(cv_mixt_dens,ic) )* &
230  ( cv(cv_mixt_xmom,ic)*cv(cv_mixt_xmom,ic) + &
231  cv(cv_mixt_ymom,ic)*cv(cv_mixt_ymom,ic) + &
232  cv(cv_mixt_zmom,ic)*cv(cv_mixt_zmom,ic) )
233  pressure = ( gamma-1._rfreal )* &
234  ( cv(cv_mixt_ener, ic) - rhoq )
235  temperature = pressure/( cv(cv_mixt_dens, ic)*rgas )
236  sound_speed = sqrt(gamma*rgas*temperature)
237  mach_number = sqrt(2.0_rfreal*rhoq/cv(cv_mixt_dens,ic))/sound_speed
238  ev( is, js, ks ) = 1.0_rfreal + &
239  0.5_rfreal*(gamma-1.0_rfreal)* &
240  mach_number*mach_number
241  ev( is, js, ks ) = (ev( is, js, ks)**(gamma/(gamma-1.0_rfreal)))*&
242  pressure
243  END SELECT
244  END IF ! fileType
245 
246 ! - For Analytical and Experimental Extract as is while shifting cv by 3.
247 
248  IF ( filetype == file_analytical .OR. &
249  filetype == file_experimental ) THEN
250 
251  ev( is, js, ks ) = cv(variableindex-zcoord,ic)
252 
253  END IF ! fileType
254 
255 
256 ! ... DO NOT DEALLOCATE ev. It is a pointer that is required outside this code
257 ! ... No derived variables such as entropy and vorticity.
258 
259  ENDDO
260  ENDDO
261  ENDDO
262 
263 ! finalize --------------------------------------------------------------------
264 
265  CALL deregisterfunction( global )
266 
267 END SUBROUTINE rvav_extractvariables
268 
269 !******************************************************************************
270 !
271 ! RCS Revision history:
272 !
273 ! $Log: RVAV_ExtractVariables.F90,v $
274 ! Revision 1.3 2008/12/06 08:45:08 mtcampbe
275 ! Updated license.
276 !
277 ! Revision 1.2 2008/11/19 22:18:18 mtcampbe
278 ! Added Illinois Open Source License/Copyright
279 !
280 ! Revision 1.1 2004/12/01 22:43:21 fnajjar
281 ! Initial revision after changing case
282 !
283 ! Revision 1.11 2003/11/21 23:40:45 fnajjar
284 ! Remove quotes from comment lines as it confuses the compiler
285 !
286 ! Revision 1.10 2003/11/20 16:40:41 mdbrandy
287 ! Backing out RocfluidMP changes from 11-17-03
288 !
289 ! Revision 1.6 2003/05/15 02:57:08 jblazek
290 ! Inlined index function.
291 !
292 ! Revision 1.5 2002/09/10 00:01:45 f-najjar
293 ! Variable global moved into regions()
294 !
295 ! Revision 1.4 2002/06/24 15:50:10 f-najjar
296 ! Fixed Offset for Blasius
297 !
298 ! Revision 1.3 2002/06/19 20:22:40 f-najjar
299 ! Cleaned unnecessary PRINT statement
300 !
301 ! Revision 1.2 2002/06/15 17:28:52 f-najjar
302 ! Bug Fix of iOffSet and ijOffset
303 !
304 ! Revision 1.1.1.1 2002/06/03 21:41:29 f-najjar
305 ! Initial Import of RocVaV
306 !
307 
308 
309 
310 
311 
312 
313 
**********************************************************************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 ibeg
subroutine rvav_extractvariables(global, region, ibeg, iend, ijump, jbeg, jend, jjump, kbeg, kend, kjump, iCOff, ijCOff, variableIndex, fileType, indCp, indMol, ev)
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
**********************************************************************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 ic
double sqrt(double d)
Definition: double.h:73
**********************************************************************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 knode iend
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 knode jend
**********************************************************************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 knode jbeg
subroutine grid(bp)
Definition: setup_py.f90:257
**********************************************************************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 knode kbeg
subroutine deregisterfunction(global)
Definition: ModError.F90:469