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 "ADPenaltyDirichletBC.h" 11 : 12 : registerMooseObject("MooseApp", ADPenaltyDirichletBC); 13 : 14 : InputParameters 15 14311 : ADPenaltyDirichletBC::validParams() 16 : { 17 14311 : InputParameters params = ADIntegratedBC::validParams(); 18 14311 : params.addRequiredParam<Real>("penalty", "Penalty scalar"); 19 14311 : params.addParam<Real>("value", 0.0, "Boundary value of the variable"); 20 14311 : params.declareControllable("value"); 21 14311 : params.addClassDescription("Enforces a Dirichlet boundary condition " 22 : "in a weak sense by penalizing differences between the current " 23 : "solution and the Dirichlet data."); 24 14311 : return params; 25 0 : } 26 : 27 24 : ADPenaltyDirichletBC::ADPenaltyDirichletBC(const InputParameters & parameters) 28 24 : : ADIntegratedBC(parameters), _p(getParam<Real>("penalty")), _v(getParam<Real>("value")) 29 : { 30 24 : } 31 : 32 : ADReal 33 3432240 : ADPenaltyDirichletBC::computeQpResidual() 34 : { 35 6864480 : return _p * _test[_i][_qp] * (-_v + _u[_qp]); 36 : }