NEML2 1.4.0
|
Definition of a nonlinear system of equations. More...
Definition of a nonlinear system of equations.
#include <NonlinearSystem.h>
Public Member Functions | |
NonlinearSystem (const OptionSet &options) | |
virtual void | init_scaling (const bool verbose=false) |
Compute algebraic Jacobian-based automatic scaling following https://cs.stanford.edu/people/paulliu/files/cs517-project.pdf. | |
BatchTensor | scale_residual (const BatchTensor &r) const |
Apply scaling to the residual. | |
BatchTensor | scale_Jacobian (const BatchTensor &J) const |
Apply scaling to the Jacobian. | |
BatchTensor | scale_direction (const BatchTensor &p) const |
Remove scaling from the search direction, i.e. \( J^{-1} r \). | |
virtual void | set_solution (const BatchTensor &x) |
Set the solution vector. | |
virtual BatchTensor | solution () const |
Get the solution vector. | |
BatchTensor | residual (const BatchTensor &x) |
Convenient shortcut to set the current solution, assemble and return the system residual. | |
void | residual () |
Convenient shortcut to assemble and return the system residual. | |
BatchTensor | Jacobian (const BatchTensor &x) |
Convenient shortcut to set the current solution, assemble and return the system Jacobian. | |
void | Jacobian () |
Convenient shortcut to assemble and return the system Jacobian. | |
std::tuple< BatchTensor, BatchTensor > | residual_and_Jacobian (const BatchTensor &x) |
Convenient shortcut to set the current solution, assemble and return the system residual and Jacobian. | |
void | residual_and_Jacobian () |
Convenient shortcut to assemble and return the system residual and Jacobian. | |
const BatchTensor & | residual_view () const |
const BatchTensor & | Jacobian_view () const |
BatchTensor | residual_norm () const |
The residual norm. | |
Static Public Member Functions | |
static OptionSet | expected_options () |
static void | disable_automatic_scaling (OptionSet &options) |
static void | enable_automatic_scaling (OptionSet &options) |
Protected Member Functions | |
virtual void | assemble (bool residual, bool Jacobian)=0 |
Compute the residual and Jacobian. | |
Protected Attributes | |
TorchSize | _ndof |
Number of degrees of freedom. | |
BatchTensor | _solution |
View for the solution of this nonlinear system. | |
BatchTensor | _residual |
View for the residual of this nonlinear system. | |
BatchTensor | _Jacobian |
View for the Jacobian of this nonlinear system. | |
BatchTensor | _scaled_residual |
BatchTensor | _scaled_Jacobian |
const bool | _autoscale |
If true, do automatic scaling. | |
const Real | _autoscale_tol |
Tolerance for convergence check of the iterative automatic scaling algorithm. | |
const unsigned int | _autoscale_miter |
Maximum number of iterations allowed for the iterative automatic scaling algorithm. | |
bool | _scaling_matrices_initialized |
Flag to indicate whether scaling matrices have been computed. | |
BatchTensor | _row_scaling |
Row scaling "matrix" – since it's a batched diagonal matrix, we are only storing its diagonals. | |
BatchTensor | _col_scaling |
Column scaling "matrix" – since it's a batched diagonal matrix, we are only storing its diagonals. | |
NonlinearSystem | ( | const OptionSet & | options | ) |
Compute the residual and Jacobian.
residual | Whether residual is requested |
Jacobian | Whether Jacobian is requested |
Implemented in Model, and TrustRegionSubProblem.
|
static |
Compute algebraic Jacobian-based automatic scaling following https://cs.stanford.edu/people/paulliu/files/cs517-project.pdf.
verbose | Print automatic scaling convergence information |
void Jacobian | ( | ) |
Convenient shortcut to assemble and return the system Jacobian.
BatchTensor Jacobian | ( | const BatchTensor & | x | ) |
Convenient shortcut to set the current solution, assemble and return the system Jacobian.
|
inline |
void residual | ( | ) |
Convenient shortcut to assemble and return the system residual.
BatchTensor residual | ( | const BatchTensor & | x | ) |
Convenient shortcut to set the current solution, assemble and return the system residual.
void residual_and_Jacobian | ( | ) |
Convenient shortcut to assemble and return the system residual and Jacobian.
std::tuple< BatchTensor, BatchTensor > residual_and_Jacobian | ( | const BatchTensor & | x | ) |
Convenient shortcut to set the current solution, assemble and return the system residual and Jacobian.
BatchTensor residual_norm | ( | ) | const |
The residual norm.
|
inline |
BatchTensor scale_direction | ( | const BatchTensor & | p | ) | const |
Remove scaling from the search direction, i.e. \( J^{-1} r \).
BatchTensor scale_Jacobian | ( | const BatchTensor & | J | ) | const |
Apply scaling to the Jacobian.
BatchTensor scale_residual | ( | const BatchTensor & | r | ) | const |
Apply scaling to the residual.
|
virtual |
Set the solution vector.
Reimplemented in Model.
|
inlinevirtual |
Get the solution vector.
Maximum number of iterations allowed for the iterative automatic scaling algorithm.
Tolerance for convergence check of the iterative automatic scaling algorithm.
|
protected |
Column scaling "matrix" – since it's a batched diagonal matrix, we are only storing its diagonals.
|
protected |
View for the Jacobian of this nonlinear system.
|
protected |
Number of degrees of freedom.
|
protected |
View for the residual of this nonlinear system.
|
protected |
Row scaling "matrix" – since it's a batched diagonal matrix, we are only storing its diagonals.
|
protected |
|
protected |
|
protected |
Flag to indicate whether scaling matrices have been computed.
|
protected |
View for the solution of this nonlinear system.