This is a stripped-down numerical integrator for small ODE or DAE problems whose size is known at compile time, with no provision for discrete variables, event detection, or interpolation.
More...
|
| GeodesicIntegrator (const Eqn &eqn, Real accuracy, Real constraintTol) |
| Construct an integrator for the given set of equations eqn, which are to be solved to the given accuracy, with constraints maintained to within the given constraintTol.
|
|
void | initialize (Real t, const Vec< N > &y) |
| Call this once before taking a series of steps.
|
|
void | setTimeAndState (Real t, const Vec< N > &y) |
| Set initial time and state prior to integrating.
|
|
void | setNextStepSizeToTry (Real h) |
| Use this if you think you know a better initial step size to try than the default.
|
|
Real | getNextStepSizeToTry () const |
| Return the size of the next time step the integrator will attempt on the next call to takeOneStep().
|
|
Real | getRequiredAccuracy () const |
| Return the accuracy requirement as set in the constructor.
|
|
Real | getConstraintTolerance () const |
| Return the constraint tolerance as set in the constructor.
|
|
Real | getActualInitialStepSizeTaken () const |
| Return the size of the first accepted step to be taken after the most recent initialize() call.
|
|
int | getNumStepsTaken () const |
| Return the number of successful time steps taken since the most recent initialize() call.
|
|
int | getNumStepsAttempted () const |
| Return the total number of steps that were attempted since the most recent initialize() call.
|
|
int | getNumErrorTestFailures () const |
| How many steps were rejected because they did not satisfy the accuracy requirement, since the most recent initialize() call.
|
|
int | getNumProjectionFailures () const |
| How many steps were rejected because the projectIfNeeded() method was unable to satisfy the constraint tolerance (since the most recent initialize() call).
|
|
int | getNumInitializations () const |
| Return the number of calls to initialize() since construction of this integrator object.
|
|
void | takeOneStep (Real tStop) |
| Advance time and state by one error-controlled step and return, but in no case advance past t=tStop.
|
|
const Real & | getTime () const |
| Return the current time.
|
|
const Vec< N > & | getY () const |
| Return the complete current state as a Vec<N>.
|
|
const Vec< NQ > & | getQ () const |
| Return just the "position" variables q from the current state.
|
|
const Vec< NQ > & | getU () const |
| Return just the "velocity" variables u from the current state.
|
|
const Vec< N > & | getYDot () const |
| Return the complete set of time derivatives of the current state.
|
|
const Vec< NQ > & | getQDot () const |
| Return just the derivatives qdot of the "position" variables q.
|
|
const Vec< NQ > & | getUDot () const |
| Return just the derivatives udot of the "velocity" variables u.
|
|
template<class Eqn>
class SimTK::GeodesicIntegrator< Eqn >
This is a stripped-down numerical integrator for small ODE or DAE problems whose size is known at compile time, with no provision for discrete variables, event detection, or interpolation.
You cannot use this integrator to advance a Simbody System; see Integrator instead. Everything is defined in this header file so that the integration can proceed with virtually no overhead. Templates are used rather than run-time polymorphism, so there are no virtual function calls. The system of equations is given as a template object that must implement particular methods which the compiler may inline if they are simple enough.
Class Equations
This integrator is instantiated with a class that encapsulates the system of equations to be solved, and must provide compile time constants and methods with the following signatures:
class MyEquations {
public:
enum { NQ=5,
NC=3,
N = 2*NQ };
};
This is a fixed-length column vector designed for no-overhead inline computation.
Definition Vec.h:184
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition SimTKcommon/include/SimTKcommon/internal/common.h:606
Usage
MyEquations eqns(...);
integ.initialize(t0, y0);
while (true) {
std::cout << "t=" << integ.getTime() << " y=" << integ.getY() << "\n";
if (integ.getTime() == finalTime)
break;
integ.takeOneStep(finalTime);
}
This is a stripped-down numerical integrator for small ODE or DAE problems whose size is known at com...
Definition GeodesicIntegrator.h:134
Mathematical Overview
This is an explicit, variable-step integrator solving a 2nd-order DAE structured as an ODE-on-a-manifold system[1] like this:
(1) udot = f(t,q,u) NQ dynamic differential equations
(2) qdot = u NQ kinematic differential equations
(3) 0 = c(t,q,u) NC constraints
Here the "dot" suffix indicates differentiation with respect to the independent variable t which we'll refer to as time here although it can be anything (for geodesic calculations it is arc length). We'll
call the second order variables q the "position variables", and their time derivatives u the "velocity variables". Collected together we call the state y={q,u}. At the beginning of a step, we expect to have been given initial conditions t0,q0,u0 such that |c(t0,q0,u0)|<=tol. The user provides the accuracy requirement and constraint tolerance. We solve the system to that accuracy while keeping the constraints within tolerance. The integrator returns after taking a successful step which may involve trial evaluations that are retracted.
By "ODE on a manifold" we mean that the ODE (1,2) automatically satisfies the condition that IF c==0, THEN cdot=0, where
cdot=Dc/Dt + Dc/Dq*qdot + Dc/Du*udot
This means that satisfaction of the acceleration-level constraints is built into the dynamic differential equations (1) so that we need only deal with relatively slow drift of the solution away from the position and velocity constraint manifolds.
To handle the constraint drift we use the method of coordinate projection and expect the supplied Equations object to be able to perform a least-squares projection of a state (q,u) to move it onto the constraint manifolds.
[1] Hairer, Lubich, Wanner, "Geometric Numerical Integration:
Structure-Preserving Algorithms for Ordinary Differential Equations", 2nd ed., section IV.4, pg 109ff, Springer, 2006.