www.mooseframework.org
TwoPhaseStressMaterial.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 #include "RankTwoTensor.h"
9 #include "RankFourTensor.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<Material>();
16  params.addClassDescription("Compute a global stress in a two phase model");
17  params.addParam<MaterialPropertyName>(
18  "h", "h", "Switching Function Material that provides h(eta)");
19  params.addRequiredParam<std::string>("base_A", "Base name for the Phase A strain.");
20  params.addRequiredParam<std::string>("base_B", "Base name for the Phase B strain.");
21  params.addParam<std::string>("base_name", "Base name for the computed global stress (optional).");
22  return params;
23 }
24 
25 TwoPhaseStressMaterial::TwoPhaseStressMaterial(const InputParameters & parameters)
26  : Material(parameters),
27  _h_eta(getMaterialProperty<Real>("h")),
28 
29  _base_A(getParam<std::string>("base_A") + "_"),
30  _stress_A(getMaterialPropertyByName<RankTwoTensor>(_base_A + "stress")),
31  _dstress_dstrain_A(getMaterialPropertyByName<RankFourTensor>(_base_A + "Jacobian_mult")),
32 
33  _base_B(getParam<std::string>("base_B") + "_"),
34  _stress_B(getMaterialPropertyByName<RankTwoTensor>(_base_B + "stress")),
35  _dstress_dstrain_B(getMaterialPropertyByName<RankFourTensor>(_base_B + "Jacobian_mult")),
36 
37  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
38  _stress(declareProperty<RankTwoTensor>(_base_name + "stress")),
39  _dstress_dstrain(declareProperty<RankFourTensor>(_base_name + "Jacobian_mult"))
40 {
41 }
42 
43 void
45 {
46  _stress[_qp] = _h_eta[_qp] * _stress_B[_qp] + (1.0 - _h_eta[_qp]) * _stress_A[_qp];
47  _dstress_dstrain[_qp] =
48  _h_eta[_qp] * _dstress_dstrain_B[_qp] + (1.0 - _h_eta[_qp]) * _dstress_dstrain_A[_qp];
49 }
const MaterialProperty< RankTwoTensor > & _stress_A
MaterialProperty< RankTwoTensor > & _stress
const MaterialProperty< RankFourTensor > & _dstress_dstrain_B
TwoPhaseStressMaterial(const InputParameters &parameters)
MaterialProperty< RankFourTensor > & _dstress_dstrain
InputParameters validParams< TwoPhaseStressMaterial >()
const MaterialProperty< RankTwoTensor > & _stress_B
const MaterialProperty< RankFourTensor > & _dstress_dstrain_A
const MaterialProperty< Real > & _h_eta