25#include "neml2/drivers/solid_mechanics/SolidMechanicsDriver.h"
36 "Driver for small deformation solid mechanics material model with optional thermal coupling.";
38 options.
set<std::string>(
"control") =
"STRAIN";
39 options.
set(
"control").doc() =
"External control of the material update. Options are STRAIN and "
40 "STRESS, for strain control and stress control, respectively.";
43 options.
set(
"total_strain").doc() =
"Total strain";
46 options.
set(
"cauchy_stress").doc() =
"Cauchy stress";
49 options.
set(
"temperature").doc() =
"Name of temperature";
52 options.
set(
"fixed_values").doc() =
"Name of fixed values (when control = MIXED)";
55 options.
set(
"prescribed_strains").doc() =
"Prescribed strain (when control = STRAIN)";
58 options.
set(
"prescribed_stresses").doc() =
"Prescribed stress (when control = STRESS)";
61 options.
set(
"prescribed_temperatures").doc() =
62 "Actual prescibed temperature values, when providing temperatures to the model";
65 options.
set(
"prescribed_mixed_conditions").doc() =
66 "The fixed, controlled values provided as user input for the mixed control case. Where the "
67 "control signal is 0 these are strain values, where it is 1 these are stress values";
70 options.
set(
"control_name").doc() =
"The name of the control signal on the input axis";
73 options.
set(
"prescribed_control").doc() =
"The actual values of the control signal. 0 implies "
74 "strain control, 1 implies stress control";
81 _control(options.get<std::
string>(
"control")),
82 _control_name(options.get<
VariableName>(
"control_name")),
83 _temperature_name(options.get<
VariableName>(
"temperature")),
84 _temperature_prescribed(
85 !options.get<
CrossRef<torch::Tensor>>(
"prescribed_temperatures").raw().empty()),
86 _temperature(_temperature_prescribed
87 ?
Scalar(options.get<
CrossRef<torch::Tensor>>(
"prescribed_temperatures"), 2)
89 _control_signal(_control ==
"MIXED"
90 ?
SR2(options.get<
CrossRef<torch::Tensor>>(
"prescribed_control"), 2)
127 "Input strain/stress should have dimension 3 but instead has dimension",
130 "Input strain/stress and time should have the same number of time steps. The input "
133 " time steps, while the input strain/stress has ",
137 "Input strain/stress and time should have the same batch size. The input time has a "
140 " while the input strain/stress has a batch size of ",
143 "Input strain/stress should have final dimension 6 but instead has final dimension ",
149 "Input temperature should have 2 batch dimensions but instead has batch dimension",
152 "Input temperature and time should have the same number of time steps. The input "
155 " time steps, while the input temperature has ",
159 "Input temperature and time should have the same batch size. The input time has a "
162 " while the input temperature has a batch size of ",
170 "Input control signal should have 2 batch dimensions but instead has batch dimension",
174 "Input control signal should have the same number of steps steps as time, but instead has",
179 "Input control signal should have the same batch size as time, but instead has batch size",
TorchSize batch_dim() const
Return the number of batch dimensions.
Definition BatchTensorBase.cxx:128
Derived batch_index(TorchSlice indices) const
Get a batch.
Definition BatchTensorBase.cxx:184
Derived to(const torch::TensorOptions &options) const
Send to options.
Definition BatchTensorBase.cxx:331
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:52
The accessor containing all the information needed to access an item in a LabeledAxis.
Definition LabeledAxisAccessor.h:44
void set(const BatchTensorBase< T > &value, S &&... names)
Set and interpret the input as an object.
Definition LabeledTensor.h:193
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:59
const std::string & doc() const
A readonly reference to the option set's docstring.
Definition OptionSet.h:91
const T & get(const std::string &) const
Definition OptionSet.h:422
T & set(const std::string &)
Definition OptionSet.h:436
The (logical) symmetric second order tensor.
Definition SR2.h:46
The (logical) scalar.
Definition Scalar.h:38
The transient driver specialized for solid mechanics problems.
Definition SolidMechanicsDriver.h:36
SR2 _control_signal
Actual control signal, when used for control == "MIXED".
Definition SolidMechanicsDriver.h:85
const std::string _control
The control method to drive the constitutive update.
Definition SolidMechanicsDriver.h:58
SolidMechanicsDriver(const OptionSet &options)
Construct a new SolidMechanicsDriver object.
Definition SolidMechanicsDriver.cxx:79
Scalar _temperature
Temperature.
Definition SolidMechanicsDriver.h:82
const VariableName _control_name
Name of the control signal for mixed stress/strain control.
Definition SolidMechanicsDriver.h:73
void check_integrity() const override
Check the integrity of the set up.
Definition SolidMechanicsDriver.cxx:123
virtual void update_forces() override
Update the driving forces for the current time step.
Definition SolidMechanicsDriver.cxx:185
VariableName _driving_force_name
Definition SolidMechanicsDriver.h:70
const VariableName _temperature_name
Name of the temperature variable.
Definition SolidMechanicsDriver.h:76
static OptionSet expected_options()
Definition SolidMechanicsDriver.cxx:32
const bool _temperature_prescribed
Whether temperature is prescribed.
Definition SolidMechanicsDriver.h:79
SR2 _driving_force
Definition SolidMechanicsDriver.h:64
The driver for a transient initial-value problem.
Definition TransientDriver.h:41
const torch::Device _device
The device on which to evaluate the model.
Definition TransientDriver.h:94
virtual void update_forces()
Update the driving forces for the current time step.
Definition TransientDriver.cxx:218
Scalar _time
The current time.
Definition TransientDriver.h:97
virtual void check_integrity() const override
Check the integrity of the set up.
Definition TransientDriver.cxx:135
LabeledVector & _in
The input to the constitutive model.
Definition TransientDriver.h:107
static OptionSet expected_options()
Definition TransientDriver.cxx:34
TorchSize _step_count
The current step count.
Definition TransientDriver.h:99
Definition CrossRef.cxx:32
LabeledAxisAccessor VariableName
Definition Variable.h:35
void neml_assert(bool assertion, Args &&... args)
Definition error.h:73