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/VoceIsotropicHardening.h"
26 : #include "neml2/tensors/Scalar.h"
27 : #include "neml2/tensors/functions/exp.h"
28 :
29 : namespace neml2
30 : {
31 : register_NEML2_object(VoceIsotropicHardening);
32 :
33 : OptionSet
34 2 : VoceIsotropicHardening::expected_options()
35 : {
36 2 : OptionSet options = IsotropicHardening::expected_options();
37 2 : options.doc() = "Voce isotropic hardening model, \\f$ h = R \\left[ 1 - \\exp(-d \\varepsilon_p) "
38 : "\\right] \\f$, where \\f$ R \\f$ is the isotropic hardening upon saturation, "
39 2 : "and \\f$ d \\f$ is the hardening rate.";
40 :
41 4 : options.set<bool>("define_second_derivatives") = true;
42 :
43 4 : options.set_parameter<TensorName<Scalar>>("saturated_hardening");
44 4 : options.set("saturated_hardening").doc() = "Saturated isotropic hardening";
45 4 : options.set_parameter<TensorName<Scalar>>("saturation_rate");
46 2 : options.set("saturation_rate").doc() = "Hardening saturation rate";
47 :
48 2 : return options;
49 0 : }
50 :
51 3 : VoceIsotropicHardening::VoceIsotropicHardening(const OptionSet & options)
52 : : IsotropicHardening(options),
53 9 : _R(declare_parameter<Scalar>("R", "saturated_hardening", true)),
54 15 : _d(declare_parameter<Scalar>("d", "saturation_rate", true))
55 : {
56 3 : }
57 :
58 : void
59 7 : VoceIsotropicHardening::set_value(bool out, bool dout_din, bool d2out_din2)
60 : {
61 7 : if (out)
62 5 : _h = _R * (-exp(-_d * _ep) + 1.0);
63 :
64 7 : if (dout_din)
65 : {
66 3 : if (_ep.is_dependent())
67 3 : _h.d(_ep) = _R * _d * exp(-_d * _ep);
68 :
69 9 : if (const auto * const R = nl_param("R"))
70 1 : _h.d(*R) = -exp(-_d * _ep) + 1.0;
71 :
72 9 : if (const auto * const d = nl_param("d"))
73 1 : _h.d(*d) = _ep * _R * exp(-_d * _ep);
74 : }
75 :
76 7 : if (d2out_din2)
77 1 : if (_ep.is_dependent())
78 1 : _h.d(_ep, _ep) = -_R * _d * _d * exp(-_d * _ep);
79 7 : }
80 : } // namespace neml2
|