Line data Source code
1 : // Copyright 2024, 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/AssociativeKinematicPlasticHardening.h"
26 : #include "neml2/tensors/Scalar.h"
27 : #include "neml2/tensors/SR2.h"
28 : #include "neml2/tensors/SSR4.h"
29 :
30 : namespace neml2
31 : {
32 : register_NEML2_object(AssociativeKinematicPlasticHardening);
33 :
34 : OptionSet
35 2 : AssociativeKinematicPlasticHardening::expected_options()
36 : {
37 2 : OptionSet options = FlowRule::expected_options();
38 2 : options.doc() +=
39 : " This object calculates the rate of kinematic plastic strain following associative flow "
40 : "rule, i.e. \\f$ \\dot{\\boldsymbol{K}}_p = - \\dot{\\gamma} \\frac{\\partial f}{\\partial "
41 : "\\boldsymbol{X}} \\f$, where \\f$ \\dot{\\boldsymbol{K}}_p \\f$ is the kinematic plastic "
42 : "strain, \\f$ \\dot{\\gamma} \\f$ is the flow rate, \\f$ f \\f$ is the yield function, and "
43 2 : "\\f$ \\boldsymbol{X} \\f$ is the kinematic hardening.";
44 :
45 6 : options.set_input("kinematic_hardening_direction") = VariableName(STATE, "internal", "NX");
46 4 : options.set("kinematic_hardening_direction").doc() =
47 2 : "Direction of associative kinematic hardening which can be calculated using Normality.";
48 :
49 6 : options.set_output("kinematic_plastic_strain_rate") = VariableName(STATE, "internal", "Kp_rate");
50 2 : options.set("kinematic_plastic_strain_rate").doc() = "Rate of kinematic plastic strain";
51 :
52 2 : return options;
53 0 : }
54 :
55 1 : AssociativeKinematicPlasticHardening::AssociativeKinematicPlasticHardening(
56 1 : const OptionSet & options)
57 : : FlowRule(options),
58 1 : _NX(declare_input_variable<SR2>("kinematic_hardening_direction")),
59 2 : _Kp_dot(declare_output_variable<SR2>("kinematic_plastic_strain_rate"))
60 : {
61 1 : }
62 :
63 : void
64 2 : AssociativeKinematicPlasticHardening::set_value(bool out, bool dout_din, bool /*d2out_din2*/)
65 : {
66 : // For associative flow,
67 : // Kp_dot = - gamma_dot * NX
68 : // NX = df/dX
69 :
70 2 : if (out)
71 1 : _Kp_dot = -_gamma_dot * _NX;
72 :
73 2 : if (dout_din)
74 : {
75 1 : auto I = SR2::identity_map(_gamma_dot.options());
76 :
77 1 : if (_gamma_dot.is_dependent())
78 1 : _Kp_dot.d(_gamma_dot) = -_NX;
79 :
80 1 : if (_NX.is_dependent())
81 1 : _Kp_dot.d(_NX) = -_gamma_dot * I;
82 1 : }
83 2 : }
84 : } // namespace neml2
|