https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
50Real
52{
53 // The velocity vector
54 RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
55
56 // Specify desired velocity component
57 return _u[_qp] - _rho[_qp] * _desired_unit_velocity_component * vel.norm();
58}
registerMooseObject("NavierStokesApp", NSImposedVelocityDirectionBC)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
This class imposes a velocity direction component as a Dirichlet condition on the appropriate momentu...
NSImposedVelocityDirectionBC(const InputParameters &parameters)
const VariableValue & _u
static InputParameters validParams()
const unsigned int _qp
static const std::string density
Definition NS.h:34
static const std::string velocity_y
Definition NS.h:48
static const std::string velocity_z
Definition NS.h:49
static const std::string velocity_x
Definition NS.h:47