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 "NS.h" 12 : #include "NSMomentumInviscidSpecifiedNormalFlowBC.h" 13 : 14 : registerMooseObject("NavierStokesApp", NSMomentumInviscidSpecifiedNormalFlowBC); 15 : 16 : InputParameters 17 0 : NSMomentumInviscidSpecifiedNormalFlowBC::validParams() 18 : { 19 0 : InputParameters params = NSMomentumInviscidBC::validParams(); 20 0 : params.addClassDescription("Momentum equation boundary condition in which pressure is specified " 21 : "(given) and the value of the convective part is allowed to vary (is " 22 : "computed implicitly)."); 23 0 : params.addRequiredCoupledVar(NS::pressure, "pressure"); 24 0 : params.addRequiredParam<Real>( 25 : "rhou_udotn", "The _component'th entry of the (rho*u)(u.n) vector for this boundary"); 26 0 : return params; 27 0 : } 28 : 29 0 : NSMomentumInviscidSpecifiedNormalFlowBC::NSMomentumInviscidSpecifiedNormalFlowBC( 30 0 : const InputParameters & parameters) 31 : : NSMomentumInviscidBC(parameters), 32 0 : _pressure(coupledValue(NS::pressure)), 33 0 : _rhou_udotn(getParam<Real>("rhou_udotn")) 34 : { 35 0 : } 36 : 37 : Real 38 0 : NSMomentumInviscidSpecifiedNormalFlowBC::computeQpResidual() 39 : { 40 0 : return pressureQpResidualHelper(_pressure[_qp]) + convectiveQpResidualHelper(_rhou_udotn); 41 : } 42 : 43 : Real 44 0 : NSMomentumInviscidSpecifiedNormalFlowBC::computeQpJacobian() 45 : { 46 : // There is no Jacobian for the convective term when (rho*u)(u.n) is specified, 47 : // so all we have left is the pressure jacobian. The on-diagonal variable number 48 : // is _component+1 49 0 : return pressureQpJacobianHelper(_component + 1); 50 : } 51 : 52 : Real 53 0 : NSMomentumInviscidSpecifiedNormalFlowBC::computeQpOffDiagJacobian(unsigned jvar) 54 : { 55 0 : if (isNSVariable(jvar)) 56 0 : return pressureQpJacobianHelper(mapVarNumber(jvar)); 57 : else 58 : return 0.0; 59 : }