www.mooseframework.org
FunctionScalarAux.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 "FunctionScalarAux.h"
11 #include "Function.h"
12 
14 
15 template <>
18 {
20  params.addRequiredParam<std::vector<FunctionName>>(
21  "function", "The functions to set the scalar variable components.");
22 
23  return params;
24 }
25 
27  : AuxScalarKernel(parameters)
28 {
29  std::vector<FunctionName> funcs = getParam<std::vector<FunctionName>>("function");
30  if (funcs.size() != _var.order())
31  mooseError("number of functions is not equal to the number of scalar variable components");
32 
33  for (const auto & func : funcs)
34  _functions.push_back(&getFunctionByName(func));
35 }
36 
37 Real
39 {
40  return _functions[_i]->value(_t, _point_zero);
41 }
MooseVariableScalar & _var
const Point & _point_zero
Zero point.
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 mooseError(Args &&... args) const
Definition: MooseObject.h:147
registerMooseObject("MooseApp", FunctionScalarAux)
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
Sets a value of a scalar variable based on the function.
InputParameters validParams< AuxScalarKernel >()