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 "ArrayPenaltyDirichletBC.h" 11 : 12 : registerMooseObject("MooseApp", ArrayPenaltyDirichletBC); 13 : 14 : InputParameters 15 14355 : ArrayPenaltyDirichletBC::validParams() 16 : { 17 14355 : InputParameters params = ArrayIntegratedBC::validParams(); 18 14355 : params.addParam<Real>("penalty", 4, "Penalty scalar"); 19 14355 : params.addRequiredParam<RealEigenVector>("value", "Boundary value of the array variable"); 20 14355 : params.addClassDescription( 21 : "Enforces a Dirichlet boundary condition " 22 : "in a weak sense with $p(\\vec{u}^\\ast, \\vec{u} - \\vec{u}_0)$, where $p$ is the constant " 23 : "scalar penalty; $\\vec{u}^\\ast$ is the test functions and $\\vec{u} - \\vec{u}_0$ is the " 24 : "differences between the current solution and the Dirichlet data."); 25 14355 : return params; 26 0 : } 27 : 28 47 : ArrayPenaltyDirichletBC::ArrayPenaltyDirichletBC(const InputParameters & parameters) 29 : : ArrayIntegratedBC(parameters), 30 47 : _p(getParam<Real>("penalty")), 31 94 : _v(getParam<RealEigenVector>("value")) 32 : { 33 47 : if (_v.size() != _count) 34 0 : paramError( 35 0 : "value", "Number of 'values' must equal number of variable components (", _count, ")."); 36 47 : } 37 : 38 : void 39 5216 : ArrayPenaltyDirichletBC::computeQpResidual(RealEigenVector & residual) 40 : { 41 5216 : residual = _p * _test[_i][_qp] * (_u[_qp] - _v); 42 5216 : } 43 : 44 : RealEigenVector 45 7936 : ArrayPenaltyDirichletBC::computeQpJacobian() 46 : { 47 15872 : return RealEigenVector::Constant(_count, _p * _phi[_j][_qp] * _test[_i][_qp]); 48 : }