LCOV - code coverage report
Current view: top level - src/materials - ComputeEigenstrainBeamBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 20 21 95.2 %
Date: 2025-07-25 05:00:39 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://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 "ComputeEigenstrainBeamBase.h"
      11             : 
      12             : InputParameters
      13          50 : ComputeEigenstrainBeamBase::validParams()
      14             : {
      15          50 :   InputParameters params = Material::validParams();
      16         100 :   params.addRequiredParam<std::string>("eigenstrain_name",
      17             :                                        "Material property name for the eigenstrain vector computed "
      18             :                                        "by this model. IMPORTANT: The name of this property must "
      19             :                                        "also be provided to the strain calculator.");
      20          50 :   return params;
      21           0 : }
      22             : 
      23          38 : ComputeEigenstrainBeamBase::ComputeEigenstrainBeamBase(const InputParameters & parameters)
      24             :   : Material(parameters),
      25          38 :     _eigenstrain_name(getParam<std::string>("eigenstrain_name")),
      26          38 :     _disp_eigenstrain(declareProperty<RealVectorValue>("disp_" + _eigenstrain_name)),
      27          38 :     _rot_eigenstrain(declareProperty<RealVectorValue>("rot_" + _eigenstrain_name)),
      28         114 :     _step_zero(declareRestartableData<bool>("step_zero", true))
      29             : {
      30          38 : }
      31             : 
      32             : void
      33         320 : ComputeEigenstrainBeamBase::initQpStatefulProperties()
      34             : {
      35             :   // This property can be promoted to be stateful by other models that use it,
      36             :   // so it needs to be initalized.
      37             :   RealVectorValue a;
      38         320 :   _disp_eigenstrain[_qp] = a;
      39         320 :   _rot_eigenstrain[_qp] = a;
      40         320 : }
      41             : 
      42             : void
      43         640 : ComputeEigenstrainBeamBase::computeQpProperties()
      44             : {
      45         640 :   if (_t_step >= 1)
      46         640 :     _step_zero = false;
      47             : 
      48             :   // Skip the eigenstrain calculation in step zero because no solution is computed during
      49             :   // the zeroth step, hence computing the eigenstrain in the zeroth step would result in
      50             :   // an incorrect calculation of mechanical_strain, which is stateful.
      51         640 :   if (!_step_zero)
      52         640 :     computeQpEigenstrain();
      53         640 : }

Generated by: LCOV version 1.14