www.mooseframework.org
ComputeElasticityTensorBase.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 #include "Function.h"
12 
13 template <bool is_ad, typename T>
16 {
18  params.addParam<FunctionName>(
19  "elasticity_tensor_prefactor",
20  "Optional function to use as a scalar prefactor on the elasticity tensor.");
21  params.addParam<std::string>("base_name",
22  "Optional parameter that allows the user to define "
23  "multiple mechanics material systems on the same "
24  "block, i.e. for multiple phases");
25  return params;
26 }
27 
28 template <bool is_ad, typename T>
30  const InputParameters & parameters)
32  GuaranteeProvider(this),
33  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
34  _elasticity_tensor_name(_base_name + "elasticity_tensor"),
35  _elasticity_tensor(declareGenericProperty<T, is_ad>(_elasticity_tensor_name)),
36  _effective_stiffness(declareGenericProperty<Real, is_ad>(_base_name + "effective_stiffness")),
37  _prefactor_function(isParamValid("elasticity_tensor_prefactor")
38  ? &getFunction("elasticity_tensor_prefactor")
39  : nullptr)
40 {
41 }
42 
43 template <bool is_ad, typename T>
44 void
46 {
47  _effective_stiffness[_qp] = 0; // Currently overriden by ComputeIsotropicElasticityTensor
48  computeQpElasticityTensor();
49 
50  // Multiply by prefactor
51  if (_prefactor_function)
52  {
53  _elasticity_tensor[_qp] *= _prefactor_function->value(_t, _q_point[_qp]);
54  _effective_stiffness[_qp] *= std::sqrt(_prefactor_function->value(_t, _q_point[_qp]));
55  }
56 }
57 
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
ComputeElasticityTensorBase the base class for computing elasticity tensors.
Add-on class that provides the functionality to issue guarantees for declared material properties...
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
static InputParameters validParams()
ComputeElasticityTensorBaseTempl(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real