https://mooseframework.inl.gov
CoupledPenaltyInterfaceDiffusion.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 
13 
16 {
18  params.addClassDescription(
19  "Enforces continuity of flux and continuity of solution via penalty across an interface.");
20  params.addRequiredParam<Real>(
21  "penalty",
22  "The penalty that penalizes jump between primary and neighbor secondary variables.");
23  params.addCoupledVar("primary_coupled_var", "The coupled variable on the master side");
24  params.addCoupledVar("secondary_coupled_var", "The coupled variable on the slave side");
25  return params;
26 }
27 
29  const InputParameters & parameters)
30  : InterfaceKernel(parameters),
31  _penalty(getParam<Real>("penalty")),
32  _primary_coupled_value(isCoupled("primary_coupled_var") ? coupledValue("primary_coupled_var")
33  : _var.sln()),
34  _secondary_coupled_value(isCoupled("secondary_coupled_var")
35  ? coupledNeighborValue("secondary_coupled_var")
36  : _neighbor_var.slnNeighbor()),
37  _primary_coupled_id(isCoupled("primary_coupled_var") ? coupled("primary_coupled_var")
38  : _var.number()),
39  _secondary_coupled_id(isCoupled("secondary_coupled_var") ? coupled("secondary_coupled_var")
40  : _neighbor_var.number())
41 {
42 }
43 
44 Real
46 {
47  Real r = 0;
48 
49  switch (type)
50  {
51  case Moose::Element:
53  break;
54 
55  case Moose::Neighbor:
56  r = _test_neighbor[_i][_qp] * -_penalty *
58  break;
59  }
60 
61  return r;
62 }
63 
65 
66 Real
68  unsigned int jvar)
69 {
70  if (jvar == _primary_coupled_id)
71  {
72  switch (type)
73  {
75  return _test[_i][_qp] * _penalty * _phi[_j][_qp];
77  return _test_neighbor[_i][_qp] * -_penalty * _phi[_j][_qp];
80  break;
81  }
82  }
83  else if (jvar == _secondary_coupled_id)
84  {
85  switch (type)
86  {
88  return _test[_i][_qp] * _penalty * -_phi_neighbor[_j][_qp];
90  return _test_neighbor[_i][_qp] * -_penalty * -_phi_neighbor[_j][_qp];
93  break;
94  }
95  }
96  return 0;
97 }
98 
99 void
101 {
104 }
105 
106 void
108 {
111 }
virtual Real computeQpResidual(Moose::DGResidualType type) override
NeighborElement
registerMooseObject("FsiApp", CoupledPenaltyInterfaceDiffusion)
virtual Real computeQpJacobian(Moose::DGJacobianType type) override
const TemplateVariablePhiValue & _phi
DGResidualType
ElementElement
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual void computeElementOffDiagJacobian(unsigned int jvar) override
DG kernel for interfacing diffusion between two variables on adjacent blocks.
ElementNeighbor
virtual void computeOffDiagElemNeighJacobian(Moose::DGJacobianType type, unsigned int jvar)
virtual void computeNeighborOffDiagJacobian(unsigned int jvar) override
const std::string & type() const
const TemplateVariableTestValue & _test
void addCoupledVar(const std::string &name, const std::string &doc_string)
DGJacobianType
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real computeQpOffDiagJacobian(Moose::DGJacobianType type, unsigned int jvar) override
CoupledPenaltyInterfaceDiffusion(const InputParameters &parameters)
void addClassDescription(const std::string &doc_string)
const TemplateVariableTestValue & _test_neighbor
NeighborNeighbor
const TemplateVariablePhiValue & _phi_neighbor
static InputParameters validParams()