Skip to content

Commit

Permalink
Compute effective inelastic strain (idaholab#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwen committed Apr 23, 2021
1 parent f0d70f0 commit 8a5aa26
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
7 changes: 4 additions & 3 deletions include/materials/NEMLStressBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ class NEMLStressBase : public ComputeStressBase
MaterialProperty<RankTwoTensor> & _inelastic_strain;

///@{ Computation of a material based time step limit
const bool _compute_dt;
const Real _target_increment;
const MaterialProperty<RankTwoTensor> * _inelastic_strain_old;
MaterialProperty<Real> * _material_dt;
const MaterialProperty<RankTwoTensor> & _inelastic_strain_old;
MaterialProperty<Real> & _effective_inelastic_strain;
const MaterialProperty<Real> & _effective_inelastic_strain_old;
MaterialProperty<Real> & _material_dt;
///@}

/// Print debugging data on failed NEML stress updates
Expand Down
29 changes: 17 additions & 12 deletions src/materials/NEMLStressBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "NEMLStressBase.h"
#include "Conversion.h"
#include "RankTwoScalarTools.h"

#include <limits>
#include <type_traits>
Expand All @@ -26,6 +27,7 @@ NEMLStressBase::validParams()
InputParameters params = ComputeStressBase::validParams();
params.addCoupledVar("temperature", 0.0, "Coupled temperature");
params.addParam<Real>("target_increment",
1e-3,
"L2 norm of the inelastic strain increment to target by adjusting the "
"timestep");
params.addParam<bool>("debug",
Expand All @@ -49,12 +51,11 @@ NEMLStressBase::NEMLStressBase(const InputParameters & parameters)
_temperature(coupledValue("temperature")),
_temperature_old(coupledValueOld("temperature")),
_inelastic_strain(declareProperty<RankTwoTensor>(_base_name + "inelastic_strain")),
_compute_dt(isParamValid("target_increment")),
_target_increment(_compute_dt ? getParam<Real>("target_increment") : 0.0),
_inelastic_strain_old(
_compute_dt ? &getMaterialPropertyOld<RankTwoTensor>(_base_name + "inelastic_strain")
: nullptr),
_material_dt(_compute_dt ? &declareProperty<Real>("material_timestep_limit") : nullptr),
_target_increment(getParam<Real>("target_increment")),
_inelastic_strain_old(getMaterialPropertyOld<RankTwoTensor>(_base_name + "inelastic_strain")),
_effective_inelastic_strain(declareProperty<Real>("effective_inelastic_strain")),
_effective_inelastic_strain_old(getMaterialPropertyOld<Real>("effective_inelastic_strain")),
_material_dt(declareProperty<Real>("material_timestep_limit")),
_debug(getParam<bool>("debug"))
{
// We're letting NEML write to raw pointers. Best make sure the stored types are
Expand Down Expand Up @@ -170,13 +171,17 @@ NEMLStressBase::computeQpStress()

nemlToRankTwoTensor(pstrain, _inelastic_strain[_qp]);

// compute effective inelastic strain increment
const auto inelastic_strain_increment = _inelastic_strain[_qp] - _inelastic_strain_old[_qp];
const auto effective_inelastic_strain_increment =
RankTwoScalarTools::effectiveStrain(inelastic_strain_increment);
_effective_inelastic_strain[_qp] =
_effective_inelastic_strain_old[_qp] + effective_inelastic_strain_increment;

// compute material timestep
if (_compute_dt)
{
const auto increment = (_inelastic_strain[_qp] - (*_inelastic_strain_old)[_qp]).L2norm();
(*_material_dt)[_qp] =
increment > 0 ? _dt * _target_increment / increment : std::numeric_limits<Real>::max();
}
_material_dt[_qp] = effective_inelastic_strain_increment > 0
? _dt * _target_increment / effective_inelastic_strain_increment
: std::numeric_limits<Real>::max();

// Store dissipation
_energy[_qp] = u_np1;
Expand Down

0 comments on commit 8a5aa26

Please sign in to comment.