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 "ADFunctionPenaltyDirichletBC.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("MooseApp", ADFunctionPenaltyDirichletBC); 14 : 15 : InputParameters 16 14336 : ADFunctionPenaltyDirichletBC::validParams() 17 : { 18 14336 : InputParameters params = ADIntegratedBC::validParams(); 19 14336 : params.addClassDescription( 20 : "Enforces a (possibly) time and space-dependent MOOSE Function Dirichlet boundary condition " 21 : "in a weak sense by penalizing differences between the current " 22 : "solution and the Dirichlet data."); 23 14336 : params.addRequiredParam<Real>("penalty", "Penalty scalar"); 24 14336 : params.addRequiredParam<FunctionName>("function", "Forcing function"); 25 : 26 14336 : return params; 27 0 : } 28 : 29 37 : ADFunctionPenaltyDirichletBC::ADFunctionPenaltyDirichletBC(const InputParameters & parameters) 30 37 : : ADIntegratedBC(parameters), _func(getFunction("function")), _p(getParam<Real>("penalty")) 31 : { 32 37 : } 33 : 34 : ADReal 35 3547440 : ADFunctionPenaltyDirichletBC::computeQpResidual() 36 : { 37 7094880 : return _p * _test[_i][_qp] * (-_func.value(_t, _q_point[_qp]) + _u[_qp]); 38 : }