LCOV - code coverage report
Current view: top level - src/bcs - FunctionPenaltyDirichletBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 13 14 92.9 %
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 "FunctionPenaltyDirichletBC.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("MooseApp", FunctionPenaltyDirichletBC);
      14             : 
      15             : InputParameters
      16       14502 : FunctionPenaltyDirichletBC::validParams()
      17             : {
      18       14502 :   InputParameters params = IntegratedBC::validParams();
      19       14502 :   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       14502 :   params.addRequiredParam<Real>("penalty", "Penalty scalar");
      24       14502 :   params.addRequiredParam<FunctionName>("function", "Forcing function");
      25             : 
      26       14502 :   return params;
      27           0 : }
      28             : 
      29         121 : FunctionPenaltyDirichletBC::FunctionPenaltyDirichletBC(const InputParameters & parameters)
      30         121 :   : IntegratedBC(parameters), _func(getFunction("function")), _p(getParam<Real>("penalty"))
      31             : {
      32         121 : }
      33             : 
      34             : Real
      35     1090080 : FunctionPenaltyDirichletBC::computeQpResidual()
      36             : {
      37     1090080 :   return _p * _test[_i][_qp] * (-_func.value(_t, _q_point[_qp]) + _u[_qp]);
      38             : }
      39             : 
      40             : Real
      41     6979896 : FunctionPenaltyDirichletBC::computeQpJacobian()
      42             : {
      43     6979896 :   return _p * _phi[_j][_qp] * _test[_i][_qp];
      44             : }

Generated by: LCOV version 1.14