25#include "neml2/models/solid_mechanics/crystal_plasticity/SumSlipRates.h"
27#include "neml2/models/crystallography/CrystalGeometry.h"
29#include "neml2/tensors/tensors.h"
30#include "neml2/tensors/list_tensors.h"
40 options.doc() =
"Calculates the sum of the absolute value of all the slip rates as \\f$ "
41 "\\sum_{i=1}^{n_{slip}} \\left| \\dot{\\gamma}_i \\right| \\f$.";
44 options.set(
"slip_rates").doc() =
"The name of individual slip rates";
47 options.set(
"sum_slip_rates").doc() =
"The outut name for the scalar sum of the slip rates";
49 options.set<std::string>(
"crystal_geometry_name") =
"crystal_geometry";
50 options.set(
"crystal_geometry_name").doc() =
51 "The name of the Data object containing the crystallographic information";
58 _crystal_geometry(register_data<crystallography::CrystalGeometry>(
59 options.get<std::
string>(
"crystal_geometry_name"))),
60 _sg(declare_output_variable<
Scalar>(
"sum_slip_rates")),
61 _g(declare_input_variable_list<
Scalar>(_crystal_geometry.nslip(),
"slip_rates"))
BatchTensor base_unsqueeze(TorchSize d) const
Unsqueeze a base dimension.
Definition BatchTensorBase.cxx:282
Definition BatchTensor.h:32
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
The base class for all constitutive models.
Definition Model.h:53
TorchSize batch_dim() const
This model's batch dim.
Definition Model.h:110
const torch::TensorOptions & options() const
This model's tensor options.
Definition Model.h:116
static OptionSet expected_options()
Definition Model.cxx:33
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:59
The (logical) scalar.
Definition Scalar.h:38
A helper model to calculate the sum of the absolute value of the slip rates.
Definition SumSlipRates.h:38
SumSlipRates(const OptionSet &options)
Definition SumSlipRates.cxx:56
Variable< Scalar > & _sg
Sum of the absolute slip rates.
Definition SumSlipRates.h:58
const Variable< BatchTensor > & _g
Slip rates.
Definition SumSlipRates.h:61
static OptionSet expected_options()
Definition SumSlipRates.cxx:37
void set_value(bool out, bool dout_din, bool d2out_din2) override
Calculate the sum and the derivatives.
Definition SumSlipRates.cxx:66
Derivative d(const VariableBase &x)
Create a wrapper representing the derivative dy/dx.
Definition Variable.cxx:102
Derived abs(const Derived &a)
Definition BatchTensorBase.h:457
Derived sign(const Derived &a)
Definition BatchTensorBase.h:360
Definition CrossRef.cxx:32
void neml_assert_dbg(bool assertion, Args &&... args)
Definition error.h:85
LabeledAxisAccessor VariableName
Definition Variable.h:35