LCOV - code coverage report
Current view: top level - src/bcs - PenaltyDirichletBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 14 15 93.3 %
Date: 2025-08-08 20:01:16 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          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 "PenaltyDirichletBC.h"
      11             : 
      12             : registerMooseObject("MooseApp", PenaltyDirichletBC);
      13             : 
      14             : InputParameters
      15       15045 : PenaltyDirichletBC::validParams()
      16             : {
      17       15045 :   InputParameters params = IntegratedBC::validParams();
      18       15045 :   params.addRequiredParam<Real>("penalty", "Penalty scalar");
      19       15045 :   params.addParam<Real>("value", 0.0, "Boundary value of the variable");
      20       15045 :   params.declareControllable("value");
      21       15045 :   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       15045 :   return params;
      25           0 : }
      26             : 
      27         404 : PenaltyDirichletBC::PenaltyDirichletBC(const InputParameters & parameters)
      28         404 :   : IntegratedBC(parameters), _p(getParam<Real>("penalty")), _v(getParam<Real>("value"))
      29             : {
      30         404 : }
      31             : 
      32             : Real
      33     1928400 : PenaltyDirichletBC::computeQpResidual()
      34             : {
      35     1928400 :   return _p * _test[_i][_qp] * (-_v + _u[_qp]);
      36             : }
      37             : 
      38             : Real
      39      753782 : PenaltyDirichletBC::computeQpJacobian()
      40             : {
      41      753782 :   return _p * _phi[_j][_qp] * _test[_i][_qp];
      42             : }

Generated by: LCOV version 1.14