CppNoddy  0.92
Loading...
Searching...
No Matches
ArcLength_base.cpp
Go to the documentation of this file.
1/// \file ArcLength_base.cpp
2/// An implementation of the arclength class. 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#include <Uncopyable.h>
8#include <ArcLength_base.h>
9
10namespace CppNoddy {
11
12 template <typename _Type>
14 return DS;
15 }
16
17 template <typename _Type>
19 return ARCSTEP_MULTIPLIER;
20 }
21
22 template <typename _Type>
24 return RESCALE_THETA;
25 }
26
27 template <typename _Type>
29 return THETA;
30 }
31
32 template <typename _Type>
34 return DESIRED_ARC_PROPORTION;
35 }
36
37 template <typename _Type>
39 {}
40
41 template <typename _Type>
43 if(RESCALE_THETA) {
44 update_theta(x);
45 }
46 X_DERIV_S = (x - LAST_X) / DS;
47 PARAM_DERIV_S = (*p_PARAM - LAST_PARAM) / DS;
48 LAST_X = x;
49 LAST_PARAM = *p_PARAM;
50 }
51
52 template <typename _Type>
54 _Type* param,
55 const double& length,
56 const double& max_length) {
57 // set the pointers to the parameter & state variable
58 p_PARAM = param;
59 // compute the solution at this parameter value in usual way
60 solve(x);
61 // store the converged solution at this point
62 LAST_X = x;
63 LAST_PARAM = *p_PARAM;
64 //
65 // we now have one solution and can get ready to arc-length continue
66 //
67 DS = length;
68 // put the arc-length entirely into a parameter for step 1
69 *p_PARAM += DS;
70 // recompute the state at this parameter value
71 solve(x);
72 // update the derivatives of state & parameter variables
73 update(x);
74 INITIALISED = true;
75 MAX_DS = max_length;
76 }
77
78
79
80 template <typename _Type>
82 return THETA * (x - LAST_X).two_norm() / x.size()
83 + (1.0 - THETA) * std::pow(std::abs(*p_PARAM - LAST_PARAM), 2)
84 - DS * DS;
85 }
86
87 template <typename _Type>
89 if(RESCALE_THETA) {
90 double Delta_p2 = std::pow(std::abs(*p_PARAM - LAST_PARAM), 2);
91 double Delta_x2 = (x - LAST_X).two_norm() / x.size();
92 THETA = Delta_p2 * (DESIRED_ARC_PROPORTION - 1.0)
93 / (Delta_p2 * (DESIRED_ARC_PROPORTION - 1.0)
94 - DESIRED_ARC_PROPORTION * Delta_x2);
95 }
96 }
97
98 // the templated versions we require are:
99 template class ArcLength_base<double>
100 ;
102 ;
103}
A base class for arclength-capable solvers.
void update_theta(const DenseVector< _Type > &x)
Automatically update the Keller THETA such that the proportion of the arclength obtained from the par...
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...
void init_arc(DenseVector< _Type > x, _Type *p, const double &length, const double &max_length)
Initialise the class ready for arc-length continuation.
bool & rescale_theta()
Handle to the RESCALE_THETA flag.
double & ds()
Return a handle to the arclength step.
double & theta()
Set the arclength theta parameter.
double arclength_residual(const DenseVector< _Type > &x) const
The extra constraint that is to be used to replace the unknown arc length.
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
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...

© 2012

R.E. Hewitt