https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
17template <bool is_ad>
20{
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
31template <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
45template <bool is_ad>
46void
51
52template <bool is_ad>
53void
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}
registerMooseObject("MooseApp", GenericFunctionRankTwoTensor)
std::array< Real, 2 > values
Definition MortarUtils.C:52
const Function & getFunctionByName(const FunctionName &name) const
Get a function with a given name.
Declares a function material property of type RankTwoTensor.
const std::vector< FunctionName > _function_names
std::vector< const Function * > _functions
virtual void computeQpProperties() override
Users must override this method.
virtual void initQpStatefulProperties() override
Initialize stateful properties at quadrature points.
GenericFunctionRankTwoTensorTempl(const InputParameters &parameters)
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.
Materials compute MaterialProperties.
Definition Material.h:36
static InputParameters validParams()
Definition Material.C:14