Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RFLU_ComputeVertexVariables.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 variables other than conserved variables at vertices.
26 !
27 ! Description: None.
28 !
29 ! Input:
30 ! pRegion Pointer to region data
31 !
32 ! Output: None.
33 !
34 ! Notes:
35 ! 1. This routine should only be used to compute variables at vertices
36 ! which can be computed exclusively from variables already interpolated
37 ! to vertices.
38 !
39 ! ******************************************************************************
40 !
41 ! $Id: RFLU_ComputeVertexVariables.F90,v 1.11 2008/12/06 08:45:05 mtcampbe Exp $
42 !
43 ! Copyright: (c) 2003-2006 by the University of Illinois
44 !
45 ! ******************************************************************************
46 
47 SUBROUTINE rflu_computevertexvariables(pRegion)
48 
49  USE moddatatypes
50  USE modglobal, ONLY: t_global
51  USE modparameters
52  USE moderror
53  USE moddatastruct, ONLY: t_region
54  USE modgrid, ONLY: t_grid
55 
56  USE modinterfaces, ONLY: mixtgasliq_c, &
57  mixtgasliq_p, &
58  mixtliq_c2_bp, &
60  mixtperf_c_dgp, &
65  mixtperf_g_cpr, &
67  mixtperf_r_m, &
70 
71  IMPLICIT NONE
72 
73 ! ******************************************************************************
74 ! Declarations and definitions
75 ! ******************************************************************************
76 
77 ! ==============================================================================
78 ! Arguments
79 ! ==============================================================================
80 
81  TYPE(t_region), POINTER :: pregion
82 
83 ! ==============================================================================
84 ! Local variables
85 ! ==============================================================================
86 
87  CHARACTER(CHRLEN) :: rcsidentstring
88  INTEGER :: indcp,indmol,ivg
89  REAL(RFREAL) :: bg2,bl2,bp,bt,bv2,cg2,cl2,cv2,cp,cvg,cvl,cvm,cvv,eo,g,gc, &
90  ir,mw,p,po,r,reo,rg,rgas,rl,ro,ru,rv,rvap,rw,ryg,ryl,ryv, &
91  to,u,v,vfg,vfl,vfv,vm2,w
92  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcv,pdv,pgv
93 #ifdef SPEC
94  REAL(RFREAL), DIMENSION(:,:), POINTER :: pcvspec
95 #endif
96  TYPE(t_global), POINTER :: global
97  TYPE(t_grid), POINTER :: pgrid
98 
99 ! ******************************************************************************
100 ! Start
101 ! ******************************************************************************
102 
103  rcsidentstring = '$RCSfile: RFLU_ComputeVertexVariables.F90,v $ $Revision: 1.11 $'
104 
105  global => pregion%global
106 
107  CALL registerfunction(global,'RFLU_ComputeVertexVariables', &
108  'RFLU_ComputeVertexVariables.F90')
109 
110  IF ( global%verbLevel > verbose_none ) THEN
111  WRITE(stdout,'(A,1X,A)') solver_name,'Computing vertex variables...'
112  END IF ! global%verbLevel
113 
114 ! ******************************************************************************
115 ! Set pointers and variables
116 ! ******************************************************************************
117 
118  pgrid => pregion%grid
119 
120  pcv => pregion%mixt%cvVert ! NOTE vertex variables
121  pdv => pregion%mixt%dvVert
122  pgv => pregion%mixt%gvVert
123 
124 #ifdef SPEC
125  pcvspec => pregion%spec%cvVert
126 #endif
127 
128  indcp = pregion%mixtInput%indCp
129  indmol = pregion%mixtInput%indMol
130 
131 ! ******************************************************************************
132 ! Compute dependent variables
133 ! ******************************************************************************
134 
135  SELECT CASE ( pregion%mixtInput%fluidModel )
136 
137 ! ==============================================================================
138 ! Incompressible fluid model
139 ! ==============================================================================
140 
141  CASE ( fluid_model_incomp )
142 
143 ! ==============================================================================
144 ! Compressible fluid model. NOTE check state of solution vector.
145 ! ==============================================================================
146 
147  CASE ( fluid_model_comp )
148  IF ( pregion%mixt%cvState /= cv_mixt_state_cons ) THEN
149  CALL errorstop(global,err_cv_state_invalid,__line__)
150  END IF ! pRegion%mixt%cvState
151 
152  SELECT CASE ( pregion%mixtInput%gasModel )
153 
154 ! ------------------------------------------------------------------------------
155 ! Gas models without liquid phase
156 ! ------------------------------------------------------------------------------
157 
158  CASE ( gas_model_tcperf, &
159  gas_model_tperf, &
160  gas_model_mixt_tcperf, &
161  gas_model_mixt_tperf, &
162  gas_model_mixt_pseudo )
163  DO ivg = 1,pgrid%nVertTot
164  r = pcv(cv_mixt_dens,ivg)
165  ru = pcv(cv_mixt_xmom,ivg)
166  rv = pcv(cv_mixt_ymom,ivg)
167  rw = pcv(cv_mixt_zmom,ivg)
168  reo = pcv(cv_mixt_ener,ivg)
169 
170  ir = 1.0_rfreal/r
171  u = ir*ru
172  v = ir*rv
173  w = ir*rw
174  eo = ir*reo
175  vm2 = u*u + v*v + w*w
176 
177  cp = pgv(gv_mixt_cp ,indcp *ivg)
178  mw = pgv(gv_mixt_mol,indmol*ivg)
179 
180  gc = mixtperf_r_m(mw)
181  g = mixtperf_g_cpr(cp,gc)
182 
183  p = mixtperf_p_deogvm2(r,eo,g,vm2)
184 
185  pdv(dv_mixt_pres,ivg) = p
186  pdv(dv_mixt_temp,ivg) = mixtperf_t_dpr(r,p,gc)
187  pdv(dv_mixt_soun,ivg) = mixtperf_c_dgp(r,g,p)
188  END DO ! ivg
189 
190 ! ------------------------------------------------------------------------------
191 ! Mixture of gas, liquid, and vapor
192 ! ------------------------------------------------------------------------------
193 
194  CASE ( gas_model_mixt_gasliq )
195 #ifdef SPEC
196  IF ( pregion%mixt%cvState /= cv_mixt_state_cons ) THEN
197  CALL errorstop(global,err_cv_state_invalid,__line__)
198  END IF ! pRegion%mixt%cvState
199 
200  ro = global%refDensityLiq
201  po = global%refPressLiq
202  to = global%refTempLiq
203  bp = global%refBetaPLiq
204  bt = global%refBetaTLiq
205  cvl = global%refCvLiq
206 
207  rgas = mixtperf_r_m(pregion%specInput%specType(1)%pMaterial%molw)
208  cvg = mixtperf_cv_cpr(pregion%specInput%specType(1)%pMaterial%spht, &
209  rgas)
210 
211  rvap = mixtperf_r_m(pregion%specInput%specType(2)%pMaterial%molw)
212  cvv = mixtperf_cv_cpr(pregion%specInput%specType(2)%pMaterial%spht, &
213  rvap)
214 
215  DO ivg = 1,pgrid%nVertTot
216  r = pcv(cv_mixt_dens,ivg)
217  ru = pcv(cv_mixt_xmom,ivg)
218  rv = pcv(cv_mixt_ymom,ivg)
219  rw = pcv(cv_mixt_zmom,ivg)
220  reo = pcv(cv_mixt_ener,ivg)
221 
222  ir = 1.0_rfreal/r
223  u = ir*ru
224  v = ir*rv
225  w = ir*rw
226  eo = ir*reo
227  vm2 = u*u + v*v + w*w
228 
229  ryg = pcvspec(1,ivg)
230  ryv = pcvspec(2,ivg)
231  ryl = r - ryg - ryv
232 
233  cvm = (ryl*cvl + ryv*cvv + ryg*cvg)/r
234 
235  pdv(dv_mixt_temp,ivg) = mixtperf_t_cveovm2(cvm,eo,vm2)
236 
237  cl2 = mixtliq_c2_bp(bp)
238  cv2 = mixtperf_c2_grt(1.0_rfreal,rvap,pdv(dv_mixt_temp,ivg))
239  cg2 = mixtperf_c2_grt(1.0_rfreal,rgas,pdv(dv_mixt_temp,ivg))
240 
241  pdv(dv_mixt_pres,ivg) = mixtgasliq_p(ryl,ryv,ryg,cl2,cv2,cg2,r,ro, &
242  po,to,bp,bt, &
243  pdv(dv_mixt_temp,ivg))
244  rl = mixtliq_d_dobpppobttto(ro,bp,bt,pdv(dv_mixt_pres,ivg),po, &
245  pdv(dv_mixt_temp,ivg),to)
246  rv = mixtperf_d_prt(pdv(dv_mixt_pres,ivg),rvap,pdv(dv_mixt_temp,ivg))
247  rg = mixtperf_d_prt(pdv(dv_mixt_pres,ivg),rgas,pdv(dv_mixt_temp,ivg))
248 
249  vfg = ryg/rg
250  vfv = ryv/rv
251  vfl = 1.0_rfreal - vfg - vfv
252 
253  bl2 = -bt/bp
254  bv2 = rv*rvap
255  bg2 = rg*rgas
256 
257  pdv(dv_mixt_soun,ivg) = mixtgasliq_c(cvm,r,pdv(dv_mixt_pres,ivg), &
258  rl,rv,rg,vfl,vfv,vfg,cl2,cv2, &
259  cg2,bl2,bv2,bg2)
260  END DO ! ivg
261 #else
262  CALL errorstop(global,err_reached_default,__line__)
263 #endif
264  CASE default
265  CALL errorstop(global,err_reached_default,__line__)
266  END SELECT ! pRegion%mixt%gasModel
267 
268 ! ==============================================================================
269 ! Default
270 ! ==============================================================================
271 
272  CASE default
273  CALL errorstop(global,err_reached_default,__line__)
274  END SELECT ! pRegion%mixtInput%fluidModel
275 
276 ! ******************************************************************************
277 ! End
278 ! ******************************************************************************
279 
280  IF ( global%verbLevel > verbose_none ) THEN
281  WRITE(stdout,'(A,1X,A)') solver_name,'Computing vertex variables done.'
282  END IF ! global%verbLevel
283 
284  CALL deregisterfunction(global)
285 
286 END SUBROUTINE rflu_computevertexvariables
287 
288 ! ******************************************************************************
289 !
290 ! RCS Revision history:
291 !
292 ! $Log: RFLU_ComputeVertexVariables.F90,v $
293 ! Revision 1.11 2008/12/06 08:45:05 mtcampbe
294 ! Updated license.
295 !
296 ! Revision 1.10 2008/11/19 22:18:16 mtcampbe
297 ! Added Illinois Open Source License/Copyright
298 !
299 ! Revision 1.9 2006/04/07 15:19:26 haselbac
300 ! Removed tabs
301 !
302 ! Revision 1.8 2006/03/26 20:28:45 haselbac
303 ! Added support for GL model
304 !
305 ! Revision 1.7 2005/11/10 02:47:15 haselbac
306 ! Added support for variable properties
307 !
308 ! Revision 1.6 2005/10/31 21:09:39 haselbac
309 ! Changed specModel and SPEC_MODEL_NONE
310 !
311 ! Revision 1.5 2004/11/14 19:56:57 haselbac
312 ! Added setting of vertex variables for various fluid models
313 !
314 ! Revision 1.4 2003/12/04 03:32:59 haselbac
315 ! Added missing description of input argument
316 !
317 ! Revision 1.3 2003/11/25 21:03:54 haselbac
318 ! Added clarifying comment under Notes
319 !
320 ! Revision 1.2 2003/03/20 20:07:19 haselbac
321 ! Modified RegFun call to avoid probs with long 'RFLU_ComputeVertexVariables.F90' names
322 !
323 ! Revision 1.1 2003/03/15 19:16:54 haselbac
324 ! Initial revision
325 !
326 ! ******************************************************************************
327 
328 
329 
330 
331 
332 
333 
334 
unsigned char r() const
Definition: Color.h:68
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 rflu_computevertexvariables(pRegion)
real(rfreal) function mixtperf_c_dgp(D, G, P)
Definition: MixtPerf_C.F90:56
subroutine registerfunction(global, funName, fileName)
Definition: ModError.F90:449
real(rfreal) function mixtperf_d_prt(P, R, T)
Definition: MixtPerf_D.F90:71
real(rfreal) function mixtgasliq_p(DYl, DYv, DYg, Cl2, Cv2, Cg2, D, Dz, Po, To, Bp, Bt, T)
*********************************************************************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_c2_grt(G, R, T)
Definition: MixtPerf_C.F90:101
real(rfreal) function mixtliq_c2_bp(Bp)
Definition: MixtLiq_C.F90:54
real(rfreal) function mixtperf_t_dpr(D, P, R)
Definition: MixtPerf_T.F90:85
real(rfreal) function mixtliq_d_dobpppobttto(Dz, Bp, Bt, P, Po, T, To)
Definition: MixtLiq_D.F90:40
real(rfreal) function mixtperf_c_grt(G, R, T)
Definition: MixtPerf_C.F90:86
real(rfreal) function mixtgasliq_c(Cvm, D, P, Dl, Dv, Dg, VFl, VFv, VFg, Cl2, Cv2, Cg2, Bl2, Bv2, Bg2)
subroutine errorstop(global, errorCode, errorLine, addMessage)
Definition: ModError.F90:483
real(rfreal) function mixtperf_t_cveovm2(Cv, Eo, Vm2)
Definition: MixtPerf_T.F90:70
subroutine deregisterfunction(global)
Definition: ModError.F90:469
real(rfreal) function mixtperf_g_cpr(Cp, R)
Definition: MixtPerf_G.F90:39
real(rfreal) function mixtperf_cv_cpr(Cp, R)
Definition: MixtPerf_Cv.F90:39
unsigned char g() const
Definition: Color.h:69