![]() |
Reference documentation for deal.II version Git c9feb145b3 2021-03-01 21:22:52 +0100
|
#include <deal.II/algorithms/newton.h>
Public Member Functions | |
Newton (OperatorBase &residual, OperatorBase &inverse_derivative) | |
void | parse_parameters (ParameterHandler ¶m) |
void | initialize (OutputOperator< VectorType > &output) |
virtual void | operator() (AnyData &out, const AnyData &in) override |
virtual void | notify (const Event &) override |
double | threshold (double new_value) |
void | clear_events () |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Subscriptor functionality | |
Classes derived from Subscriptor provide a facility to subscribe to this object. This is mostly used by the SmartPointer class. | |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
template<typename StreamType > | |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
Static Public Member Functions | |
static void | declare_parameters (ParameterHandler ¶m) |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
Public Attributes | |
ReductionControl | control |
bool | debug_vectors |
unsigned int | debug |
Protected Attributes | |
Event | notifications |
Private Attributes | |
SmartPointer< OperatorBase, Newton< VectorType > > | residual |
SmartPointer< OperatorBase, Newton< VectorType > > | inverse_derivative |
SmartPointer< OutputOperator< VectorType >, Newton< VectorType > > | data_out |
bool | assemble_now |
unsigned int | n_stepsize_iterations |
double | assemble_threshold |
Operator class performing Newton's iteration with standard step size control and adaptive matrix generation.
This class performs a Newton iteration up to convergence determined by control. If after an update the norm of the residual has become larger, then step size control is activated and the update is subsequently divided by two until the residual actually becomes smaller (or the minimal scaling factor determined by n_stepsize_iterations is reached).
Since assembling matrices, depending on the implementation, tends to be costly, this method applies an adaptive reassembling strategy. Only if the reduction factor for the residual is more than threshold, the event Algorithms::bad_derivative is submitted to inverse_derivative. It is up to this object to implement reassembling accordingly.
The only value used by the Newton method is the first vector in the parameter out
of operator()(). It serves as the start vector of Newton's method and in the end contains the solution. All other vectors of out
are ignored by Newton's method and its inner Operator objects. All vectors of in
are forwarded to the inner Operator objects, with additional information added as follows.
When calling (*residual)(), the AnyData in
given to the Newton iteration is prepended by a vector "Newton iterate"
, the current value of the Newton iterate, which can be used to evaluate the residual at this point.
For the call to (*inverse_derivative), the vector "Newton
residual"
is inserted before "Newton iterate"
.
Algorithms::Newton< VectorType >::Newton | ( | OperatorBase & | residual, |
OperatorBase & | inverse_derivative | ||
) |
Constructor, receiving the applications computing the residual and solving the linear problem, respectively.
|
static |
Declare the parameters applicable to Newton's method.
void Algorithms::Newton< VectorType >::parse_parameters | ( | ParameterHandler & | param | ) |
Read the parameters in the ParameterHandler.
void Algorithms::Newton< VectorType >::initialize | ( | OutputOperator< VectorType > & | output | ) |
Initialize the pointer data_out for debugging.
|
overridevirtual |
The actual Newton iteration. The initial value is in out(0)
, which also contains the result after convergence. Values in in
are not used by Newton, but will be handed down to the objects residual and inverse_derivative.
Implements Algorithms::OperatorBase.
|
overridevirtual |
Register an event triggered by an outer iteration.
Reimplemented from Algorithms::OperatorBase.
double Algorithms::Newton< VectorType >::threshold | ( | double | new_value | ) |
Set the maximal residual reduction allowed without triggering assembling in the next step. Return the previous value.
|
inherited |
Clear all notifications.
Definition at line 49 of file operator.cc.
|
inherited |
Subscribes a user of the object by storing the pointer validity
. The subscriber may be identified by text supplied as identifier
.
Definition at line 136 of file subscriptor.cc.
|
inherited |
Unsubscribes a user from the object.
identifier
and the validity
pointer must be the same as the one supplied to subscribe(). Definition at line 156 of file subscriptor.cc.
|
inlineinherited |
Return the present number of subscriptions to this object. This allows to use this class for reference counted lifetime determination where the last one to unsubscribe also deletes the object.
Definition at line 301 of file subscriptor.h.
|
inlineinherited |
List the subscribers to the input stream
.
Definition at line 318 of file subscriptor.h.
|
inherited |
List the subscribers to deallog
.
Definition at line 204 of file subscriptor.cc.
|
inlineinherited |
Read or write the data of this object to or from a stream for the purpose of serialization using the BOOST serialization library.
This function does not actually serialize any of the member variables of this class. The reason is that what this class stores is only who subscribes to this object, but who does so at the time of storing the contents of this object does not necessarily have anything to do with who subscribes to the object when it is restored. Consequently, we do not want to overwrite the subscribers at the time of restoring, and then there is no reason to write the subscribers out in the first place.
Definition at line 310 of file subscriptor.h.
ReductionControl Algorithms::Newton< VectorType >::control |
|
private |
|
private |
|
private |
|
private |
This flag is set by the function assemble(), indicating that the matrix must be assembled anew upon start.
|
private |
|
private |
Threshold for re-assembling matrix.
If the quotient of two consecutive residuals is smaller than this threshold, the system matrix is not assembled in this step.
The default values is zero, resulting in reassembling in every Newton step.
bool Algorithms::Newton< VectorType >::debug_vectors |
unsigned int Algorithms::Newton< VectorType >::debug |
|
protectedinherited |
Accumulate events here. If any of those is set, the function solve() of a terminal application must take care of reassembling the matrix.
Definition at line 97 of file operator.h.