Skip to content
Permalink
Browse files

Merge pull request #12965 from bwspenc/no_req_elasticity_tensor

Move _elasticity_tensor from ComputeStressBase to derived classes
  • Loading branch information...
jasondhales committed Feb 26, 2019
2 parents 45e7813 + 8cccbbe commit e3b783b9af203cb67f4638361c02b1d5c4392ed2
Showing with 123 additions and 39 deletions.
  1. +6 −0 modules/tensor_mechanics/include/materials/ADComputeFiniteStrainElasticStress.h
  2. +12 −2 modules/tensor_mechanics/include/materials/ADComputeLinearElasticStress.h
  3. +0 −5 modules/tensor_mechanics/include/materials/ADComputeStressBase.h
  4. +7 −2 modules/tensor_mechanics/include/materials/ComputeCosseratLinearElasticStress.h
  5. +7 −0 modules/tensor_mechanics/include/materials/ComputeFiniteStrainElasticStress.h
  6. +6 −3 modules/tensor_mechanics/include/materials/ComputeLinearElasticStress.h
  7. +5 −0 modules/tensor_mechanics/include/materials/ComputeMultiPlasticityStress.h
  8. +1 −2 modules/tensor_mechanics/include/materials/ComputeMultipleInelasticStress.h
  9. +5 −0 modules/tensor_mechanics/include/materials/ComputePFFractureStressBase.h
  10. +13 −2 modules/tensor_mechanics/include/materials/ComputeStrainIncrementBasedStress.h
  11. +10 −3 modules/tensor_mechanics/include/materials/ComputeStressBase.h
  12. +3 −0 modules/tensor_mechanics/include/materials/FiniteStrainCrystalPlasticity.h
  13. +4 −0 modules/tensor_mechanics/include/materials/FiniteStrainHyperElasticViscoPlastic.h
  14. +3 −0 modules/tensor_mechanics/include/materials/FiniteStrainPlasticMaterial.h
  15. +4 −0 modules/tensor_mechanics/include/materials/FiniteStrainUObasedCP.h
  16. +2 −0 modules/tensor_mechanics/src/materials/ADComputeFiniteStrainElasticStress.C
  17. +3 −1 modules/tensor_mechanics/src/materials/ADComputeLinearElasticStress.C
  18. +1 −3 modules/tensor_mechanics/src/materials/ADComputeStressBase.C
  19. +3 −1 modules/tensor_mechanics/src/materials/ComputeCosseratLinearElasticStress.C
  20. +2 −0 modules/tensor_mechanics/src/materials/ComputeFiniteStrainElasticStress.C
  21. +2 −1 modules/tensor_mechanics/src/materials/ComputeLinearElasticStress.C
  22. +2 −0 modules/tensor_mechanics/src/materials/ComputeMultiPlasticityStress.C
  23. +0 −1 modules/tensor_mechanics/src/materials/ComputeMultipleInelasticStress.C
  24. +2 −0 modules/tensor_mechanics/src/materials/ComputePFFractureStressBase.C
  25. +12 −9 modules/tensor_mechanics/src/materials/ComputeStrainIncrementBasedStress.C
  26. +0 −2 modules/tensor_mechanics/src/materials/ComputeStressBase.C
  27. +2 −1 modules/tensor_mechanics/src/materials/FiniteStrainCrystalPlasticity.C
  28. +2 −0 modules/tensor_mechanics/src/materials/FiniteStrainHyperElasticViscoPlastic.C
  29. +2 −1 modules/tensor_mechanics/src/materials/FiniteStrainPlasticMaterial.C
  30. +2 −0 modules/tensor_mechanics/src/materials/FiniteStrainUObasedCP.C
@@ -15,6 +15,8 @@

#define usingComputeFiniteStrainElasticStressMembers \
usingComputeStressBaseMembers; \
using ADComputeFiniteStrainElasticStress<compute_stage>::_elasticity_tensor; \
using ADComputeFiniteStrainElasticStress<compute_stage>::_elasticity_tensor_name; \
using ADComputeFiniteStrainElasticStress<compute_stage>::_strain_increment; \
using ADComputeFiniteStrainElasticStress<compute_stage>::_rotation_increment; \
using ADComputeFiniteStrainElasticStress<compute_stage>::_stress_old; \
@@ -41,6 +43,10 @@ class ADComputeFiniteStrainElasticStress : public ADComputeStressBase<compute_st
protected:
virtual void computeQpStress() override;

