views:

194

answers:

8

I've been out of the modeling biz, so to speak, for a while now. When I was in college, most of the models I worked with were written in FORTRAN, which I never liked. I'm looking to get back into science, so I'm wondering if there are modern languages with feature sets suited for this kind of application. What would you consider to be an optimal language for simulating complex physics systems?

+4  A: 

I think it's arguable that FORTRAN is still dominant when it comes to solving large-scale problems in physics, as long as we're talking about serial calculations.

I know that parallelization is changing the game. I'm less certain about whether or not parallelized versions of LINPACK and other linear algebra packages are still written in FORTRAN.

A lot of engineers are using MATLAB and Mathematica these days, because they combine numerical and graphics capabilities.

I'd also point out that there's a difference between calculation and display engines. The former might still be written in FORTRAN, but the latter may be using more modern languages and OpenGL.

I'm also unsure about how much modeling has crept into biology. Physical chemistry might be a very different animal altogether.

If you write a terrific parallel linear algebra package in Scala or F# or Haskell that performs well, the world will beat a path to your door.

duffymo
Oh sorry, I didn't realise you'd already suggested Matlab. To add to your answer though: Fortran is still around today in codes like Siesta (Spanish Initiative for Electronic Simulations with Thousands of Atoms) which is parallelized.
Geodesic
i think it's not even worth mentioning FORTRAN in this day and age.
OTZ
Really? Have all the commercial finite element packages been rewritten? Are people doing CFD in C# now? Are you writing software to model physics problems? If yes, is it sold for money?
duffymo
+5  A: 

While certainly Fortran was the absolute ruler for this, Python is being used more and more exactly for this purpose. While it is very hard to say which is the BEST program for this, I've found python pretty useful for physics simulations and physics education.

Seth Illgard
+1 - NumPy and SciPy. I don't believe commercially available software is following your lead.
duffymo
+1  A: 

Python + Matplotlib + NumPy + α

OTZ
+1  A: 

There's also a lot of capability with MATLAB. Especially when interfacing your simulations with hardware, or if you need your results visualised.

Geodesic
I'm sorry, commercial softwares like matlab are too old-school. Considering the probability of you continuously paying for the future subscription and upgrades, it is not worth the investment.
OTZ
The people I know at a Dow Jones engineering company are all using Matlab and write CFD packages in Fortran. What credentials do you have to back up what you're saying?
duffymo
OTZ
@OTZ: Really? A few of the DJ 30: 3M...Cisco...DuPont...GE...Hewlett-Packard...IBM...MicroSoft...
dmckee
OTZ
Regardless of whether you feel they're old school or not is irrelevant. The OP wants to know what's optimal - which in this case is subjective and situational. If they're joining a group of set-in-their-ways academics then Fortran might be the best language for the task. The same goes for an Engineering firm with a Matlab site licence and coders that don't want to have to wrapper every other language under the sun to interface seamlessly. I agree with you that the Python route is indeed a clean and easy solution, but it's certainly not the only one.
Geodesic
OTZ - You still haven't presented your credentials. And I still fail to see why using a language that's old means that the techniques are any less credible. Python is a fine language, with wonderful libraries for scientific computing, but if you need to solve a 3D transient multi-physics problem you aren't going to care whether or not the language is the shiniest new toy. You are going to want raw, unadulterated speed. Languages that parallelize well might have a tremendous advantage. Perhaps you should express your arguments in those terms. This tantrum sounds childish and unschooled.
duffymo
If you've flown recently, you've taken advantage of the labors of two Dow Jones companies: GE and UTC. Jet engines are very technically advanced products.
duffymo
+1  A: 

The nuclear/particle/high energy physics community has moved heavily toward c++ (in part due to ROOT and Geant4), with some interest in Python (because it has ROOT bindings).

But you'll note that this is sub-discipline dependent..."physics" and "modeling" are big, broad topics, so there is no one answer.

dmckee
Interesting. I did all of my work in astro and planetary physics, and I worked with several models, all of which were written in FORTRAN. We used IDL for analysis.
FCBastiat
+3  A: 

It depends on the task

  • C++ is good at complicated data structures, but it is bad at slicing and multiply matrices. (This task equires you to spend a lot of time writing for loops.)
  • FORTRAN has a nice notation for slicing and multiplying matrices, but it is clumsy for creating complicated data structure such as graphs and linked lists.
  • Python/scipy has a nice notation for everything, but python is an interepreted language, so it is slow at certain tasks.
  • Some people are interested in languages like CUDA that allow you to use your GPU to speed up your simulations.

In the molecular dynamics community c++ seems to be popular, because you need somewhat complicated data structures to represent the shapes of the molecules.

nielsle
A: 

Modelica is a specialized language for modeling (and simulating) physical systems. OpenModelica is an open source implementation of Modelica.

wilhelmmedetz
+1  A: 

I'll chime in with Python but you should also look to R for any statistical work you may need to do. You should really be asking more about what packages for which languages to use rather than the language itself.

wheaties