https://mooseframework.inl.gov
MassFluxPenalty.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 
10 #include "MassFluxPenalty.h"
11 
12 // MOOSE includes
13 #include "MooseVariableFE.h"
14 
15 #include "libmesh/utility.h"
16 
17 registerMooseObject("NavierStokesApp", MassFluxPenalty);
18 
21 {
23  params.addRequiredCoupledVar("u", "The x-velocity");
24  params.addRequiredCoupledVar("v", "The y-velocity");
25  params.addRequiredParam<unsigned short>("component",
26  "The velocity component this object is being applied to");
27  params.addParam<Real>("gamma", 1, "The penalty to multiply the jump");
28  params.addClassDescription("Introduces a jump correction on internal faces for grad-div "
29  "stabilization for discontinuous Galerkin methods. Because this is "
30  "derived from DGKernel this class executes once per face.");
31  return params;
32 }
33 
35  : ADDGKernel(parameters),
36  _vel_x(adCoupledValue("u")),
37  _vel_x_neighbor(adCoupledNeighborValue("u")),
38  _vel_y(adCoupledValue("v")),
39  _vel_y_neighbor(adCoupledNeighborValue("v")),
40  _comp(getParam<unsigned short>("component")),
41  _matrix_only(getParam<bool>("matrix_only")),
42  _gamma(getParam<Real>("gamma"))
43 {
44  if (_mesh.dimension() > 2)
45  mooseError("This class only supports 2D simulations at this time");
46 }
47 
48 void
50 {
51  if (!_matrix_only)
53 }
54 
55 ADReal
57 {
58  ADReal r = 0.0;
59  const ADRealVectorValue soln_jump(
61 
62  switch (type)
63  {
64  case Moose::Element:
65  r = _gamma * soln_jump * _normals[_qp] * _test[_i][_qp] * _normals[_qp](_comp);
66  break;
67 
68  case Moose::Neighbor:
69  r = -_gamma * soln_jump * _normals[_qp] * _test_neighbor[_i][_qp] * _normals[_qp](_comp);
70  break;
71  }
72 
73  return r;
74 }
MooseMesh & _mesh
This class introduces a jump correction for grad-div stabilization (see GradDiv) for discontinuous Ga...
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const ADVariableValue & _vel_y_neighbor
const ADVariableValue & _vel_x
const unsigned short _comp
const ADVariableValue & _vel_x_neighbor
static InputParameters validParams()
unsigned int _i
DGResidualType
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("NavierStokesApp", MassFluxPenalty)
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual void computeResidual() override
unsigned int _qp
const bool _matrix_only
whether to avoid contributing to the residual
const Real _gamma
Stabilization magnitude parameter.
MassFluxPenalty(const InputParameters &parameters)
virtual unsigned int dimension() const
const VariableTestValue & _test_neighbor
const std::string & type() const
const MooseArray< Point > & _normals
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
const ADVariableValue & _vel_y
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void computeResidual() override
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
virtual ADReal computeQpResidual(Moose::DGResidualType type) override
const VariableTestValue & _test