https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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())
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
56void
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}
registerMooseObject("SolidMechanicsApp", MultiPhaseStressMaterial)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
unsigned int _qp
static InputParameters validParams()
const std::string & name() const
void mooseError(Args &&... args) const
Construct a global strain from the phase strains in a manner that is consistent with the construction...
static InputParameters validParams()
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
std::vector< MaterialPropertyName > _h_list
switching function name list
MaterialProperty< RankFourTensor > & _dstress_dstrain
std::vector< const MaterialProperty< RankTwoTensor > * > _phase_stress
std::vector< const MaterialProperty< Real > * > _h_eta
switching functions
MultiPhaseStressMaterial(const InputParameters &parameters)
std::vector< std::string > _phase_base