/// Name of the elasticity tensor material property
const std::string _elasticity_tensor_name;
/// Elasticity tensor material property
const ADMaterialProperty(RankFourTensor) & _elasticity_tensor;
const ADMaterialProperty(RankTwoTensor) & _strain_increment;
const ADMaterialProperty(RankTwoTensor) & _rotation_increment;
const MaterialProperty<RankTwoTensor> & _stress_old;
@@ -12,6 +12,11 @@

#include "ADComputeStressBase.h"

#define usingComputeLinearElasticStressMembers \
usingComputeStressBaseMembers; \
using ADComputeLinearElasticStress<compute_stage>::_elasticity_tensor; \
using ADComputeLinearElasticStress<compute_stage>::_elasticity_tensor_name;

template <ComputeStage>
class ADComputeLinearElasticStress;

@@ -26,10 +31,15 @@ class ADComputeLinearElasticStress : public ADComputeStressBase<compute_stage>
{
public:
ADComputeLinearElasticStress(const InputParameters & parameters);
virtual void initialSetup();
virtual void initialSetup() override;

protected:
virtual void computeQpStress();
virtual void computeQpStress() override;

/// Name of the elasticity tensor material property
const std::string _elasticity_tensor_name;
/// Elasticity tensor material property
const ADMaterialProperty(RankFourTensor) & _elasticity_tensor;

usingComputeStressBaseMembers;
};
@@ -19,8 +19,6 @@
using ADComputeStressBase<compute_stage>::_mechanical_strain; \
using ADComputeStressBase<compute_stage>::_elastic_strain; \
using ADComputeStressBase<compute_stage>::_base_name; \
using ADComputeStressBase<compute_stage>::_elasticity_tensor; \
using ADComputeStressBase<compute_stage>::_elasticity_tensor_name; \
using ADComputeStressBase<compute_stage>::_initial_stress_fcn

// Forward Declarations
@@ -52,14 +50,11 @@ class ADComputeStressBase : public ADMaterial<compute_stage>
virtual void computeQpStress() = 0;

const std::string _base_name;
const std::string _elasticity_tensor_name;

const ADMaterialProperty(RankTwoTensor) & _mechanical_strain;
ADMaterialProperty(RankTwoTensor) & _stress;
ADMaterialProperty(RankTwoTensor) & _elastic_strain;

const ADMaterialProperty(RankFourTensor) & _elasticity_tensor;

/// initial stress components
std::vector<Function *> _initial_stress_fcn;

@@ -27,10 +27,15 @@ class ComputeCosseratLinearElasticStress : public ComputeCosseratStressBase
{
public:
ComputeCosseratLinearElasticStress(const InputParameters & parameters);
virtual void initialSetup();
virtual void initialSetup() override;

protected:
virtual void computeQpStress();
virtual void computeQpStress() override;

/// Name of the elasticity tensor material property
const std::string _elasticity_tensor_name;
/// Elasticity tensor material property
const MaterialProperty<RankFourTensor> & _elasticity_tensor;
};

#endif // COMPUTECOSSERATLINEARELASTICSTRESS_H
@@ -32,8 +32,15 @@ class ComputeFiniteStrainElasticStress : public ComputeStressBase, public Guaran
protected:
virtual void computeQpStress() override;

/// Name of the elasticity tensor material property
const std::string _elasticity_tensor_name;
/// Elasticity tensor material property
const MaterialProperty<RankFourTensor> & _elasticity_tensor;
/// Strain increment material property
const MaterialProperty<RankTwoTensor> & _strain_increment;
/// Rotation increment material property
const MaterialProperty<RankTwoTensor> & _rotation_increment;
/// Old state of the stress tensor material property
const MaterialProperty<RankTwoTensor> & _stress_old;

