www.mooseframework.org
CNSFVFreeInflowBoundaryFlux.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<BoundaryFluxBase>();
15 
16  params.addClassDescription("A user object that computes the inflow boundary flux.");
17 
18  params.addRequiredParam<UserObjectName>("bc_uo", "Name for boundary condition user object");
19 
20  params.addRequiredParam<UserObjectName>("fluid_properties",
21  "Name for fluid properties user object");
22 
23  return params;
24 }
25 
27  : BoundaryFluxBase(parameters),
28  _bc_uo(getUserObject<BCUserObject>("bc_uo")),
29  _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
30 {
31 }
32 
34 
35 void
37  dof_id_type ielem,
38  const std::vector<Real> & uvec1,
39  const RealVectorValue & dwave,
40  std::vector<Real> & flux) const
41 {
43 
44  Real nx = dwave(0);
45  Real ny = dwave(1);
46  Real nz = dwave(2);
47 
49 
50  flux.resize(5);
51 
52  std::vector<Real> U2(5, 0.);
53 
54  U2 = _bc_uo.getGhostCellValue(iside, ielem, uvec1, dwave);
55 
56  Real rho2 = U2[0];
57  Real rhou2 = U2[1];
58  Real rhov2 = U2[2];
59  Real rhow2 = U2[3];
60  Real rhoe2 = U2[4];
61 
62  Real uadv2 = rhou2 / rho2;
63  Real vadv2 = rhov2 / rho2;
64  Real wadv2 = rhow2 / rho2;
65  Real vdov2 = uadv2 * uadv2 + vadv2 * vadv2 + wadv2 * wadv2;
66  Real v2 = 1. / rho2;
67  Real e2 = rhoe2 / rho2 - 0.5 * vdov2;
68  Real pres2 = _fp.pressure(v2, e2);
69 
70  Real vdon2 = uadv2 * nx + vadv2 * ny + wadv2 * nz;
71 
72  flux[0] = vdon2 * rho2;
73  flux[1] = vdon2 * rho2 * uadv2 + pres2 * nx;
74  flux[2] = vdon2 * rho2 * vadv2 + pres2 * ny;
75  flux[3] = vdon2 * rho2 * wadv2 + pres2 * nz;
76  flux[4] = vdon2 * (rhoe2 + pres2);
77 }
78 
79 void
81  dof_id_type /*ielem*/,
82  const std::vector<Real> & /*uvec1*/,
83  const RealVectorValue & /*dwave*/,
84  DenseMatrix<Real> & /*jac1*/) const
85 {
86 }
virtual void calcJacobian(unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave, DenseMatrix< Real > &jac1) const
Compute the Jacobian matrix on the boundary face.
CNSFVFreeInflowBoundaryFlux(const InputParameters &parameters)
InputParameters validParams< BoundaryFluxBase >()
A base class for computing/caching fluxes at boundaries.
Common class for single phase fluid properties.
const SinglePhaseFluidProperties & _fp
virtual void calcFlux(unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave, std::vector< Real > &flux) const
Solve the Riemann problem on the boundary face.
virtual std::vector< Real > getGhostCellValue(unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave) const =0
compute the ghost cell variable values
A base class of user object for calculating the variable values in ghost element according to specifi...
Definition: BCUserObject.h:42
InputParameters validParams< CNSFVFreeInflowBoundaryFlux >()
virtual Real pressure(Real v, Real u) const =0
Pressure as a function of specific internal energy and specific volume.