www.mooseframework.org
MaterialAuxBase.h
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 #pragma once
11 
12 // MOOSE includes
13 #include "AuxKernel.h"
14 
15 // Forward declarations
16 template <typename T = Real>
18 
19 template <>
20 InputParameters validParams<MaterialAuxBase<>>();
21 
25 template <typename T>
26 class MaterialAuxBase : public AuxKernel
27 {
28 public:
34 
35 protected:
36  virtual Real computeValue() override;
37 
39  virtual Real getRealValue() = 0;
40 
43 
44 private:
46  const Real _factor;
47 
49  const Real _offset;
50 };
51 
52 template <typename T>
54  : AuxKernel(parameters),
55  _prop(getMaterialProperty<T>("property")),
56  _factor(getParam<Real>("factor")),
57  _offset(getParam<Real>("offset"))
58 {
59 }
60 
61 template <typename T>
62 Real
64 {
65  return _factor * getRealValue() + _offset;
66 }
67 
MaterialAuxBase(const InputParameters &parameters)
Class constructor.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
A base class for the various Material related AuxKernal objects.
const MaterialProperty< T > & _prop
Reference to the material property for this AuxKernel.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
virtual Real getRealValue()=0
Returns material property values at quadrature points.
const Real _factor
Multiplier for the material property.
virtual Real computeValue() override
Compute and return the value of the aux variable.
Concrete definition of a parameter value for a specified type.
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:33
const Real _offset
Value to be added to the material property.