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