large scale physics simulations in industrial vehicle simulators · anatomy of a physics engine agx...

31
Large scale physics simulations in industrial vehicle simulators Kenneth Bodin Algoryx Simulation, Umeå, Sweden http://www.algoryx.se/ [email protected]

Upload: hathuy

Post on 15-Dec-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

Large scale physics simulations

in industrial vehicle simulators

Kenneth Bodin Algoryx Simulation, Umeå, Sweden

http://www.algoryx.se/

[email protected]

Scope

• The anatomy, models and methods of a ”Phyics Engine”

• Use in vehicle simulators

Acknowledgements

Martin Servin

Anders Backman

Claude Lacoursiére

Atlas Copco Surface Drilling Rig

Atlas Copco Surface Drilling Rig

physics

System diagram

3D IG Display

Physics

HCI

Audio

Platform driver

Speakers

Platform

Control

Models Dynamics

Graphics (CAD) Environment

Manager

Physics models

• Vehicle geometry

• Engine

• Drive train

• Suspension

• Hydraulics

• Tools

• Wheel-ground

• Environment (soils, rocks, trees, objects)

Tasks of a physics engine

read models and initialize while (simulating) broad phase proximity detection near phase proximity detection – contact set read: control build constraint Jacobians solve mixed LCP for constraint forces integrate velocities and positions write: graphics, audio, platform, control end Generally this loop is soft real-time at 60-200 Hz.

Anatomy of a physics engine

AGX Multiphysics SDK

AGX API

Declarative .agx

.aagx

C/C++/C#

Lua/Python

WWW

Simulink

FMI/FMU

Physics Models

Contact Friction

Joints

Fluids

Wires

Elastic

Solvers and

Algos

Partitioner

Direct solver

Iterative solvers

Interference

User exposed.

Platform

independent

XML

Declared/configurable

Kernel library

BLAS

Math

Reductions Scans

Geometry

Space

Platform integration

agx::Kernel

Agx::Buffer

Agx::Device

Platforms

Native C/C++

OpenCL

OpenGL

CUDA

Hardware

GPU

Multi CPU

Network

...

Constraint based physics

Use of constraints to model mechanical systems

• Non smooth rigid body contacts with friction

• Jointed, articulated systems, joint limits

• Motors

Constrained lumped elements

• Cables and wires

• Cloth

• Elastic and deformable bodies

Multiphysics

• Constraint fluids

• Hydraulics

• Electro mechanical systems

Joints, motors, and frictional contacts

http://youtu.be/8YrAyJcipk8

Joints, motors and frictional contacts

http://www.youtube.com/watch?v=trUtNhJKzEo

Large contact systems

http://youtu.be/R0_4f7Ri440

Constraint based physics

Advantages with constraint based physics

• Efficient handling of stiff forces, non-smooth mechanics, transients

• Stability for large timesteps (fundamental for real-time)

• Leads to sparse blocked linear systems that can be solved efficiently

• Can also handle handle soft forces and potentials

• Consistent multiphysics coupling, e.g. rigid body contacts, wires, fluids.

• Easy-to-grasp modeling paradigm and API’s

• Constraints and contacts created or deleted on the fly No recompilation, preprocessing or code generation required.

• Constraints have real physics based modeling parameters! Can be modeled with elasticity and dissipation.

Limitations

• Not efficient in the smooth limit (typically when sound speed is important), But can be switched to smooth model in this limit.

• Not per se a general modeling language, but still pretty general.

Constraint physics

A constraint is satisfied when the constraint function defining the constraint is zero,

𝑔 𝑞 = 0

where 𝑞 are the variables of the system (e.g. position, orientation). The Jacobian of the

constraint is defined as the gradient of this function,

𝐺 =𝛿𝑔

𝛿𝑞

If 𝑔 = 0 and 𝑔 is stationary, so is its time derivative 𝑔 = 𝑑𝑔

𝑑𝑡= 0.

Chain rule gives,

𝑑𝑔

𝑑𝑡=

𝛿𝑔

𝛿𝑞

𝑑𝑞

𝑑𝑡= 𝐺𝑣 = 0

𝑣 are the system velocities (e.g. translational, rotational).

The constraint Jacobian is a matrix with each row corresponding to a specific constraint.

𝐺𝑣 = 0 means that the projection of the velocities in the direction of the Jacobian are zero.

Or, velocities normal to the constraint surface are zero, and will thus not break the

constraint.

Discrete variational mechanics

Constraint based physics

These equations of motions are then time discretized with a timestep, ℎ, via a discrete

variational principle with the result (lots of analysis left out here…),

𝑀 −𝐺𝑘

𝑇

𝐺𝑘 Σ

𝑣𝑘+1

ℎ𝜆 =

𝑀𝑣𝑘 + ℎ𝑓𝑒

−4

ℎ(1 +4𝛾ℎ

)𝑔𝑘 +

1

ℎ(1 +4𝛾ℎ

)𝐺𝑘𝑣𝑘

