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

Generated by: LCOV version 1.14