#include <NumericalMethods.h>
In this formulation, we expect to compute state derivatives directly by embedding the acceleration-level constraints, forming an ODE. We integrate this system using an ordinary ODE method, but then the solution will violate position and velocity constraints. The coordinate projection scheme moves the solution back onto the constraint manifold. Typically there is a lot of exploitable structure to the constraints so we expect the user function here to be capable of performing the projection itself, resulting in a *small* change to the state. If the calling ODE solver is a multistep method which must retain past solution values, it needs to update its internal solution memory using the *projected* result.
The state y is internally partitioned into three segments: y = {q,u,z) although the caller does not need to know about this partioning. The q's are configuration coordinates and participate in all the constraints. u's are velocity coordinates (the qdots are some linear function of the u's) and participate in velocity constraints. z's are "dynamic" state variables typically associated with forces and are not involved in any of the constraints (TODO: we could add dynamic constraints as well).
The system of equations represented here is: ydot=f(t,y) derivative function perr=p(t,q) position constraint errors verr=v(t,q,u) velocity constraint errors
Scaling ------- In internal coordinates, different state variable can be expected to have very different scales. We expect the system here to understand the scaling of each of its state variables. That is, it should be able to provide "units" ui for each yi in y. Unit ui (>0) is the amount we would consider a "unit" change in yi, measuring about its current value. NOTE: "unit" here does not mean "small"! These units are intended as a statement about the model, not the numerical solution, so they are independent of the requested integration accuracy. The default unit is 1 which would treat all variables as equally important. Also we expect to know for each variable whether it is appropriate to use relative tolerance on that variable. Angles, for example, are periodic so the accuracy requirement is independent of the current value which may have "wrapped" many times. We'll define ri=1 if relative error is OK, ri=0 if not.
Given this knowledge, we expect the system to implement a method which, given a scalar relative tolerance rtol and absolute tolerance atol, can return a multiplicative weighting to be applied to estimated state errors, such that a resulting WRMS norm <= 1 would indicate that the requested tolerances had been achieved.
If an integrator solution is being performed with relative tolerance rtol and absolute tolerance atol, then the weight for an error in yi is Wi = 1/(ri*rtol*|yi| + ui*atol)
Constraint tolerances --------------------- We do not expect to project constraints every step, since the ODE automatically satisfies them at the acceleration level. However, we do need to project them if they have drifted too far, and the acceptable drift depends on user-requested accuracy. As for scaling of the state variables, we expect the model to understand the units for each constraint violation, so that a "unit" change in any constraint would be considered equally as egregious as a "unit" change in any other. Again note that "unit" does not mean small. Typical choices for a translational constraint might be meters for large systems and nanometers for molecules and in both cases one might consider 0.001 unit to be a "small" violation (a millimeter or hundredth of an Angstrom). Velocity constraints do not need separate units, but they require a notion of timescale. That is, what do you consider a significant amount of time? Call that time ts; then a "unit" velocity constraint error is that velocity which would result in a unit position error after a time ts.
With the constraint units and timescale known, we are given a single scalar constraint tolerance which is interpreted as the maximum number of units of error we can tolerate in any constraint. If the current constraint violations are each smaller than that (in their own units) then we won't project for that step. When we do project, the projection should be done so as to reduce the violations substantially. Abstract Index3 DAE Integrator using the Coordinate Projection method. We expect this to be able to take a single, error-controlled step advancing the solution y(t) to a DAE initial value problem of the form y' = f(t,y) 0 = c(t,y) constraints (position & velocity)
y(t0) = y0 initial conditions c(t0,y0) = 0
We expect to be given a DAE System to integrate which can calculate the derivatives from the state and perform the necessary projections to solve c(t,y)=0.
In general an integrator will maintain a complex internal state which must be allocated when the problem size is known.
MechanicalDAEIntegrator | ( | const MultibodySystem & | mb, | |
State & | s | |||
) | [inline, explicit] |
virtual ~MechanicalDAEIntegrator | ( | ) | [inline, virtual] |
const MultibodySystem& getMultibodySystem | ( | ) | const [inline] |
References MechanicalDAEIntegrator::mbs.
Referenced by CPodesMultibodySystem::constraint(), CPodesMultibodySystem::explicitODE(), and CPodesMultibodySystem::project().
const State& getState | ( | ) | const [inline] |
References MechanicalDAEIntegrator::state.
Referenced by CPodesMultibodySystem::constraint(), and CPodesMultibodySystem::explicitODE().
State& updState | ( | ) | [inline] |
References MechanicalDAEIntegrator::state.
Referenced by CPodesMultibodySystem::constraint(), CPodesMultibodySystem::explicitODE(), and CPodesMultibodySystem::project().
virtual MechanicalDAEIntegrator* clone | ( | ) | const [pure virtual] |
Implemented in OLDCPodesIntegrator, OLDExplicitEuler, and OLDRungeKuttaMerson.
virtual bool initialize | ( | ) | [pure virtual] |
Implemented in OLDCPodesIntegrator, OLDExplicitEuler, and OLDRungeKuttaMerson.
virtual bool step | ( | const Real & | tout | ) | [pure virtual] |
Implemented in OLDCPodesIntegrator, OLDExplicitEuler, and OLDRungeKuttaMerson.
virtual Real getConstraintTolerance | ( | ) | const [pure virtual] |
Implemented in OLDCPodesIntegrator, OLDExplicitEuler, and OLDRungeKuttaMerson.
Referenced by CPodesMultibodySystem::project().
void setStopTime | ( | const Real & | tstop | ) | [inline] |
References MechanicalDAEIntegrator::userStopTime.
void setInitialStepSize | ( | const Real & | z | ) | [inline] |
void setMinimumStepSize | ( | const Real & | z | ) | [inline] |
void setMaximumStepSize | ( | const Real & | z | ) | [inline] |
void setAccuracy | ( | const Real & | accuracy | ) | [inline] |
References MechanicalDAEIntegrator::userAccuracy.
void setRelativeTolerance | ( | const Real & | relTol | ) | [inline] |
References MechanicalDAEIntegrator::userRelTol.
void setAbsoluteTolerance | ( | const Real & | absTol | ) | [inline] |
References MechanicalDAEIntegrator::userAbsTol.
void setConstraintTolerance | ( | const Real & | consTol | ) | [inline] |
References MechanicalDAEIntegrator::userConsTol.
void setVelocityConstraintRescale | ( | const Real & | rescale | ) | [inline] |
References MechanicalDAEIntegrator::userVConsRescale.
void setProjectEveryStep | ( | bool | forceProject | ) | [inline] |
References MechanicalDAEIntegrator::userProjectEveryStep.
long getStepsAttempted | ( | ) | const [inline] |
References MechanicalDAEIntegrator::statsStepsAttempted.
long getStepsTaken | ( | ) | const [inline] |
References MechanicalDAEIntegrator::statsStepsTaken.
long getErrorTestFailures | ( | ) | const [inline] |
References MechanicalDAEIntegrator::statsErrorTestFailures.
long getRealizeFailures | ( | ) | const [inline] |
long getProjectionFailures | ( | ) | const [inline] |
References MechanicalDAEIntegrator::statsProjectionFailures.
long getStepSizeChanges | ( | ) | const [inline] |
References MechanicalDAEIntegrator::statsStepSizeChanges.
void initializeUserStuff | ( | ) | [inline, protected] |
References MechanicalDAEIntegrator::userAbsTol, MechanicalDAEIntegrator::userAccuracy, MechanicalDAEIntegrator::userConsTol, MechanicalDAEIntegrator::userInitStepSize, MechanicalDAEIntegrator::userMaxNumSteps, MechanicalDAEIntegrator::userMaxStepSize, MechanicalDAEIntegrator::userMinStepSize, MechanicalDAEIntegrator::userProjectEveryStep, MechanicalDAEIntegrator::userRelTol, MechanicalDAEIntegrator::userStopTime, and MechanicalDAEIntegrator::userVConsRescale.
Referenced by MechanicalDAEIntegrator::MechanicalDAEIntegrator().
void zeroStats | ( | ) | [inline, protected] |
References MechanicalDAEIntegrator::statsErrorTestFailures, MechanicalDAEIntegrator::statsProjectionFailures, MechanicalDAEIntegrator::statsRealizationFailures, MechanicalDAEIntegrator::statsStepsAttempted, MechanicalDAEIntegrator::statsStepSizeChanges, and MechanicalDAEIntegrator::statsStepsTaken.
Referenced by MechanicalDAEIntegrator::MechanicalDAEIntegrator().
const MultibodySystem& mbs [protected] |
Referenced by MechanicalDAEIntegrator::getState(), OLDRungeKuttaMerson::initialize(), OLDExplicitEuler::initialize(), OLDCPodesIntegrator::initialize(), OLDCPodesIntegrator::OLDCPodesIntegrator(), OLDExplicitEuler::OLDExplicitEuler(), OLDRungeKuttaMerson::OLDRungeKuttaMerson(), OLDRungeKuttaMerson::step(), OLDExplicitEuler::step(), OLDCPodesIntegrator::step(), and MechanicalDAEIntegrator::updState().
Real userInitStepSize [protected] |
Real userMinStepSize [protected] |
Real userMaxStepSize [protected] |
Real userAccuracy [protected] |
Referenced by MechanicalDAEIntegrator::initializeUserStuff(), and MechanicalDAEIntegrator::setAccuracy().
Real userRelTol [protected] |
Real userAbsTol [protected] |
Real userConsTol [protected] |
Real userVConsRescale [protected] |
Real userStopTime [protected] |
Referenced by MechanicalDAEIntegrator::initializeUserStuff(), and MechanicalDAEIntegrator::setStopTime().
long userMaxNumSteps [protected] |
Referenced by MechanicalDAEIntegrator::initializeUserStuff().
int userProjectEveryStep [protected] |
long statsStepsAttempted [protected] |
long statsStepsTaken [protected] |
long statsErrorTestFailures [protected] |
long statsRealizationFailures [protected] |
long statsProjectionFailures [protected] |
long statsStepSizeChanges [protected] |