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 inclues 11 : #include "NS.h" 12 : #include "NSPressureNeumannBC.h" 13 : 14 : registerMooseObject("NavierStokesApp", NSPressureNeumannBC); 15 : 16 : InputParameters 17 82 : NSPressureNeumannBC::validParams() 18 : { 19 82 : InputParameters params = NSIntegratedBC::validParams(); 20 : 21 82 : params.addClassDescription("This kernel is appropriate for use with a 'zero normal flow' " 22 : "boundary condition in the context of the Euler equations."); 23 82 : params.addRequiredCoupledVar(NS::pressure, "The current value of the pressure"); 24 164 : params.addRequiredParam<unsigned>( 25 : "component", "(0,1,2) = (x,y,z) for which momentum component this BC is applied to"); 26 : 27 82 : return params; 28 0 : } 29 : 30 44 : NSPressureNeumannBC::NSPressureNeumannBC(const InputParameters & parameters) 31 : : NSIntegratedBC(parameters), 32 88 : _pressure(coupledValue(NS::pressure)), 33 88 : _component(getParam<unsigned>("component")), 34 44 : _pressure_derivs(*this) 35 : { 36 44 : } 37 : 38 : Real 39 1370880 : NSPressureNeumannBC::computeQpResidual() 40 : { 41 1370880 : return _pressure[_qp] * _normals[_qp](_component) * _test[_i][_qp]; 42 : } 43 : 44 : Real 45 838656 : NSPressureNeumannBC::computeQpJacobian() 46 : { 47 838656 : return computeJacobianHelper(_component + 48 838656 : 1); // <-- the on-diagonal variable number is _component+1 49 : } 50 : 51 : Real 52 2515968 : NSPressureNeumannBC::computeQpOffDiagJacobian(unsigned jvar) 53 : { 54 2515968 : if (isNSVariable(jvar)) 55 2515968 : return computeJacobianHelper(mapVarNumber(jvar)); 56 : else 57 : return 0.0; 58 : } 59 : 60 : Real 61 3354624 : NSPressureNeumannBC::computeJacobianHelper(unsigned m) 62 : { 63 3354624 : return _normals[_qp](_component) * _pressure_derivs.get_grad(m) * _phi[_j][_qp] * _test[_i][_qp]; 64 : }