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