https://mooseframework.inl.gov
Loading...
Searching...
No Matches
AdvectionBC.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 "AdvectionBC.h"
11#include "MooseMesh.h"
12
13registerMooseObject("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{
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
41Real
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
52Real
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}
registerMooseObject("NavierStokesApp", AdvectionBC)
Boundary terms for inflow/outflow of advected quantities, e.g.
Definition AdvectionBC.h:21
const std::vector< const VariableValue * > _velocity
Definition AdvectionBC.h:33
virtual Real computeQpJacobian() override
Definition AdvectionBC.C:53
const unsigned int _dim
Definition AdvectionBC.h:31
static InputParameters validParams()
Definition AdvectionBC.C:16
virtual Real computeQpResidual() override
Definition AdvectionBC.C:42
const unsigned int _coupled_components
Definition AdvectionBC.h:32
AdvectionBC(const InputParameters &parameters)
Definition AdvectionBC.C:26
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
unsigned int _qp
unsigned int _i
unsigned int _j
const VariableValue & _u
static InputParameters validParams()
const VariablePhiValue & _phi
const MooseArray< Point > & _normals
const VariableTestValue & _test
void paramError(const std::string &param, Args... args) const