LCOV - code coverage report
Current view: top level - src/materials - ComputeThermalExpansionEigenstrainBeamBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 21 22 95.5 %
Date: 2025-07-25 05:00:39 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 "ComputeThermalExpansionEigenstrainBeamBase.h"
      11             : 
      12             : InputParameters
      13          24 : ComputeThermalExpansionEigenstrainBeamBase::validParams()
      14             : {
      15          24 :   InputParameters params = ComputeEigenstrainBeamBase::validParams();
      16          48 :   params.addRequiredCoupledVar("temperature", "Coupled temperature");
      17          48 :   params.addRequiredCoupledVar("stress_free_temperature",
      18             :                                "Reference temperature at which there is no "
      19             :                                "thermal expansion for thermal eigenstrain "
      20             :                                "calculation");
      21          24 :   return params;
      22           0 : }
      23             : 
      24          18 : ComputeThermalExpansionEigenstrainBeamBase::ComputeThermalExpansionEigenstrainBeamBase(
      25          18 :     const InputParameters & parameters)
      26             :   : ComputeEigenstrainBeamBase(parameters),
      27          18 :     _temperature(coupledValue("temperature")),
      28          36 :     _stress_free_temperature(coupledValue("stress_free_temperature"))
      29             : {
      30          18 : }
      31             : 
      32             : void
      33         320 : ComputeThermalExpansionEigenstrainBeamBase::computeQpEigenstrain()
      34             : {
      35             :   // fetch the two end nodes for current element
      36             :   std::vector<const Node *> node;
      37         960 :   for (unsigned int i = 0; i < 2; ++i)
      38         640 :     node.push_back(_current_elem->node_ptr(i));
      39             : 
      40             :   // calculate initial axis of the beam element
      41         960 :   for (unsigned int i = 0; i < 2; ++i)
      42         640 :     _initial_axis(i) = (*node[1])(i) - (*node[0])(i);
      43             : 
      44         320 :   _initial_axis /= _initial_axis.norm();
      45             : 
      46         320 :   Real thermal_strain = computeThermalStrain();
      47             : 
      48         320 :   _disp_eigenstrain[_qp].zero();
      49         320 :   _rot_eigenstrain[_qp].zero();
      50         320 :   _disp_eigenstrain[_qp] = _initial_axis * thermal_strain;
      51         320 : }

Generated by: LCOV version 1.14