https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
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 primary side");
24 params.addCoupledVar("secondary_coupled_var", "The coupled variable on the secondary 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
44Real
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
64Real
69
70Real
72 unsigned int jvar)
73{
74 if (jvar == _primary_coupled_id)
75 {
76 switch (type)
77 {
79 return _test[_i][_qp] * _penalty * _phi[_j][_qp];
81 return _test_neighbor[_i][_qp] * -_penalty * _phi[_j][_qp];
84 break;
85 }
86 }
87 else if (jvar == _secondary_coupled_id)
88 {
89 switch (type)
90 {
92 return _test[_i][_qp] * _penalty * -_phi_neighbor[_j][_qp];
97 break;
98 }
99 }
100 return 0;
101}
102
103void
109
110void
registerMooseObject("FsiApp", CoupledPenaltyInterfaceDiffusion)
DG kernel for interfacing diffusion between two variables on adjacent blocks.
virtual void computeElementOffDiagJacobian(unsigned int jvar) override
CoupledPenaltyInterfaceDiffusion(const InputParameters &parameters)
virtual Real computeQpOffDiagJacobian(Moose::DGJacobianType type, unsigned int jvar) override
virtual Real computeQpResidual(Moose::DGResidualType type) override
virtual void computeNeighborOffDiagJacobian(unsigned int jvar) override
virtual Real computeQpJacobian(Moose::DGJacobianType type) override
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
virtual void computeOffDiagElemNeighJacobian(Moose::DGJacobianType type, unsigned int jvar)
static InputParameters validParams()
const TemplateVariableTestValue & _test_neighbor
const TemplateVariablePhiValue & _phi
const TemplateVariableTestValue & _test
const TemplateVariablePhiValue & _phi_neighbor
const std::string & type() const
DGResidualType
DGJacobianType
NeighborNeighbor
ElementElement
NeighborElement
ElementNeighbor