LCOV - code coverage report
Current view: top level - src/materials - ComputeExtraStressConstant.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 14 15 93.3 %
Date: 2024-02-27 11:53:14 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://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 "ComputeExtraStressConstant.h"
      11             : 
      12             : registerMooseObject("TensorMechanicsApp", ComputeExtraStressConstant);
      13             : 
      14             : InputParameters
      15          48 : ComputeExtraStressConstant::validParams()
      16             : {
      17          48 :   InputParameters params = ComputeExtraStressBase::validParams();
      18          48 :   params.addClassDescription("Computes a constant extra stress that is added to the stress "
      19             :                              "calculated by the constitutive model");
      20          96 :   params.addRequiredParam<std::vector<Real>>("extra_stress_tensor",
      21             :                                              "Vector of values defining the constant extra stress "
      22             :                                              "to add, in order 11, 22, 33, 23, 13, 12");
      23          96 :   params.addParam<MaterialPropertyName>(
      24          96 :       "prefactor", 1.0, "Name of material property defining additional constant prefactor");
      25          48 :   return params;
      26           0 : }
      27             : 
      28          36 : ComputeExtraStressConstant::ComputeExtraStressConstant(const InputParameters & parameters)
      29          72 :   : ComputeExtraStressBase(parameters), _prefactor(getMaterialProperty<Real>("prefactor"))
      30             : {
      31          72 :   _extra_stress_tensor.fillFromInputVector(getParam<std::vector<Real>>("extra_stress_tensor"));
      32          36 : }
      33             : 
      34             : void
      35       28544 : ComputeExtraStressConstant::computeQpExtraStress()
      36             : {
      37       28544 :   _extra_stress[_qp] = _extra_stress_tensor * _prefactor[_qp];
      38       28544 : }

Generated by: LCOV version 1.14