Skip to content

Commit

Permalink
Modify TwoPhaseStressMaterial to allow a global extra_stress #12675
Browse files Browse the repository at this point in the history
  • Loading branch information
Larry Aagesen authored and Larry Aagesen committed Jan 11, 2019
1 parent 18c1a12 commit 859e19f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Expand Up @@ -11,6 +11,7 @@
#define TWOPHASESTRESSMATERIAL_H

#include "Material.h"
#include "DerivativeMaterialInterface.h"

// Forward Declarations
class TwoPhaseStressMaterial;
Expand All @@ -28,7 +29,7 @@ InputParameters validParams<TwoPhaseStressMaterial>();
* Construct a global strain from the phase strains in a manner that is consistent
* with the construction of the global elastic energy by DerivativeTwoPhaseMaterial.
*/
class TwoPhaseStressMaterial : public Material
class TwoPhaseStressMaterial : public DerivativeMaterialInterface<Material>
{
public:
TwoPhaseStressMaterial(const InputParameters & parameters);
Expand All @@ -53,6 +54,9 @@ class TwoPhaseStressMaterial : public Material
std::string _base_name;
MaterialProperty<RankTwoTensor> & _stress;
MaterialProperty<RankFourTensor> & _dstress_dstrain;

/// Global extra stress tensor
const MaterialProperty<RankTwoTensor> & _global_extra_stress;
};

#endif // TWOPHASESTRESSMATERIAL_H
Expand Up @@ -28,7 +28,7 @@ validParams<TwoPhaseStressMaterial>()
}

TwoPhaseStressMaterial::TwoPhaseStressMaterial(const InputParameters & parameters)
: Material(parameters),
: DerivativeMaterialInterface<Material>(parameters),
_h_eta(getMaterialProperty<Real>("h")),

_base_A(getParam<std::string>("base_A") + "_"),
Expand All @@ -41,14 +41,19 @@ TwoPhaseStressMaterial::TwoPhaseStressMaterial(const InputParameters & parameter

_base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
_stress(declareProperty<RankTwoTensor>(_base_name + "stress")),
_dstress_dstrain(declareProperty<RankFourTensor>(_base_name + "Jacobian_mult"))
_dstress_dstrain(declareProperty<RankFourTensor>(_base_name + "Jacobian_mult")),
_global_extra_stress(getDefaultMaterialProperty<RankTwoTensor>("extra_stress"))
{
}

void
TwoPhaseStressMaterial::computeQpProperties()
{
_stress[_qp] = _h_eta[_qp] * _stress_B[_qp] + (1.0 - _h_eta[_qp]) * _stress_A[_qp];

// Add in global extra stress
_stress[_qp] += _global_extra_stress[_qp];

_dstress_dstrain[_qp] =
_h_eta[_qp] * _dstress_dstrain_B[_qp] + (1.0 - _h_eta[_qp]) * _dstress_dstrain_A[_qp];
}

0 comments on commit 859e19f

Please sign in to comment.