www.mooseframework.org
ADDGDiffusion.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 
10 #include "ADDGDiffusion.h"
11 
12 // MOOSE includes
13 #include "MooseVariableFE.h"
14 
15 #include "libmesh/utility.h"
16 
18 
21 {
23  // See header file for sigma and epsilon
24  params.addRequiredParam<Real>("sigma", "sigma");
25  params.addRequiredParam<Real>("epsilon", "epsilon");
26  params.addParam<MaterialPropertyName>(
27  "diff", 1., "The diffusion (or thermal conductivity or viscosity) coefficient.");
28  params.addClassDescription("DG kernel for diffusion operator");
29  return params;
30 }
31 
33  : ADDGKernel(parameters),
34  _epsilon(getParam<Real>("epsilon")),
35  _sigma(getParam<Real>("sigma")),
36  _diff(getADMaterialProperty<Real>("diff")),
37  _diff_neighbor(getNeighborADMaterialProperty<Real>("diff"))
38 {
39 }
40 
41 ADReal
43 {
44  ADReal r = 0.0;
45 
46  const int elem_b_order = std::max(libMesh::Order(1), _var.order());
47  const Real h_elem =
49 
50  switch (type)
51  {
52  case Moose::Element:
53  r -= 0.5 *
54  (_diff[_qp] * _grad_u[_qp] * _normals[_qp] +
56  _test[_i][_qp];
57  r += _epsilon * 0.5 * (_u[_qp] - _u_neighbor[_qp]) * _diff[_qp] * _grad_test[_i][_qp] *
58  _normals[_qp];
59  r += _sigma / h_elem * (_u[_qp] - _u_neighbor[_qp]) * _test[_i][_qp];
60  break;
61 
62  case Moose::Neighbor:
63  r += 0.5 *
64  (_diff[_qp] * _grad_u[_qp] * _normals[_qp] +
67  r += _epsilon * 0.5 * (_u[_qp] - _u_neighbor[_qp]) * _diff_neighbor[_qp] *
69  r -= _sigma / h_elem * (_u[_qp] - _u_neighbor[_qp]) * _test_neighbor[_i][_qp];
70  break;
71  }
72 
73  return r;
74 }
ADDGDiffusion(const InputParameters &parameters)
Definition: ADDGDiffusion.C:32
DG kernel for diffusion.
Definition: ADDGDiffusion.h:24
const Real & _current_side_volume
The volume (or length) of the current side.
Definition: DGKernelBase.h:100
virtual ADReal computeQpResidual(Moose::DGResidualType type) override
Compute this Kernel&#39;s contribution to the residual at the current quadrature point.
Definition: ADDGDiffusion.C:42
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
Definition: ADDGKernel.C:22
unsigned int _i
Definition: DGKernelBase.h:136
DGResidualType
Definition: MooseTypes.h:656
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...
auto max(const L &left, const R &right)
unsigned int _qp
Definition: DGKernelBase.h:134
const ADVariableValue & _u
Holds the solution at current quadrature points.
Definition: ADDGKernel.h:57
const ADMaterialProperty< Real > & _diff
Definition: ADDGDiffusion.h:36
const VariableTestValue & _test_neighbor
Side test function.
Definition: ADDGKernel.h:52
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:51
const MooseArray< Point > & _normals
Normal vectors at the quadrature points.
Definition: DGKernelBase.h:113
DualReal ADReal
Definition: ADRealForward.h:14
registerMooseObject("MooseApp", ADDGDiffusion)
MooseVariable & _var
Variable this kernel operates on.
Definition: ADDGKernel.h:38
const ADVariableGradient & _grad_u_neighbor
Holds the current solution gradient at the current quadrature point.
Definition: ADDGKernel.h:66
Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const ADMaterialProperty< Real > & _diff_neighbor
Definition: ADDGDiffusion.h:37
const ADVariableGradient & _grad_u
Holds the solution gradient at the current quadrature points.
Definition: ADDGKernel.h:60
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...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
const VariableTestGradient & _grad_test_neighbor
Gradient of side shape function.
Definition: ADDGKernel.h:54
const ADVariableValue & _u_neighbor
Holds the current solution at the current quadrature point.
Definition: ADDGKernel.h:63
static InputParameters validParams()
Definition: ADDGDiffusion.C:20
const VariableTestValue & _test
test functions
Definition: ADDGKernel.h:44
const Real & _current_elem_volume
The volume (or length) of the current element.
Definition: DGKernelBase.h:87
const VariableTestGradient & _grad_test
Gradient of side shape function.
Definition: ADDGKernel.h:46
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template pow< 2 >(tan(_arg))+1.0) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(sqrt