https://mooseframework.inl.gov
EqualGradientLagrangeMultiplier.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 
12 // MOOSE includes
13 #include "MooseVariable.h"
14 
16 
19 {
21  params.addClassDescription("Lagrange multiplier kernel for EqualGradientLagrangeInterface.");
22  params.addRequiredParam<unsigned int>("component", "Gradient component to constrain");
23  params.addCoupledVar("element_var",
24  "The gradient constrained variable on this side of the interface.");
25  params.addParam<Real>("jacobian_fill",
26  0.0,
27  "Compensate on diagonal Jacobian fill term when "
28  "using a NullKernel on the Lagrange multiplier "
29  "variable");
30  return params;
31 }
32 
34  : InterfaceKernel(parameters),
35  _component(getParam<unsigned int>("component")),
36  _grad_element_value(getVar("element_var", 0)->gradSln()),
37  _element_jvar(getVar("element_var", 0)->number()),
38  _neighbor_jvar(_neighbor_var.number()),
39  _jacobian_fill(getParam<Real>("jacobian_fill"))
40 {
41 }
42 
43 Real
45 {
46  if (type == Moose::Element)
48  _test[_i][_qp];
49 
50  return 0.0;
51 }
52 
53 Real
55 {
58 
60  return -_jacobian_fill;
61 
62  return 0.0;
63 }
64 
65 Real
67  unsigned int jvar)
68 {
69  if (type == Moose::ElementElement && jvar == _element_jvar)
70  return _grad_phi[_j][_qp](_component) * _test[_i][_qp];
71 
72  return 0.0;
73 }
virtual Real computeQpOffDiagJacobian(Moose::DGJacobianType type, unsigned int jvar) override
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
EqualGradientLagrangeMultiplier(const InputParameters &parameters)
registerMooseObject("PhaseFieldApp", EqualGradientLagrangeMultiplier)
DGResidualType
ElementElement
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual Real computeQpResidual(Moose::DGResidualType type) override
virtual Real computeQpJacobian(Moose::DGJacobianType type) override
ElementNeighbor
const std::string & type() const
const unsigned int _component
x,y,z component of the gradient to constrain
const VariableGradient & _grad_element_value
variable to control gradient on the primary side of the interface
const TemplateVariableTestValue & _test
const Real _jacobian_fill
compensate Jacobian fill term from NullKernel
void addCoupledVar(const std::string &name, const std::string &doc_string)
const TemplateVariablePhiGradient & _grad_phi_neighbor
DGJacobianType
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
const TemplateVariablePhiGradient & _grad_phi
Lagrange multiplier "FaceKernel" that is used in conjunction with EqualGradientLagrangeInterface.
void ErrorVector unsigned int
static InputParameters validParams()
const TemplateVariableGradient & _grad_neighbor_value