What is the best way to build a physics simulation

Click For Summary

Discussion Overview

The discussion revolves around the best tools and libraries for building physics simulations, particularly in mechanics, including aspects like gravity, collisions, and springs. Participants explore various software options and programming languages suitable for different levels of fidelity and ease of use.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant inquires about tools for quickly setting up physics simulations, expressing limited time for development.
  • Another suggests Java physics programs and engines as potential resources.
  • MATLAB and Simulink are recommended by some for their extensive libraries, though concerns are raised about their speed and programming language limitations.
  • Gaming physics engines are mentioned as a viable option for somewhat accurate simulations, but with the caveat that they prioritize visual fidelity over physical accuracy.
  • A participant notes the speed limitations of using Sagemath, SciPy, and NumPy for custom simulations, while highlighting the advantages of OpenCL for performance.
  • Discussion includes the challenges of developing open-source scientific computing libraries, with some participants emphasizing the lack of resources and expertise in the community.
  • Concerns are raised about the reliability of fixes in open-source projects like Sagemath, due to the complexity of ensuring mathematical correctness.
  • ArrayFire is mentioned as a promising tool, with a participant expressing interest in its capabilities compared to MATLAB's Parallel Computing Toolbox.

Areas of Agreement / Disagreement

Participants express a range of opinions on the effectiveness and suitability of various tools, with no clear consensus on the best approach or tool for building physics simulations. The discussion reflects multiple competing views and uncertainties regarding the capabilities of different software options.

Contextual Notes

Participants highlight limitations in open-source scientific computing, including the dependency on the expertise of developers and the challenges of integrating mathematical correctness in software. There are also mentions of the varying fidelity requirements for simulations and the trade-offs involved in choosing different tools.

Who May Find This Useful

This discussion may be useful for individuals interested in programming physics simulations, particularly those exploring different software options and seeking insights into the challenges of simulation fidelity and open-source development.

RaamGeneral
Messages
49
Reaction score
1
Hello.

I know a bit of programming, python, C and I tried once the processing language.
I'd like to make, sometimes, some simulation on mechanics, with gravity, collisions, springs, ecc...

But I have not very much time to spend in creating these things (supposing I could), so I would like to know if there some tool, software or library to quickly set up a simulation (I'm on Windows).

Thank you.
 
Technology news on Phys.org
If you can afford them, MATLAB and Simulink are widely used for simulations in Engineering. There is a forum here for those types of programs (see "Math and Science Software" under "Computing and Technology") MATLAB is a script language and Simulink is a diagramming tool to make signal-flow diagrams and run them in time simulations. Both have extensive libraries to support areas of application.
 
Depends on your level of fidelity. If you want something somewhat accurate, you can try gaming physics engines. They run off of the same basic physics principles and they're often quick. The problem is that games only have to look and feel right, not be physically correct.

Matlab and Simulink are good options as well, but they're not too fast and it's harder to do something freeform. Plus, if you're doing any kind of involved programming, you'll hate Matlab's language. It's a good script language, but not for libraries or any hard development.

A good finite element analysis package will get all the forces and things right, but it's very expensive and time-consuming. As well, you'd probably find it hard to create an accurate model (although the solver is really good about getting the solution to the model).
 
I am paying attention to this thread, its something I've been wondering too. The sagemath/scipy/numpy suit has a lot built in, but for custom stuff its so slow when you can't use the wrapped C libraries. What I have done with Open CL is fantastic in speed, but limited. I've actually seen some good stuff in webgl:
http://nullprogram.com/webgl-particles/
But again, its really written for graphics. Writing for parallel execution is just hard for some things, but I don't have an nvidia card and I've heard really good things about their scientific computing library in Cuda.
I've been messing with it for a long time though, and I seriously think the best advice I could give is to really delve what MATLAB and Wolfram's software have to offer, save up and buy what you need. Its just not there yet in the open source community: The good programmers didn't major in physics and the good physicists didn't major in programming.
 
I like OpenCL's capabilities. I've been waiting for ArrayFire to catch up with what Accelereyes developed for Matlab's Parallel Computing Toolbox. I guess Mathworks bought all the "nice code" and now the community is going to have to rebuild it.

It's true that there's not a great open-source community for scientific computing, but most of the time it's about money. There are very few people that study these hard subjects that have enough spare time and energy to want to develop cool libraries and NOT get paid for it.
 
  • Like
Likes   Reactions: Fooality
Yeah, good point. The other thing is its multi-disciplinary in a way other FOSS projects are not. If you have the programming skills, and you find something wrong in Firefox, you fix it, because you know how a browser should act. But I have found clear errors in Sagemath and watched them sit there for years, because its unclear if what appears to be a fix is truly mathematically correct, or if they integrate into the "Symbolic Ring" in the right way... I just don't have the math chops to know for sure. I'm sure its the same for physics software. Of course in a company you just ask the physicist/mathematician down the hall and work it out.

Thanks for letting me know about ArrayFire, I hadn't seen that.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
10
Views
5K
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
48
Views
5K
  • · Replies 8 ·
Replies
8
Views
3K