Welcome, Guest

Author Topic: Converting Fortran code into C# for adding Stellar Evolution to Universe Sandbox  (Read 11906 times)

Dan Dixon

  • Creator of Universe Sandbox
  • Developer
  • *****
  • Posts: 3244
    • Personal Site
I'm looking for some help converting the code contained in 'BSE tar file' found here:
http://astronomy.swin.edu.au/~jhurley/
... into something usable for future inclusion into Universe Sandbox.

It's my understanding that the Binary Evolution code includes the Stellar Evolution code too, so I'll like to be able to do both. The final result should be a function that where one can pass in the starting variables and get the evolved result in the end (for both single stars and binaries).

I'm able to offer payment for this work, and once the code is converted I will publish the converted code on the Universe Sandbox website.

If you're interested please send me an email with your qualifications (you'll need to know Fortran and C# (or VB.net, which is equivalent to C#) and what your quote is for the entire job to:
jobs at universesandbox dot com

And please ask questions. As it's not entirely clear to me how hard it will be to create a two function for single vs binary stars out of that code.

In in no rush to get this done, but this is something I've been wanting to do for months:
http://universesandbox.com/forum/index.php/topic,2080.0.html

atomic7732

  • Global Moderator
  • *****
  • Posts: 3849
  • caught in the river turning blue
    • Paladin of Storms
Stellar Evolution  :o

Binary stellar evolution  :o :o :o :o :o :o :o :o :o :o

That would be epic... Would it have support for like... one star's gasses taken by the other... novae? I'm not sure how it works exactly... lol

ChemicalBR0

  • *****
  • Posts: 82
  • flying is just falling without hitting the ground
does that mean you could do simulations of say our sun going red giant over time and what would happen to the planets?

Holy crap!!!!!!!! that would be a stellar addition to US  ;)


um sorry i can't help with the code Dan. i've enough problems remembering my bank pin number.

Ramierez

  • **
  • Posts: 19
Reading through the documentation file...it looks like this not only just does stellar evolution (with what appears to be 16 distinct stages of possible evolution including supernova) but also uses composition variables to help calculate everything - IE metallicity, H and He abundance.  I also saw references to mass-loss equations.

This would be a game-changer that's for sure.  Though I saw reference that the program currently resets the age of the star as it hits each new stage, but I imagine that's a minor thing.

atomic7732

  • Global Moderator
  • *****
  • Posts: 3849
  • caught in the river turning blue
    • Paladin of Storms
does that mean you could do simulations of say our sun going red giant over time and what would happen to the planets?

Holy crap!!!!!!!! that would be a stellar addition to US  ;)


um sorry i can't help with the code Dan. i've enough problems remembering my bank pin number.

New update? YAY

*starts a simulation*

*goes to somewhere*

*comes back after an hour*

Uhhh... Nothing happened. What the simulation only ran 5000 years?

That would be a big problem, with planets you couldn't run at very high timesteps, but it would be awesome. I'm sure one day Dan will be able to get something working like that.

Dan Dixon

  • Creator of Universe Sandbox
  • Developer
  • *****
  • Posts: 3244
    • Personal Site
does that mean you could do simulations of say our sun going red giant over time and what would happen to the planets?

It wouldn't change the time step issue (where planets fly off into space if you turn it up too high), it would simply provide a way to change the properties of stars over long periods of time in a realistic way.

Joshimitsu91

  • *****
  • Posts: 78
  • Hit me up on Steam: "Joshimitsu91"
does that mean you could do simulations of say our sun going red giant over time and what would happen to the planets?

It wouldn't change the time step issue (where planets fly off into space if you turn it up too high), it would simply provide a way to change the properties of stars over long periods of time in a realistic way.

I'm not sure if this would be possible, but could you implement a feature that sort of locks the orbits in place, like the lock feature thats already in place? So that if you were watching a star evolve the sim would know to keep the planets from flying off, and then if you slow it down you could see them orbit again?

