www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
CNSFVRiemannInvariantBCUserObject Class Reference

A user object that computes the ghost cell values based on the Riemann invariant boundary condition. More...

#include <CNSFVRiemannInvariantBCUserObject.h>

Inheritance diagram for CNSFVRiemannInvariantBCUserObject:
[legend]

Public Member Functions

 CNSFVRiemannInvariantBCUserObject (const InputParameters &parameters)
 
virtual std::vector< Real > getGhostCellValue (unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave) const
 compute the ghost cell variable values More...
 
virtual void initialize ()
 
virtual void execute ()
 
virtual void finalize ()
 

Protected Attributes

const SinglePhaseFluidProperties_fp
 
Real _inf_rho
 
Real _inf_uadv
 
Real _inf_vadv
 
Real _inf_wadv
 
Real _inf_pres
 

Detailed Description

A user object that computes the ghost cell values based on the Riemann invariant boundary condition.

Definition at line 23 of file CNSFVRiemannInvariantBCUserObject.h.

Constructor & Destructor Documentation

CNSFVRiemannInvariantBCUserObject::CNSFVRiemannInvariantBCUserObject ( const InputParameters &  parameters)

Definition at line 36 of file CNSFVRiemannInvariantBCUserObject.C.

38  : BCUserObject(parameters),
39  _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties")),
40  _inf_rho(getParam<Real>("infinity_density")),
41  _inf_uadv(getParam<Real>("infinity_x_velocity")),
42  _inf_vadv(getParam<Real>("infinity_y_velocity")),
43  _inf_wadv(getParam<Real>("infinity_z_velocity")),
44  _inf_pres(getParam<Real>("infinity_pressure"))
45 {
46 }
BCUserObject(const InputParameters &parameters)
Definition: BCUserObject.C:18

Member Function Documentation

void BCUserObject::execute ( )
virtualinherited

Definition at line 26 of file BCUserObject.C.

27 {
28 }
void BCUserObject::finalize ( )
virtualinherited

Definition at line 31 of file BCUserObject.C.

32 {
33 }
std::vector< Real > CNSFVRiemannInvariantBCUserObject::getGhostCellValue ( unsigned int  iside,
dof_id_type  ielem,
const std::vector< Real > &  uvec1,
const RealVectorValue &  dwave 
) const
virtual

compute the ghost cell variable values

Parameters
[in]isidelocal index of current side
[in]ielemglobal index of the current element
[in]uvec1vector of variables on the host side
[in]dwavevector of unit normal

pass the inputs to local

compute the local Mach number with state variables on the left

calc the ghost state according to local Mach number

supersonic inflow

subsonic inflow

subsonic outflow

supersonic outflow

Implements BCUserObject.

Definition at line 49 of file CNSFVRiemannInvariantBCUserObject.C.