/**
@@ -24,12 +24,15 @@ class ComputeLinearElasticStress : public ComputeStressBase
{
public:
ComputeLinearElasticStress(const InputParameters & parameters);
virtual void initialSetup();
virtual void initialSetup() override;

protected:
virtual void computeQpStress();
virtual void computeQpStress() override;

const MaterialProperty<RankTwoTensor> & _mechanical_strain;
/// Name of the elasticity tensor material property
const std::string _elasticity_tensor_name;
/// Elasticity tensor material property
const MaterialProperty<RankFourTensor> & _elasticity_tensor;
};

#endif // COMPUTELINEARELASTICSTRESS_H
@@ -98,6 +98,11 @@ class ComputeMultiPlasticityStress : public ComputeStressBase, public MultiPlast
/// whether to perform the rotations necessary in finite-strain simulations
bool _perform_finite_strain_rotations;

/// Name of the elasticity tensor material property
const std::string _elasticity_tensor_name;
/// Elasticity tensor material property
const MaterialProperty<RankFourTensor> & _elasticity_tensor;

/// plastic strain
MaterialProperty<RankTwoTensor> & _plastic_strain;

@@ -126,8 +126,7 @@ class ComputeMultipleInelasticStress : public ComputeFiniteStrainElasticStress
/// after updateQpState, rotate the stress, elastic_strain, inelastic_strain and Jacobian_mult using _rotation_increment
const bool _perform_finite_strain_rotations;

///@{ Rank-4 and Rank-2 elasticity and elastic strain tensors
const MaterialProperty<RankFourTensor> & _elasticity_tensor;
///@{ Strain tensors
const MaterialProperty<RankTwoTensor> & _elastic_strain_old;
const MaterialProperty<RankTwoTensor> & _strain_increment;
///@}
@@ -28,6 +28,11 @@ class ComputePFFractureStressBase : public ComputeStressBase
protected:
virtual void initQpStatefulProperties() override;

/// Name of the elasticity tensor material property
const std::string _elasticity_tensor_name;
/// Elasticity tensor material property
const MaterialProperty<RankFourTensor> & _elasticity_tensor;

/// Coupled order parameter defining the crack
const VariableValue & _c;

@@ -29,14 +29,25 @@ class ComputeStrainIncrementBasedStress : public ComputeStressBase
virtual void computeQpStress();
virtual void computeQpJacobian();

/// Name of the elasticity tensor material property
const std::string _elasticity_tensor_name;
/// Elasticity tensor material property
const MaterialProperty<RankFourTensor> & _elasticity_tensor;
/// Old state of the stress tensor material property
const MaterialProperty<RankTwoTensor> & _stress_old;
///@{ Current and old states of the mechanical strain material property
const MaterialProperty<RankTwoTensor> & _mechanical_strain;
const MaterialProperty<RankTwoTensor> & _mechanical_strain_old;
///@}
///@{ Vectors of current and old states of the inelastic strain material properties
std::vector<const MaterialProperty<RankTwoTensor> *> _inelastic_strains;
std::vector<const MaterialProperty<RankTwoTensor> *> _inelastic_strains_old;
///@}

std::vector<MaterialPropertyName> _property_names;
unsigned int _num_property;
/// Names of the inelastic strain material properties for all inelastic models
std::vector<MaterialPropertyName> _inelastic_strain_names;
/// Number of inelastic models
unsigned int _num_inelastic_strain_models;
};

#endif // COMPUTESTRAININCREMENTBASEDSTRESS_H
@@ -32,17 +32,24 @@ class ComputeStressBase : public DerivativeMaterialInterface<Material>
protected:
virtual void initQpStatefulProperties() override;
virtual void computeQpProperties() override;

/**
* Compute the stress and store it in the _stress material property
* for the current quadrature point
**/
virtual void computeQpStress() = 0;

/// Base name prepended to all material property names to allow for
/// multi-material systems
const std::string _base_name;
const std::string _elasticity_tensor_name;

/// Mechanical strain material property
const MaterialProperty<RankTwoTensor> & _mechanical_strain;
/// Stress material property
MaterialProperty<RankTwoTensor> & _stress;
/// Elastic strain material property
MaterialProperty<RankTwoTensor> & _elastic_strain;

const MaterialProperty<RankFourTensor> & _elasticity_tensor;

/// Extra stress tensor
const MaterialProperty<RankTwoTensor> & _extra_stress;

@@ -314,6 +314,9 @@ class FiniteStrainCrystalPlasticity : public ComputeStressBase

const MaterialProperty<RankTwoTensor> & _deformation_gradient;
const MaterialProperty<RankTwoTensor> & _deformation_gradient_old;
/// Name of the elasticity tensor material property
const std::string _elasticity_tensor_name;
/// Elasticity tensor material property
const MaterialProperty<RankFourTensor> & _elasticity_tensor;
const MaterialProperty<RankTwoTensor> & _crysrot;

@@ -197,6 +197,10 @@ class FiniteStrainHyperElasticViscoPlastic : public ComputeStressBase
const MaterialProperty<RankTwoTensor> & _fp_old;
MaterialProperty<RankTwoTensor> & _ce;

