Astrophysics in Virtual Worlds: Implementing N-Body Simulations in OpenSim

Sat, Jul 19, 2008

Junichiro Makino, University of Tokyo, leads the way into the National Astronomical Observatory of Japan (NAOJ) in Tokyo. Piet Hut, Institute of Advanced Studies, Princeton, is right behind with the Genkii team. Jun Makino has offered the use of a server at the observatory to set up an OpenSim environment. History is about to be made.

Thanks Genkii for the photos! Genkii is a Tokyo-based strategic consultancy focusing on social media and virtual worlds (see here for my interview with CEO of Genkii, Ken Brady and COO, Adam Johnson).

Next day Piet Hut announced to the Meta Institute for Computational Astrophysics MICA:

Adam Johnson and Jeff Ames, developers of OpenSim, and members of the Tokyo Genkii team, have succeeded today in tweaking their physics engine in OpenSim to let stars dance according to Newtonian Gravity.

On a Mac laptop, they let hundreds of stars move in real time, as a gravitational N-body problem (yes, a few hundred!). This is a historic watershed.

A video was soon up on YouTube here. But as Adam Johnson noted:

I don’t think the video can capture the pure fun of this thing, it makes computational astrophysics approachable to a 3 year old… like legos for astronomy. And it really puts OpenSim in a new light! This same method can be applied to other areas too.. think protein folding visualizations.

Computational Astrophysics is a field that has long been associated with some serious number crunching. Jun Makino is holding up a piece of the new GRAPE (an acronym for “gravity pipeline” and an intended pun on the Apple line of computers) – a super computer that will become one of the fastest super computers in the world (again).

Later in this post there is an in depth interview I did in Second Life with Jun. His Second Life avatar is Makino Magic. Jun discusses the future of computational astrophysics, and how this may be tied in with virtual worlds

The photo above was taken by Adam Johnson of Genkii. Adam noted:

We want to use super computers like this (the Cray and GRAPE) to offset the simulations and push the results to OpenSim. That way it can simulate thousands, or millions of stars/planets

The picture below shows the Cray at the National Observatory of japan on the right, and on the left Jeff Ames is shown working on the N-Body simulation in OpenSim. I heard Jeff implemented most of the code for Newtonian Gravity in OpenSim on the train ride to the observatory!

Genkii, in addition to their work on OpenSim are developing, with 3Di and other open source virtual world developers, an OpenViewer a “from scratch” that should allow people like scientific researchers, game developers, educators, etc to make fully customized viewers more easily than they could before. Adam explained:

Open Viewer is (BSD Licensed) using, at the moment, OgreDotNet for rendering and LibSL for the protocol.

But you can use any protocol you want actually and any rendering engine – ideally we want to allow it to support numerous virtual worlds with one viewer. We have been talking to HiPiHi guys about getting their protocol working with it as well, and soon will talk to some IBM guys in China to see if they want to take part in that action.

MICA – Pioneering Astrophysics in Virtual Worlds

Piet Hut has been evangelizing the potential of virtual worlds for astrophysics, and bringing astrophysicists into virtual worlds through the Meta Institute for Computational Astrophysics (MICA) for quite a while now (see my previous post). And, Piet and Eiko Ikegami have just published a fascinating paper about Japanese History and Second Life.

MICA, begun in 2007, is a virtual astronomy institute featuring many MODEST-related activities. Aimed at harnessing the capabilities of virtual worlds and 3D collaborative environments (such as Second Life, Qwaq, Sun Wonderland), it fosters interaction among astrophysicists with interest in large-scale simulations, including dense stellar systems. Outreach and educational activities are also major MICA goals. MICA weekly events include popular talks, computational astrophysics lectures and Journal Club discussions of recent astro-ph papers. The MICA wiki, containing more information, schedules of events, and links to related pages, can be found here.

Also, there is an excellent video of Piet’s talk on the “Scientists and Science Outreach in Second Life,” that was part of the SL5BD events posted on YouTube here.

