https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ElasticEnergyAux.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
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
31Real
33{
34 return 0.5 * _stress[_qp].doubleContraction(_elastic_strain[_qp]);
35}
registerMooseObject("SolidMechanicsApp", ElasticEnergyAux)
static InputParameters validParams()
static InputParameters validParams()
const MaterialProperty< RankTwoTensor > & _elastic_strain
const MaterialProperty< RankTwoTensor > & _stress
The stress tensor.
virtual Real computeValue()
ElasticEnergyAux(const InputParameters &parameters)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)