www.mooseframework.org
ElasticEnergyAux.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "ElasticEnergyAux.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<AuxKernel>();
14  params.addClassDescription("Compute the local elastic energy");
15  params.addParam<std::string>("base_name", "Mechanical property base name");
16  return params;
17 }
18 
19 ElasticEnergyAux::ElasticEnergyAux(const InputParameters & parameters)
20  : AuxKernel(parameters),
21  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
22  _stress(getMaterialProperty<RankTwoTensor>(_base_name + "stress")),
23  _elastic_strain(getMaterialProperty<RankTwoTensor>(_base_name + "elastic_strain"))
24 {
25 }
26 
27 Real
29 {
30  return 0.5 * _stress[_qp].doubleContraction(_elastic_strain[_qp]);
31 }
ElasticEnergyAux(const InputParameters &parameters)
virtual Real computeValue()
const MaterialProperty< RankTwoTensor > & _stress
const MaterialProperty< RankTwoTensor > & _elastic_strain
InputParameters validParams< ElasticEnergyAux >()