https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PenaltyInterfaceDiffusion.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
16
17template <typename T, bool is_ad>
20{
22 params.addRequiredParam<Real>(
23 "penalty", "The penalty that penalizes jump between primary and neighbor variables.");
24 params.addParam<MaterialPropertyName>(
25 "jump_prop_name", "the name of the material property that calculates the jump.");
27 "A penalty-based interface condition that forces"
28 "the continuity of variables and the flux equivalence across an interface.");
29 return params;
30}
31
32template <typename T, bool is_ad>
34 const InputParameters & parameters)
35 : GenericInterfaceKernelTempl<T, is_ad>(parameters),
36 _penalty(this->template getParam<Real>("penalty")),
37 _jump(isParamValid("jump_prop_name")
38 ? &this->template getGenericMaterialProperty<T, is_ad>("jump_prop_name")
39 : nullptr)
40{
41}
42
43template <typename T, bool is_ad>
46{
48
49 Moose::GenericType<T, is_ad> jump_value = 0;
50
51 if (_jump != nullptr)
52 jump_value = (*_jump)[_qp];
53 else
54 jump_value = _u[_qp] - _neighbor_value[_qp];
55
56 switch (type)
57 {
58 case Moose::Element:
59 r = _test[_i][_qp] * _penalty * jump_value;
60 break;
61
62 case Moose::Neighbor:
63 r = _test_neighbor[_i][_qp] * -_penalty * jump_value;
64 break;
65 }
66
67 return r;
68}
69
70template <typename T, bool is_ad>
71Real
73{
74 Real jac = 0;
75
76 switch (type)
77 {
79 jac = _test[_i][_qp] * _penalty * _phi[_j][_qp];
80 break;
81
83 jac = _test[_i][_qp] * _penalty * -_phi_neighbor[_j][_qp];
84 break;
85
87 jac = _test_neighbor[_i][_qp] * -_penalty * _phi[_j][_qp];
88 break;
89
91 jac = _test_neighbor[_i][_qp] * -_penalty * -_phi_neighbor[_j][_qp];
92 break;
93 }
94
95 return jac;
96}
97
Moose::GenericType< Real, is_ad > GenericReal
Definition MooseTypes.h:698
registerMooseObject("MooseApp", PenaltyInterfaceDiffusion)
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
Interface kernel for interfacing diffusion between two variables on adjacent blocks.
Real computeQpJacobian(Moose::DGJacobianType type) override
Compute jacobians at quadrature points.
GenericReal< is_ad > computeQpResidual(Moose::DGResidualType type) override
Compute residuals at quadrature points.
PenaltyInterfaceDiffusionTempl(const InputParameters &parameters)
DGResidualType
Definition MooseTypes.h:798
@ Element
Definition MooseTypes.h:799
@ Neighbor
Definition MooseTypes.h:800
typename std::conditional< is_ad, typename ADType< T >::type, T >::type GenericType
Definition MooseTypes.h:694
DGJacobianType
Definition MooseTypes.h:804
@ NeighborNeighbor
Definition MooseTypes.h:808
@ ElementElement
Definition MooseTypes.h:805
@ NeighborElement
Definition MooseTypes.h:807
@ ElementNeighbor
Definition MooseTypes.h:806