https://mooseframework.inl.gov
PlasticHeatEnergy.C
Go to the documentation of this file.
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 "PlasticHeatEnergy.h"
11 #include "MooseMesh.h"
12 #include "MooseVariable.h"
13 
14 registerMooseObject("SolidMechanicsApp", PlasticHeatEnergy);
15 
18 {
20  params.addClassDescription("Plastic heat energy density = coeff * stress * plastic_strain_rate");
21  params.addRequiredCoupledVar("displacements",
22  "The string of displacements suitable for the problem statement");
23  params.addParam<std::string>("base_name", "Material property base name");
24  params.addParam<Real>("coeff", 1.0, "Heat energy density = coeff * stress * plastic_strain_rate");
25  return params;
26 }
27 
29  : Kernel(parameters),
30  _coeff(getParam<Real>("coeff")),
31  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
32  _plastic_heat(getMaterialProperty<Real>(_base_name + "plastic_heat")),
33  _dplastic_heat_dstrain(
34  getMaterialProperty<RankTwoTensor>(_base_name + "dplastic_heat_dstrain")),
35  _ndisp(coupledComponents("displacements")),
36  _disp_var(_ndisp)
37 {
38  for (unsigned int i = 0; i < _ndisp; ++i)
39  _disp_var[i] = coupled("displacements", i);
40 
41  // Checking for consistency between mesh size and length of the provided displacements vector
42  if (_ndisp != _mesh.dimension())
43  mooseError("PlasticHeatEnergy: The number of displacement variables supplied must match the "
44  "mesh dimension.");
45 }
46 
47 Real
49 {
50  return -_test[_i][_qp] * _coeff * _plastic_heat[_qp];
51 }
52 
53 Real
55 {
57 }
58 
59 Real
61 {
62  for (unsigned int i = 0; i < _ndisp; ++i)
63  if (jvar == _disp_var[i])
64  return -_test[_i][_qp] * _coeff * (_dplastic_heat_dstrain[_qp] * _grad_phi[_j][_qp])(i);
65 
66  return 0.0;
67 }
MooseMesh & _mesh
const MaterialProperty< Real > & _plastic_heat
stress * plastic_strain_rate
virtual unsigned int coupled(const std::string &var_name, unsigned int comp=0) const
static InputParameters validParams()
MooseVariable & _var
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
unsigned int number() const
const VariablePhiGradient & _grad_phi
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
virtual Real computeQpResidual() override
Real _coeff
coefficient of stress * plastic_strain_rate
PlasticHeatEnergy(const InputParameters &parameters)
Provides a heat source from plastic deformation: coeff * stress * plastic_strain_rate.
const VariableTestValue & _test
virtual unsigned int dimension() const
registerMooseObject("SolidMechanicsApp", PlasticHeatEnergy)
unsigned int _i
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _j
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void mooseError(Args &&... args) const
const MaterialProperty< RankTwoTensor > & _dplastic_heat_dstrain
d(plastic_heat)/d(total_strain)
void addClassDescription(const std::string &doc_string)
unsigned int _ndisp
umber of coupled displacement variables
std::vector< unsigned int > _disp_var
MOOSE variable number for the displacement variables.
unsigned int _qp
virtual Real computeQpJacobian() override