/// Name of the elasticity tensor material property
const std::string _elasticity_tensor_name;
/// Elasticity tensor material property
const MaterialProperty<RankFourTensor> & _elasticity_tensor;
const MaterialProperty<RankTwoTensor> & _deformation_gradient;
const MaterialProperty<RankTwoTensor> & _deformation_gradient_old;
const MaterialProperty<RankTwoTensor> & _rotation_increment;
@@ -43,6 +43,9 @@ class FiniteStrainPlasticMaterial : public ComputeStressBase
const MaterialProperty<RankTwoTensor> & _stress_old;
const MaterialProperty<RankTwoTensor> & _strain_increment;
const MaterialProperty<RankTwoTensor> & _rotation_increment;
/// Name of the elasticity tensor material property
const std::string _elasticity_tensor_name;
/// Elasticity tensor material property
const MaterialProperty<RankFourTensor> & _elasticity_tensor;
Real _rtol;
Real _ftol;
@@ -250,6 +250,10 @@ class FiniteStrainUObasedCP : public ComputeStressBase
MaterialProperty<RankTwoTensor> & _update_rot;
const MaterialProperty<RankTwoTensor> & _update_rot_old;

/// Name of the elasticity tensor material property
const std::string _elasticity_tensor_name;
/// Elasticity tensor material property
const MaterialProperty<RankFourTensor> & _elasticity_tensor;
const MaterialProperty<RankTwoTensor> & _deformation_gradient;
const MaterialProperty<RankTwoTensor> & _deformation_gradient_old;

@@ -21,6 +21,8 @@ ADComputeFiniteStrainElasticStress<compute_stage>::ADComputeFiniteStrainElasticS
const InputParameters & parameters)
: ADComputeStressBase<compute_stage>(parameters),
GuaranteeConsumer(this),
_elasticity_tensor_name(_base_name + "elasticity_tensor"),
_elasticity_tensor(adGetADMaterialProperty<RankFourTensor>(_elasticity_tensor_name)),
_strain_increment(
adGetADMaterialPropertyByName<RankTwoTensor>(_base_name + "strain_increment")),
_rotation_increment(
@@ -19,7 +19,9 @@ defineADValidParams(
template <ComputeStage compute_stage>
ADComputeLinearElasticStress<compute_stage>::ADComputeLinearElasticStress(
const InputParameters & parameters)
: ADComputeStressBase<compute_stage>(parameters)
: ADComputeStressBase<compute_stage>(parameters),
_elasticity_tensor_name(_base_name + "elasticity_tensor"),
_elasticity_tensor(adGetADMaterialProperty<RankFourTensor>(_elasticity_tensor_name))
{
}

@@ -24,11 +24,9 @@ template <ComputeStage compute_stage>
ADComputeStressBase<compute_stage>::ADComputeStressBase(const InputParameters & parameters)
: ADMaterial<compute_stage>(parameters),
_base_name(isParamValid("base_name") ? adGetParam<std::string>("base_name") + "_" : ""),
_elasticity_tensor_name(_base_name + "elasticity_tensor"),
_mechanical_strain(adGetADMaterialProperty<RankTwoTensor>(_base_name + "mechanical_strain")),
_stress(adDeclareADProperty<RankTwoTensor>(_base_name + "stress")),
_elastic_strain(adDeclareADProperty<RankTwoTensor>(_base_name + "elastic_strain")),
_elasticity_tensor(adGetADMaterialProperty<RankFourTensor>(_elasticity_tensor_name))
_elastic_strain(adDeclareADProperty<RankTwoTensor>(_base_name + "elastic_strain"))
{

if (adGetParam<bool>("use_displaced_mesh"))
@@ -23,7 +23,9 @@ validParams<ComputeCosseratLinearElasticStress>()

ComputeCosseratLinearElasticStress::ComputeCosseratLinearElasticStress(
const InputParameters & parameters)
: ComputeCosseratStressBase(parameters)
: ComputeCosseratStressBase(parameters),
_elasticity_tensor_name(_base_name + "elasticity_tensor"),
_elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_elasticity_tensor_name))
{
}

@@ -24,6 +24,8 @@ ComputeFiniteStrainElasticStress::ComputeFiniteStrainElasticStress(
const InputParameters & parameters)
: ComputeStressBase(parameters),
GuaranteeConsumer(this),
_elasticity_tensor_name(_base_name + "elasticity_tensor"),
_elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_elasticity_tensor_name)),
_strain_increment(getMaterialPropertyByName<RankTwoTensor>(_base_name + "strain_increment")),
_rotation_increment(
getMaterialPropertyByName<RankTwoTensor>(_base_name + "rotation_increment")),
@@ -22,7 +22,8 @@ validParams<ComputeLinearElasticStress>()

ComputeLinearElasticStress::ComputeLinearElasticStress(const InputParameters & parameters)
: ComputeStressBase(parameters),
_mechanical_strain(getMaterialPropertyByName<RankTwoTensor>(_base_name + "mechanical_strain"))
_elasticity_tensor_name(_base_name + "elasticity_tensor"),
_elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_elasticity_tensor_name))
{
}

