Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PerfgasDependentVars.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: compute dependent variables for a thermally and calorically
26 ! perfect gas.
27 !
28 ! Description: none.
29 !
30 ! Input: inBeg = first value to update
31 ! inEnd = last value to update
32 ! indCp = indicates if cp varies over cells (=1) or is constant (=0)
33 ! indMol = indicates if the mol mass varies over cells (=1) or is
34 ! constant (=0)
35 ! cv = conservative variables
36 ! gv = gas variables (cp, Mol)
37 !
38 ! Output: dv = dependent variables (p, T, c and u, v, w for RocfloMP)
39 !
40 ! Notes: none.
41 !
42 !******************************************************************************
43 !
44 ! $Id: PerfgasDependentVars.F90,v 1.3 2008/12/06 08:44:09 mtcampbe Exp $
45 !
46 ! Copyright: (c) 2001 by the University of Illinois
47 !
48 !******************************************************************************
49 
50 SUBROUTINE perfgasdependentvars( inBeg,inEnd,indCp,indMol,cv,gv,dv )
51 
52  USE moddatatypes
53  USE modparameters
54 
55 #ifdef RFLU
58 #endif
59 
60  IMPLICIT NONE
61 
62 ! ... parameters
63  INTEGER :: inbeg, inend, indcp, indmol
64 
65  REAL(RFREAL), POINTER :: cv(:,:), gv(:,:), dv(:,:)
66 
67 ! ... loop variables
68  INTEGER :: ic
69 
70 ! ... local variables
71  REAL(RFREAL) :: rgas,rrho,vm2
72 #ifdef RFLO
73  REAL(RFREAL) :: gam1, g1cp
74 #endif
75 #ifdef RFLU
76  REAL(RFREAL) :: eo,gamma,rho
77 #endif
78 
79 !******************************************************************************
80 
81  DO ic=inbeg,inend
82 #ifdef RFLO
83  rgas = 8314.3_rfreal/gv(gv_mixt_mol,ic*indmol)
84  gam1 = gv(gv_mixt_cp,ic*indcp)/(gv(gv_mixt_cp,ic*indcp)-rgas) - 1._rfreal
85  g1cp = gam1*gv(gv_mixt_cp,ic*indcp)
86  rrho = 1._rfreal/cv(cv_mixt_dens,ic)
87 
88  dv(dv_mixt_uvel,ic) = cv(cv_mixt_xmom,ic)*rrho
89  dv(dv_mixt_vvel,ic) = cv(cv_mixt_ymom,ic)*rrho
90  dv(dv_mixt_wvel,ic) = cv(cv_mixt_zmom,ic)*rrho
91 
92  vm2 = dv(dv_mixt_uvel,ic)*dv(dv_mixt_uvel,ic) + &
93  dv(dv_mixt_vvel,ic)*dv(dv_mixt_vvel,ic) + &
94  dv(dv_mixt_wvel,ic)*dv(dv_mixt_wvel,ic)
95 
96  dv(dv_mixt_pres,ic) = gam1*(cv(cv_mixt_ener,ic)- &
97  0.5_rfreal*vm2*cv(cv_mixt_dens,ic))
98  dv(dv_mixt_temp,ic) = dv(dv_mixt_pres,ic)*rrho/rgas
99  dv(dv_mixt_soun,ic) = sqrt(g1cp*dv(dv_mixt_temp,ic))
100 #endif
101 #ifdef RFLU
102  rgas = mixtperf_r_m(gv(gv_mixt_mol,ic*indmol))
103  gamma = mixtperf_g_cpr(gv(gv_mixt_cp,ic*indcp),rgas)
104 
105  rho = cv(cv_mixt_dens,ic)
106  rrho = 1.0_rfreal/rho
107  eo = cv(cv_mixt_ener,ic)*rrho
108 
109  vm2 = (cv(cv_mixt_xmom,ic)*cv(cv_mixt_xmom,ic) + &
110  cv(cv_mixt_ymom,ic)*cv(cv_mixt_ymom,ic) + &
111  cv(cv_mixt_zmom,ic)*cv(cv_mixt_zmom,ic))*rrho*rrho
112 
113  dv(dv_mixt_pres,ic) = mixtperf_p_deogvm2(rho,eo,gamma,vm2)
114  dv(dv_mixt_temp,ic) = mixtperf_t_dpr(rho,dv(dv_mixt_pres,ic),rgas)
115  dv(dv_mixt_soun,ic) = mixtperf_c_grt(gamma,rgas,dv(dv_mixt_temp,ic))
116 #endif
117  ENDDO
118 
119 END SUBROUTINE perfgasdependentvars
120 
121 !******************************************************************************
122 !
123 ! RCS Revision history:
124 !
125 ! $Log: PerfgasDependentVars.F90,v $
126 ! Revision 1.3 2008/12/06 08:44:09 mtcampbe
127 ! Updated license.
128 !
129 ! Revision 1.2 2008/11/19 22:17:23 mtcampbe
130 ! Added Illinois Open Source License/Copyright
131 !
132 ! Revision 1.1 2004/12/01 16:49:56 haselbac
133 ! Initial revision after changing case
134 !
135 ! Revision 1.12 2003/11/20 16:40:35 mdbrandy
136 ! Backing out RocfluidMP changes from 11-17-03
137 !
138 ! Revision 1.9 2003/05/13 23:46:52 haselbac
139 ! Reverted to use of MixtPerf routines for RFLU
140 !
141 ! Revision 1.8 2003/05/06 20:05:39 jblazek
142 ! Corrected bug in grid motion (corner "averaging").
143 !
144 ! Revision 1.7 2002/07/05 23:20:46 jblazek
145 ! Corrected bug in perfgasDependentVars.F90; did some cosmetics.
146 !
147 ! Revision 1.6 2002/06/05 18:33:00 haselbac
148 ! Converted to use of mixtPerf routines
149 !
150 ! Revision 1.5 2002/03/18 22:25:45 jblazek
151 ! Finished multiblock and MPI.
152 !
153 ! Revision 1.4 2002/02/21 23:25:05 jblazek
154 ! Blocks renamed as regions.
155 !
156 ! Revision 1.3 2002/02/09 01:47:01 jblazek
157 ! Added multi-probe option, residual smoothing, physical time step.
158 !
159 ! Revision 1.2 2002/01/23 03:51:24 jblazek
160 ! Added low-level time-stepping routines.
161 !
162 ! Revision 1.1 2002/01/10 00:02:06 jblazek
163 ! Added calculation of mixture properties.
164 !
165 !******************************************************************************
166 
167 
168 
169 
170 
171 
real(rfreal) function mixtperf_p_deogvm2(D, Eo, G, Vm2)
Definition: MixtPerf_P.F90:39
real(rfreal) function mixtperf_r_m(M)
Definition: MixtPerf_R.F90:54
subroutine perfgasdependentvars(inBeg, inEnd, indCp, indMol, cv, gv, dv)
**********************************************************************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
real(rfreal) function mixtperf_t_dpr(D, P, R)
Definition: MixtPerf_T.F90:85
real(rfreal) function mixtperf_c_grt(G, R, T)
Definition: MixtPerf_C.F90:86
real(rfreal) function mixtperf_g_cpr(Cp, R)
Definition: MixtPerf_G.F90:39