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("TensorMechanicsApp", ElasticEnergyAux);
13 
15 
16 InputParameters
18 {
19  InputParameters params = AuxKernel::validParams();
20  params.addClassDescription("Compute the local elastic energy");
21  params.addParam<std::string>("base_name", "Mechanical property base name");
22  return params;
23 }
24 
25 ElasticEnergyAux::ElasticEnergyAux(const InputParameters & parameters)
26  : AuxKernel(parameters),
27  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
28  _stress(getMaterialProperty<RankTwoTensor>(_base_name + "stress")),
29  _elastic_strain(getMaterialProperty<RankTwoTensor>(_base_name + "elastic_strain"))
30 {
31 }
32 
33 Real
35 {
36  return 0.5 * _stress[_qp].doubleContraction(_elastic_strain[_qp]);
37 }
ElasticEnergyAux::_stress
const MaterialProperty< RankTwoTensor > & _stress
Definition: ElasticEnergyAux.h:34
ElasticEnergyAux.h
ElasticEnergyAux::ElasticEnergyAux
ElasticEnergyAux(const InputParameters &parameters)
Definition: ElasticEnergyAux.C:25
defineLegacyParams
defineLegacyParams(ElasticEnergyAux)
validParams
InputParameters validParams()
registerMooseObject
registerMooseObject("TensorMechanicsApp", ElasticEnergyAux)
ElasticEnergyAux::_elastic_strain
const MaterialProperty< RankTwoTensor > & _elastic_strain
Definition: ElasticEnergyAux.h:35
ElasticEnergyAux::validParams
static InputParameters validParams()
Definition: ElasticEnergyAux.C:17
RankTwoTensorTempl< Real >
ElasticEnergyAux::computeValue
virtual Real computeValue()
Definition: ElasticEnergyAux.C:34
ElasticEnergyAux
Definition: ElasticEnergyAux.h:21