NEML2 1.4.0
Loading...
Searching...
No Matches
ChabochePlasticHardening.cxx
1// Copyright 2023, UChicago Argonne, LLC
2// All Rights Reserved
3// Software Name: NEML2 -- the New Engineering material Model Library, version 2
4// By: Argonne National Laboratory
5// OPEN SOURCE LICENSE (MIT)
6//
7// Permission is hereby granted, free of charge, to any person obtaining a copy
8// of this software and associated documentation files (the "Software"), to deal
9// in the Software without restriction, including without limitation the rights
10// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11// copies of the Software, and to permit persons to whom the Software is
12// furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice shall be included in
15// all copies or substantial portions of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23// THE SOFTWARE.
24
25#include "neml2/models/solid_mechanics/ChabochePlasticHardening.h"
26#include "neml2/tensors/SSR4.h"
27
28namespace neml2
29{
30register_NEML2_object(ChabochePlasticHardening);
31
34{
36 options.doc() +=
37 " This object defines the non-associative Chaboche kinematic hardening. In the Chaboche "
38 "model, back stress is directly treated as an internal variable. Rate of back stress is "
39 "given as \\f$ \\dot{\\boldsymbol{X}} = \\left( \\frac{2}{3} C \\frac{\\partial f}{\\partial "
40 "\\boldsymbol{M}} - g \\boldsymbol{X} \\right) \\dot{\\gamma} - A \\lVert \\boldsymbol{X} "
41 "\\rVert^{a - 1} \\boldsymbol{X} \\f$, including kinematic hardening, dynamic recovery, and "
42 "static recovery. \\f$ \\frac{\\partial f}{\\partial \\boldsymbol{M}} \\f$ is the flow "
43 "direction, \\f$ \\dot{\\gamma} \\f$ is the flow rate, and \\f$ C \\f$, \\f$ g \\f$, \\f$ A "
44 "\\f$, and \\f$ a \\f$ are material parameters.";
45
46 options.set<VariableName>("back_stress") = VariableName("state", "internal", "X");
47 options.set("back_stress").doc() = "Back stress";
48
49 options.set<VariableName>("flow_direction") = VariableName("state", "internal", "NM");
50 options.set("flow_direction").doc() = "Flow direction";
51
52 options.set<CrossRef<Scalar>>("C");
53 options.set("C").doc() = "Kinematic hardening coefficient";
54
55 options.set<CrossRef<Scalar>>("g");
56 options.set("g").doc() = "Dynamic recovery coefficient";
57
58 options.set<CrossRef<Scalar>>("A");
59 options.set("A").doc() = "Static recovery prefactor";
60
61 options.set<CrossRef<Scalar>>("a");
62 options.set("a").doc() = "Static recovery exponent";
63
64 return options;
65}
66
68 : FlowRule(options),
69 _X(declare_input_variable<SR2>("back_stress")),
70 _NM(declare_input_variable<SR2>("flow_direction")),
71 _X_dot(declare_output_variable<SR2>(_X.name().with_suffix("_rate"))),
72 _C(declare_parameter<Scalar>("C", "C")),
73 _g(declare_parameter<Scalar>("g", "g")),
74 _A(declare_parameter<Scalar>("A", "A")),
75 _a(declare_parameter<Scalar>("a", "a"))
76{
77}
78
79void
81{
82 neml_assert_dbg(!d2out_din2, "Chaboche model doesn't implement second derivatives.");
83
84 // The effective stress
85 auto s = SR2(_X).norm(NEML2_EPS);
86 // The part that's proportional to the plastic strain rate
87 auto g_term = 2.0 / 3.0 * _C * _NM - _g * _X;
88
89 if (out)
90 {
91 // The static recovery term
92 auto s_term = -_A * math::pow(s, _a - 1) * _X;
94 }
95
96 if (dout_din)
97 {
98 auto I = SR2::identity_map(options());
99
101 _X_dot.d(_NM) = 2.0 / 3.0 * _C * _gamma_dot * I;
102 _X_dot.d(_X) = -_g * _gamma_dot * I -
103 _A * math::pow(s, _a - 3) * ((_a - 1) * SR2(_X).outer(SR2(_X)) + s * s * I);
104 }
105}
106
107} // namespace neml2
Definition ChabochePlasticHardening.h:32
const Scalar & _C
Definition ChabochePlasticHardening.h:50
const Variable< SR2 > & _X
Back stress.
Definition ChabochePlasticHardening.h:42
Variable< SR2 > & _X_dot
Rate of back stress.
Definition ChabochePlasticHardening.h:48
const Scalar & _A
Definition ChabochePlasticHardening.h:52
const Variable< SR2 > & _NM
Flow direction.
Definition ChabochePlasticHardening.h:45
const Scalar & _g
Definition ChabochePlasticHardening.h:51
static OptionSet expected_options()
Definition ChabochePlasticHardening.cxx:33
const Scalar & _a
Definition ChabochePlasticHardening.h:53
ChabochePlasticHardening(const OptionSet &options)
Definition ChabochePlasticHardening.cxx:67
void set_value(bool out, bool dout_din, bool d2out_din2) override
The map between input -> output, and optionally its derivatives.
Definition ChabochePlasticHardening.cxx:80
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:52
Definition FlowRule.h:32
const Variable< Scalar > & _gamma_dot
Definition FlowRule.h:39
static OptionSet expected_options()
Definition FlowRule.cxx:30
The accessor containing all the information needed to access an item in a LabeledAxis.
Definition LabeledAxisAccessor.h:44
const torch::TensorOptions & options() const
This model's tensor options.
Definition Model.h:116
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:59
The (logical) symmetric second order tensor.
Definition SR2.h:46
SSR4 outer(const SR2 &other) const
Outer product ij,kl -> ijkl.
Definition SR2.cxx:205
Scalar norm(Real eps=0) const
Norm.
Definition SR2.cxx:199
static SSR4 identity_map(const torch::TensorOptions &options=default_tensor_options())
The derivative of a SR2 with respect to itself.
Definition SR2.cxx:116
The (logical) scalar.
Definition Scalar.h:38
Derived pow(const Derived &a, const Real &n)
Definition BatchTensorBase.h:332
Definition CrossRef.cxx:32
void neml_assert_dbg(bool assertion, Args &&... args)
Definition error.h:85
LabeledAxisAccessor VariableName
Definition Variable.h:35