https://mooseframework.inl.gov
MultiPhaseStressMaterial.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 
11 #include "RankTwoTensor.h"
12 #include "RankFourTensor.h"
13 
14 registerMooseObject("SolidMechanicsApp", MultiPhaseStressMaterial);
15 
18 {
20  params.addClassDescription("Compute a global stress from multiple phase stresses");
21  params.addParam<std::vector<MaterialPropertyName>>(
22  "h", "Switching Function Materials that provide h(eta_i)");
23  params.addRequiredParam<std::vector<std::string>>("phase_base",
24  "Base names for the Phase strains");
25  params.addParam<std::string>("base_name", "Base name for the computed global stress (optional)");
26  return params;
27 }
28 
30  : Material(parameters),
31  _h_list(getParam<std::vector<MaterialPropertyName>>("h")),
32  _n_phase(_h_list.size()),
33  _h_eta(_n_phase),
34  _phase_base(getParam<std::vector<std::string>>("phase_base")),
35  _phase_stress(_n_phase),
36  _dphase_stress_dstrain(_n_phase),
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  // verify parameter length
42  if (_n_phase != _phase_base.size())
43  mooseError(
44  "h and phase_base input vectors need to have the same length in MultiPhaseStressMaterial ",
45  name());
46 
47  for (unsigned int i = 0; i < _n_phase; ++i)
48  {
49  _h_eta[i] = &getMaterialProperty<Real>(_h_list[i]);
50  _phase_stress[i] = &getMaterialProperty<RankTwoTensor>(_phase_base[i] + "_stress");
52  &getMaterialProperty<RankFourTensor>(_phase_base[i] + "_Jacobian_mult");
53  }
54 }
55 
56 void
58 {
59  _stress[_qp].zero();
60  _dstress_dstrain[_qp].zero();
61 
62  for (unsigned int i = 0; i < _n_phase; ++i)
63  {
64  _stress[_qp] += (*_h_eta[i])[_qp] * (*_phase_stress[i])[_qp];
66  }
67 }
std::vector< const MaterialProperty< RankFourTensor > * > _dphase_stress_dstrain
MaterialProperty< RankTwoTensor > & _stress
The stress tensor.
unsigned int _n_phase
number of phases handled by this material
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
registerMooseObject("SolidMechanicsApp", MultiPhaseStressMaterial)
MaterialProperty< RankFourTensor > & _dstress_dstrain
MultiPhaseStressMaterial(const InputParameters &parameters)
virtual const std::string & name() const
void addRequiredParam(const std::string &name, const std::string &doc_string)
Construct a global strain from the phase strains in a manner that is consistent with the construction...
unsigned int _qp
std::vector< const MaterialProperty< RankTwoTensor > * > _phase_stress
static InputParameters validParams()
static InputParameters validParams()
std::vector< std::string > _phase_base
std::vector< const MaterialProperty< Real > * > _h_eta
switching functions
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
std::vector< MaterialPropertyName > _h_list
switching function name list