with the block Σ being a diagonal matrix, modeling elasticity and dissipation,

Σ =4𝜖

ℎ2(1 +4𝛾ℎ

)𝟏

The task is now to solve for the new velocities 𝑣𝑘+1 and the constraint forces 𝜆.

Elasticity and plasticity

http://www.youtube.com/watch?v=bxjSZji1sG

Elasticity and plasticity

http://www.youtube.com/watch?v=AGl4OHJ1dlI

Incompressible particle fluids

http://vimeo.com/16372553

Incompressible particle fluids

http://www.youtube.com/watch?v=XTO4DmEbv34

Solvers

Fluid: 150K x 150K Rocks: 2K x 2K Loader: 150 x 150

Projected Gauss-Seidel Direct Sparse Blocked LCP Conjugate Gradient iterations

Performance

Accessible real-time performance, e.g. Quad i7

~ 10.000 jointed bodies solved with direct sparse solver, at 100 Hz (much depending on structure)

~ 5.000 bodies with 5 contacts per body, and dry friction, e.g. 50.000 equations, at 100Hz, using iterative PGS solver.

Performance

Non-realtime performance (often memory bound)

~ 2M bodies, 10M contacts, 30M equations One timestep in 10s with PGS iterations on i7 PC.

~ 3M fluid particles, 4 timesteps per second on GPU with PC-CG solver.

Generally 50% time on collision detection, and 50% on mixed LCP/QP solves.

Conclusions

Physics engine paradigm efficient for: Realtime, stiff, large timesteps Scaling to very large systems Strongly varying systems (contacts, interactive CAD) Constraint based modeling pretty general for multiphysics. A physics engine has no modeling language per se. No code generation! Declarative, event and data driven! Underlying physics can be modeled Connection with Modelica and FMI/FMU under investigation. - Modeling with Modelica? - Back-end solves with AGX for Modelica? - Extensions to Modelica language needed?

References

Selected references and further reading

Ghosts and machines: regularized variational methods for interactive simulations of multibodies with dry frictional contacts. Lacoursière, Claude, Umeå universitet (2007). http://urn.kb.se/resolve?urn=urn:nbn:se:umu:diva-1143

Hybrid, multi-resolution wires with massless frictional contacts, M. Servin, C. Lacoursière, K. Bodin, IEEE Transactions on Visualization and Computer Graphics, Volume: 17 Issue:7, On page(s): 970 - 982, July (2011). IEEE computer Society Digital Library. IEEE Computer Society,

Examining the smooth and nonsmooth discrete element approaches to granular matter, M. Servin, C. Lacoursère, D. Wang, K. Bodin, Particles 2011 – ECCOMAS International Conference on Particle-based Methods, Barcelona (2011). abstract slides

Outlet design optimization based on large-scale nonsmooth DEM simulation, D. Wang, M. Servin, K. Mickelsson, Particles 2011 – ECCOMAS International Conference on Particle-based Methods, Barcelona (2011).abstract

Constraint based particle fluids on GPGPU, K. Bodin, C. Lacoursière, M. Nilsson, M. Servin, Particles 2011 – ECCOMAS International Conference on Particle-based Methods, Barcelona (2011). abstract

Regularized multibody dynamics with dry frictional contacts, C. Lacoursière and M. Servin, Euromech Colloquium: Nonsmooth contact and impact laws in mechanics, July 6th - 8th 2011, Grenoble, France, (2011) pdf, web

Constraint fluids, K. Bodin, C. Lacoursière, M. Servin, IEEE Transactions on Visualization and Computer Graphics, Vol pp, Issue 99. 2011. IEEE computer Society Digital Library. IEEE Computer Society, <http://doi.ieeecomputersociety.org/10.1109/TVCG.2011.29>

Interactive simulation of elastic deformable materials, by M. Servin, C. Lacoursière and N. Melin, In Proceedings of SIGRAD Conference 2006 in Skövde, Sweden, Linköping University Electronic Press, Linköping, 22-32 (2006)

A regularized time stepper for multibody systems, C. Lacoursière. In J. Sporring, K. Erleben, and H. Dohlmann, editors, PDE Methods in Computer Graphics. Charles River Media, 2005.

Regularized, stabilized, variational methods for multibodies, C. Lacoursière, In Dag Fritzson Peter Bunus and Claus Führer, editors, The 48th Scandinavian Conference on Simulation and Modeling (SIMS 2007), 30-31 October, 2007, Göteborg (Särö), Sweden, Linköping Electronic Conference Proceedings, pages 40–48. Linköping University Electronic Press, December 2007.

A parallel block iterative method for interactive contacting rigid multibody simulations on multicore PCs, C. Lacoursière. A, In PARA’06, pages 956–965, 2006.

Visual Simulation of Machine Concepts for Forest Biomass Harvesting, M. Servin, A. Backman, K. Bodin, U. Bergsten, D. Bergström, B. Löfgren, T. Nordfjell, I. Wästerlund, VRIC 2008 - 10th International Conference on Virtual Reality (Laval Virtual), (2008).