LCOV - code coverage report
Current view: top level - src/nodalkernels - PenaltyDirichletNodalKernel.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 14 15 93.3 %
Date: 2025-07-17 01:28:37 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 "PenaltyDirichletNodalKernel.h"
      11             : 
      12             : registerMooseObject("MooseApp", PenaltyDirichletNodalKernel);
      13             : 
      14             : InputParameters
      15       14311 : PenaltyDirichletNodalKernel::validParams()
      16             : {
      17       14311 :   InputParameters params = NodalKernel::validParams();
      18       14311 :   params.addClassDescription("Enforces a Dirichlet boundary condition "
      19             :                              "in a weak sense by penalizing differences between the current "
      20             :                              "solution and the Dirichlet value on nodesets.");
      21             : 
      22       14311 :   params.addRequiredParam<Real>("penalty", "Penalty scalar");
      23       14311 :   params.addParam<Real>("value", 0.0, "Boundary value of the variable");
      24       14311 :   params.declareControllable("value");
      25             : 
      26       14311 :   return params;
      27           0 : }
      28             : 
      29          24 : PenaltyDirichletNodalKernel::PenaltyDirichletNodalKernel(const InputParameters & parameters)
      30          24 :   : NodalKernel(parameters), _p(getParam<Real>("penalty")), _v(getParam<Real>("value"))
      31             : {
      32          24 : }
      33             : 
      34             : Real
      35       11352 : PenaltyDirichletNodalKernel::computeQpResidual()
      36             : {
      37       11352 :   return _p * (-_v + _u[_qp]);
      38             : }
      39             : 
      40             : Real
      41        1098 : PenaltyDirichletNodalKernel::computeQpJacobian()
      42             : {
      43        1098 :   return _p;
      44             : }

Generated by: LCOV version 1.14