https://mooseframework.inl.gov
FunctionArrayAux.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 "FunctionArrayAux.h"
11 #include "Function.h"
12 
14 
17 {
19  params.addClassDescription("Auxiliary Kernel that creates and updates an array field variable by "
20  "sampling functions through space and time.");
21  params.addRequiredParam<std::vector<FunctionName>>("functions",
22  "The functions to use as the value");
23  return params;
24 }
25 
27 {
28  auto & func_names = getParam<std::vector<FunctionName>>("functions");
29  if (func_names.size() != _var.count())
30  paramError("functions",
31  "Number of functions must be equal to the number of components of array variable ",
32  _var.name());
33 
34  for (auto & fname : func_names)
35  _funcs.push_back(&getFunctionByName(fname));
36 }
37 
40 {
42  const Point & p = isNodal() ? *_current_node : _q_point[_qp];
43  for (unsigned int i = 0; i < _var.count(); ++i)
44  v(i) = _funcs[i]->value(_t, p);
45  return v;
46 }
registerMooseObject("MooseApp", FunctionArrayAux)
const Node *const & _current_node
Current node (valid only for nodal kernels)
Definition: AuxKernel.h:214
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one...
const std::string & name() const override
Get the variable name.
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...
virtual RealEigenVector computeValue() override
Compute and return the value of the aux variable.
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
MooseVariableField< ComputeValueType > & _var
This is a regular kernel so we cast to a regular MooseVariable.
Definition: AuxKernel.h:174
const Function & getFunctionByName(const FunctionName &name) const
Get a function with a given name.
std::vector< const Function * > _funcs
Functions being used to compute the value of this kernel.
unsigned int _qp
Quadrature point index.
Definition: AuxKernel.h:230
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
static InputParameters validParams()
Definition: AuxKernel.C:27
static InputParameters validParams()
Eigen::Matrix< Real, Eigen::Dynamic, 1 > RealEigenVector
Definition: MooseTypes.h:146
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:36
const MooseArray< Point > & _q_point
Active quadrature points.
Definition: AuxKernel.h:196
FunctionArrayAux(const InputParameters &parameters)
bool isNodal() const
Nodal or elemental kernel?
Definition: AuxKernel.h:86