www.mooseframework.org
EqualGradientLagrangeInterface.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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("Enforce componentwise gradient continuity between two different "
22  "variables across a subdomain boundary using a Lagrange multiplier");
23  params.addRequiredParam<unsigned int>("component", "Gradient component to constrain");
24  params.addCoupledVar("lambda",
25  "The gradient constrained variable on this side of the interface.");
26  return params;
27 }
28 
30  : InterfaceKernel(parameters),
31  _component(getParam<unsigned int>("component")),
32  _lambda(getVar("lambda", 0)->sln()),
33  _lambda_jvar(getVar("lambda", 0)->number())
34 {
35 }
36 
37 Real
39 {
40  switch (type)
41  {
42  case Moose::Element:
43  return _lambda[_qp] * _grad_test[_i][_qp](_component);
44 
45  case Moose::Neighbor:
47  }
48 
49  mooseError("Internal error.");
50 }
51 
53 {
54  return 0.0;
55 }
56 
57 Real
59  unsigned int jvar)
60 {
61  if (jvar != _lambda_jvar)
62  return 0.0;
63 
64  // lambda is only solved on the element side
65  switch (type)
66  {
68  return _phi[_j][_qp] * _grad_test[_i][_qp](_component);
69 
72 
73  default:
74  return 0.0;
75  }
76 }
NeighborElement
const TemplateVariableTestGradient & _grad_test
const TemplateVariablePhiValue & _phi
DGResidualType
virtual Real computeQpJacobian(Moose::DGJacobianType type) override
virtual Real computeQpOffDiagJacobian(Moose::DGJacobianType type, unsigned int jvar) override
InterfaceKernel to enforce a Lagrange-Multiplier based componentwise continuity of a variable gradien...
ElementElement
void addRequiredParam(const std::string &name, const std::string &doc_string)
const TemplateVariableTestGradient & _grad_test_neighbor
virtual Real computeQpResidual(Moose::DGResidualType type) override
const std::string & type() const
registerMooseObject("PhaseFieldApp", EqualGradientLagrangeInterface)
void addCoupledVar(const std::string &name, const std::string &doc_string)
const VariableValue & _lambda
Lagrange multiplier.
DGJacobianType
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
void ErrorVector unsigned int
static InputParameters validParams()
EqualGradientLagrangeInterface(const InputParameters &parameters)