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 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<IntegratedBC>();
20  params.addClassDescription("Boundary conditions for outflow/outflow of advected quantities:"
21  "\n phi * velocity * normal, where phi is the advected quantitiy");
22  params.addRequiredCoupledVar("velocity_vector",
23  "The components of the velocity vector up to problem dimension");
24  return params;
25 }
26 
27 AdvectionBC::AdvectionBC(const InputParameters & parameters)
28  : IntegratedBC(parameters),
29  _dim(_mesh.dimension()),
30  _coupled_components(coupledComponents("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 
41  for (unsigned int j = 0; j < _coupled_components; ++j)
42  _velocity[j] = &coupledValue("velocity_vector", j);
43 }
44 
45 Real
47 {
48  RealVectorValue vel;
49  for (unsigned int j = 0; j < _coupled_components; ++j)
50  vel(j) = (*_velocity[j])[_qp];
51  if (vel * _normals[_qp] > 0)
52  return _test[_i][_qp] * _u[_qp] * vel * _normals[_qp];
53  return 0;
54 }
55 
56 Real
58 {
59  RealVectorValue vel;
60  for (unsigned int j = 0; j < _coupled_components; ++j)
61  vel(j) = (*_velocity[j])[_qp];
62  if (vel * _normals[_qp] > 0)
63  return _test[_i][_qp] * _phi[_j][_qp] * vel * _normals[_qp];
64  return 0;
65 }
AdvectionBC::computeQpJacobian
virtual Real computeQpJacobian() override
Definition: AdvectionBC.C:57
AdvectionBC::_dim
const unsigned int _dim
Definition: AdvectionBC.h:33
AdvectionBC::_coupled_components
const unsigned int _coupled_components
Definition: AdvectionBC.h:34
registerMooseObject
registerMooseObject("NavierStokesApp", AdvectionBC)
AdvectionBC
Boundary terms for inflow/outflow of advected quantities, e.g.
Definition: AdvectionBC.h:24
validParams< AdvectionBC >
InputParameters validParams< AdvectionBC >()
Definition: AdvectionBC.C:17
AdvectionBC.h
AdvectionBC::computeQpResidual
virtual Real computeQpResidual() override
Definition: AdvectionBC.C:46
AdvectionBC::AdvectionBC
AdvectionBC(const InputParameters &parameters)
Definition: AdvectionBC.C:27
AdvectionBC::_velocity
std::vector< const VariableValue * > _velocity
Definition: AdvectionBC.h:35