www.mooseframework.org
GenericConstantRankTwoTensor.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 
11 
14 
15 template <bool is_ad>
18 {
20  params.addClassDescription(
21  "Object for declaring a constant rank two tensor as a material property.");
22  params.addRequiredParam<std::vector<Real>>(
23  "tensor_values", "Vector of values defining the constant rank two tensor");
24  params.addRequiredParam<MaterialPropertyName>(
25  "tensor_name", "Name of the tensor material property to be created");
26  params.set<MooseEnum>("constant_on") = "SUBDOMAIN";
27  return params;
28 }
29 
30 template <bool is_ad>
32  const InputParameters & parameters)
33  : Material(parameters),
34  _prop(
35  declareGenericProperty<RankTwoTensor, is_ad>(getParam<MaterialPropertyName>("tensor_name")))
36 {
37  _tensor.fillFromInputVector(getParam<std::vector<Real>>("tensor_values"));
38 }
39 
40 template <bool is_ad>
41 void
43 {
45 }
46 
47 template <bool is_ad>
48 void
50 {
51  _prop[_qp] = _tensor;
52 }
53 
GenericConstantRankTwoTensorTempl(const InputParameters &parameters)
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
virtual void computeQpProperties() override
Users must override this method.
registerMooseObject("MooseApp", GenericConstantRankTwoTensor)
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 fillFromInputVector(const std::vector< T > &input, FillMethod fill_method=autodetect)
The smart mutator that determines how to fill the second order tensor based on the size of the input ...
static InputParameters validParams()
Definition: Material.C:14
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
Declares a constant material property of type RankTwoTensor.
Materials compute MaterialProperties.
Definition: Material.h:34
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...
virtual void initQpStatefulProperties() override
Initialize stateful properties at quadrature points.