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/drivers/solid_mechanics/SDTSolidMechanicsDriver.h"
26 :
27 : namespace neml2
28 : {
29 : register_NEML2_object(SDTSolidMechanicsDriver);
30 :
31 : OptionSet
32 2 : SDTSolidMechanicsDriver::expected_options()
33 : {
34 2 : OptionSet options = SolidMechanicsDriver::expected_options();
35 2 : options.doc() +=
36 2 : " This driver is specialized for small deformation models using the total formulation.";
37 :
38 6 : options.set<VariableName>("strain") = VariableName(FORCES, "E");
39 4 : options.set("strain").doc() = "Name of the strain used to drive the update";
40 4 : options.set<TensorName<SR2>>("prescribed_strain");
41 2 : options.set("prescribed_strain").doc() = "Prescribed strain (when control = STRAIN)";
42 :
43 6 : options.set<VariableName>("stress") = VariableName(FORCES, "S");
44 4 : options.set("stress").doc() = "Name of the stress used to drive the update";
45 4 : options.set<TensorName<SR2>>("prescribed_stress");
46 2 : options.set("prescribed_stress").doc() = "Prescribed stress (when control = STRESS)";
47 :
48 2 : return options;
49 0 : }
50 :
51 6 : SDTSolidMechanicsDriver::SDTSolidMechanicsDriver(const OptionSet & options)
52 6 : : SolidMechanicsDriver(options)
53 : {
54 6 : }
55 :
56 : void
57 4 : SDTSolidMechanicsDriver::init_strain_control(const OptionSet & options)
58 : {
59 4 : _driving_force_name = options.get<VariableName>("strain");
60 8 : _driving_force = resolve_tensor<SR2>("prescribed_strain");
61 4 : _driving_force = _driving_force.to(_device);
62 4 : }
63 :
64 : void
65 1 : SDTSolidMechanicsDriver::init_stress_control(const OptionSet & options)
66 : {
67 1 : _driving_force_name = options.get<VariableName>("stress");
68 2 : _driving_force = resolve_tensor<SR2>("prescribed_stress");
69 1 : _driving_force = _driving_force.to(_device);
70 1 : }
71 : } // namespace neml2
|