Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BcondInflowPerf_GL.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: Set inflow boundary condition for one cell for gas-liquid model.
26 !
27 ! Input:
28 ! bcOptType boundary treatment: subsonic, supersonic, or mixed
29 ! Bp compressibility at const. pressure
30 ! Bt compressibility at const. temperature
31 ! cvg specific heat of gas at constant volume (boundary cell)
32 ! cvl specific heat of liquid at constant volume (boundary cell)
33 ! cvv specific heat of vapor at constant volume (boundary cell)
34 ! po reference pressure
35 ! ro reference density
36 ! to reference Temperature
37 ! rl given density
38 ! rel given energy
39 ! ru/v/wl given velocity components
40 ! nx/y/z components of normalized face vector (outward facing)
41 ! Rg gas constant
42 ! Rv vapor constant
43 ! rgpgl given density of gas * volume fraction of gas
44 ! rvpvl given density of vapor * volume fraction of vapor
45 ! pl given pressure
46 ! press given total pressure
47 ! temp given total temperature
48 !
49 ! Output:
50 ! rr density at boundary
51 ! ru/v/wr density * velocity components at boundary
52 ! rer density * total internal energy at boundary
53 ! rgpgr density of gas * volume fraction of gas at boundary
54 ! rvpvr density of vapor * volume fraction of vapor at boundary
55 ! pr pressure at boundary
56 !
57 ! Notes: None.
58 !
59 ! *****************************************************************************
60 !
61 ! $Id:
62 !
63 ! Copyright: (c) 2006 by the University of Illinois
64 !
65 ! *****************************************************************************
66 
67 SUBROUTINE bcondinflowperf_gl(bcOptType,ro,po,to,Bp,Bt,cvl,cvv,cvg,Rg,Rv,ur,&
68  vr,wr,vfgr,vfvr,vflr,temp,press,nx,ny,nz,rl, &
69  rul,rvl,rwl,rel,rgpgl,rvpvl,pl,rr,rur,rvr, &
70  rwr,rer,rgpgr,rvpvr,pr)
71 
72  USE moddatatypes
73  USE modglobal , ONLY : t_global
74  USE modparameters
75  USE modtools, ONLY : makenonzero
76 
77  USE modinterfaces, ONLY: mixtgasliq_c, &
78  mixtliq_c2_bp, &
83  IMPLICIT NONE
84 
85 ! ******************************************************************************
86 ! Declarations and definitions
87 ! ******************************************************************************
88 
89 ! ==============================================================================
90 ! Arguments
91 ! ==============================================================================
92 
93  INTEGER, INTENT(IN) :: bcopttype
94  REAL(RFREAL), INTENT(IN) :: bp,bt,cvg,cvl,cvv,nx,ny,nz,pl,po,press,rel, &
95  rg,rgpgl,rl,ro,rul,rv,rvl,rvpvl,rwl,temp,to, &
96  ur,vfgr,vflr,vfvr,vr,wr
97  REAL(RFREAL), INTENT(OUT):: pr,rer,rgpgr,rr,rur,rvr,rvpvr,rwr
98  TYPE(t_global), POINTER :: global
99 
100 ! ==============================================================================
101 ! Locals
102 ! ==============================================================================
103 
104  REAL(RFREAL) :: bg2i,bg2l,bl2i,bl2l,bv2i,bv2l,cg2i,cg2l,cl2i,cl2l,cmi,cmi2, &
105  cml,cv2i,cv2l,cvmi,cvml,el,rgi,rhogl,rhogr,rholl,rholr, &
106  rhovl,rhovr,rli,rlpll,rtcvtr,rti,rvi,tl,tr,ul,vfgi,vfgl, &
107  vfli,vfll,vfvi,vfvl,vl,vml2,vmr2,wl
108 
109 ! ******************************************************************************
110 ! Start
111 ! ******************************************************************************
112 
113  rli = mixtliq_d_dobpppobttto(ro,bp,bt,press,po,temp,to)
114  rvi = mixtperf_d_prt(press,rv,temp)
115  rgi = mixtperf_d_prt(press,rg,temp)
116 
117  vfli = vflr
118  vfvi = vfvr
119  vfgi = vfgr
120 
121  cl2i = mixtliq_c2_bp(bp)
122  cv2i = mixtperf_c2_grt(1.0_rfreal,rv,temp)
123  cg2i = mixtperf_c2_grt(1.0_rfreal,rg,temp)
124 
125  bl2i = -bt/bp
126  bv2i = rvi*rv
127  bg2i = rgi*rg
128 
129  rti = rli*vfli + rvi*vfvi + rgi*vfgi
130  cvmi = (rli*vfli*cvl + rvi*vfvi*cvv + rgi*vfgi*cvg)/rti
131  cmi = mixtgasliq_c(cvmi,rti,press,rli,rvi,rgi,vfli,vfvi,vfgi,cl2i, &
132  cv2i,cg2i,bl2i,bv2i,bg2i)
133  cmi2 = cmi*cmi
134  vmr2 = ur*ur + vr*vr + wr*wr
135 
136 ! ==============================================================================
137 ! Supersonic inflow
138 ! ==============================================================================
139 
140  IF ( vmr2 > cmi2 ) THEN
141  rr = rti
142  rur = rr*ur
143  rvr = rr*vr
144  rwr = rr*wr
145  rer = rti*cvmi*temp + 0.5_rfreal*rr*vmr2
146  rgpgr = rgi*vfgi
147  rvpvr = rvi*vfvi
148  pr = press
149 
150 ! ==============================================================================
151 ! Subsonic outflow
152 ! ==============================================================================
153 
154  ELSE
155  ul = rul/rl
156  vl = rvl/rl
157  wl = rwl/rl
158 
159  vml2 = ul*ul + vl*vl + wl*wl
160  rlpll = rl - rvpvl - rgpgl
161  cvml = (rlpll*cvl + rvpvl*cvv + rgpgl*cvg)/rl
162  el = rel/rl
163  tl = mixtperf_t_cveovm2(cvml,el,vml2)
164 
165  rholl = mixtliq_d_dobpppobttto(ro,bp,bt,pl,po,tl,to)
166  rhovl = mixtperf_d_prt(pl,rv,tl)
167  rhogl = mixtperf_d_prt(pl,rg,tl)
168 
169  vfll = rlpll/rholl
170  vfvl = rvpvl/rhovl
171  vfgl = rgpgl/rhogl
172 
173  cl2l = mixtliq_c2_bp(bp)
174  cv2l = mixtperf_c2_grt(1.0_rfreal,rv,tl)
175  cg2l = mixtperf_c2_grt(1.0_rfreal,rg,tl)
176 
177  bl2l = -bt/bp
178  bv2l = rhovl*rv
179  bg2l = rhogl*rg
180  cml = mixtgasliq_c(cvml,rl,pl,rholl,rhovl,rhogl,vfll,vfvl,vfgl,cl2l, &
181  cv2l,cg2l,bl2l,bv2l,bg2l)
182  pr = pl + (sqrt(vmr2) - sqrt(vml2))*rl*cml
183 
184  rholr = mixtliq_d_dobpppobttto(ro,bp,bt,pr,po,temp,to)
185  rhovr = mixtperf_d_prt(pr,rv,temp)
186  rhogr = mixtperf_d_prt(pr,rg,temp)
187 
188  rr = rholr*vflr + rhovr*vfvr + rhogr*vfgr
189  rtcvtr = rholr*vflr*cvl + rhovr*vfvr*cvv + rhogr*vfgr*cvg
190  rer = rtcvtr*temp + 0.5_rfreal*rr*vmr2
191  rur = rr*ur
192  rvr = rr*vr
193  rwr = rr*wr
194  rgpgr = rhogr*vfgr
195  rvpvr = rhovr*vfvr
196  END IF ! vmr2
197 
198 ! ******************************************************************************
199 ! End
200 ! ******************************************************************************
201 
202 END SUBROUTINE bcondinflowperf_gl
203 
204 ! *****************************************************************************
205 !
206 ! RCS Revision history:
207 !
208 ! $Log: BcondInflowPerf_GL.F90,v $
209 ! Revision 1.3 2008/12/06 08:44:08 mtcampbe
210 ! Updated license.
211 !
212 ! Revision 1.2 2008/11/19 22:17:22 mtcampbe
213 ! Added Illinois Open Source License/Copyright
214 !
215 ! Revision 1.1 2006/03/26 20:20:42 haselbac
216 ! Initial revision
217 !
218 ! *****************************************************************************
219 
220 
221 
222 
223 
224 
real(rfreal) function mixtperf_d_prt(P, R, T)
Definition: MixtPerf_D.F90:71
double sqrt(double d)
Definition: double.h:73
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 mixtliq_d_dobpppobttto(Dz, Bp, Bt, P, Po, T, To)
Definition: MixtLiq_D.F90:40
subroutine bcondinflowperf_gl(bcOptType, ro, po, to, Bp, Bt, cvl, cvv, cvg, Rg, Rv, ur, vr, wr, vfgr, vfvr, vflr, temp, press, nx, ny, nz, rl, rul, rvl, rwl, rel, rgpgl, rvpvl, pl, rr, rur, rvr, rwr, rer, rgpgr, rvpvr, pr)
real(rfreal) function mixtgasliq_c(Cvm, D, P, Dl, Dv, Dg, VFl, VFv, VFg, Cl2, Cv2, Cg2, Bl2, Bv2, Bg2)
real(rfreal) function mixtperf_t_cveovm2(Cv, Eo, Vm2)
Definition: MixtPerf_T.F90:70
real(rfreal) function makenonzero(x)
Definition: ModTools.F90:85