Line data Source code
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 : 14 : InputParameters 15 64 : ElasticEnergyAux::validParams() 16 : { 17 64 : InputParameters params = AuxKernel::validParams(); 18 64 : params.addClassDescription("Compute the local elastic energy"); 19 128 : params.addParam<std::string>("base_name", "Mechanical property base name"); 20 64 : return params; 21 0 : } 22 : 23 32 : ElasticEnergyAux::ElasticEnergyAux(const InputParameters & parameters) 24 : : AuxKernel(parameters), 25 32 : _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""), 26 32 : _stress(getMaterialProperty<RankTwoTensor>(_base_name + "stress")), 27 64 : _elastic_strain(getMaterialProperty<RankTwoTensor>(_base_name + "elastic_strain")) 28 : { 29 32 : } 30 : 31 : Real 32 32597 : ElasticEnergyAux::computeValue() 33 : { 34 32597 : return 0.5 * _stress[_qp].doubleContraction(_elastic_strain[_qp]); 35 : }