LCOV - code coverage report
Current view: top level - src/materials - ComputeGeneralStressBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 20 21 95.2 %
Date: 2024-02-27 11:53:14 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          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 "ComputeGeneralStressBase.h"
      11             : #include "ComputeElasticityTensorBase.h"
      12             : #include "Function.h"
      13             : 
      14             : InputParameters
      15       11239 : ComputeGeneralStressBase::validParams()
      16             : {
      17       11239 :   InputParameters params = Material::validParams();
      18       22478 :   params.addParam<std::string>("base_name",
      19             :                                "Optional parameter that allows the user to define "
      20             :                                "multiple mechanics material systems on the same "
      21             :                                "block, i.e. for multiple phases");
      22       11239 :   return params;
      23           0 : }
      24             : 
      25        8411 : ComputeGeneralStressBase::ComputeGeneralStressBase(const InputParameters & parameters)
      26             :   : DerivativeMaterialInterface<Material>(parameters),
      27        8645 :     _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
      28       16822 :     _mechanical_strain(getMaterialPropertyByName<RankTwoTensor>(_base_name + "mechanical_strain")),
      29        8411 :     _stress(declareProperty<RankTwoTensor>(_base_name + "stress")),
      30        8411 :     _elastic_strain(declareProperty<RankTwoTensor>(_base_name + "elastic_strain")),
      31        8411 :     _extra_stress(getDefaultMaterialProperty<RankTwoTensor>(_base_name + "extra_stress")),
      32       16822 :     _Jacobian_mult(declareProperty<RankFourTensor>(_base_name + "Jacobian_mult"))
      33             : {
      34        8411 : }
      35             : 
      36             : void
      37      548008 : ComputeGeneralStressBase::initQpStatefulProperties()
      38             : {
      39      548008 :   _elastic_strain[_qp].zero();
      40      548008 :   _stress[_qp].zero();
      41      548008 : }
      42             : 
      43             : void
      44    43442225 : ComputeGeneralStressBase::computeQpProperties()
      45             : {
      46    43442225 :   computeQpStress();
      47             : 
      48             :   // Add in extra stress
      49    43442011 :   _stress[_qp] += _extra_stress[_qp];
      50    43442011 : }

Generated by: LCOV version 1.14