https://mooseframework.inl.gov
GenericFunctionRankTwoTensor.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 
11 
12 #include "Function.h"
13 
16 
17 template <bool is_ad>
20 {
22  params.addClassDescription(
23  "Material object for defining rank two tensor properties using functions.");
24  params.addRequiredParam<std::vector<FunctionName>>(
25  "tensor_functions", "Vector of Function names defining the rank two tensor");
26  params.addRequiredParam<MaterialPropertyName>(
27  "tensor_name", "Name of the tensor material property to be created");
28  return params;
29 }
30 
31 template <bool is_ad>
33  const InputParameters & parameters)
34  : Material(parameters),
35  _prop(declareGenericProperty<RankTwoTensor, is_ad>(
36  getParam<MaterialPropertyName>("tensor_name"))),
37  _function_names(getParam<std::vector<FunctionName>>("tensor_functions")),
38  _num_functions(_function_names.size()),
39  _functions(_num_functions)
40 {
41  for (unsigned int i = 0; i < _num_functions; i++)
43 }
44 
45 template <bool is_ad>
46 void
48 {
50 }
51 
52 template <bool is_ad>
53 void
55 {
56  std::vector<GenericReal<is_ad>> values(_num_functions);
57  for (unsigned int i = 0; i < _num_functions; i++)
58  values[i] = (*_functions[i]).value(_t, _q_point[_qp]);
59 
60  _prop[_qp].fillFromInputVector(values);
61 }
virtual void computeQpProperties() override
Users must override this method.
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...
Declares a function material property of type RankTwoTensor.
static InputParameters validParams()
Definition: Material.C:14
std::vector< const Function * > _functions
const std::vector< FunctionName > _function_names
Materials compute MaterialProperties.
Definition: Material.h:34
GenericFunctionRankTwoTensorTempl(const InputParameters &parameters)
const Function & getFunctionByName(const FunctionName &name) const
Get a function with a given name.
virtual void initQpStatefulProperties() override
Initialize stateful properties at quadrature points.
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...
registerMooseObject("MooseApp", GenericFunctionRankTwoTensor)