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 "INSCompressibilityPenalty.h" 11 : 12 : registerMooseObject("NavierStokesApp", INSCompressibilityPenalty); 13 : 14 : InputParameters 15 0 : INSCompressibilityPenalty::validParams() 16 : { 17 0 : InputParameters params = Kernel::validParams(); 18 : 19 0 : params.addClassDescription("The penalty term may be used when Dirichlet boundary condition is " 20 : "applied to the entire boundary."); 21 0 : params.addParam<Real>("penalty", 1e-4, "Penalty value is used to relax the incompressibility"); 22 : 23 0 : return params; 24 0 : } 25 : 26 0 : INSCompressibilityPenalty::INSCompressibilityPenalty(const InputParameters & parameters) 27 : : Kernel(parameters), 28 : // penalty value 29 0 : _penalty(getParam<Real>("penalty")) 30 : 31 : { 32 0 : } 33 : 34 : Real 35 0 : INSCompressibilityPenalty::computeQpResidual() 36 : { 37 : // penalty*p*q 38 0 : return _penalty * _u[_qp] * _test[_i][_qp]; 39 : } 40 : 41 : Real 42 0 : INSCompressibilityPenalty::computeQpOffDiagJacobian(unsigned /* jvar */) 43 : { 44 : // does not couple any variables 45 0 : return 0; 46 : } 47 : 48 : Real 49 0 : INSCompressibilityPenalty::computeQpJacobian() 50 : { 51 : // Derivative wrt to p 52 0 : return _penalty * _phi[_j][_qp] * _test[_i][_qp]; 53 : }