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 : #include "MomentumFreeBC.h" 11 : #include "MooseMesh.h" 12 : #include "NS.h" 13 : 14 : registerMooseObject("NavierStokesApp", MomentumFreeBC); 15 : 16 : InputParameters 17 0 : MomentumFreeBC::validParams() 18 : { 19 0 : InputParameters params = IntegratedBC::validParams(); 20 0 : params.addRequiredCoupledVar("vel_x", "x-component of velocity"); 21 0 : params.addCoupledVar("vel_y", "y-component of velocity"); 22 0 : params.addCoupledVar("vel_z", "z-component of velocity"); 23 0 : params.addRequiredParam<unsigned int>("component", "Component of the momentum equation"); 24 0 : params.addRequiredCoupledVar(NS::pressure, "The value of pressure"); 25 0 : params.addClassDescription( 26 : "Implements free flow boundary conditions for one of the momentum equations."); 27 0 : return params; 28 0 : } 29 : 30 0 : MomentumFreeBC::MomentumFreeBC(const InputParameters & parameters) 31 : : IntegratedBC(parameters), 32 0 : _component(getParam<unsigned int>("component")), 33 0 : _pressure(coupledValue(NS::pressure)), 34 0 : _vel_x(coupledValue("vel_x")), 35 0 : _vel_y(_mesh.dimension() >= 2 ? coupledValue("vel_y") : _zero), 36 0 : _vel_z(_mesh.dimension() >= 3 ? coupledValue("vel_z") : _zero) 37 : { 38 0 : } 39 : 40 : Real 41 0 : MomentumFreeBC::computeQpResidual() 42 : { 43 0 : RealVectorValue vel_vec(_vel_x[_qp], _vel_y[_qp], _vel_z[_qp]); 44 0 : return (_u[_qp] * vel_vec * _normals[_qp] + _pressure[_qp] * _normals[_qp](_component)) * 45 0 : _test[_i][_qp]; 46 : }