LCOV - code coverage report
Current view: top level - src/auxkernels - ElasticEnergyAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #32971 (54bef8) with base c6cf66 Lines: 12 13 92.3 %
Date: 2026-05-29 20:40:07 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14