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 "ComputeEigenstrainBeamFromVariable.h" 11 : 12 : registerMooseObject("SolidMechanicsApp", ComputeEigenstrainBeamFromVariable); 13 : 14 : InputParameters 15 26 : ComputeEigenstrainBeamFromVariable::validParams() 16 : { 17 26 : InputParameters params = ComputeEigenstrainBeamBase::validParams(); 18 26 : params.addClassDescription("Computes an eigenstrain from a set of variables"); 19 52 : 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 52 : 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 26 : return params; 30 0 : } 31 : 32 20 : ComputeEigenstrainBeamFromVariable::ComputeEigenstrainBeamFromVariable( 33 20 : const InputParameters & parameters) 34 : : ComputeEigenstrainBeamBase(parameters), 35 20 : _ndisp(coupledComponents("displacement_eigenstrain_variables")), 36 20 : _nrot(coupledComponents("rotational_eigenstrain_variables")), 37 20 : _disp(_ndisp > 0 ? coupledValues("displacement_eigenstrain_variables") 38 20 : : std::vector<const VariableValue *>(3, &_zero)), 39 20 : _rot(_nrot > 0 ? coupledValues("rotational_eigenstrain_variables") 40 40 : : std::vector<const VariableValue *>(3, &_zero)) 41 : { 42 20 : if ((_ndisp != 3 && _ndisp != 0) || (_nrot != 3 && _nrot != 0)) 43 2 : 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 18 : } 47 : 48 : void 49 320 : ComputeEigenstrainBeamFromVariable::computeQpEigenstrain() 50 : { 51 1280 : for (unsigned int i = 0; i < 3; ++i) 52 : { 53 960 : _disp_eigenstrain[_qp](i) = (*_disp[i])[_qp]; 54 960 : _rot_eigenstrain[_qp](i) = (*_rot[i])[_qp]; 55 : } 56 320 : }