https://mooseframework.inl.gov
INSPressureGradientDGKernel.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 "NS.h"
12 
14 
17 {
19 
20  params.addClassDescription("Adds the pressure term on interior faces. This is appropriate when "
21  "the pressure term is integrated by parts");
22  params.addRequiredCoupledVar(NS::pressure, "The current value of the pressure");
23  params.addRequiredRangeCheckedParam<unsigned>(
24  "component",
25  "component>=0 & component<=2",
26  "(0,1,2) = (x,y,z) for which momentum component this BC is applied to");
27 
28  return params;
29 }
30 
32  : ADDGKernel(parameters),
33  _pressure(adCoupledValue(NS::pressure)),
34  _pressure_neighbor(adCoupledNeighborValue(NS::pressure)),
35  _component(getParam<unsigned>("component"))
36 {
37 }
38 
39 void
41 {
43  mooseError("INSPressureGradientDGKernel does not support RSPHERICAL coordinates.");
44 }
45 
46 ADReal
48 {
49  const auto avg_pressure = 0.5 * (_pressure[_qp] + _pressure_neighbor[_qp]);
50  switch (type)
51  {
52  case Moose::Element:
53  return avg_pressure * _normals[_qp](_component) * _test[_i][_qp];
54  case Moose::Neighbor:
55  return -avg_pressure * _normals[_qp](_component) * _test_neighbor[_i][_qp];
56  default:
57  libmesh_assert(false);
58  return 0;
59  }
60 }
MooseMesh & _mesh
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
Moose::CoordinateSystemType getUniqueCoordSystem() const
COORD_RSPHERICAL
static InputParameters validParams()
unsigned int _i
DGResidualType
registerMooseObject("NavierStokesApp", INSPressureGradientDGKernel)
DualNumber< Real, DNDerivativeType, false > ADReal
unsigned int _qp
const unsigned _component
Momentum component to which this pressure contribution is added.
const VariableTestValue & _test_neighbor
virtual ADReal computeQpResidual(Moose::DGResidualType type) override
INSPressureGradientDGKernel(const InputParameters &parameters)
libmesh_assert(ctx)
const std::string & type() const
const MooseArray< Point > & _normals
const ADVariableValue & _pressure_neighbor
Pressure on the neighboring element side.
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
Adds the centered interior-face pressure contribution for a discontinuous momentum equation whose pre...
const ADVariableValue & _pressure
Pressure on the current element side.
static const std::string pressure
Definition: NS.h:57
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const VariableTestValue & _test