www.mooseframework.org
ComputeStressBase.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 "ComputeStressBase.h"
12 #include "Function.h"
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<Material>();
19  params.addParam<std::string>("base_name",
20  "Optional parameter that allows the user to define "
21  "multiple mechanics material systems on the same "
22  "block, i.e. for multiple phases");
23  params.suppressParameter<bool>("use_displaced_mesh");
24  return params;
25 }
26 
27 ComputeStressBase::ComputeStressBase(const InputParameters & parameters)
28  : DerivativeMaterialInterface<Material>(parameters),
29  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
30  _mechanical_strain(getMaterialPropertyByName<RankTwoTensor>(_base_name + "mechanical_strain")),
31  _stress(declareProperty<RankTwoTensor>(_base_name + "stress")),
32  _elastic_strain(declareProperty<RankTwoTensor>(_base_name + "elastic_strain")),
33  _extra_stress(getDefaultMaterialProperty<RankTwoTensor>(_base_name + "extra_stress")),
34  _Jacobian_mult(declareProperty<RankFourTensor>(_base_name + "Jacobian_mult"))
35 {
36 
37  if (getParam<bool>("use_displaced_mesh"))
38  mooseError("The stress calculator needs to run on the undisplaced mesh.");
39 }
40 
41 void
43 {
44  _elastic_strain[_qp].zero();
45  _stress[_qp].zero();
46 }
47 
48 void
50 {
52 
53  // Add in extra stress
54  _stress[_qp] += _extra_stress[_qp];
55 }
virtual void computeQpStress()=0
Compute the stress and store it in the _stress material property for the current quadrature point...
MaterialProperty< RankTwoTensor > & _stress
Stress material property.
virtual void computeQpProperties() override
ComputeStressBase(const InputParameters &parameters)
InputParameters validParams< ComputeStressBase >()
virtual void initQpStatefulProperties() override
MaterialProperty< RankTwoTensor > & _elastic_strain
Elastic strain material property.
const MaterialProperty< RankTwoTensor > & _extra_stress
Extra stress tensor.