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/AssociativeIsotropicPlasticHardening.h"
26 : #include "neml2/tensors/Scalar.h"
27 :
28 : namespace neml2
29 : {
30 : register_NEML2_object(AssociativeIsotropicPlasticHardening);
31 :
32 : OptionSet
33 2 : AssociativeIsotropicPlasticHardening::expected_options()
34 : {
35 2 : OptionSet options = FlowRule::expected_options();
36 2 : options.doc() += " This object calculates the rate of equivalent plastic strain following "
37 : "associative flow rule, i.e. \\f$ \\dot{\\varepsilon}_p = - \\dot{\\gamma} "
38 : "\\frac{\\partial f}{\\partial k} \\f$, where \\f$ \\dot{\\varepsilon}_p \\f$ "
39 : "is the equivalent plastic strain, \\f$ \\dot{\\gamma} \\f$ is the flow rate, "
40 2 : "\\f$ f \\f$ is the yield function, and \\f$ k \\f$ is the isotropic hardening.";
41 :
42 6 : options.set_input("isotropic_hardening_direction") = VariableName(STATE, "internal", "Nk");
43 4 : options.set("isotropic_hardening_direction").doc() =
44 2 : "Direction of associative isotropic hardening which can be calculated using Normality.";
45 :
46 6 : options.set_output("equivalent_plastic_strain_rate") = VariableName(STATE, "internal", "ep_rate");
47 2 : options.set("equivalent_plastic_strain_rate").doc() = "Rate of equivalent plastic strain";
48 :
49 2 : return options;
50 0 : }
51 :
52 2 : AssociativeIsotropicPlasticHardening::AssociativeIsotropicPlasticHardening(
53 2 : const OptionSet & options)
54 : : FlowRule(options),
55 2 : _Nk(declare_input_variable<Scalar>("isotropic_hardening_direction")),
56 4 : _ep_dot(declare_output_variable<Scalar>("equivalent_plastic_strain_rate"))
57 : {
58 2 : }
59 :
60 : void
61 4 : AssociativeIsotropicPlasticHardening::set_value(bool out, bool dout_din, bool /*d2out_din2*/)
62 : {
63 : // For associative flow,
64 : // ep_dot = - gamma_dot * Nk
65 : // Nk = df/dk
66 :
67 4 : if (out)
68 3 : _ep_dot = -_gamma_dot * _Nk;
69 :
70 4 : if (dout_din)
71 : {
72 2 : if (_gamma_dot.is_dependent())
73 2 : _ep_dot.d(_gamma_dot) = -_Nk;
74 :
75 2 : if (_Nk.is_dependent())
76 2 : _ep_dot.d(_Nk) = -_gamma_dot;
77 : }
78 4 : }
79 : } // namespace neml2
|