Reference documentation for deal.II version GIT relicensing-136-gb80d0be4af 2024-03-18 08:20:02+00:00
|
Modules | |
SLEPcWrappers | |
Namespaces | |
namespace | PETScWrappers |
namespace | PETScWrappers::MPI |
namespace | internal |
Functions | |
PETScWrappers::NonlinearSolverData::NonlinearSolverData (const std::string &options_prefix="", const std::string &snes_type="", const std::string &snes_linesearch_type="", const real_type absolute_tolerance=0, const real_type relative_tolerance=0, const real_type step_tolerance=0, const int maximum_non_linear_iterations=-1, const int max_n_function_evaluations=-1) | |
template<typename VectorType = PETScWrappers::VectorBase, typename PMatrixType = PETScWrappers::MatrixBase, typename AMatrixType = PMatrixType> | |
PETScWrappers::DEAL_II_CXX20_REQUIRES ((concepts::is_dealii_petsc_vector_type< VectorType >||std::constructible_from< VectorType, Vec >)&&(concepts::is_dealii_petsc_matrix_type< PMatrixType >||std::constructible_from< PMatrixType, Mat >)&&(concepts::is_dealii_petsc_matrix_type< AMatrixType >||std::constructible_from< AMatrixType, Mat >)) class NonlinearSolver | |
PETScWrappers::TimeStepperData::TimeStepperData (const std::string &options_prefix="", const std::string &ts_type="", const real_type initial_time=0.0, const real_type final_time=0.0, const real_type initial_step_size=0.0, const int max_steps=-1, const bool match_step=false, const std::string &ts_adapt_type="none", const real_type minimum_step_size=-1.0, const real_type maximum_step_size=-1.0, const real_type absolute_tolerance=-1.0, const real_type relative_tolerance=-1.0, const bool ignore_algebraic_lte=true) | |
The classes in this module are wrappers around functionality provided by the PETSc library. They provide a modern object-oriented interface that is compatible with the interfaces of the other linear algebra classes in deal.II. All classes and functions in this group reside in a namespace PETScWrappers
.
These classes are only available if a PETSc installation was detected during configuration of deal.II. Refer to the README file for more details about this.
|
inline |
Initialization parameters for NonlinearSolverData.
Running parameters:
options_prefix | The string indicating the options prefix for command line customization. |
snes_type | The string indicating the PETSc SNES solver type. |
snes_linesearch_type | The string indicating the PETSc linesearch type. |
absolute_tolerance | Absolute error tolerance. |
relative_tolerance | Relative error tolerance. |
step_tolerance | Step tolerance. |
maximum_non_linear_iterations | Maximum number of iterations allowed. |
max_n_function_evaluations | Maximum number of function evaluations allowed. |
Definition at line 74 of file petsc_snes.h.
PETScWrappers::DEAL_II_CXX20_REQUIRES | ( | (concepts::is_dealii_petsc_vector_type< VectorType >|| std::constructible_from< VectorType, Vec >)&&(concepts::is_dealii_petsc_matrix_type< PMatrixType >|| std::constructible_from< PMatrixType, Mat >)&&(concepts::is_dealii_petsc_matrix_type< AMatrixType >|| std::constructible_from< AMatrixType, Mat >) | ) |
Interface to PETSc SNES solver for nonlinear equations. The SNES solver is described in the PETSc manual.
This class solves the nonlinear system of algebraic equations \(F(x) = 0\).
The interface to PETSc is realized by means of std::function callbacks like in the TrilinosWrappers::NOXSolver and SUNDIALS::KINSOL classes.
NonlinearSolver supports any vector and matrix type having constructors and methods:
In particular, the supported types are the ones that can wrap PETSc's native vector and matrix classes, that are able to modify them in place, and that can return PETSc native types when requested.
To use the solvers the user needs to provide the implementation of \(F\) via the NonlinearSolver::residual callback.
The default linearization procedure of a solver instantiated with this class consists in using Jacobian-Free-Newton-Krylov; the action of tangent matrices inside a linear solver process are approximated via matrix-free finite-differencing of the nonlinear residual equations. For details, consult the PETSc manual.
Users can also provide the implementations of the Jacobian. This can be accomplished in two ways:
NonlinearSolver::set_matrices() must be used in case the user wants to provide the iteration matrix of the tangent system in the deal.II style approach, thus replacing the matrix-free linearization.
The correctness of the constructed Jacobians passed using NonlinearSolver::set_matrix() can be checked using
See NonlinearSolver::set_matrix() and NonlinearSolver::set_matrices() for additional details.
The deal.II style approach still allows command line customization, like for example,
in case the user wants to change the default nonlinear solver to a trust region solver and iterate on the matrix-free tangent system with CG, still using NonlinearSolver::solve_with_jacobian as a preconditioner.
The PETSc style approach has instead the advantage that only the matrix assembly procedure has to be implemented, thus allowing quicker implementations and faster turnaround for experimenting with linear solver preconditioning configurations via command line customizations, like for example,
In case the nonlinear equations are derived from energy minimization arguments, it may be beneficial to perform linesearch or test trust-region model reductions using the energy functional. In such cases, users can set an optional NonlinearSolver::energy callback.
Type that holds real-valued numbers.
Used to represent norms.
Constructor.
Destructor.
Conversion operator to gain access to the underlying PETSc type. If you do this, you cut this class off some information it may need, so this conversion operator should only be used if you know what you do.
Return the PETSc SNES object.
Return the underlying MPI communicator.
Reset the solver, it does not change the customization.
Reset solver. Change customization according to data
.
Set the preconditioning matrix only.
When used with NonlinearSolver::setup_jacobian and NonlinearSolver::solve_with_jacobian, PETSc will approximate the linear system matrix-vector product using an internal matrix-free representation.
When used with NonlinearSolver::jacobian PETSc will use the same matrix for both preconditioning and matrix-vector products.
Set both the linear system matrix and the preconditioning matrix that PETSc will use (can be the same matrix). In this case, the Jacobian-Free-Newton-Krylov approach will not be used.
Solve the nonlinear system of equations \(F(x) = 0\).
This function returns the number of iterations. The vector x
must contain the initial guess. Upon returning, the x
vector contains the solution.
Solve the nonlinear system of equations \(F(x) = 0\).
This function returns the number of iterations. The vector x
must contain the initial guess. Upon returning, the x
vector contains the solution.
Here we also set the matrix to precondition the tangent system.
Solve the nonlinear system of equations \(F(x) = 0\).
This function returns the number of iterations. The vector x
must contain the initial guess. Upon returning, the x
vector contains the solution.
Here we also set the matrices to describe and precondition the tangent system.
Callback for the computation of the nonlinear residual \(F(x)\).
Callback for the computation of the Jacobian \(\dfrac{\partial F}{\partial x}\).
Callback for monitoring the solution process.
This function is called by NonlinearSolver at the beginning of each step. Input arguments are the current step number and the current value for \(||F(x)||\).
Callback for the set up of the Jacobian system.
This callback gives full control to users to set up the tangent operator \(\dfrac{\partial F}{\partial x}\).
Solvers must be provided via NonlinearSolver::solve_with_jacobian.
Callback for the solution of the tangent system set up with NonlinearSolver::setup_jacobian.
This is used as a preconditioner inside the Krylov process.
Callback for the computation of the energy function.
This is usually not needed, since by default SNES assumes that the objective function to be minimized is \(\frac{1}{2} || F(x) ||^2 \).
However, if the nonlinear equations are derived from energy arguments, it may be useful to use this callback to perform linesearch or to test for the reduction in a trust region step.
The value of the energy function must be returned in energy_value
.
The PETSc SNES object.
Pointers to the internal PETSc matrix objects.
This flag is used to support versions of PETSc older than 3.13.
A pointer to any exception that may have been thrown in user-defined call-backs and that we have to deal after the KINSOL function we call has returned.
Definition at line 260 of file petsc_snes.h.
|
inline |
Initialization parameters for TimeStepper.
Running parameters:
options_prefix | The string indicating the options prefix for command line customization. |
ts_type | The string indicating the PETSc solver type. |
initial_time | Initial simulation time. |
final_time | Final simulation time. |
initial_step_size | Initial step size. |
max_steps | Maximum number of steps allowed. |
match_step | Whether or not to exactly stop at final time or step over it. |
Error parameters:
ts_adapt_type | The string indicating the PETSc time step adaptor type. |
minimum_step_size | Minimum step size allowed. |
maximum_step_size | Maximum step size allowed. |
absolute_tolerance | Absolute error tolerance. |
relative_tolerance | Relative error tolerance. |
ignore_algebraic_lte | Ignore algebraic terms for error computations |
Note that one between final_time
or max_steps
must be specified by the user, otherwise PETSc will complain. Adaptive time stepping is disabled by default. Negative values indicate using PETSc's default.
Definition at line 87 of file petsc_ts.h.