In the picture above, MICA members Prospero Frobozz (Prospero Linden a.k.a. Robert Knop in RL), Tara5 Oh (me, Tish Shute in RL), Pema Pera (Piet Hut in RL), Peter28 shostakovich (Peter Teuben in RL), Paradox Olbers (Spike MacPhee in RL) see also Paradox’s Spindrift in Scilands blog, Pan Numanox (Alfred Whitehead in RL), Jazz90meteotl Loon, Eamu Godenot (Will Farr in RL), and Lagrange Euler (Steven McMilland in RL). Thank you MICA member and SL photographer Kirk Smythe (Tom Deluca III in “real” life) for this picture, and for the portrait of Piet’s avatar Pema Pera below.

I have been attending MICA meetings as an observer since spring when their activities were mostly focused in Qwaq. Now the focus of MICA is Second Life and OpenSim. There is a regular schedule of events. In fact, I was invited to speak about Open Source virtual worlds at one of the daily “coffee” meetings. I later heard that my talk was in fact the trigger for the collaboration between Piet and the Genkii team!

I invited Adam Johnson to come to the discussion after my talk when the conversation focused on OpenSim. After I introduced Adam to Piet, they realized they were both in Tokyo in RL, they met for lunch and the rest is history.

I have blogged and attended a number of MICA’s events including Dr. Rob Knop’s (a.k.a Prospero Linden a.k.a Prospero Frobozz) talk, “The Power of the Dark Side: How Dark Matter and Dark Energy dominate our Universe.” Dr. Knop was on the team that discovered the accelerating expansion of the universe.

Why does MICA want to do simulations within Virtual Worlds?

I asked Piet (Pema Pera in Second Life, picture below) why MICA wants to do simulations in virtual worlds and, why N-body simulation is so important to astrophysics?

Pema Pera: For two reasons:

1) Traditionally simulations were where scientists spent years and visualization was an afterthought, a few pictures in a journal, never the right tools to really mine the data, not enough time, money, tools. So we can use VWs to start with visualization and then have the simulations follow. Another example of inverting a traditional priority, like going to what-you-see-is-what-you-get. Most breakthroughs in computer use are like that. So starting with the enormous investment already in the visualization aspects of Virtual Worlds, you can then run your simulations within them, or so it seems. Whether they actually run in there, or in a hidden way elsewhere on a Cray or GRAPE is of no real concern for the user.

2) Collaborative code writing and debugging. Traditionally, observers collaborate — can’t build a telescope and observatory with one person. Theoretical folks now have to learn to collaborate. You can’t write a whole simulation package in one PhD three-year period.

Most breakthroughs are inverting something, first direct addressing to make the computer fast, but a pain for humans, then you switch to indrect addressing, makes more sense for the human, slower at first for the computer, but the advantages in software productivity are overwhelming. Same with going from assembly code to compilers, same from complied languages to scripting languages

Theorists are learning to collaborate and they have to write computer code together! What better way than to do pair programming in a virtual world, so pair coding and pair debugging becomes possible within a VW, especially when you can see the results in your simulation.

Tara5 Oh: oooh that is interesting, so being able to “play” with a physics engine could be very key!

Pema Pera: YES! You simulate at large scales VERY directly into the fabric of the simulated world iteself. It is the difference between having a stage on which you play and having the stage itself play for you!!!!

Tara5 Oh: Why are N-body simulations so key to astrophysics?

Pema Pera: Ah, great question! Gravity dominates. On short scales we have electricity and magnetism and friction and much more but on large enough scales only gravity is felt. Electricity cancels + and – charges but gravity is only attractive, hense a gravitational N-body problem. You cut up the world into N parts as large an N as you can handle and then you simulate the UNIVERSE.

Will Farr (MIT) implements the “Hermite Algorithm” in OpenSim

The Thumbnails of screenshots above (in order) are from a simple N-Body simulation of 32 bodies in OpenSim. Basically, you can see the bodies collapse, eject some of their members, and form a cluster of the remaining bodies in the sequence of photos

It wasn’t long before MICA members were deep into OpenSim. Notably, Will Farr, Eamu Godenot in Second Life is a MICA member and a 5th-year graduate student at MIT working on numerical relativity and N-body simulation algorithms, “lots of theory and numerics, very little observing, unfortunately,” he told me. Will was one of the first MICA members to pick up on the N-body work in OpenSim.

Tara5 Oh: Could you explain what you have been doing with n-body simulation in OpenSim?

