25#include "neml2/models/ImplicitUpdate.h"
26#include "neml2/misc/math.h"
37 "Update an implicit model by solving the underlying implicit system of equations.";
39 options.set<std::string>(
"implicit_model");
40 options.set(
"implicit_model").doc() =
41 "The implicit model defining the implicit system of equations to be solved";
43 options.set<std::string>(
"solver");
44 options.set(
"solver").doc() =
"Solver used to solve the implicit system";
51 _model(register_model<
Model>(options.get<std::
string>(
"implicit_model"),
52 requires_grad() ? 0 : 1,
58 "The implicit model's input should have a state subaxis. The input axis is\n",
61 "The implicit model's output should have a residual subaxis. The output axis is\n",
64 "The implicit model should have conformal trial state and residual. The input state "
67 "\nThe output residual subaxis is\n",
84 "ImplicitUpdate does not support AD because it uses in-place operations to "
85 "iteratively update the trial solution until convergence.");
94 "ImplicitUpdate: requires the value and the first derivatives to be computed together.");
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:52
Definition ImplicitUpdate.h:33
Model & _model
The implicit model to be updated.
Definition ImplicitUpdate.h:45
ImplicitUpdate(const OptionSet &name)
Definition ImplicitUpdate.cxx:49
virtual void check_AD_limitation() const override
Definition ImplicitUpdate.cxx:81
NonlinearSolver & _solver
The nonlinear solver used to solve the nonlinear system.
Definition ImplicitUpdate.h:48
static OptionSet expected_options()
Definition ImplicitUpdate.cxx:33
void set_value(bool out, bool dout_din, bool d2out_din2) override
The map between input -> output, and optionally its derivatives.
Definition ImplicitUpdate.cxx:89
const LabeledAxis & subaxis(const std::string &name) const
Get a sub-axis.
Definition LabeledAxis.cxx:365
bool has_subaxis(const LabeledAxisAccessor &s) const
Check the existence of a subaxis by its LabeledAxisAccessor.
Definition LabeledAxis.cxx:200
A single-batched, logically 2D LabeledTensor.
Definition LabeledMatrix.h:38
void copy_(const T &other)
Copy the value from another tensor.
Definition LabeledTensor.h:235
A single-batched, logically 1D LabeledTensor.
Definition LabeledVector.h:38
The base class for all constitutive models.
Definition Model.h:53
bool _AD_2nd_deriv
Whether to use AD to compute 2nd derivatives.
Definition Model.h:281
const torch::TensorOptions & options() const
This model's tensor options.
Definition Model.h:116
bool _AD_1st_deriv
Whether to use AD to compute 1st derivatives.
Definition Model.h:278
virtual std::tuple< LabeledVector, LabeledMatrix > value_and_dvalue(const LabeledVector &in)
Convenient shortcut to construct and return the model value and its derivative.
Definition Model.cxx:357
@ SOLVING
Definition Model.h:188
@ UPDATING
Definition Model.h:188
static OptionSet expected_options()
Definition Model.cxx:33
static enum neml2::Model::Stage stage
Definition Model.cxx:30
The nonlinear solver solves a nonlinear system of equations.
Definition NonlinearSolver.h:37
virtual std::tuple< bool, size_t > solve(NonlinearSystem &system, BatchTensor &sol)=0
Solve the given nonlinear system.
virtual void init_scaling(const bool verbose=false)
Compute algebraic Jacobian-based automatic scaling following https://cs.stanford.edu/people/paulliu/f...
Definition NonlinearSystem.cxx:78
virtual BatchTensor solution() const
Get the solution vector.
Definition NonlinearSystem.h:66
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:59
const bool verbose
Whether to print additional (debugging) information during the solve.
Definition Solver.h:49
LabeledMatrix & derivative_storage()
Definition VariableStore.h:127
Variable< T > & declare_output_variable(S &&... name)
Declare an output variable.
Definition VariableStore.h:205
LabeledVector & output_storage()
Definition VariableStore.h:121
LabeledAxis & output_axis()
Definition VariableStore.h:97
LabeledVector & input_storage()
Definition VariableStore.h:115
LabeledAxis & input_axis()
Definition VariableStore.h:91
std::tuple< BatchTensor, BatchTensor > lu_factor(const BatchTensor &A, bool pivot)
Definition math.cxx:346
BatchTensor lu_solve(const BatchTensor &LU, const BatchTensor &pivots, const BatchTensor &B, bool left, bool adjoint)
Definition math.cxx:353
Definition CrossRef.cxx:32
void neml_assert_dbg(bool assertion, Args &&... args)
Definition error.h:85
void neml_assert(bool assertion, Args &&... args)
Definition error.h:73