www.mooseframework.org
NSImposedVelocityDirectionBC.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 
8 // Navier-Stokes includes
10 #include "NS.h"
11 
12 // MOOSE includes
13 #include "MooseMesh.h"
14 
15 // Full specialization of the validParams function for this object
16 template <>
17 InputParameters
19 {
20  // Initialize the params object from the base class
21  InputParameters params = validParams<NodalBC>();
22 
23  params.addClassDescription("This class imposes a velocity direction component as a Dirichlet "
24  "condition on the appropriate momentum equation.");
25  // Coupled variables
26  params.addRequiredCoupledVar(NS::density, "density");
27  params.addRequiredCoupledVar(NS::velocity_x, "x-velocity");
28  params.addCoupledVar(NS::velocity_y, "y-velocity"); // only required in >= 2D
29  params.addCoupledVar(NS::velocity_z, "z-velocity"); // only required in 3D
30 
31  // Coupled parameters
32  params.addRequiredParam<Real>("desired_unit_velocity_component", "");
33 
34  return params;
35 }
36 
38  : NodalBC(parameters),
39  _rho(coupledValue(NS::density)),
40  _u_vel(coupledValue(NS::velocity_x)),
41  _v_vel(_mesh.dimension() == 2 ? coupledValue(NS::velocity_y) : _zero),
42  _w_vel(_mesh.dimension() == 3 ? coupledValue(NS::velocity_z) : _zero),
43  _desired_unit_velocity_component(getParam<Real>("desired_unit_velocity_component"))
44 {
45 }
46 
47 Real
49 {
50  // The velocity vector
51  RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
52 
53  // Specify desired velocity component
54  return _u[_qp] - _rho[_qp] * _desired_unit_velocity_component * vel.norm();
55 }
Definition: NS.h:13
NSImposedVelocityDirectionBC(const InputParameters &parameters)
const std::string velocity_z
Definition: NS.h:23
const std::string density
Definition: NS.h:15
InputParameters validParams< NSImposedVelocityDirectionBC >()
const std::string velocity_x
Definition: NS.h:21
const std::string velocity_y
Definition: NS.h:22