LCOV - code coverage report
Current view: top level - include/constraints - EqualValueEmbeddedConstraint.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 4 5 80.0 %
Date: 2026-05-29 20:35:17 Functions: 8 10 80.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             : #pragma once
      11             : 
      12             : // MOOSE includes
      13             : #include "GenericNodeElemConstraint.h"
      14             : #include "MooseEnum.h"
      15             : 
      16             : class DisplacedProblem;
      17             : class FEProblemBase;
      18             : 
      19             : /**
      20             :  * A EqualValueEmbeddedConstraint forces the value of a variable to be the same
      21             :  * on overlapping portion of two blocks
      22             :  */
      23             : template <bool is_ad>
      24             : class EqualValueEmbeddedConstraintTempl : public GenericNodeElemConstraint<is_ad>
      25             : {
      26             : public:
      27             :   static InputParameters validParams();
      28             : 
      29             :   EqualValueEmbeddedConstraintTempl(const InputParameters & parameters);
      30             : 
      31         180 :   virtual void timestepSetup() override {}
      32         180 :   virtual void jacobianSetup() override {}
      33         360 :   virtual void residualEnd() override {}
      34             : 
      35           0 :   virtual bool addCouplingEntriesToJacobian() override { return true; }
      36             : 
      37             :   bool shouldApply() override final;
      38             : 
      39             :   /**
      40             :    * Prepare the residual contribution of the current constraint required to enforce it
      41             :    * based on the specified formulation.
      42             :    */
      43             :   virtual void reinitConstraint();
      44             : 
      45             : protected:
      46             :   virtual void prepareSecondaryToPrimaryMap() override;
      47             :   virtual Real computeQpSecondaryValue() override;
      48             :   virtual GenericReal<is_ad> computeQpResidual(Moose::ConstraintType type) override;
      49             :   virtual Real computeQpJacobian(Moose::ConstraintJacobianType type) override;
      50             :   virtual Real computeQpOffDiagJacobian(Moose::ConstraintJacobianType type,
      51             :                                         unsigned int jvar) override;
      52             : 
      53             :   MooseSharedPointer<DisplacedProblem> _displaced_problem;
      54             :   FEProblem & _fe_problem;
      55             : 
      56             :   /// Formulations, currently only supports KINEMATIC and PENALTY
      57       95820 :   CreateMooseEnumClass(Formulation, KINEMATIC, PENALTY) _formulation;
      58             :   /// Penalty parameter used in constraint enforcement for kinematic and penalty formulations
      59             :   const Real _penalty;
      60             :   /// copy of the residual before the constraint is applied
      61             :   NumericVector<Number> & _residual_copy;
      62             :   /// constraint force needed to enforce the constraint
      63             :   GenericReal<is_ad> _constraint_residual;
      64             : 
      65             :   usingGenericNodeElemConstraint;
      66             : };
      67             : 
      68             : typedef EqualValueEmbeddedConstraintTempl<false> EqualValueEmbeddedConstraint;
      69             : typedef EqualValueEmbeddedConstraintTempl<true> ADEqualValueEmbeddedConstraint;

Generated by: LCOV version 1.14