You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A modern C++17 library for rigid multibody dynamics and flexible-body finite-element analysis using the Absolute Nodal Coordinate Formulation (ANCF). Includes real-time Qt5 visualization, contact/collision handling, and a rich set of time integrators.
Features
Rigid-body dynamics — constrained multibody systems with joints, forces, and contact
Flexible-body dynamics — ANCF tetrahedral elements with St. Venant–Kirchhoff and Neo-Hookean materials
Contact & collision — broad-phase AABB + narrow-phase detection for both rigid and flexible bodies; Hertz + Flores + Coulomb force models
Installs headers to <prefix>/include/mb/ and the static library to <prefix>/lib/.
Examples
Example
Description
pendulum.cpp
Simple rigid-body pendulum (console output)
pendulum_qt.cpp
Interactive rigid-body pendulum with Qt5 viewer
chain20_qt.cpp
20-link constrained chain with gravity
cantilever_qt.cpp
ANCF cantilever beam under gravity
spinning_beam_qt.cpp
Spinning ANCF beam — centrifugal stiffening demo. Controls: Space (pause), W/S (speed ω), G (toggle gravity), +/− (zoom), mouse orbit/pan
tet_collision_qt.cpp
Two ANCF tetrahedra colliding with ground contact, elastic/plastic modes, MP4 recording
energy_test.cpp
Rigid-body energy conservation verification
flex_energy_test.cpp
Flexible-body energy conservation verification
Quick Start
#include"mb/fem/FlexibleBody.h"
#include"mb/fem/FlexibleIntegrators.h"
#include"mb/fem/ANCFTypes.h"usingnamespacemb;// Define material
ElasticMaterialProps mat{70e9, 0.3, 7800.0, MaterialType::NeoHookean};
// Build flexible body from Gmsh meshauto body = FlexibleBody::fromMesh(mesh, mat, "beam");
body->fixNodesOnPlane('x', 0.0); // clamp at x = 0// Create integrator and step
FlexDOPRI45 integrator(*body);
for (int i = 0; i < 1000; ++i) {
FlexStepResult res = integrator.step(0.01);
}
Contact Model Theory
The flexible-body contact pipeline uses a Hertz–Flores normal force with Coulomb friction:
Normal Force
$$F_n = K , \delta^{3/2} \left(1 + D , \dot{\delta}\right)$$
where the contact stiffness $K = \frac{4}{3} E^* \sqrt{R^*}$, the combined modulus:
For stiff materials (steel, E ~ 200 GPa), explicit integrators require prohibitively small time steps due to the CFL condition. The ImplicitFlexIntegrator provides unconditional stability: