www.mooseframework.org
FunctionScalarAux.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "FunctionScalarAux.h"
16 #include "Function.h"
17 
18 template <>
21 {
23  params.addRequiredParam<std::vector<FunctionName>>(
24  "function", "The functions to set the scalar variable components.");
25 
26  return params;
27 }
28 
30  : AuxScalarKernel(parameters)
31 {
32  std::vector<FunctionName> funcs = getParam<std::vector<FunctionName>>("function");
33  if (funcs.size() != _var.order())
34  mooseError("number of functions is not equal to the number of scalar variable components");
35 
36  for (const auto & func : funcs)
37  _functions.push_back(&getFunctionByName(func));
38 }
39 
40 Real
42 {
43  return _functions[_i]->value(_t, Point(0, 0, 0));
44 }
MooseVariableScalar & _var
std::vector< Function * > _functions
virtual Real computeValue() override
Compute the value of this kernel.
InputParameters validParams< FunctionScalarAux >()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
Base class for making kernels that work on auxiliary scalar variables.
Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int...
FunctionScalarAux(const InputParameters &parameters)
Function & getFunctionByName(const FunctionName &name)
Get a function with a given name.
unsigned int _i
void mooseError(Args &&...args) const
Definition: MooseObject.h:80
InputParameters validParams< AuxScalarKernel >()