https://mooseframework.inl.gov
NSImposedVelocityDirectionBC.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 // Navier-Stokes includes
12 #include "NS.h"
13 
14 // MOOSE includes
15 #include "MooseMesh.h"
16 
17 // Full specialization of the validParams function for this object
19 
22 {
23  // Initialize the params object from the base class
25 
26  params.addClassDescription("This class imposes a velocity direction component as a Dirichlet "
27  "condition on the appropriate momentum equation.");
28  // Coupled variables
29  params.addRequiredCoupledVar(NS::density, "density");
30  params.addRequiredCoupledVar(NS::velocity_x, "x-velocity");
31  params.addCoupledVar(NS::velocity_y, "y-velocity"); // only required in >= 2D
32  params.addCoupledVar(NS::velocity_z, "z-velocity"); // only required in 3D
33 
34  // Coupled parameters
35  params.addRequiredParam<Real>("desired_unit_velocity_component", "");
36 
37  return params;
38 }
39 
41  : NodalBC(parameters),
42  _rho(coupledValue(NS::density)),
43  _u_vel(coupledValue(NS::velocity_x)),
44  _v_vel(_mesh.dimension() == 2 ? coupledValue(NS::velocity_y) : _zero),
45  _w_vel(_mesh.dimension() == 3 ? coupledValue(NS::velocity_z) : _zero),
46  _desired_unit_velocity_component(getParam<Real>("desired_unit_velocity_component"))
47 {
48 }
49 
50 Real
52 {
53  // The velocity vector
55 
56  // Specify desired velocity component
57  return _u[_qp] - _rho[_qp] * _desired_unit_velocity_component * vel.norm();
58 }
auto norm() const -> decltype(std::norm(Real()))
NSImposedVelocityDirectionBC(const InputParameters &parameters)
static const std::string velocity_z
Definition: NS.h:48
static const std::string density
Definition: NS.h:33
static const std::string velocity_x
Definition: NS.h:46
const unsigned int _qp
void addRequiredParam(const std::string &name, const std::string &doc_string)
static const std::string velocity_y
Definition: NS.h:47
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
This class imposes a velocity direction component as a Dirichlet condition on the appropriate momentu...
registerMooseObject("NavierStokesApp", NSImposedVelocityDirectionBC)
static InputParameters validParams()
const VariableValue & _u