12 #include "MooseException.h"
13 #include "MathUtils.h"
23 params.addClassDescription(
24 "Computes the stress and strain for a truss element with plastic behavior defined by either "
25 "linear hardening or a user-defined hardening function.");
26 params.addRequiredParam<Real>(
"yield_stress",
27 "Yield stress after which plastic strain starts accumulating");
28 params.addParam<Real>(
"hardening_constant", 0.0,
"Hardening slope");
29 params.addParam<FunctionName>(
"hardening_function",
30 "Engineering stress as a function of plastic strain");
31 params.addParam<Real>(
32 "absolute_tolerance", 1e-10,
"Absolute convergence tolerance for Newton iteration");
33 params.addParam<Real>(
34 "relative_tolerance", 1e-8,
"Relative convergence tolerance for Newton iteration");
40 _yield_stress(getParam<Real>(
"yield_stress")),
41 _hardening_constant(getParam<Real>(
"hardening_constant")),
42 _hardening_function(isParamValid(
"hardening_function") ? &getFunction(
"hardening_function")
44 _absolute_tolerance(parameters.get<Real>(
"absolute_tolerance")),
45 _relative_tolerance(parameters.get<Real>(
"relative_tolerance")),
46 _total_stretch_old(getMaterialPropertyOld<Real>(_base_name +
"total_stretch")),
47 _plastic_strain(declareProperty<Real>(_base_name +
"plastic_stretch")),
48 _plastic_strain_old(getMaterialPropertyOld<Real>(_base_name +
"plastic_stretch")),
49 _stress_old(getMaterialPropertyOld<Real>(_base_name +
"axial_stress")),
50 _hardening_variable(declareProperty<Real>(_base_name +
"hardening_variable")),
51 _hardening_variable_old(getMaterialPropertyOld<Real>(_base_name +
"hardening_variable")),
54 if (!parameters.isParamSetByUser(
"hardening_constant") && !isParamValid(
"hardening_function"))
55 mooseError(
"PlasticTruss: Either hardening_constant or hardening_function must be defined");
57 if (parameters.isParamSetByUser(
"hardening_constant") && isParamValid(
"hardening_function"))
58 mooseError(
"PlasticTruss: Only the hardening_constant or only the hardening_function can be "
59 "defined but not both");
87 Real plastic_strain_increment = 0.0;
88 Real elastic_strain_increment = strain_increment;
90 if (yield_condition > 0.0)
95 Real reference_residual =
96 std::abs(trial_stress) -
_youngs_modulus[_qp] * plastic_strain_increment;
107 plastic_strain_increment += scalar;
112 reference_residual = std::abs(trial_stress) -
_youngs_modulus[_qp] * plastic_strain_increment;
116 throw MooseException(
"PlasticTruss: Plasticity model did not converge");
118 plastic_strain_increment *= MathUtils::sign(trial_stress);
120 elastic_strain_increment = strain_increment - plastic_strain_increment;