Eamu Godenot: When Adam and Jeff wrote a Newtonian physics engine for OpenSim, this was a couple of weeks ago. they showed that it was possible to run gravitational simulations using a custom physics engine, but they didn’t know a lot about n-body simulations. I don’t know a ton, but I know more, and I was coming to Japan to visit Piet/Pema and Jun/Makino. So, Piet suggested that we try to improve the algorithms that the physics engine used. Maybe enough to do some physically relevant simulations

Tara5 Oh: You all met in Tokyo?

Eamu Godenot: Yes, it was exciting—I met Adam and Jeff two days ago, and spent some time learning about OpenSim and the code from them. Plus pestering them with lots of questions about genkii, programming, and OpenSim in general. Then, on Wednesday and some of Thursday, I started improving the n-body part of the physics engine. They had implemented a nice algorithm for evolving the bodies, but the standard ones used in the field are more efficient and accurate. In particular, Jun Makino invented a technique called the Hermite algorithm that is, more-or-less, the “industry standard” So, I implemented that.

Interview With Jun Makino (avatar Makino Magic)

Tara5 Oh: MICA has been doing some work on N-Body simulation in OpenSim in which you have access to the physics engine. How doe this open up new possibilities for astrophysics to use a general simulation platform in conjunction with super computers?

Makino Magic: Well, what Piet and other people have done so far is mainly to implement some simple models directly as simulation modules in Opensim. That itself is nice, but not quite enough to share and work on really high-end simulations. However, once we learn how to show things in SL/OpenSim, it *should be* not too difficult to connect the Opensim program directly to data visualization or analysis program which runs on any other computer, or actually connect it directly to a supercomputer or GRAPE.

Tara5 Oh: Could a general simulation platform like OpenSim ultimately become an operating system/user interface to super computers? And do you think this could bring a new kind of interactivity to number crunching?

Makino Magic:
I think it could. That’s rather similar to the web browser becomming an general user interface for whatever programs people develop. Well, I think the important thing here is the possibility of people in different places working on a single dataset or simulation in really real-time.

Tara5 Oh: Yes it is really my big dream for virtual worlds, or rather for the free form, programmable, 3D collaborative space exemplified by OpenSim. to make the previously invisible world of software becomes visible in a shared interactive environment!

Makino Magic: Yes, not just dataset and simulation, but the possibility to share the program for simulation itself and to do the development in that way like pair- or “Extreme” programming, so more than two people physically far away that can really change the way we do research and development.

Tara5 Oh: Yes! What is you role in MICA?

Makino Magic: Well, at this point not much. I have been too busy with my real-life duties….

Tara5 Oh: What do you think MICA could achieve re integrating virtual worlds in astrophysics? And what to you think you colleagues who are the first evangelists of the use of virtual worlds in astrophysics may be overlooking?

Makino Magic: Well, at this point I cannot predict. But the simulation stuff implemented in OpenSim looks very promising

Tara5 Oh: Do you have any different ideas from Piet re the the role virtual worlds can play?

Makino Magic: Hmm, I must say I do not know all the details of Piet’s ideas, but for me the first step would be to use the environment to really do some collaborative research and discusssion, and we do not yet have simple tools to do so…

Tara5 Oh: And what are the most urgent tools you need now?

Makino Magic: A very first thing, which might be actually there, is to really work in multiple windows much in the same way as yo do in the pair-programming. You should be able to use one editor window, a graphic window to show result, etc, and should be able to edit one file….

Tara5 Oh: and secondly?

Makino Magic: Well, that is hard to predict… But clearly we need a “virtual” 3D “screen” , in which we visualize 3D results and see, walk into or fly.

Tara5 Oh: And is the N- Body simulation in OpenSim the first step to this last requirement?

Makino Magic: Yes, I think so. And that is useful not only for real research but for educational or public-outreach type stuff. Which is also important to get the attention of wide range of people, many of them are better programmers than astrophysists, like the people from Genkii who implemented the first N-body simulation in OpenSim.

Tara5 Oh: Do you have an OpenSim running in your own lab yet?

Makino Magic: Well, the server is running, but I have no client PC in my office yet (My windows PC in my offiice is toooo old and slow…)

Tara5 Oh: What is the contribution that being able to play with physicis engine so easily in OpenSim makes to N-Body simulation research?

Makino Magic: The most important thing is that you can show the result to people, including yourself, much easier than without OpenSim. well, hopefully…

