forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OneDEqualValueConstraintBC.C
63 lines (55 loc) · 1.97 KB
/
OneDEqualValueConstraintBC.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/****************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* (c) 2010 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* Under Contract No. DE-AC07-05ID14517 */
/* With the U. S. Department of Energy */
/* */
/* See COPYRIGHT for full restrictions */
/****************************************************************/
#include "OneDEqualValueConstraintBC.h"
template<>
InputParameters validParams<OneDEqualValueConstraintBC>()
{
InputParameters params = validParams<IntegratedBC>();
params.addRequiredCoupledVar("lambda", "Lagrange multiplier");
params.addRequiredParam<unsigned int>("component", "Component of the Lagrange multiplier");
return params;
}
OneDEqualValueConstraintBC::OneDEqualValueConstraintBC(const std::string & name, InputParameters parameters) :
IntegratedBC(name, parameters),
_lambda(coupledScalarValue("lambda")),
_lambda_var_number(coupledScalar("lambda")),
_component(getParam<unsigned int>("component"))
{
}
OneDEqualValueConstraintBC::~OneDEqualValueConstraintBC()
{
}
Real
OneDEqualValueConstraintBC::computeQpResidual()
{
return _lambda[_component] * _normals[_qp](0) * _test[_i][_qp];
}
Real
OneDEqualValueConstraintBC::computeQpJacobian()
{
return 0.;
}
Real
OneDEqualValueConstraintBC::computeQpOffDiagJacobian(unsigned jvar)
{
if (jvar == _lambda_var_number)
{
if (_j == _component)
return _normals[_qp](0) * _test[_i][_qp];
else
return 0.;
}
else
return 0.;
}