LCOV - code coverage report
Current view: top level - src/constraints - EqualGradientConstraint.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 17 20 85.0 %
Date: 2025-08-08 20:01:16 Functions: 3 3 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 "EqualGradientConstraint.h"
      11             : #include "SubProblem.h"
      12             : #include "FEProblem.h"
      13             : 
      14             : registerMooseObject("MooseApp", EqualGradientConstraint);
      15             : 
      16             : InputParameters
      17       14317 : EqualGradientConstraint::validParams()
      18             : {
      19       14317 :   InputParameters params = ADMortarConstraint::validParams();
      20       14317 :   params.addClassDescription(
      21             :       "EqualGradientConstraint enforces continuity of a gradient component between secondary and "
      22             :       "primary sides of a mortar interface using lagrange multipliers");
      23       14317 :   params.addRequiredParam<unsigned int>("component", "Gradient component to constrain");
      24       14317 :   return params;
      25           0 : }
      26             : 
      27          26 : EqualGradientConstraint::EqualGradientConstraint(const InputParameters & parameters)
      28          26 :   : ADMortarConstraint(parameters), _component(getParam<unsigned int>("component"))
      29             : {
      30          26 : }
      31             : 
      32             : ADReal
      33       48640 : EqualGradientConstraint::computeQpResidual(Moose::MortarType mortar_type)
      34             : {
      35       48640 :   switch (mortar_type)
      36             :   {
      37       19456 :     case Moose::MortarType::Secondary:
      38       38912 :       return -_lambda[_qp] * _grad_test_secondary[_i][_qp](_component);
      39       19456 :     case Moose::MortarType::Primary:
      40       19456 :       return _lambda[_qp] * _grad_test_primary[_i][_qp](_component);
      41        9728 :     case Moose::MortarType::Lower:
      42       19456 :       return (_grad_u_primary[_qp](_component) - _grad_u_secondary[_qp](_component)) *
      43       19456 :              _test[_i][_qp];
      44           0 :     default:
      45           0 :       return 0;
      46             :   }
      47             : }

Generated by: LCOV version 1.14