www.mooseframework.org
ADComputeElasticityTensorBase.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 
14 
15 template <ComputeStage compute_stage>
16 InputParameters
18 {
19  InputParameters params = ADMaterial<compute_stage>::validParams();
20  params.addParam<FunctionName>(
21  "elasticity_tensor_prefactor",
22  "Optional function to use as a scalar prefactor on the elasticity tensor.");
23  params.addParam<std::string>(
24  "base_name",
25  "Optional parameter that allows the user to define multiple mechanics "
26  "material systems on the same block, i.e. for multiple phases");
27  return params;
28 }
29 
30 template <ComputeStage compute_stage>
32  const InputParameters & parameters)
33  : ADMaterial<compute_stage>(parameters),
34  GuaranteeProvider(this),
35  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
36  _elasticity_tensor_name(_base_name + "elasticity_tensor"),
37  _elasticity_tensor(declareADProperty<RankFourTensor>(_elasticity_tensor_name)),
38  _prefactor_function(isParamValid("elasticity_tensor_prefactor")
39  ? &getFunction("elasticity_tensor_prefactor")
40  : nullptr)
41 {
42 }
43 
44 template <ComputeStage compute_stage>
45 void
47 {
48  computeQpElasticityTensor();
49 
50  // Multiply by prefactor
51  if (_prefactor_function)
52  _elasticity_tensor[_qp] *= _prefactor_function->value(_t, _q_point[_qp]);
53 }
54 
55 // explicit instantiation is required for AD base classes
GuaranteeProvider
Add-on class that provides the functionality to issue guarantees for declared material properties.
Definition: GuaranteeProvider.h:25
ADComputeElasticityTensorBase::computeQpProperties
virtual void computeQpProperties()
Definition: ADComputeElasticityTensorBase.C:46
adBaseClass
adBaseClass(ADComputeElasticityTensorBase)
defineADLegacyParams
defineADLegacyParams(ADComputeElasticityTensorBase)
ADComputeElasticityTensorBase::validParams
static InputParameters validParams()
Definition: ADComputeElasticityTensorBase.C:17
ADComputeElasticityTensorBase.h
ADComputeElasticityTensorBase
ADComputeElasticityTensorBase is a the base class for computing elasticity tensors.
Definition: ADComputeElasticityTensorBase.h:24
validParams
InputParameters validParams()
ADComputeElasticityTensorBase::ADComputeElasticityTensorBase
ADComputeElasticityTensorBase(const InputParameters &parameters)
Definition: ADComputeElasticityTensorBase.C:31
RankFourTensorTempl< Real >