Tara5 Oh: Piet said something to me that I was interested by: “If we really want to reverse simulating and visualizing, we can IMAGINE doing everything on the visualizer and then using a “simulations accelerator” (the opposite of a “graphics accelerator”) to get speed.” He went on to say, “similar techniques can be used in visualization as in simulations, actually, where also you don’t compute the force on one particle from all the billion other particles in a large simulation, so we have a lot of experience there already both conceptually and practically.”

Makino Magic: Hmm, Well, for me it is not too important where the simlation is done, but it must be reasonablly fast. Currently, really cutting-edge large-scale simulation can take months on the largest Cray or GRAPE.

On the other hand, lots of things can be done real-time, and my guess is Piet is mainly interested in those kind of things. There are many interesting problems for which we need to do simulations, but not the largest ones on supercomputers.

Tara5 Oh: So there are many interesting problems for simulation that do not require a super computer?

Makino Magic: Yes. for example, just by solving many three-body problems we can learn a lot, and can even publish an interesting paper in Nature (we did in 2004).

Tara5 Oh: What will scientific computing look like 25 years from now?

Makino Magic: Well, Piet has been in on that for more than 25 years, and I’m approaching to that many years, but it is hard to predict….

Tara5 Oh: But just some speculation, hehe!

Makino Magic: Well, one thing is that it’s becoming more and more difficult to develop large simulation programs. Much of the code we use now has been maintained for more than 20, or 30 years. In that sense, even though the hardware changes, the software changes very very slowly, and that is the problem.

Tara5 Oh: Do you think the intereactivity of virtual worlds could be useful in solving or preventing the problem (frequent in science) of 25 year old code still being in use?

Makino Magic: Well, interactivity itself might not be the solution, but the way SL/OpenSim works and the way it talks to other simulation programs might be able to change the view. In some (many) cases, the program to be solved is really simple, like one line of and equation of motion, resulting in millions of lines to be able to efficiently solve a partucular kind of initial condition with very limited computing power. I do not say there will be any real solution, but there may be some alternative approach.

Tara5 Oh: Do you think that a virtual astrophysics organization like MICA could apply and recieve funding for this kind of research on their own, or would they neeed a RL university partner?

Makino Magic: In the case of MICA it is not difficult to get RL partner, IAS or Drexel or whatever.

[The MICA steering meeting began to convene at this point]

Tara5 Oh: Have I missed asking you any important questions do you think?

Makino Magic: Hmm, no.

Tara5 Oh: Thanks so much Makino!

Makino Magic: Okay, this was fun! Thanks a lot!

Tara5 Oh: And I look forward to hearing about the continuing story in the future!

Makino Magic: Yes, bye for now.

categories: 3D internet, Astrophysics in Virtual Worlds, Metaverse, Mixed Reality, nanotechnology, online privacy, open metaverse, open source, OpenSim, science outreach in virtual worlds, scientific simulation in virtual worlds, Second Life, social media, Uncategorized, Virtual Citizenship, Web 2.0, Web 3D, Web3.D, World 2.0
tags: , , , , , , , , , , , , , , , , , ,

0 Comments For This Post

4 Trackbacks For This Post

  1. UgoTrade » Blog Archive » Meet the Rising Stars of the Open Metaverse at Virtual Worlds 2008, LA Says:

    [...] trillion apparel industry, Genkii’s work with astrophysicists Piet Hut and Junichiro Makino on N-body simulation in OpenSim, and an extensive list of virtual world providers, and much [...]

  2. 赵珂网志 - 使用OpenSim模拟宇宙星体运动 - 专注Second Life, Buzz世界, 3D互联网 Says:

    [...] 1. Piet Hut’s Recent Highlights 2. Implementing N-Body Simulations in OpenSim 关键字: 第二人生, 虚拟世界, 虚拟世界平台, islab, OpenSim, Second Life, [...]

  3. UgoTrade » Blog Archive » Interview with Mic Bowman, Intel: The Future of Virtual Worlds Says:

    [...] (The Genkii team who created the OpenSim N-Body demonstration with astrophysicists Piet Hut and Junichiro Makino, see here for more). [...]

  4. People Meet People Meet Big Data: ScienceSim Explores Collaborative High Performance Computing | UgoTrade Says:

    [...] OpenSim and Supercomputing (an encounter I to some degree provoked by making the introductions) see this post.  So I have been following the ScienceSim initiative with great [...]

Leave a Reply