Line data Source code
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 11 : #include "NSImposedVelocityBC.h" 12 : #include "NS.h" 13 : 14 : registerMooseObject("NavierStokesApp", NSImposedVelocityBC); 15 : 16 : InputParameters 17 0 : NSImposedVelocityBC::validParams() 18 : { 19 0 : InputParameters params = NodalBC::validParams(); 20 0 : params.addClassDescription("Impose Velocity BC."); 21 0 : params.addRequiredCoupledVar(NS::density, "density"); 22 0 : params.addRequiredParam<Real>("desired_velocity", ""); 23 0 : return params; 24 0 : } 25 : 26 0 : NSImposedVelocityBC::NSImposedVelocityBC(const InputParameters & parameters) 27 : : NodalBC(parameters), 28 0 : _rho(coupledValue(NS::density)), 29 0 : _desired_velocity(getParam<Real>("desired_velocity")) 30 : { 31 0 : } 32 : 33 : Real 34 0 : NSImposedVelocityBC::computeQpResidual() 35 : { 36 : // Return the difference between the current momentum and the desired value 37 : // (rho*u) - rho*desired_velocity 38 0 : return _u[_qp] - (_rho[_qp] * _desired_velocity); 39 : }