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/VolumeChangeEigenstrain.h"
26 : #include "neml2/tensors/functions/pow.h"
27 :
28 : namespace neml2
29 : {
30 : register_NEML2_object(VolumeChangeEigenstrain);
31 :
32 : OptionSet
33 2 : VolumeChangeEigenstrain::expected_options()
34 : {
35 2 : OptionSet options = Eigenstrain::expected_options();
36 2 : options.doc() =
37 : "Define the (cummulative, as opposed to instantaneous) linear isotropic volume expansion "
38 : "eigenstrain, "
39 : "i.e. \\f$ \\boldsymbol{\\varepsilon}_V = (\\frac{V}{V0})^(1/3)-1 \\boldsymbol{I} \\f$, "
40 : "where "
41 : " \\f$ V \\f$ is the current volume, "
42 2 : "and \\f$ V0 \\f$ is the reference (initial) volume.";
43 :
44 6 : options.set_input("volume") = VariableName(STATE, "V");
45 4 : options.set("volume").doc() = "Volume";
46 :
47 4 : options.set_parameter<TensorName<Scalar>>("reference_volume");
48 2 : options.set("reference_volume").doc() = "Reference (initial) volume";
49 :
50 2 : return options;
51 0 : }
52 :
53 1 : VolumeChangeEigenstrain::VolumeChangeEigenstrain(const OptionSet & options)
54 : : Eigenstrain(options),
55 3 : _V0(declare_parameter<Scalar>("V0", "reference_volume")),
56 2 : _V(declare_input_variable<Scalar>("volume"))
57 : {
58 1 : }
59 :
60 : void
61 2 : VolumeChangeEigenstrain::set_value(bool out, bool dout_din, bool d2out_din2)
62 : {
63 2 : if (out)
64 1 : _eg = (pow(_V / _V0, (1.0 / 3.0)) - 1.0) * SR2::identity(_V.options());
65 :
66 2 : if (dout_din)
67 : {
68 1 : if (_V.is_dependent())
69 1 : _eg.d(_V) = 1.0 / (3 * _V0) * pow(_V / _V0, (-2.0 / 3.0)) * SR2::identity(_V.options());
70 : }
71 :
72 2 : if (d2out_din2)
73 : {
74 0 : if (_V.is_dependent())
75 0 : _eg.d(_V, _V) =
76 0 : -2.0 / (9.0 * _V0 * _V0) * pow(_V / _V0, (-5.0 / 3.0)) * SR2::identity(_V.options());
77 : }
78 2 : }
79 : }
80 : // namespace neml2
|