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

Generated by: LCOV version 1.14