www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SwitchingFunctionConstraintLagrange Class Reference

SwitchingFunctionConstraintLagrange is a constraint kernel that acts on the lambda lagrange multiplier non-linear variables to enforce \( \sum_n h_i(\eta_i) - \epsilon\lambda \equiv 1 \). More...

#include <SwitchingFunctionConstraintLagrange.h>

Inheritance diagram for SwitchingFunctionConstraintLagrange:
[legend]

Public Member Functions

 SwitchingFunctionConstraintLagrange (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int)
 

Protected Attributes

std::vector< MaterialPropertyName > _h_names
 Switching function names. More...
 
unsigned int _num_h
 number of switching functions More...
 
std::vector< const MaterialProperty< Real > * > _h
 Switching functions. More...
 
std::vector< std::vector< const MaterialProperty< Real > * > > _dh
 Switching function derivatives. More...
 
const JvarMap & _eta_map
 map for getting the "etas" index from jvar More...
 
Real _epsilon
 shift factor More...
 

Detailed Description

SwitchingFunctionConstraintLagrange is a constraint kernel that acts on the lambda lagrange multiplier non-linear variables to enforce \( \sum_n h_i(\eta_i) - \epsilon\lambda \equiv 1 \).

Definition at line 28 of file SwitchingFunctionConstraintLagrange.h.

Constructor & Destructor Documentation

◆ SwitchingFunctionConstraintLagrange()

SwitchingFunctionConstraintLagrange::SwitchingFunctionConstraintLagrange ( const InputParameters &  parameters)

Definition at line 28 of file SwitchingFunctionConstraintLagrange.C.

30  : DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>(parameters),
31  _h_names(getParam<std::vector<MaterialPropertyName>>("h_names")),
32  _num_h(_h_names.size()),
33  _h(_num_h),
34  _dh(_num_h),
35  _eta_map(getParameterJvarMap("etas")),
36  _epsilon(getParam<Real>("epsilon"))
37 {
38  // parameter check. We need exactly one eta per h
39  if (_num_h != coupledComponents("etas"))
40  paramError("etas", "Need to pass in as many etas as h_names");
41 
42  // fetch switching functions (for the residual) and h derivatives (for the Jacobian)
43  for (std::size_t i = 0; i < _num_h; ++i)
44  {
45  _h[i] = &getMaterialPropertyByName<Real>(_h_names[i]);
46 
47  _dh[i].resize(_num_h);
48  for (std::size_t j = 0; j < _num_h; ++j)
49  _dh[i][j] = &getMaterialPropertyDerivative<Real>(_h_names[i], getVar("etas", j)->name());
50  }
51 }

Member Function Documentation

◆ computeQpJacobian()

Real SwitchingFunctionConstraintLagrange::computeQpJacobian ( )
protectedvirtual

Definition at line 64 of file SwitchingFunctionConstraintLagrange.C.

65 {
66  return _test[_i][_qp] * -_epsilon * _phi[_j][_qp];
67 }

◆ computeQpOffDiagJacobian()

Real SwitchingFunctionConstraintLagrange::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 70 of file SwitchingFunctionConstraintLagrange.C.

71 {
72  auto eta = mapJvarToCvar(jvar, _eta_map);
73  if (eta >= 0)
74  {
75  Real g = 0.0;
76  for (std::size_t i = 0; i < _num_h; ++i)
77  g += (*_dh[i][eta])[_qp] * _phi[_j][_qp];
78  return g * _test[_i][_qp];
79  }
80 
81  return 0.0;
82 }

◆ computeQpResidual()

Real SwitchingFunctionConstraintLagrange::computeQpResidual ( )
protectedvirtual

Definition at line 54 of file SwitchingFunctionConstraintLagrange.C.

55 {
56  Real g = -_epsilon * _u[_qp] - 1.0;
57  for (std::size_t i = 0; i < _num_h; ++i)
58  g += (*_h[i])[_qp];
59 
60  return _test[_i][_qp] * g;
61 }

Member Data Documentation

◆ _dh

std::vector<std::vector<const MaterialProperty<Real> *> > SwitchingFunctionConstraintLagrange::_dh
protected

Switching function derivatives.

Definition at line 49 of file SwitchingFunctionConstraintLagrange.h.

Referenced by computeQpOffDiagJacobian(), and SwitchingFunctionConstraintLagrange().

◆ _epsilon

Real SwitchingFunctionConstraintLagrange::_epsilon
protected

shift factor

Definition at line 55 of file SwitchingFunctionConstraintLagrange.h.

Referenced by computeQpJacobian(), and computeQpResidual().

◆ _eta_map

const JvarMap& SwitchingFunctionConstraintLagrange::_eta_map
protected

map for getting the "etas" index from jvar

Definition at line 52 of file SwitchingFunctionConstraintLagrange.h.

Referenced by computeQpOffDiagJacobian().

◆ _h

std::vector<const MaterialProperty<Real> *> SwitchingFunctionConstraintLagrange::_h
protected

Switching functions.

Definition at line 46 of file SwitchingFunctionConstraintLagrange.h.

Referenced by computeQpResidual(), and SwitchingFunctionConstraintLagrange().

◆ _h_names

std::vector<MaterialPropertyName> SwitchingFunctionConstraintLagrange::_h_names
protected

Switching function names.

Definition at line 40 of file SwitchingFunctionConstraintLagrange.h.

Referenced by SwitchingFunctionConstraintLagrange().

◆ _num_h

unsigned int SwitchingFunctionConstraintLagrange::_num_h
protected

number of switching functions

Definition at line 43 of file SwitchingFunctionConstraintLagrange.h.

Referenced by computeQpOffDiagJacobian(), computeQpResidual(), and SwitchingFunctionConstraintLagrange().


The documentation for this class was generated from the following files:
SwitchingFunctionConstraintLagrange::_epsilon
Real _epsilon
shift factor
Definition: SwitchingFunctionConstraintLagrange.h:55
SwitchingFunctionConstraintLagrange::_num_h
unsigned int _num_h
number of switching functions
Definition: SwitchingFunctionConstraintLagrange.h:43
SwitchingFunctionConstraintLagrange::_dh
std::vector< std::vector< const MaterialProperty< Real > * > > _dh
Switching function derivatives.
Definition: SwitchingFunctionConstraintLagrange.h:49
SwitchingFunctionConstraintLagrange::_h_names
std::vector< MaterialPropertyName > _h_names
Switching function names.
Definition: SwitchingFunctionConstraintLagrange.h:40
name
const std::string name
Definition: Setup.h:21
SwitchingFunctionConstraintLagrange::_h
std::vector< const MaterialProperty< Real > * > _h
Switching functions.
Definition: SwitchingFunctionConstraintLagrange.h:46
SwitchingFunctionConstraintLagrange::_eta_map
const JvarMap & _eta_map
map for getting the "etas" index from jvar
Definition: SwitchingFunctionConstraintLagrange.h:52