www.mooseframework.org
AdvectionBC.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 "AdvectionBC.h"
11 #include "MooseMesh.h"
12 
13 registerMooseObject("NavierStokesApp", AdvectionBC);
14 
17 {
19  params.addClassDescription("Boundary conditions for outflow/outflow of advected quantities:"
20  "\n phi * velocity * normal, where phi is the advected quantitiy");
21  params.addRequiredCoupledVar("velocity_vector",
22  "The components of the velocity vector up to problem dimension");
23  return params;
24 }
25 
27  : IntegratedBC(parameters),
28  _dim(_mesh.dimension()),
29  _coupled_components(coupledComponents("velocity_vector")),
30  _velocity(coupledValues("velocity_vector"))
31 {
33  paramError(
34  "velocity_vector",
35  "Number of components of velocity_vector must be at least equal to the mesh dimension");
36  if (_coupled_components > 3)
37  paramError("velocity_vector",
38  "You cannot supply more than 3 components for the velocity vector");
39 }
40 
41 Real
43 {
44  RealVectorValue vel;
45  for (unsigned int j = 0; j < _coupled_components; ++j)
46  vel(j) = (*_velocity[j])[_qp];
47  if (vel * _normals[_qp] > 0)
48  return _test[_i][_qp] * _u[_qp] * vel * _normals[_qp];
49  return 0;
50 }
51 
52 Real
54 {
55  RealVectorValue vel;
56  for (unsigned int j = 0; j < _coupled_components; ++j)
57  vel(j) = (*_velocity[j])[_qp];
58  if (vel * _normals[_qp] > 0)
59  return _test[_i][_qp] * _phi[_j][_qp] * vel * _normals[_qp];
60  return 0;
61 }
const VariableTestValue & _test
unsigned int _j
const MooseArray< Point > & _normals
virtual Real computeQpJacobian() override
Definition: AdvectionBC.C:53
const unsigned int _dim
Definition: AdvectionBC.h:31
const unsigned int _coupled_components
Definition: AdvectionBC.h:32
static InputParameters validParams()
unsigned int _i
const VariablePhiValue & _phi
unsigned int _qp
const std::vector< const VariableValue * > _velocity
Definition: AdvectionBC.h:33
void paramError(const std::string &param, Args... args) const
Boundary terms for inflow/outflow of advected quantities, e.g.
Definition: AdvectionBC.h:20
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
AdvectionBC(const InputParameters &parameters)
Definition: AdvectionBC.C:26
virtual Real computeQpResidual() override
Definition: AdvectionBC.C:42
static InputParameters validParams()
Definition: AdvectionBC.C:16
void addClassDescription(const std::string &doc_string)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
registerMooseObject("NavierStokesApp", AdvectionBC)
const VariableValue & _u