forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GapConductanceConstraint.C
68 lines (59 loc) · 2.25 KB
/
GapConductanceConstraint.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
64
65
66
67
68
/****************************************************************/
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* All contents are licensed under LGPL V2.1 */
/* See LICENSE for full restrictions */
/****************************************************************/
#include "GapConductanceConstraint.h"
template<>
InputParameters validParams<GapConductanceConstraint>()
{
InputParameters params = validParams<FaceFaceConstraint>();
params.addClassDescription("Computes the residual and Jacobian contributions for the 'Lagrange Multiplier' "
"implementation of the thermal contact problem. For more information, see the "
"detailed description here: http://tinyurl.com/gmmhbe9");
params.addRequiredParam<Real>("k", "Gap conductance");
return params;
}
GapConductanceConstraint::GapConductanceConstraint(const InputParameters & parameters) :
FaceFaceConstraint(parameters),
_k(getParam<Real>("k"))
{
}
GapConductanceConstraint::~GapConductanceConstraint()
{
}
Real
GapConductanceConstraint::computeQpResidual()
{
Real l = (_phys_points_master[_qp] - _phys_points_slave[_qp]).norm();
return (_k * (_u_master[_qp] - _u_slave[_qp]) / l - _lambda[_qp]) * _test[_i][_qp];
}
Real
GapConductanceConstraint::computeQpResidualSide(Moose::ConstraintType res_type)
{
switch (res_type)
{
case Moose::Master: return _lambda[_qp] * _test_master[_i][_qp];
case Moose::Slave: return -_lambda[_qp] * _test_slave[_i][_qp];
default: return 0;
}
}
Real
GapConductanceConstraint::computeQpJacobian()
{
return -_phi[_j][_qp] * _test[_i][_qp];
}
Real
GapConductanceConstraint::computeQpJacobianSide(Moose::ConstraintJacobianType jac_type)
{
Real l = (_phys_points_master[_qp] - _phys_points_slave[_qp]).norm();
switch (jac_type)
{
case Moose::MasterMaster: return (_k / l) * _phi[_j][_qp] * _test_master[_i][_qp];
case Moose::MasterSlave: return -(_k / l) * _phi[_j][_qp] * _test_slave[_i][_qp];
case Moose::SlaveMaster: return _phi[_j][_qp] * _test_master[_i][_qp];
case Moose::SlaveSlave: return -_phi[_j][_qp] * _test_slave[_i][_qp];
default: return 0;
}
}