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