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

Generated by: LCOV version 1.14