LCOV - code coverage report
Current view: top level - src/bcs - CoupledVarNeumannBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 19 21 90.5 %
Date: 2025-07-17 01:28:37 Functions: 7 7 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 "CoupledVarNeumannBC.h"
      11             : 
      12             : registerMooseObject("MooseApp", CoupledVarNeumannBC);
      13             : registerMooseObject("MooseApp", ADCoupledVarNeumannBC);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17       28832 : CoupledVarNeumannBCTempl<is_ad>::validParams()
      18             : {
      19       28832 :   InputParameters params = IntegratedBCParent<is_ad>::validParams();
      20       28832 :   params.addRequiredCoupledVar("v", "Coupled variable setting the gradient on the boundary.");
      21       28832 :   params.addCoupledVar("scale_factor", 1., "Scale factor to multiply the heat flux with");
      22       86496 :   params.addParam<Real>(
      23       57664 :       "coef", 1.0, "Coefficent ($\\sigma$) multiplier for the coupled force term.");
      24       28832 :   params.addClassDescription("Imposes the integrated boundary condition "
      25             :                              "$\\frac{\\partial u}{\\partial n}=v$, "
      26             :                              "where $v$ is a variable.");
      27       28832 :   return params;
      28           0 : }
      29             : template <bool is_ad>
      30         158 : CoupledVarNeumannBCTempl<is_ad>::CoupledVarNeumannBCTempl(const InputParameters & parameters)
      31             :   : IntegratedBCParent<is_ad>(parameters),
      32         158 :     _coupled_var(this->template coupledGenericValue<is_ad>("v")),
      33         158 :     _coupled_num(this->coupled("v")),
      34         158 :     _coef(this->template getParam<Real>("coef")),
      35         316 :     _scale_factor(this->template coupledGenericValue<is_ad>("scale_factor"))
      36             : {
      37         158 : }
      38             : 
      39             : template <bool is_ad>
      40             : GenericReal<is_ad>
      41      498520 : CoupledVarNeumannBCTempl<is_ad>::computeQpResidual()
      42             : {
      43      498520 :   return -_scale_factor[_qp] * _coef * _test[_i][_qp] * _coupled_var[_qp];
      44             : }
      45             : 
      46             : Real
      47         120 : CoupledVarNeumannBC::computeQpOffDiagJacobian(const unsigned int jvar)
      48             : {
      49         120 :   if (jvar == _coupled_num)
      50         120 :     return -_scale_factor[_qp] * _coef * _test[_i][_qp] * _phi[_j][_qp];
      51             :   else
      52           0 :     return 0;
      53             : }
      54             : 
      55             : template class CoupledVarNeumannBCTempl<false>;
      56             : template class CoupledVarNeumannBCTempl<true>;

Generated by: LCOV version 1.14