www.mooseframework.org
AEFVBC.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 "AEFVBC.h"
11 
12 registerMooseObject("RdgApp", AEFVBC);
13 
16 {
18  params.addClassDescription("A boundary condition kernel for the advection equation using a "
19  "cell-centered finite volume method.");
20  MooseEnum component("concentration");
21  params.addParam<MooseEnum>("component", component, "Choose one of the equations");
22  params.addRequiredCoupledVar("u", "Name of the variable to use");
23  params.addRequiredParam<UserObjectName>("flux", "Name of the boundary flux object to use");
24  return params;
25 }
26 
27 AEFVBC::AEFVBC(const InputParameters & parameters)
28  : IntegratedBC(parameters),
29  _component(getParam<MooseEnum>("component")),
30  _uc1(coupledValue("u")),
31  _u1(getMaterialProperty<Real>("u")),
32  _flux(getUserObject<BoundaryFluxBase>("flux"))
33 {
34 }
35 
36 Real
38 {
39  // assemble the input vectors, which are
40  // the reconstructed linear monomial
41  // extrapolated at side center from the current element
42  std::vector<Real> uvec1 = {_u1[_qp]};
43 
44  // calculate the flux
45  const auto & flux = _flux.getFlux(_current_side, _current_elem->id(), uvec1, _normals[_qp]);
46 
47  // distribute the contribution to the current element
48  return flux[_component] * _test[_i][_qp];
49 }
50 
51 Real
53 {
54  // assemble the input vectors, which are
55  // the constant monomial from the current element
56  std::vector<Real> uvec1 = {_uc1[_qp]};
57 
58  // calculate the flux
59  auto & fjac1 = _flux.getJacobian(_current_side, _current_elem->id(), uvec1, _normals[_qp]);
60 
61  // distribute the contribution to the current element
62  return fjac1(_component, _component) * _phi[_j][_qp] * _test[_i][_qp];
63 }
const VariableTestValue & _test
virtual const std::vector< Real > & getFlux(unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave) const
Get the boundary flux vector.
unsigned int _j
registerMooseObject("RdgApp", AEFVBC)
const MooseArray< Point > & _normals
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static const std::string component
Definition: NS.h:138
const Elem *const & _current_elem
virtual Real computeQpJacobian()
Definition: AEFVBC.C:52
MooseEnum _component
choose an equation
Definition: AEFVBC.h:53
static InputParameters validParams()
unsigned int _i
virtual const DenseMatrix< Real > & getJacobian(unsigned int iside, dof_id_type ielem, const std::vector< Real > &uvec1, const RealVectorValue &dwave) const
Get the boundary Jacobian matrix.
const VariableValue & _uc1
piecewise constant variable values in host element
Definition: AEFVBC.h:58
const VariablePhiValue & _phi
void addRequiredParam(const std::string &name, const std::string &doc_string)
unsigned int _qp
A base class for computing/caching fluxes at boundaries.
virtual Real computeQpResidual()
Definition: AEFVBC.C:37
A boundary condition object for the advection equation using a cell-centered finite volume method...
Definition: AEFVBC.h:40
static InputParameters validParams()
Definition: AEFVBC.C:15
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
const BoundaryFluxBase & _flux
bounadry flux object
Definition: AEFVBC.h:64
const unsigned int & _current_side
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
AEFVBC(const InputParameters &parameters)
Definition: AEFVBC.C:27
void addClassDescription(const std::string &doc_string)
const MaterialProperty< Real > & _u1
extrapolated variable values at side center
Definition: AEFVBC.h:61