https://mooseframework.inl.gov
MassFluxPenaltyBC.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 "MassFluxPenaltyBC.h"
11 #include "Function.h"
12 
13 registerMooseObject("NavierStokesApp", MassFluxPenaltyBC);
14 
17 {
19  params.addRequiredCoupledVar("u", "The x-velocity");
20  params.addRequiredCoupledVar("v", "The y-velocity");
21  params.addRequiredParam<unsigned short>("component",
22  "The velocity component this object is being applied to");
23  params.addParam<Real>("gamma", 1, "The penalty to multiply the jump with");
24  params.addClassDescription("Adds the exterior boundary contribution of penalized jumps in the "
25  "velocity variable in one component of the momentum equations.");
26  params.addRequiredParam<FunctionName>("dirichlet_value",
27  "The velocity Dirichlet value on the boundary");
28  return params;
29 }
30 
32  : ADIntegratedBC(parameters),
33  _vel_x(adCoupledValue("u")),
34  _vel_y(adCoupledValue("v")),
35  _comp(getParam<unsigned short>("component")),
36  _matrix_only(getParam<bool>("matrix_only")),
37  _gamma(getParam<Real>("gamma")),
38  _dirichlet_func(isParamValid("dirichlet_value") ? &getFunction("dirichlet_value") : nullptr)
39 {
40  if (_mesh.dimension() > 2)
41  mooseError("This class only supports 2D simulations at this time");
42 }
43 
44 void
46 {
47  if (!_matrix_only)
49 }
50 
51 ADReal
53 {
54  ADRealVectorValue soln_jump(_vel_x[_qp], _vel_y[_qp], 0);
55  if (_dirichlet_func)
56  soln_jump -= _dirichlet_func->vectorValue(_t, _q_point[_qp]);
57 
58  return _gamma * soln_jump * _normals[_qp] * _test[_i][_qp] * _normals[_qp](_comp);
59 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void computeResidual() override
const Function *const _dirichlet_func
DualNumber< Real, DNDerivativeType, true > ADReal
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
unsigned int _qp
MassFluxPenaltyBC(const InputParameters &parameters)
const MooseArray< Point > & _q_point
static InputParameters validParams()
const bool _matrix_only
whether to avoid contributing to the residual
virtual unsigned int dimension() const
registerMooseObject("NavierStokesApp", MassFluxPenaltyBC)
const Real _gamma
Stabilization magnitude parameter.
virtual void computeResidual() override
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const ADTemplateVariableTestValue< T > & _test
const ADVariableValue & _vel_x
const unsigned short _comp
virtual RealVectorValue vectorValue(Real t, const Point &p) const
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const ADVariableValue & _vel_y
virtual ADReal computeQpResidual() override
const MooseArray< ADPoint > & _normals