www.mooseframework.org
AEFVMaterial.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
8 #include "AEFVMaterial.h"
9 #include "MooseMesh.h"
10 
11 #include "libmesh/quadrature.h"
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<Material>();
18  params.addClassDescription(
19  "A material kernel for the advection equation using a cell-centered finite volume method.");
20  params.addRequiredCoupledVar("u", "Cell-averge variable");
21  params.addRequiredParam<UserObjectName>("slope_limiting", "Name for slope limiting user object");
22  return params;
23 }
24 
25 AEFVMaterial::AEFVMaterial(const InputParameters & parameters)
26  : Material(parameters),
27  _uc(coupledValue("u")),
28  _lslope(getUserObject<SlopeLimitingBase>("slope_limiting")),
29  _u(declareProperty<Real>("u"))
30 {
31 }
32 
34 
35 void
37 {
38  // initialize the variable
39  _u[_qp] = _uc[_qp];
40 
41  // interpolate variable values at face center
42  if (_bnd)
43  {
44  // you should know how many equations you are solving and assign this number
45  // e.g. = 1 (for the advection equation)
46  unsigned int nvars = 1;
47  std::vector<RealGradient> ugrad(nvars, RealGradient(0., 0., 0.));
48  ugrad = _lslope.getElementSlope(_current_elem->id());
49 
50  // get the directional vector from cell center to face center
51  RealGradient dvec = _q_point[_qp] - _current_elem->centroid();
52 
53  // calculate the variable at face center
54  _u[_qp] += ugrad[0] * dvec;
55 
56  // clear the temporary vectors
57  ugrad.clear();
58  }
59  // calculations only for elemental output
60  else if (!_bnd)
61  {
62  }
63 }
MaterialProperty< Real > & _u
Definition: AEFVMaterial.h:58
const VariableValue & _uc
Definition: AEFVMaterial.h:52
virtual const std::vector< RealGradient > & getElementSlope(dof_id_type elementid) const
accessor function call
virtual void computeQpProperties()
Definition: AEFVMaterial.C:36
Base class for slope limiting to limit the slopes of cell average variables.
const SlopeLimitingBase & _lslope
Definition: AEFVMaterial.h:55
InputParameters validParams< AEFVMaterial >()
Definition: AEFVMaterial.C:15
virtual ~AEFVMaterial()
Definition: AEFVMaterial.C:33
AEFVMaterial(const InputParameters &parameters)
Definition: AEFVMaterial.C:25