www.mooseframework.org
ElasticEnergyAux.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 
10 #include "ElasticEnergyAux.h"
11 
12 registerMooseObject("SolidMechanicsApp", ElasticEnergyAux);
13 
16 {
18  params.addClassDescription("Compute the local elastic energy");
19  params.addParam<std::string>("base_name", "Mechanical property base name");
20  return params;
21 }
22 
24  : AuxKernel(parameters),
25  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
26  _stress(getMaterialProperty<RankTwoTensor>(_base_name + "stress")),
27  _elastic_strain(getMaterialProperty<RankTwoTensor>(_base_name + "elastic_strain"))
28 {
29 }
30 
31 Real
33 {
34  return 0.5 * _stress[_qp].doubleContraction(_elastic_strain[_qp]);
35 }
ElasticEnergyAux(const InputParameters &parameters)
registerMooseObject("SolidMechanicsApp", ElasticEnergyAux)
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
virtual Real computeValue()
const MaterialProperty< RankTwoTensor > & _stress
The stress tensor.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MaterialProperty< RankTwoTensor > & _elastic_strain
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()