https://mooseframework.inl.gov
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PenaltyEqualValueConstraintTempl< is_ad > Class Template Reference

Constrain the value of a variable to be the same on both sides of an interface using a generalized force stemming from a penalty-based enforcement. More...

#include <PenaltyEqualValueConstraint.h>

Inheritance diagram for PenaltyEqualValueConstraintTempl< is_ad >:
[legend]

Public Member Functions

 PenaltyEqualValueConstraintTempl (const InputParameters &parameters)
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

GenericReal< is_ad > computeQpResidual (Moose::MortarType mortar_type) final
 
GenericReal< is_ad > computeQpJacobian (Moose::ConstraintJacobianType jacobian_type, unsigned int jvar)
 
template<>
ADReal computeQpJacobian (Moose::ConstraintJacobianType, unsigned int)
 
template<>
Real computeQpJacobian (Moose::ConstraintJacobianType jacobian_type, unsigned int jvar)
 

Protected Attributes

const Real _penalty_value
 Penalty value used to enforce the constraint. More...
 

Detailed Description

template<bool is_ad>
class PenaltyEqualValueConstraintTempl< is_ad >

Constrain the value of a variable to be the same on both sides of an interface using a generalized force stemming from a penalty-based enforcement.

Definition at line 25 of file PenaltyEqualValueConstraint.h.

Constructor & Destructor Documentation

◆ PenaltyEqualValueConstraintTempl()

template<bool is_ad>
PenaltyEqualValueConstraintTempl< is_ad >::PenaltyEqualValueConstraintTempl ( const InputParameters parameters)

Definition at line 32 of file PenaltyEqualValueConstraint.C.

34  : MortarConstraintTempl<is_ad>(parameters),
35  _penalty_value(this->template getParam<Real>("penalty_value"))
36 {
37 }
const Real _penalty_value
Penalty value used to enforce the constraint.
typename std::conditional< is_ad, ADMortarConstraint, MortarConstraint >::type MortarConstraintTempl

Member Function Documentation

◆ computeQpJacobian() [1/3]

template<bool is_ad>
GenericReal<is_ad> PenaltyEqualValueConstraintTempl< is_ad >::computeQpJacobian ( Moose::ConstraintJacobianType  jacobian_type,
unsigned int  jvar 
)
protected

◆ computeQpJacobian() [2/3]

template<>
ADReal PenaltyEqualValueConstraintTempl< true >::computeQpJacobian ( Moose::ConstraintJacobianType  ,
unsigned  int 
)
protected

Definition at line 68 of file PenaltyEqualValueConstraint.C.

70 {
71  mooseError("ADPenaltyEqualValueConstraint does not implement manual Jacobian calculation.");
72 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302

◆ computeQpJacobian() [3/3]

template<>
Real PenaltyEqualValueConstraintTempl< false >::computeQpJacobian ( Moose::ConstraintJacobianType  jacobian_type,
unsigned int  jvar 
)
protected

Definition at line 76 of file PenaltyEqualValueConstraint.C.

78 {
79  typedef Moose::ConstraintJacobianType JType;
80 
81  switch (jacobian_type)
82  {
84  if (jvar == _secondary_var.number())
85  return (*_phi)[_j][_qp] * _penalty_value * _test_secondary[_i][_qp];
86  break;
87 
89  if (jvar == _primary_var.number())
90  return -(*_phi)[_j][_qp] * _penalty_value * _test_secondary[_i][_qp];
91  break;
92 
94  if (jvar == _secondary_var.number())
95  return -(*_phi)[_j][_qp] * _penalty_value * _test_primary[_i][_qp];
96  break;
97 
99  if (jvar == _primary_var.number())
100  return (*_phi)[_j][_qp] * _penalty_value * _test_primary[_i][_qp];
101  break;
102 
103  default:
104  return 0;
105  }
106 
107  return 0;
108 }
const Real _penalty_value
Penalty value used to enforce the constraint.
ConstraintJacobianType
Definition: MooseTypes.h:796

◆ computeQpResidual()

template<bool is_ad>
GenericReal< is_ad > PenaltyEqualValueConstraintTempl< is_ad >::computeQpResidual ( Moose::MortarType  mortar_type)
finalprotected

Definition at line 41 of file PenaltyEqualValueConstraint.C.

42 {
43  switch (mortar_type)
44  {
46  {
47  auto residual =
48  -(_u_primary[_qp] - _u_secondary[_qp]) * _penalty_value * _test_secondary[_i][_qp];
49 
50  return residual;
51  }
52 
54  {
55  auto residual =
56  (_u_primary[_qp] - _u_secondary[_qp]) * _penalty_value * _test_primary[_i][_qp];
57 
58  return residual;
59  }
60 
61  default:
62  return 0;
63  }
64 }
const Real _penalty_value
Penalty value used to enforce the constraint.

◆ validParams()

template<bool is_ad>
InputParameters PenaltyEqualValueConstraintTempl< is_ad >::validParams ( )
static

Definition at line 17 of file PenaltyEqualValueConstraint.C.

18 {
20  params.addClassDescription(
21  "PenaltyEqualValueConstraint enforces solution continuity between secondary and "
22  "primary sides of a mortar interface using a penalty approach (no Lagrange multipliers "
23  "needed)");
25  "penalty_value",
26  "penalty_value>0",
27  "Penalty value used to impose a generalized force capturing the mortar constraint equation");
28  return params;
29 }
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
These methods add an range checked parameters.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...

Member Data Documentation

◆ _penalty_value

template<bool is_ad>
const Real PenaltyEqualValueConstraintTempl< is_ad >::_penalty_value
protected

Penalty value used to enforce the constraint.

Definition at line 38 of file PenaltyEqualValueConstraint.h.


The documentation for this class was generated from the following files: