LCOV - code coverage report
Current view: top level - src/materials - LinearElasticTruss.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 19 20 95.0 %
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 "LinearElasticTruss.h"
      11             : 
      12             : registerMooseObject("SolidMechanicsApp", LinearElasticTruss);
      13             : 
      14             : InputParameters
      15         276 : LinearElasticTruss::validParams()
      16             : {
      17         276 :   InputParameters params = TrussMaterial::validParams();
      18         276 :   params.addClassDescription("Computes the linear elastic strain for a truss element");
      19         552 :   params.addParam<Real>("thermal_expansion_coeff", 0.0, "Thermal expansion coefficient in 1/K");
      20         552 :   params.addParam<Real>("temperature_ref", 273, "Reference temperature for thermal expansion in K");
      21         552 :   params.addCoupledVar("temperature", 273, "Temperature in Kelvin");
      22         276 :   return params;
      23           0 : }
      24             : 
      25         208 : LinearElasticTruss::LinearElasticTruss(const InputParameters & parameters)
      26             :   : TrussMaterial(parameters),
      27         208 :     _T(coupledValue("temperature")),
      28         416 :     _T0(getParam<Real>("temperature_ref")),
      29         624 :     _thermal_expansion_coeff(getParam<Real>("thermal_expansion_coeff"))
      30             : {
      31         208 : }
      32             : 
      33             : void
      34       14000 : LinearElasticTruss::computeQpStrain()
      35             : {
      36       14000 :   _total_stretch[_qp] = _current_length / _origin_length - 1.0;
      37       14000 :   _elastic_stretch[_qp] = _total_stretch[_qp] - _thermal_expansion_coeff * (_T[_qp] - _T0);
      38       14000 : }
      39             : 
      40             : void
      41       14000 : LinearElasticTruss::computeQpStress()
      42             : {
      43       14000 :   _axial_stress[_qp] = _youngs_modulus[_qp] * _elastic_stretch[_qp];
      44       14000 : }

Generated by: LCOV version 1.14