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

Generated by: LCOV version 1.14