@@ -119,6 +119,8 @@ ComputeMultiPlasticityStress::ComputeMultiPlasticityStress(const InputParameters

_perform_finite_strain_rotations(getParam<bool>("perform_finite_strain_rotations")),

_elasticity_tensor_name(_base_name + "elasticity_tensor"),
_elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_elasticity_tensor_name)),
_plastic_strain(declareProperty<RankTwoTensor>("plastic_strain")),
_plastic_strain_old(getMaterialPropertyOld<RankTwoTensor>("plastic_strain")),
_intnl(declareProperty<std::vector<Real>>("plastic_internal_parameter")),
@@ -77,7 +77,6 @@ ComputeMultipleInelasticStress::ComputeMultipleInelasticStress(const InputParame
_absolute_tolerance(parameters.get<Real>("absolute_tolerance")),
_internal_solve_full_iteration_history(getParam<bool>("internal_solve_full_iteration_history")),
_perform_finite_strain_rotations(getParam<bool>("perform_finite_strain_rotations")),
_elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_base_name + "elasticity_tensor")),
_elastic_strain_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "elastic_strain")),
_strain_increment(getMaterialProperty<RankTwoTensor>(_base_name + "strain_increment")),
_inelastic_strain(declareProperty<RankTwoTensor>(_base_name + "combined_inelastic_strain")),
@@ -32,6 +32,8 @@ validParams<ComputePFFractureStressBase>()

ComputePFFractureStressBase::ComputePFFractureStressBase(const InputParameters & parameters)
: ComputeStressBase(parameters),
_elasticity_tensor_name(_base_name + "elasticity_tensor"),
_elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_elasticity_tensor_name)),
_c(coupledValue("c")),
_l(getMaterialProperty<Real>("l")),
_gc(getMaterialProperty<Real>("gc_prop")),
@@ -26,23 +26,26 @@ validParams<ComputeStrainIncrementBasedStress>()
ComputeStrainIncrementBasedStress::ComputeStrainIncrementBasedStress(
const InputParameters & parameters)
: ComputeStressBase(parameters),
_elasticity_tensor_name(_base_name + "elasticity_tensor"),
_elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_elasticity_tensor_name)),
_stress_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "stress")),
_mechanical_strain(getMaterialPropertyByName<RankTwoTensor>(_base_name + "mechanical_strain")),
_mechanical_strain_old(
getMaterialPropertyOldByName<RankTwoTensor>(_base_name + "mechanical_strain")),
_property_names(getParam<std::vector<MaterialPropertyName>>("inelastic_strain_names"))
_inelastic_strain_names(getParam<std::vector<MaterialPropertyName>>("inelastic_strain_names"))
{
_num_property = _property_names.size();
_num_inelastic_strain_models = _inelastic_strain_names.size();

if (_num_property > 0)
if (_num_inelastic_strain_models > 0)
{
_inelastic_strains.resize(_num_property);
_inelastic_strains_old.resize(_num_property);
_inelastic_strains.resize(_num_inelastic_strain_models);
_inelastic_strains_old.resize(_num_inelastic_strain_models);

for (unsigned int i = 0; i < _num_property; ++i)
for (unsigned int i = 0; i < _num_inelastic_strain_models; ++i)
{
_inelastic_strains[i] = &getMaterialProperty<RankTwoTensor>(_property_names[i]);
_inelastic_strains_old[i] = &getMaterialPropertyOld<RankTwoTensor>(_property_names[i]);
_inelastic_strains[i] = &getMaterialProperty<RankTwoTensor>(_inelastic_strain_names[i]);
_inelastic_strains_old[i] =
&getMaterialPropertyOld<RankTwoTensor>(_inelastic_strain_names[i]);
}
}
}
@@ -52,7 +55,7 @@ ComputeStrainIncrementBasedStress::computeQpStress()
{
RankTwoTensor elastic_strain_increment = (_mechanical_strain[_qp] - _mechanical_strain_old[_qp]);

for (unsigned int i = 0; i < _num_property; ++i)
for (unsigned int i = 0; i < _num_inelastic_strain_models; ++i)
elastic_strain_increment -= (*_inelastic_strains[i])[_qp] - (*_inelastic_strains_old[i])[_qp];

_stress[_qp] = _stress_old[_qp] + _elasticity_tensor[_qp] * elastic_strain_increment;
Oops, something went wrong.

0 comments on commit e3b783b

Please sign in to comment.
You can’t perform that action at this time.