www.mooseframework.org
EqualGradientLagrangeMultiplier.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 
9 // MOOSE includes
10 #include "MooseVariable.h"
11 
12 template <>
13 InputParameters
15 {
16  InputParameters params = validParams<InterfaceKernel>();
17  params.addClassDescription("Lagrange multiplier kernel for EqualGradientLagrangeInterface.");
18  params.addRequiredParam<unsigned int>("component", "Gradient component to constrain");
19  params.addCoupledVar("element_var",
20  "The gradient constrained variable on this side of the interface.");
21  params.addParam<Real>("jacobian_fill",
22  0.0,
23  "Compensate on diagonal Jacobian fill term when "
24  "using a NullKernel on the Lagrange multiplier "
25  "variable");
26  return params;
27 }
28 
30  : InterfaceKernel(parameters),
31  _component(getParam<unsigned int>("component")),
32  _grad_element_value(getVar("element_var", 0)->gradSln()),
33  _element_jvar(getVar("element_var", 0)->number()),
34  _neighbor_jvar(_neighbor_var.number()),
35  _jacobian_fill(getParam<Real>("jacobian_fill"))
36 {
37 }
38 
39 Real
41 {
42  if (type == Moose::Element)
43  return (_grad_element_value[_qp](_component) - _grad_neighbor_value[_qp](_component)) *
44  _test[_i][_qp];
45 
46  return 0.0;
47 }
48 
49 Real
51 {
52  if (type == Moose::ElementNeighbor)
53  return -_grad_phi_neighbor[_j][_qp](_component) * _test[_i][_qp];
54 
55  if (type == Moose::ElementElement)
56  return -_jacobian_fill;
57 
58  return 0.0;
59 }
60 
61 Real
63  unsigned int jvar)
64 {
65  if (type == Moose::ElementElement && jvar == _element_jvar)
66  return _grad_phi[_j][_qp](_component) * _test[_i][_qp];
67 
68  return 0.0;
69 }
virtual Real computeQpOffDiagJacobian(Moose::DGJacobianType type, unsigned int jvar) override
InputParameters validParams< EqualGradientLagrangeMultiplier >()
EqualGradientLagrangeMultiplier(const InputParameters &parameters)
virtual Real computeQpResidual(Moose::DGResidualType type) override
virtual Real computeQpJacobian(Moose::DGJacobianType type) override
const unsigned int _component
x,y,z component of the gradient to constrain
const VariableGradient & _grad_element_value
variable to control gradient on the master side of the interface
const Real _jacobian_fill
compensate Jacobian fill term from NullKernel