https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
38RealEigenVector
40{
41 RealEigenVector v(_var.count());
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)
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition AuxKernel.h:28
bool isNodal() const
Nodal or elemental kernel?
Definition AuxKernel.h:43
const MooseArray< Point > & _q_point
Active quadrature points.
Definition AuxKernel.h:125
const Node *const & _current_node
Current node (valid only for nodal kernels)
Definition AuxKernel.h:143
unsigned int _qp
Quadrature point index.
Definition AuxKernel.h:155
MooseVariableField< ComputeValueType > & _var
This is a regular kernel so we cast to a regular MooseVariable, hides base _var.
Definition AuxKernel.h:113
static InputParameters validParams()
Definition AuxKernel.C:27
FunctionArrayAux(const InputParameters &parameters)
virtual RealEigenVector computeValue() override
Compute and return the value of the aux variable.
static InputParameters validParams()
std::vector< const Function * > _funcs
Functions being used to compute the value of this kernel.
const Function & getFunctionByName(const FunctionName &name) const
Get a function with a given 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...
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.
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
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 ...
Definition MooseBase.h:457
unsigned int count() const
Get the number of components Note: For standard and vector variables, the number is one.