LCOV - code coverage report
Current view: top level - src/materials - ComputeEigenstrainBeamFromVariable.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 22 23 95.7 %
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 "ComputeEigenstrainBeamFromVariable.h"
      11             : 
      12             : registerMooseObject("TensorMechanicsApp", ComputeEigenstrainBeamFromVariable);
      13             : 
      14             : InputParameters
      15          13 : ComputeEigenstrainBeamFromVariable::validParams()
      16             : {
      17          13 :   InputParameters params = ComputeEigenstrainBeamBase::validParams();
      18          13 :   params.addClassDescription("Computes an eigenstrain from a set of variables");
      19          26 :   params.addCoupledVar("displacement_eigenstrain_variables",
      20             :                        "A list of variable names describing the "
      21             :                        "displacement eigenstrain. If provided, there must be 3 "
      22             :                        "entries, corresponding to the axial and shear "
      23             :                        "eigenstrains in the global coordinate system.");
      24          26 :   params.addCoupledVar("rotational_eigenstrain_variables",
      25             :                        "A list of variable names describing the rotational "
      26             :                        "eigenstrain. If provided, there must be 3 entries, "
      27             :                        "corresponding to the rotational eigenstrain in the "
      28             :                        "global coordinate system.");
      29          13 :   return params;
      30           0 : }
      31             : 
      32          10 : ComputeEigenstrainBeamFromVariable::ComputeEigenstrainBeamFromVariable(
      33          10 :     const InputParameters & parameters)
      34             :   : ComputeEigenstrainBeamBase(parameters),
      35          10 :     _ndisp(coupledComponents("displacement_eigenstrain_variables")),
      36          10 :     _nrot(coupledComponents("rotational_eigenstrain_variables")),
      37          10 :     _disp(_ndisp > 0 ? coupledValues("displacement_eigenstrain_variables")
      38          10 :                      : std::vector<const VariableValue *>(3, &_zero)),
      39          10 :     _rot(_nrot > 0 ? coupledValues("rotational_eigenstrain_variables")
      40          20 :                    : std::vector<const VariableValue *>(3, &_zero))
      41             : {
      42          10 :   if ((_ndisp != 3 && _ndisp != 0) || (_nrot != 3 && _nrot != 0))
      43           1 :     mooseError("ComputeEigenstrainBeamFromVariable: If the displacement or rotational eigenstrains "
      44             :                "are provided, it should contain 3 variables corresponding to the three "
      45             :                "components in the global coordinate system.");
      46           9 : }
      47             : 
      48             : void
      49         240 : ComputeEigenstrainBeamFromVariable::computeQpEigenstrain()
      50             : {
      51         960 :   for (unsigned int i = 0; i < 3; ++i)
      52             :   {
      53         720 :     _disp_eigenstrain[_qp](i) = (*_disp[i])[_qp];
      54         720 :     _rot_eigenstrain[_qp](i) = (*_rot[i])[_qp];
      55             :   }
      56         240 : }

Generated by: LCOV version 1.14