53 {
55 
56  Real rho1 = uvec1[0];
57  Real rhou1 = uvec1[1];
58  Real rhov1 = uvec1[2];
59  Real rhow1 = uvec1[3];
60  Real rhoe1 = uvec1[4];
61 
62  Real nx = dwave(0);
63  Real ny = dwave(1);
64  Real nz = dwave(2);
65 
66  std::vector<Real> urigh(5, 0.);
67 
69 
70  Real rhom1 = 1. / rho1;
71  Real uadv1 = rhou1 * rhom1;
72  Real vadv1 = rhov1 * rhom1;
73  Real wadv1 = rhow1 * rhom1;
74  Real vdov1 = uadv1 * uadv1 + vadv1 * vadv1 + wadv1 * wadv1;
75  Real eint1 = rhoe1 * rhom1 - 0.5 * vdov1;
76  Real csou1 = _fp.c(rhom1, eint1);
77  Real gamma = _fp.gamma(rhom1, eint1);
78  Real gamm1 = gamma - 1.;
79  Real mach1 = std::sqrt(vdov1) / csou1;
80 
82 
83  if (mach1 <= -1.)
84  {
86 
87  urigh[0] = _inf_rho;
88  urigh[1] = _inf_rho * _inf_uadv;
89  urigh[2] = _inf_rho * _inf_vadv;
90  urigh[3] = _inf_rho * _inf_wadv;
91  urigh[4] =
93  0.5 * (_inf_uadv * _inf_uadv + _inf_vadv * _inf_vadv + _inf_wadv * _inf_wadv));
94  }
95  else if (mach1 > -1. && mach1 <= 0.)
96  {
98 
99  Real inf_eint = _fp.e(_inf_pres, _inf_rho);
100  Real inf_csou = _fp.c(1. / _inf_rho, inf_eint);
101 
102  Real rplus = (uadv1 * nx + vadv1 * ny + wadv1 * nz) + 2. * csou1 / gamm1;
103 
104  Real rmins = (_inf_uadv * nx + _inf_vadv * ny + _inf_wadv * nz) - 2. * inf_csou / gamm1;
105 
106  Real velob = (rplus + rmins) * 0.5;
107 
108  Real csoub = (rplus - rmins) * 0.25 * gamm1;
109 
110  Real vdiff = velob - _inf_uadv * nx - _inf_vadv * ny - _inf_wadv * nz;
111 
112  Real uadvb = _inf_uadv + vdiff * nx;
113  Real vadvb = _inf_vadv + vdiff * ny;
114  Real wadvb = _inf_wadv + vdiff * nz;
115 
116  Real entrb = inf_csou * inf_csou / gamma / std::pow(_inf_rho, gamm1);
117 
118  Real rhob = std::pow(csoub * csoub / gamma / entrb, 1. / gamm1);
119 
120  Real presb = rhob * csoub * csoub / gamma;
121 
122  urigh[0] = rhob;
123  urigh[1] = rhob * uadvb;
124  urigh[2] = rhob * vadvb;
125  urigh[3] = rhob * wadvb;
126  urigh[4] =
127  rhob * _fp.e(presb, rhob) + rhob * 0.5 * (uadvb * uadvb + vadvb * vadvb + wadvb * wadvb);
128  }
129  else if (mach1 > 0. && mach1 < 1.)
130  {
132 
133  Real inf_eint = _fp.e(_inf_pres, _inf_rho);
134  Real inf_csou = _fp.c(1. / _inf_rho, inf_eint);
135 
136  Real rplus = (uadv1 * nx + vadv1 * ny + wadv1 * nz) + 2. * csou1 / gamm1;
137 
138  Real rmins = (_inf_uadv * nx + _inf_vadv * ny + _inf_wadv * nz) - 2. * inf_csou / gamm1;
139 
140  Real velob = (rplus + rmins) * 0.5;
141 
142  Real csoub = (rplus - rmins) * 0.25 * gamm1;
143 
144  Real vdiff = velob - uadv1 * nx - vadv1 * ny - wadv1 * nz;
145 
146  Real uadvb = uadv1 + vdiff * nx;
147  Real vadvb = vadv1 + vdiff * ny;
148  Real wadvb = wadv1 + vdiff * nz;
149 
150  Real entrb = csou1 * csou1 / gamma / std::pow(rho1, gamm1);
151 
152  Real rhob = std::pow(csoub * csoub / gamma / entrb, 1. / gamm1);
153 
154  Real presb = rhob * csoub * csoub / gamma;
155 
156  urigh[0] = rhob;
157  urigh[1] = rhob * uadvb;
158  urigh[2] = rhob * vadvb;
159  urigh[3] = rhob * wadvb;
160  urigh[4] =
161  rhob * _fp.e(presb, rhob) + rhob * 0.5 * (uadvb * uadvb + vadvb * vadvb + wadvb * wadvb);
162  }
163  else if (mach1 >= 1.)
164  {
166 
167  urigh[0] = rho1;
168  urigh[1] = rhou1;
169  urigh[2] = rhov1;
170  urigh[3] = rhow1;
171  urigh[4] = rhoe1;
172  }
173  else
174  mooseError("Something is wrong in ",
175  name(),
176  ": ",
177  __FUNCTION__,
178  "\n",
179  "ielem = ",
180  ielem,
181  "\n",
182  "iside = ",
183  iside,
184  "\n",
185  "mach1 = ",
186  mach1,
187  "\n");
188 
189  return urigh;
190 }
virtual Real c(Real v, Real u) const =0
Sound speed.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
virtual Real gamma(Real v, Real u) const
Compute the ratio of specific heats.
virtual Real e(Real pressure, Real rho) const =0
Computes internal energy from pressure and density.
void BCUserObject::initialize ( )
virtualinherited

Definition at line 21 of file BCUserObject.C.

22 {
23 }

Member Data Documentation

const SinglePhaseFluidProperties& CNSFVRiemannInvariantBCUserObject::_fp
protected

Definition at line 34 of file CNSFVRiemannInvariantBCUserObject.h.

Referenced by getGhostCellValue().

Real CNSFVRiemannInvariantBCUserObject::_inf_pres
protected

Definition at line 40 of file CNSFVRiemannInvariantBCUserObject.h.

Referenced by getGhostCellValue().

Real CNSFVRiemannInvariantBCUserObject::_inf_rho
protected

Definition at line 36 of file CNSFVRiemannInvariantBCUserObject.h.

Referenced by getGhostCellValue().

Real CNSFVRiemannInvariantBCUserObject::_inf_uadv
protected

Definition at line 37 of file CNSFVRiemannInvariantBCUserObject.h.

Referenced by getGhostCellValue().

Real CNSFVRiemannInvariantBCUserObject::_inf_vadv
protected

Definition at line 38 of file CNSFVRiemannInvariantBCUserObject.h.

Referenced by getGhostCellValue().

Real CNSFVRiemannInvariantBCUserObject::_inf_wadv
protected

Definition at line 39 of file CNSFVRiemannInvariantBCUserObject.h.

Referenced by getGhostCellValue().


The documentation for this class was generated from the following files: