CppNoddy  0.92
Loading...
Searching...
No Matches
ArcLength_base.h
Go to the documentation of this file.
1/// \file ArcLength_base.h
2/// A base class for arclength-capable solvers. This defines
3/// all the usual get/set methods for arclength parameters and the
4/// additional residual used when augmenting the system to allow
5/// for iteration on the arclength.
6
7#ifndef ArcLength_base_H
8#define ArcLength_base_H
9
10#include <Uncopyable.h>
11#include <DenseVector.h>
12
13namespace CppNoddy {
14
15 template <typename _Type>
16 class ArcLength_base : private Uncopyable {
17
18 public:
19
22 INITIALISED(false),
23 THETA(0.5),
24 DESIRED_ARC_PROPORTION(0.5),
25 RESCALE_THETA(false)
26 {}
27
29 {}
30
31 /// Initialise the class ready for arc-length continuation.
32 /// This will ensure that x is a solution at the current
33 /// parameter value and compute the required derivatives
34 /// with respect to the parameter.
35 /// \param x The initial guess at a solution
36 /// \param p A pointer to the required parameter
37 /// \param length Initial arc-length step to take
38 /// \param max_length Maximum absolute arc length step permitted
40 _Type* p,
41 const double& length,
42 const double& max_length);
43
44 /// Compute a solution for that state & parameter variables
45 /// that are an arc-length 'ds' from the current state.
46 ///virtual void arclength_solve( DenseVector<_Type> &x ) = 0;
47
48 /// Solve the system for a given initial guess.
49 /// \param x The initial guess for the system.
50 virtual void solve(DenseVector<_Type> &x) = 0;
51
52 /// Return a handle to the arclength step. This is normally done via the init_arc
53 /// method, but one can use this to change the setting
54 /// post-initialisation.
55 double& ds();
56
57 /// Used to set the multiplication constant used when increasing
58 /// or decreasing the arclength step.
59 double& arcstep_multiplier();
60
61 /// Handle to the RESCALE_THETA flag. If true the arclength theta
62 /// will be rescaled to balance the relative importance of
63 /// the state variables and the parameter.
64 bool& rescale_theta();
65
66 /// Set the arclength theta parameter.
67 double& theta();
68
69 /// Handle to the desired proportion of the parameter to be
70 /// used in the arc length solver. If this parameter is 1,
71 /// then the system is effectively doing zero-order continuation
72 /// in the secondary parameter.
73 double& desired_arc_proportion();
74
75 protected:
76
77 /// A method called by arclength_solve and init_arc
78 /// which stores the current converged state and parameter
79 /// and hence computes the derivatives w.r.t the arc-length.
80 void update(const DenseVector<_Type>& x);
81
82 /// The extra constraint that is to be used to replace the
83 /// unknown arc length
84 /// \return The residual of this constraint
85 double arclength_residual(const DenseVector<_Type>& x) const;
86
87 /// The derivative of the arclength_residual function with respect
88 /// to each of the state variables. When arc-length continuing boundary
89 /// value problems you would NOT want to finite-difference this
90 /// since vector lengths will be of the order of 10^3.
91 /// \param x The state vector.
92 /// \return The derivative of the arclength_residual function with
93 /// respect to each state variable.
95 // a by-hand differentiation of 'arclength_residual' provides
96 // the follwoing result.
98 Jx *= THETA / (x.size() * (x - LAST_X).two_norm());
99 return Jx;
100 }
101
102 /// Automatically update the Keller THETA such that the
103 /// proportion of the arclength obtained from the parameter
104 /// is the desired value. This method will only have any
105 /// effect of the RESCALE_THETA flag is true.
106 void update_theta(const DenseVector<_Type>& x);
107
108 /// pointer to the parameter in arclength solves
109 _Type *p_PARAM;
110 /// state variable at the last computed solution
112 /// derivative of the state variable w.r.t. arc length
114 /// parameter value at the last computed solution
116 /// derivative of the parameter w.r.t arc length
118 /// size of the arc length step
119 double DS;
120 /// maximum arc length step to be taken
121 double MAX_DS;
122 /// step change multiplier
124 /// for the arc-length solver - to show it has been initialised
126 /// the arclength theta
127 double THETA;
128
129 private:
130
131 /// the desired proportion of the arc length for the parameter
132 double DESIRED_ARC_PROPORTION;
133 /// If set, then the arclength theta will be rescaled at each step
134 bool RESCALE_THETA;
135 };
136
137}
138
139#endif // ArcLength_base_H
140
Specification for a templated DenseVector class – a dense, dynamic, vector object.
void update_theta(const DenseVector< _Type > &x)
Automatically update the Keller THETA such that the proportion of the arclength obtained from the par...
_Type * p_PARAM
pointer to the parameter in arclength solves
virtual void solve(DenseVector< _Type > &x)=0
Compute a solution for that state & parameter variables that are an arc-length 'ds' from the current ...
void update(const DenseVector< _Type > &x)
A method called by arclength_solve and init_arc which stores the current converged state and paramete...
DenseVector< _Type > Jac_arclength_residual(DenseVector< _Type > &x) const
The derivative of the arclength_residual function with respect to each of the state variables.
void init_arc(DenseVector< _Type > x, _Type *p, const double &length, const double &max_length)
Initialise the class ready for arc-length continuation.
_Type PARAM_DERIV_S
derivative of the parameter w.r.t arc length
bool INITIALISED
for the arc-length solver - to show it has been initialised
bool & rescale_theta()
Handle to the RESCALE_THETA flag.
DenseVector< _Type > X_DERIV_S
derivative of the state variable w.r.t. arc length
double & ds()
Return a handle to the arclength step.
double & theta()
Set the arclength theta parameter.
double DS
size of the arc length step
double ARCSTEP_MULTIPLIER
step change multiplier
double THETA
the arclength theta
double arclength_residual(const DenseVector< _Type > &x) const
The extra constraint that is to be used to replace the unknown arc length.
double MAX_DS
maximum arc length step to be taken
_Type LAST_PARAM
parameter value at the last computed solution
DenseVector< _Type > LAST_X
state variable at the last computed solution
double & arcstep_multiplier()
Used to set the multiplication constant used when increasing or decreasing the arclength step.
double & desired_arc_proportion()
Handle to the desired proportion of the parameter to be used in the arc length solver.
An DenseVector class – a dense vector object.
Definition: DenseVector.h:34
std::size_t size() const
A pass-thru definition to get the size of the vector.
Definition: DenseVector.h:330
An object to block copying.
Definition: Uncopyable.h:8
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...

© 2012

R.E. Hewitt