Parallel Simulation with MathModelica

Peter Aronsson

MathCore Engineering AB, Sweden

Abstract

With the stagnation of increasing processor speed that has happened during the last decade, computer architectures are instead becoming increasingly parallel. Today almost every laptop computer has a dual-core processor, and desktop computers are at least quad-core machines. Mathematica was in Version 7 equipped with powerful parallel computing capabilities to take advantage of this trend, and the latest version of MathModelica has now support for performing parallel simulations.

MathModelica is a modeling and simulation tool for complex dynamic multi physics systems and its simulation task consist of solving (hybrid) differential algebraic equations. This is a typically sequential solving process, where each integration step depends on one or several earlier steps of the numerical integration. This sequential behavior makes it very hard to use parallel computing to speed up the simulation of such systems. However, repeated simulations, with e.g. different parameter settings, is used in several engineering tasks such as Monte Carlo simulations, parameter estimation, or optimization. For such cases, the possibility of running several simulations in parallel can improve performance substantially.

This presentation will show with several examples how to use the new MathModelica function ParallelSimulate to perform parallel simulations. We will also show how to achieve the same thing by using the built in functions ParallelTable and NDSolve in combination with MathModelica's ModelEquations, and explain the difference between the two approaches and when to use which one. Finally we will briefly explore the possibilities of parallelizing one simulation, which can be useful for very large complex models.