Description
Class for assembly analysis.
Assembly is performed by satisfying constraints at a position, velocity, and acceleration levels. Assembly at position level involves solving a non-linear problem. Assembly at velocity level projects the velocities onto the velocity-level constraints, with the mass matrix as metric: a consistent velocity is kept, position-level constraint violations are not turned into velocities, and the states that items keep at velocity level without any constraint on them (e.g., the integrated angle of a speed motor or the states of an ODE item) are not changed. A unilateral constraint stays inactive while it is open (unless it would close within the step dt passed to AssemblyAnalysis()); a closed or violated one only stops the approach. With the velocity level, consistent accelerations and reactions are obtained from a linearized step of size dt from the projected velocities, whose constraint right-hand side carries the quadratic-velocity term, so that the acceleration-level constraint equations, including that term, are satisfied while unilateral constraints and frictional contacts keep their velocity-level (DVI) treatment. The quadratic-velocity term, the bias b of the acceleration-level constraint equations Cq a + b = 0, is obtained by central differences of the velocity residual Cq v + Ct (step 1e-6, see ChIntegrableIIorder::LoadConstraint_Bias), with a roundoff error of about 1e-10 times the magnitude of Cq v and Ct. Like the implicit integrators, the analysis scatters perturbed states to the system and expects the update of every item to be a function of (position, velocity, time) only. With the velocity level, accelerations and reactions are formed from a velocity increment over the step dt passed to AssemblyAnalysis() (1e-6 when called through ChSystem::DoAssembly()), so the residual left by an iterative solver in the velocities is amplified by 1/dt in them. ChSystem::DoAssembly() therefore uses this form only for systems with unilateral constraints; otherwise it requests the acceleration level separately, after the other levels, so that the accelerations come directly from the acceleration-level equations (see below). Accurate accelerations need an accurate solver: a direct solver (SPARSE_LU, SPARSE_QR), MINRES or GMRES, or, if unilateral constraints require a VI solver, BARZILAIBORWEIN. The default PSOR solver can leave large acceleration errors near singular configurations (several m/s^2 for a slider-crank modeled in SI units, at a dead center), APGD and PJACOBI even in regular ones. ChSystem::DoAssembly() checks the residual of the acceleration-level solve, relative to the terms of each constraint equation, and returns ExitFlag::ACCELERATION_INACCURATE if it is too large (see ChSystem::SetAssemblyAccelerationTolerance). This dt is distinct from the fixed 1e-6 differencing step of the quadratic-velocity term. When the acceleration level is requested without the velocity level, the velocities are kept: accelerations and reactions are computed at the current state (after the position-level assembly, if requested) from the acceleration-level equations M a = f + Cq' l and Cq a + b = 0, with the same bias b. The accelerations come directly from this solve, so the residual of an iterative solver is not amplified by 1/dt. An open unilateral constraint would act as closed at acceleration level, so ChSystem::DoAssembly() does not perform this analysis without the velocity level on a system with unilateral constraints and returns ExitFlag::UNSUPPORTED_UNILATERAL instead. NSC contacts are not supported. The active set and the friction are decided at velocity level, where the -C/dt stabilization with the tiny step dt admits an approach velocity of gap/dt, and the contact rows also enter the position-level iterations. As a result, contacts present at the time of the analysis corrupt all assembly levels (e.g., a resting body gets spurious position and velocity corrections and accelerations orders of magnitude larger than gravity). ChSystem::DoAssembly() therefore does not perform the analysis on an NSC system with contacts and returns ExitFlag::UNSUPPORTED_CONTACTS instead. Use an SMC system or a short settling run with ChSystem::DoStepDynamics() to obtain consistent accelerations and reactions in the presence of contacts.
#include <ChAssemblyAnalysis.h>
Public Member Functions | |
| ChAssemblyAnalysis (ChIntegrableIIorder &mintegrable) | |
| AssemblyAnalysis::ExitFlag | AssemblyAnalysis (int action, double dt=1e-7) |
| Perform the assembly analysis. More... | |
| void | SetMaxAssemblyIters (int mi) |
| Set the max number of Newton-Raphson iterations for the position assembly procedure. | |
| int | GetMaxAssemblyIters () |
| Get the max number of Newton-Raphson iterations for the position assembly procedure. | |
| void | SetRelToleranceUpdate (double tol) |
| Set the termination criterion on the infinity norm of the relative state update. | |
| double | GetRelToleranceUpdate () const |
| Get the termination criterion on the infinity norm of the relative state update. | |
| void | SetAbsToleranceUpdate (double tol) |
| Set the termination criterion on the infinity norm of the (absolute) state update. | |
| double | GetAbsToleranceUpdate () const |
| Get the termination criterion on the infinity norm of the (absolute) state update. | |
| void | SetAbsToleranceResidual (double tol) |
| Set the termination criterion on the infinity norm of the residual. | |
| double | GetAbsToleranceResidual () const |
| Get the termination criterion on the infinity norm of the residual. | |
| double | GetLastResidualNorm () const |
| Get the infinity norm of the last computed residual. | |
| double | GetLastUpdateNorm () const |
| Get the infinity norm of the last update. | |
| unsigned int | GetLastIters () const |
| Get the number of iterations after last assembly. | |
| ChIntegrable * | GetIntegrable () |
| Get the integrable object. | |
| const ChVectorDynamic & | GetLagrangeMultipliers () const |
| Access the Lagrange multipliers. | |
| const ChState & | GetStatePos () const |
| Access the current position state vector. | |
| const ChStateDelta & | GetStateVel () const |
| Access the current velocity state vector. | |
| const ChStateDelta & | GetStateAcc () const |
| Access the current acceleration state vector. | |
Member Function Documentation
◆ AssemblyAnalysis()
| AssemblyAnalysis::ExitFlag chrono::ChAssemblyAnalysis::AssemblyAnalysis | ( | int | action, |
| double | dt = 1e-7 |
||
| ) |
Perform the assembly analysis.
Assembly is performed by satisfying constraints at position, velocity, and acceleration levels. Assembly at position level involves solving a non-linear problem. Assembly at velocity level projects the velocities onto the velocity-level constraints. With the velocity level, consistent accelerations and reactions are obtained from a linearized step of size dt that includes the quadratic-velocity term b, so that Cq a + b = 0 holds (see the class description). Without it, they are computed at the current state, and the velocities are kept.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono/timestepper/ChAssemblyAnalysis.h
- /builds/uwsbel/chrono/src/chrono/timestepper/ChAssemblyAnalysis.cpp