CppNoddy  0.92
Loading...
Searching...
No Matches
Newton.h
Go to the documentation of this file.
1/// \file Newton.h
2/// A vector NEWTON iteration class.
3/// This allows for Newton iteration to be performed
4/// for a vector function of a vector unknown.
5/// Use templates to allow double or complex.
6
7#ifndef NEWTON_H
8#define NEWTON_H
9
10#include <complex>
11
12#include <DenseMatrix.h>
13#include <DenseVector.h>
14#include <Residual.h>
15#include <ArcLength_base.h>
16#include <DenseLinearSystem.h>
17#include <Utility.h>
18
19namespace CppNoddy {
20 /// A vector NEWTON iteration class.
21 /// This allows for Newton iteration to be performed
22 /// for a vector function of a vector unknown.
23 /// Use templates to allow double or complex.
24 template <typename _Type>
25 class Newton : public ArcLength_base< _Type > {
26
27 public:
28
29 /// Constructor
30 /// \param ptr_to_residual_object A pointer to an inherited Residual object
31 /// \param max_steps The maximum number of iteration steps.
32 /// \param tolerance A tolerance used as a convergence criterion.
33 /// \param derivative_step A step length used to compute derivatives.
34 explicit Newton(Residual<_Type >* ptr_to_residual_object,
35 unsigned max_steps = 20,
36 double tolerance = 1.e-8,
37 double derivative_step = 1.e-8);
38
39 /// The Newton iteration method.
40 /// \param x An initial guess vector and returns the solution via this too.
42
43 /// If set then the system will monitor the sign of determinant of the
44 /// Jacobian matrix and cause an ExceptionBifurcation when it changes
45 /// sign.
46 /// \param flag The value to be set.
47 void set_monitor_det(bool flag) {
48 MONITOR_DET = flag;
49 }
50
51 /// Solve the system for an initial guess by Newton iteration, this
52 /// method is inherited from the ArcLength_base class and this simply
53 /// points it to the iteration method.
54 /// \param x An initial guess vector, the solution overwrites it.
56 iterate(x);
57 }
58
59 /// Arc-length solve the system. Before this can be called the
60 /// arc_init method should have been called in order to ensure
61 /// we know a solution and have derivatives w.r.t. the arc-length
62 /// parameter.
64
65 private:
66 /// tolerance in the iteration convergence test
67 double TOL;
68 /// a derivative step
69 double DELTA;
70 /// maximum number of iterations to be taken
71 unsigned MAX_STEPS;
72 /// last sign of determinant of the Jacobian
73 int LAST_DET_SIGN;
74 /// pointer to the residual object
75 Residual<_Type >* p_RESIDUAL;
76 /// flag set to monitor determinant of the Jacobian
77 bool MONITOR_DET;
78 };
79
80
81}
82#endif // NEWTONV_H
A base class for arclength-capable solvers.
Specification of the linear system class.
A matrix class that constructs a DENSE matrix as an STL Vector of DenseVectors.
Specification for a templated DenseVector class – a dense, dynamic, vector object.
A specification of a (double/complex) VECTOR residual class.
A spec for a collection of utility functions.
An DenseVector class – a dense vector object.
Definition: DenseVector.h:34
A vector NEWTON iteration class.
Definition: Newton.h:25
void set_monitor_det(bool flag)
If set then the system will monitor the sign of determinant of the Jacobian matrix and cause an Excep...
Definition: Newton.h:47
void iterate(DenseVector< _Type > &x)
The Newton iteration method.
Definition: Newton.cpp:35
void arclength_solve(DenseVector< _Type > &x)
Arc-length solve the system.
Definition: Newton.cpp:98
void solve(DenseVector< _Type > &x)
Solve the system for an initial guess by Newton iteration, this method is inherited from the ArcLengt...
Definition: Newton.h:55
A base class to be inherited by objects that define residuals.
Definition: Residual.h:15
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...

© 2012

R.E. Hewitt