Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TURB_fluCv2Cons.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: Convert primitive state vector to consverved variables.
26 !
27 ! Description: None.
28 !
29 ! Input: region = Pointer to data of current region
30 ! cvStateFuture = Future state of conserved variables
31 !
32 ! Output: None.
33 !
34 ! Notes:
35 ! 1. Strictly speaking, cvStateFuture is not needed (there is only one
36 ! state for conserved variables), but kept for consistency with
37 ! TURB_FluCv2Prim.
38 !
39 !******************************************************************************
40 
41 SUBROUTINE turb_flucv2cons(pRegion,cvStateFuture)
42 
43  USE moddatatypes
44  USE modglobal, ONLY : t_global
45  USE moddatastruct, ONLY: t_region
46  USE modgrid, ONLY : t_grid
48  USE modparameters
49  USE moderror
50  IMPLICIT NONE
51 
52 ! =============================================================================
53 ! Arguments
54 ! =============================================================================
55 
56  TYPE(t_region), TARGET :: pregion
57  INTEGER, INTENT(IN) :: cvstatefuture
58 
59 ! =============================================================================
60 ! Locals
61 ! =============================================================================
62 
63  CHARACTER(CHRLEN) :: rcsidentstring
64  INTEGER :: ic,indcp,indmol
65  REAL(RFREAL) :: cp,g,mol,p,r,rgas,u,v,w
66  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcv,pdv,pgv
67  TYPE(t_grid), POINTER :: pgrid
68  TYPE(t_global), POINTER :: global
69 
70 ! *****************************************************************************
71 ! Start
72 ! *****************************************************************************
73 
74  rcsidentstring = '$RCSfile: TURB_fluCv2Cons.F90,v $ $Revision: 1.4 $'
75 
76  global => pregion%global
77 
78  CALL registerfunction(global,'TURB_FluCv2Cons',&
79  'TURB_fluCv2Cons.F90')
80 
81 ! *****************************************************************************
82 ! Set pointers and variables
83 ! *****************************************************************************
84 
85  pgrid => pregion%grid
86  pcv => pregion%mixt%cv
87  pdv => pregion%mixt%dv
88  pgv => pregion%mixt%gv
89 
90  indcp = pregion%mixtInput%indCp
91  indmol = pregion%mixtInput%indMol
92 
93 ! *****************************************************************************
94 ! Actual conversion
95 ! *****************************************************************************
96 
97  IF ( pregion%mixt%cvState == cv_mixt_state_duvwp .OR. &
98  pregion%mixt%cvState == cv_mixt_state_duvwt ) THEN
99 
100 ! =============================================================================
101 ! Convert from primitive to conservative form
102 ! =============================================================================
103 
104  SELECT CASE (cvstatefuture)
105  CASE (cv_mixt_state_cons)
106  pregion%mixt%cvState = cv_mixt_state_cons
107 
108  SELECT CASE (pregion%mixtInput%gasModel)
109 
110 ! ------- Perfect gas
111 
112  CASE (gas_model_tcperf)
113  DO ic = 1,pgrid%nCellsTot
114  r = pcv(cv_mixt_dens,ic)
115  u = pcv(cv_mixt_xvel,ic)
116  v = pcv(cv_mixt_yvel,ic)
117  w = pcv(cv_mixt_zvel,ic)
118  p = pdv(dv_mixt_pres,ic)
119 
120  pcv(cv_mixt_xmom,ic) = r*u
121  pcv(cv_mixt_ymom,ic) = r*v
122  pcv(cv_mixt_zmom,ic) = r*w
123 
124  cp = pgv(gv_mixt_cp,indcp*ic)
125  mol = pgv(gv_mixt_mol,indmol*ic)
126  rgas = mixtperf_r_m(mol)
127  g = mixtperf_g_cpr(cp,rgas)
128 
129  pcv(cv_mixt_ener,ic) = r*mixtperf_eo_dgpuvw(r,g,p,u,v,w)
130  END DO ! ic
131 
132 ! ------- Other or invalid gas models
133 
134  CASE default
135  CALL errorstop(global,err_reached_default,__line__)
136  END SELECT ! pRegion%mixtInput
137 
138  CASE default
139  CALL errorstop(global,err_reached_default,__line__)
140  END SELECT ! cvStateFuture
141 
142 ! =============================================================================
143 ! Error - invalid input
144 ! =============================================================================
145 
146  ELSE
147  CALL errorstop(global,err_reached_default,__line__)
148  END IF ! pRegion%mixt%cvState
149 
150 ! *****************************************************************************
151 ! End
152 ! *****************************************************************************
153 
154  CALL deregisterfunction(global)
155 
156 END SUBROUTINE turb_flucv2cons
157 
158 
159 ! ******************************************************************************
160 !
161 ! RCS Revision history:
162 !
163 ! $Log: TURB_fluCv2Cons.F90,v $
164 ! Revision 1.4 2008/12/06 08:44:44 mtcampbe
165 ! Updated license.
166 !
167 ! Revision 1.3 2008/11/19 22:17:56 mtcampbe
168 ! Added Illinois Open Source License/Copyright
169 !
170 ! Revision 1.2 2005/10/31 21:09:37 haselbac
171 ! Changed specModel and SPEC_MODEL_NONE
172 !
173 ! Revision 1.1 2004/03/29 21:10:01 wasistho
174 ! add flu routines
175 !
176 !
177 ! ******************************************************************************
178 
179 
180 
181 
182 
183 
184 
unsigned char r() const
Definition: Color.h:68
subroutine turb_flucv2cons(pRegion, cvStateFuture)
real(rfreal) function mixtperf_r_m(M)
Definition: MixtPerf_R.F90:54
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
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS 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 v
Definition: roccomf90.h:20
real(rfreal) function mixtperf_eo_dgpuvw(D, G, P, U, V, W)
Definition: MixtPerf_E.F90:40
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
subroutine deregisterfunction(global)
Definition: ModError.F90:469
real(rfreal) function mixtperf_g_cpr(Cp, R)
Definition: MixtPerf_G.F90:39
unsigned char g() const
Definition: Color.h:69