Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BcondOutflowPerf_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 outflow boundary condition for one cell for gas-liquid model.
26 !
27 ! Description:
28 !
29 ! Input:
30 ! bcOpt boundary treatment: subsonic, supersonic, or mixed
31 ! betaP compressibility at const. pressure
32 ! betaT compressibility at const. temperature
33 ! cvg specific heat of gas at constant volume (boundary cell)
34 ! cvl specific heat of liquid at constant volume (boundary cell)
35 ! cvv specific heat of vapor at constant volume (boundary cell)
36 ! pin static pressure at boundary cell
37 ! Po reference pressure
38 ! ro reference density
39 ! To reference Temperature
40 ! pout given static outlet pressure
41 ! Rg gas constant
42 ! Rv vapor constant
43 ! rho density at boundary cell
44 ! rhoe density * total energy at boundary cell
45 ! rhou/v/w density * velocity components at boundary cell
46 ! rhogpg density of gas * volume fraction of gas at boundary cell
47 ! rhovpv density of vapor * volume fraction of vapor at boundary cell
48 ! sx/y/zn components of ortho-normalized face vector (outward facing)
49 !
50 ! Output:
51 ! rhob density at boundary
52 ! rhou/v/wb density * velocity components at boundary
53 ! rhoeb density * total energy at boundary
54 ! rhogpgb density of gas * volume fraction of gas at boundary
55 ! rhovpvb density of vapor * volume fraction of vapor at boundary
56 !
57 ! Notes: None.
58 !
59 ! *****************************************************************************
60 !
61 ! $Id: BcondOutflowPerf_GL.F90,v 1.3 2008/12/06 08:44:08 mtcampbe Exp $
62 !
63 ! Copyright: (c) 2006 by the University of Illinois
64 !
65 ! *****************************************************************************
66 
67 SUBROUTINE bcondoutflowperf_gl(bcOpt,ro,Po,To,betaP,betaT,cvl,cvv,cvg,Rg,Rv, &
68  pout,sxn,syn,szn,rho,rhou,rhov,rhow,rhoe, &
69  rhogpg,rhovpv,pin,rhob,rhoub,rhovb,rhowb, &
70  rhoeb,rhogpgb,rhovpvb)
71 
72  USE moddatatypes
73  USE modparameters
74  USE modinterfaces, ONLY: mixtgasliq_c, &
75  mixtliq_c2_bp, &
80 
81  IMPLICIT NONE
82 
83 ! ******************************************************************************
84 ! Declarations and definitions
85 ! ******************************************************************************
86 
87 ! ==============================================================================
88 ! Arguments
89 ! ==============================================================================
90 
91  INTEGER :: bcopt
92  REAL(RFREAL), INTENT(IN) :: betap,betat,cvg,cvl,cvv,pin,po,pout,rg,rho,rhoe, &
93  rhogpg,rhou,rhov,rhovpv,rhow,ro,rv,sxn,syn,szn,to
94  REAL(RFREAL), INTENT(OUT) :: rhob,rhoeb,rhogpgb,rhoub,rhovb,rhovpvb,rhowb
95 
96 ! ==============================================================================
97 ! Locals
98 ! ==============================================================================
99 
100  REAL(RFREAL) :: bg2,bl2,bv2,cg2,cl2,cm,ct2,cv2,cvm,deltp,e,fg,fv,ic2p,ic2pb, &
101  mach,rhg,rhgb,rhl,rhlb,rholpl,rhv,rhvb,rrhoc,t,tb,u,ub,v,vb, &
102  vel2,vfg,vfgb,vfl,vflb,vfv,vfvb,vnd,w,wb
103 
104 ! ******************************************************************************
105 ! Start
106 ! ******************************************************************************
107 
108  u = rhou/rho
109  v = rhov/rho
110  w = rhow/rho
111  vel2 = (u*u + v*v + w*w)
112 
113  rholpl = rho - rhovpv - rhogpg
114  cvm = (rholpl*cvl + rhovpv*cvv + rhogpg*cvg)/rho
115  e = rhoe/rho
116  t = mixtperf_t_cveovm2(cvm,e,vel2)
117 
118  cl2 = mixtliq_c2_bp(betap)
119  cv2 = mixtperf_c2_grt(1.0_rfreal,rv,t)
120  cg2 = mixtperf_c2_grt(1.0_rfreal,rg,t)
121 
122  rhl = mixtliq_d_dobpppobttto(ro,betap,betat,pin,po,t,to)
123  rhv = mixtperf_d_prt(pin,rv,t)
124  rhg = mixtperf_d_prt(pin,rg,t)
125 
126  bl2 = -betat/betap
127  bv2 = rhv*rv
128  bg2 = rhg*rg
129 
130  vfl = rholpl/rhl
131  vfv = rhovpv/rhv
132  vfg = rhogpg/rhg
133  cm = mixtgasliq_c(cvm,rho,pin,rhl,rhv,rhg,vfl,vfv,vfg,cl2,cv2,cg2, &
134  bl2,bv2,bg2)
135  mach = sqrt(vel2)/cm
136 
137 ! *****************************************************************************
138 ! Subsonic outflow
139 ! *****************************************************************************
140 
141  IF ( mach < 1.0_rfreal ) THEN
142  rrhoc = 1.0_rfreal/(rho*cm)
143  deltp = pin - pout
144  ub = u + sxn*deltp*rrhoc
145  vb = v + syn*deltp*rrhoc
146  wb = w + szn*deltp*rrhoc
147 
148  tb = t - (deltp*pin)/(rho*rho*cvm*cm*cm)
149  fg = (vfg*(rhg*cg2 - rho*cm*cm +(bg2*pin)/(rho*cvm)))/(rhg*cg2*rho*cm*cm)
150  fv = (vfv*(rhv*cv2 - rho*cm*cm +(bv2*pin)/(rho*cvm)))/(rhv*cv2*rho*cm*cm)
151 
152  vfgb = vfg - deltp*fg
153  vfvb = vfv - deltp*fv
154  vflb = 1.0_rfreal - vfgb - vfvb
155 
156  ic2p = vfl/cl2 + vfg/cg2 + vfv/cv2
157  ic2pb = (bl2*vfl)/cl2 + (bg2*vfg)/cg2 + (bv2*vfv)/cv2
158 
159  rhob = rho - (rhv-rhl)*(vfl-vflb) - (rhg-rhl)*(vfg-vfgb) &
160  - deltp*ic2p + ic2pb*(t-tb)
161  rhlb = rhl - deltp/cl2 + (bl2*(t-tb))/cl2
162  rhvb = rhv - deltp/cv2 + (bv2*(t-tb))/cv2
163  rhgb = rhg - deltp/cg2 + (bg2*(t-tb))/cg2
164 
165 ! =============================================================================
166 ! Special treatment to prevent "deltp" from changing the sign of velocity
167 ! components. This may happen for very small u, v, w.
168 ! =============================================================================
169 
170  vnd = ub*sxn + vb*syn + wb*szn
171 
172  IF ( vnd < 0.0_rfreal ) THEN ! inflow at outflow boundary
173  ub = sign(1.0_rfreal,u)*max(abs(ub),abs(u))
174  vb = sign(1.0_rfreal,v)*max(abs(vb),abs(v))
175  wb = sign(1.0_rfreal,w)*max(abs(wb),abs(w))
176  END IF ! vnd
177 
178  rhoub = rhob*ub
179  rhovb = rhob*vb
180  rhowb = rhob*wb
181  rhoeb = (rhlb*vflb*cvl +rhgb*vfgb*cvg +rhvb*vfvb*cvv)*tb + &
182  0.5_rfreal*rhob*(ub*ub + vb*vb + wb*wb)
183  rhogpgb = rhgb*vfgb
184  rhovpvb = rhvb*vfvb
185 
186 ! *****************************************************************************
187 ! Supersonic flow
188 ! *****************************************************************************
189 
190  ELSE
191  rhob = rho
192  rhoub = rhou
193  rhovb = rhov
194  rhowb = rhow
195  rhoeb = rhoe
196  rhogpgb = rhogpg
197  rhovpvb = rhovpv
198  END IF ! mach
199 
200 ! *****************************************************************************
201 ! End
202 ! *****************************************************************************
203 
204 END SUBROUTINE bcondoutflowperf_gl
205 
206 ! *****************************************************************************
207 !
208 ! RCS Revision history:
209 !
210 ! $Log: BcondOutflowPerf_GL.F90,v $
211 ! Revision 1.3 2008/12/06 08:44:08 mtcampbe
212 ! Updated license.
213 !
214 ! Revision 1.2 2008/11/19 22:17:22 mtcampbe
215 ! Added Illinois Open Source License/Copyright
216 !
217 ! Revision 1.1 2006/03/26 20:20:45 haselbac
218 ! Initial revision
219 !
220 ! *****************************************************************************
221 
222 
223 
224 
225 
226 
static SURF_BEGIN_NAMESPACE double sign(double x)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
real(rfreal) function mixtperf_d_prt(P, R, T)
Definition: MixtPerf_D.F90:71
double sqrt(double d)
Definition: double.h:73
*********************************************************************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
blockLoc pin(const blockLoc &l) const
Definition: split.cpp:77
real(rfreal) function mixtliq_d_dobpppobttto(Dz, Bp, Bt, P, Po, T, To)
Definition: MixtLiq_D.F90:40
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
subroutine bcondoutflowperf_gl(bcOpt, ro, Po, To, betaP, betaT, cvl, cvv, cvg, Rg, Rv, pout, sxn, syn, szn, rho, rhou, rhov, rhow, rhoe, rhogpg, rhovpv, pin, rhob, rhoub, rhovb, rhowb, rhoeb, rhogpgb, rhovpvb)