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