Ramierez

  • **
  • Posts: 19
does that mean you could do simulations of say our sun going red giant over time and what would happen to the planets?

It wouldn't change the time step issue (where planets fly off into space if you turn it up too high), it would simply provide a way to change the properties of stars over long periods of time in a realistic way.

I'm not sure if this would be possible, but could you implement a feature that sort of locks the orbits in place, like the lock feature thats already in place? So that if you were watching a star evolve the sim would know to keep the planets from flying off, and then if you slow it down you could see them orbit again?

I like that idea...a 'lock orbit' feature.

kjaget

  • *
  • Posts: 1
Converting it by hand is going to be a good bit of work.  Perhaps there are other, easier ways.  For example : http://support.microsoft.com/kb/123841, or perhaps more up to date http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/df763ea3-456f-41e6-a945-ff0521385a70/.  If you can compile most of the functions into DLLs, you'd only have to rewrite the top-level code, which you'd probably have to do anyway to modify it to work with universe sandbox.

There are also tools which should do a fortran to C conversion automatically.  In the other thread someone mentioned F2C, and I think LLVM can also do something similar.  You'd still have to rewrite it to get it into a .net language, but C's a lot closer to them than fortran is.

Do you know what the license is for this code? 

Coldkick

  • *
  • Posts: 2
First of all, whoever gets that transcoded is awesome, this will be a huge step in realism. Next, in reply to the comment above me, I think that it would work for orbits that don't change, so if you have a stable system it could buffer the complete orbit and save its locations so that timesteps won't effect it.  If you were to have an unstable system this option would be very unrealistic though.  Generally, I think it should be included.  I would like to have a stable system that when at a large time step can stay in orbit so that we can see stellar evolution properly.

Dan Dixon

  • Creator of Universe Sandbox
  • Developer
  • *****
  • Posts: 3244
    • Personal Site
If you can compile most of the functions into DLLs, you'd only have to rewrite the top-level code, which you'd probably have to do anyway to modify it to work with universe sandbox.

I'd be open to that, but then it's becomes a black box that I couldn't modify or extend (if needed). And once it was in C# it would become much easier for others to consume as well. That said... A DLL option would be better than nothing.

There are also tools which should do a fortran to C conversion automatically.  In the other thread someone mentioned F2C, and I think LLVM can also do something similar.  You'd still have to rewrite it to get it into a .net language, but C's a lot closer to them than fortran is.

That would work too. I spent about half a day exploring this option, but just didn't have enough experience with Fortran or the various converters to know what I was doing.

Do you know what the license is for this code?  

There doesn't appear to be any license info on the original site. I've attempted to contact the original author twice, but have yet to receive a response. So perhaps I'm getting ahead of myself, but I'm hopeful he will be excited to see his work used in a popular astronomy visualizer.
« Last Edit: May 06, 2011, 05:34:36 PM by Dan Dixon »

atomic7732

  • Global Moderator
  • *****
  • Posts: 3849
  • caught in the river turning blue
    • Paladin of Storms
Isn't Fortran for Linux? Linux coding and GNU stuff is aiming to be all open source everything free... so...

SuperNova

  • Universe Sandbox 1 Beta Team
  • *****
  • Posts: 387
  • ROW ROW, FIGHT THE POWAH!
    • Dreadnaught BG

Dan Dixon

  • Creator of Universe Sandbox
  • Developer
  • *****
  • Posts: 3244
    • Personal Site
Isn't Fortran for Linux? Linux coding and GNU stuff is aiming to be all open source everything free... so...

The language doesn't effect the license. I'm not sure that there would be any license restriction on converted code, where their may be on non-converted code that was wrapped in a DLL. Either way... I'm not getting any response from the author.

There are plenty of other things to work on in the meantime. That said... I really want to get this hooked up and working. If I don't get any response here in the next few weeks, I'll probably expand my search for a programmer to other sites.