Thread: Getting started with simulation

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485

    Getting started with simulation

    Hallo to all, as this is my first post here.

    I am currently learning c++ and want to evolve into beeing able to program things like liquid simulations. My problem is where to start and what to do.

    I have some basic knowledge about C++, but are far from beeing an expert. So, after knowing the basic, what should I do if I want to do liquids in the end? I know this will not be a one week travle, it will probably take a few years maybe?

    I was now thinking of looking into openGL, is that a good idea considering what I want to do? Or is it waste of time? Well, everything I learning is good, but I think you understand what I am meaning.

    I have no problem with spending some money on things needed like books. As long as they are good. I am also thinking of studying this next year at university. (Computer graphic science at Teesside, any one know if its good?)

    thanks in advance

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    I'm not sure what you mean by "liquid simulation". I hope I'm not being ignorant here... do you mean liquid as saying you want some kind of exact simulation or do you mean liquid as in liquid? Are you doing some analytical simulation or a physical simulation. You said OpenGL which is a graphics library so I assume you're looking to draw this simulation. The thing you should be studying, first and foremost, is Physics and probably Calculus which will help you in Physics. As for programming, you can study a graphics library like OpenGL and I would also study algorithm efficiency and programming architecture because simulations usually require fast computation and sometimes a fair amount of memory depending on how detailed this simulation is.

    I'd wait for others to respond... I might have misunderstood what you were asking. I also don't know about that college, but there are some people (even moderators) on this forum from England that could probably help you with that.
    Sent from my iPadŽ

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    A start - http://en.wikipedia.org/wiki/Fluid_dynamics

    > is that a good idea considering what I want to do?
    It's just one aspect of the problem - being able to visualise what your calculations are telling you is a key part in any simulation field. Megabytes of numbers are pretty meaningless to all except the most hard core people in the field.

    To be honest, the graphics side will be easier. Studying fluid physics at university will give you all the theoretical background to being good at the subject, and you'll have first hand experience of using other peoples modelling s/w to know what works, what doesn't and what could be done better.

    Even better if you can find a course which has modules for the computational side as well.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    Thanks for the replies.

    I got interested in doing this after working with fluid and particles in Maya and realflow (3d programs)

    One of the moduels at teesside is called "simulation" an focus on fluid and liquids.

  5. #5
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Maya? Isn't that like a $5,000+ program?

    Edit: Actually, I see there is a school edition for about $400-$500
    Sent from my iPadŽ

  6. #6
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    And a free one for personal use.

    I am luck enugh to be working for a small firm

  7. #7
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    You will need to program a CFD solver (computational fluid dynamics) and I have no idea how to do that. But I reckon google does.

  8. #8

    Join Date
    May 2005
    Posts
    1,042
    CFD is the hardest area of math and physics that I have ever touched upon. I would suggest looking for pre built tools to start off. One that I've heard of is FLUent, but I'm not sure what the learning curve is to use that tool (it might not be realistic to use it).

    One of my professors held up a piece of chalk, moved it very slowly sideways in front of his face, and said that to date that's the only problem that can be accurately solved with any fluid dynamics software on a PC. Anything body larger, more complex and faster moving than that basically requires a super computer to accurately compute.

    An over simplified way to do CFD is to implement the physics for a mathematical sphere. These become your air molecules. You fill up a giant room full of these little spheres and then move a body through it. The body will bump into these little spheres, and various physical properties such as lift, drag, air density, temperature (etc) begin to emerge. The smaller you make the spheres, the more realistic it becomes. There are better approaches, but this works, just takes forever to compute.
    Last edited by BobMcGee123; 10-21-2006 at 09:18 AM.
    I'm not immature, I'm refined in the opposite direction.

  9. #9
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    If I use the Navier stoks method(not sure of the spelling, sorry) would that make life easier, or is it the same case?

  10. #10
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The point of our posts is to show you that if you intend on a real-time simulation of fluid dynamics you will need the latest version of the CRAY sitting in your house. But you can come close by approximating it and using shortcuts and pre-computed tables.

    Real time simulation is not about being 100% accurate because most complex problems in physics can rarely be solved 100% in real time on any PC. So do some research and find the variables that you feel you can eliminate. I'd suggest looking at the Microsoft Flight Simulator development website for a sample of what I'm talking about. They simulate an aircraft using about 10 to 12 laws of physics and even though it's not exactly perfect, it's damn close and believable.

    So what is it that you want to accomplish with this and why? Can you get away with eliminating some variables and/or approximating them?

    When I was coding a sky shader I could have computed the precise optical depth of one light ray from the sun to the viewer and it would have looked great, but it would have ran at about .01 FPS. I would have to integrate the equations along that ray at set points and then perform a final computation on the results of the integration. But I found an approximation function that behaves in a very similar fashion and can be run in real time.

    Running a CFD in real time on a computer is simply not an option here. You are going to have to do quite a bit of research to figure out how to approximate it.

  11. #11
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    This thread basicly turned into a "how to do fluid simulations" which was not what I intended, but probably contributed do myself :P What was really my question, was what I should learn/focus on before trying to do stuff like fluid. As there are probably no point of looking into AI programing if I want to do fluid and so on?

    Thanks

  12. #12
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    That is a completely vague question. So you get a completely vague answer.

    Stuff.

  13. #13
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    FEMLAB (now called COMSOL) is a program which solves partial differential equations. It can do what you are after. However, it is not simple to use and require a fair amount of math knowledge.

    was what I should learn/focus on before trying to do stuff like fluid.
    Mathematics, some good keywords are: "calculus", "analysis", "partial differential equations", "continuum mechanics" and "finite element method".

    .
    Last edited by Sang-drax; 10-23-2006 at 01:32 AM. Reason: Added som keywords

  14. #14
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    OK, so the hard part of doing fluid simulations are not really the programing but the math itself?

  15. #15
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by Sang-drax
    FEMLAB (now called COMSOL) is a program which solves partial differential equations. It can do what you are after. However, it is not simple to use and require a fair amount of math knowledge.


    Mathematics, some good keywords are: "calculus", "analysis", "partial differential equations", "continuum mechanics" and "finite element method".
    Don't forget physics!
    Quote Originally Posted by h3ro
    OK, so the hard part of doing fluid simulations are not really the programing but the math itself?
    You can always tell a computer "I want a green pixel", but it's not easy to know where you want to put it.
    Last edited by maxorator; 10-23-2006 at 05:29 AM.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fork, execv, spawn, or something else?
    By DavidP in forum C++ Programming
    Replies: 8
    Last Post: 01-26-2009, 04:25 PM
  2. Celestial simulation
    By G4B3 in forum Game Programming
    Replies: 10
    Last Post: 12-08-2008, 06:00 PM
  3. Role of c++ in simulation software
    By CChakra in forum C++ Programming
    Replies: 9
    Last Post: 11-18-2008, 02:36 AM
  4. Help with time simulation assignment
    By rakan in forum C++ Programming
    Replies: 3
    Last Post: 10-31-2006, 11:39 AM
  5. How to get started?
    By anoopks in forum Linux Programming
    Replies: 0
    Last Post: 01-14-2003, 03:48 AM