CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

CFD in Games

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2006, 10:36
Default Hello everyone, I'm working on
  #1
New Member
 
Daniel Olausson
Join Date: Mar 2009
Location: Sweden
Posts: 3
Rep Power: 17
malice is on a distinguished road
Hello everyone, I'm working on a project where I'm adding the flow of water into a submarine game and OpenFOAM got recommended.

What I want is a scene with some static objects affecting the flow of water. I will be using one of the sides of the scene as an inlet and the opposite side as an outlet. The effects I want it to simulate is the Coanda effect, turbulence and venturi. I'm also planning on using it for simulating airflow but only on a rough scale so the system is incompressible. Also, The surface of the water is not of interest, just the internals.

I've had a look at your C++ documentation and almost fainted when I saw the size of it, I don't have a clue where to begin and the project would be over before I figure out what classes/functions I need for my simulation. Also, I will be visualizing all this myself so I won't need any GUI or graphical representation of the simulation.

So my questions are:

Is OpenFOAM a good option for me to use?
If yes, where do I begin and what classes will I need?
Are there exporters for either 3DS Max or Maya to the format OpenFOAM uses?
Will it be difficult converting the results from OpenFLOW to a three dimensional matrix that covers my scene? (Each of the cubes in the matrix will be of equal size and I wish to average the flow within each of the cubes to the "cube's flow" so that I can easely limit the amount of time my particles will have to spend finding out what flow they are supposed to follow.)
malice is offline   Reply With Quote

Old   April 14, 2006, 16:06
Default To answer your first question:
  #2
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
To answer your first question: did you see the fluid simulation tool in Blender? Something like that is probably easier to integrate.

http://mediawiki.blender.org/index.p...uid_Simulation
mattijs is offline   Reply With Quote

Old   April 17, 2006, 15:16
Default Looks interesting, although th
  #3
New Member
 
Daniel Olausson
Join Date: Mar 2009
Location: Sweden
Posts: 3
Rep Power: 17
malice is on a distinguished road
Looks interesting, although the mesh generation for each frame sounds hefty. I'll have to have a closer look at how it works.

Currently it seems that all more correct forms of simulation (Using navier-stokes equations) are to slow to perform in real time and very difficult to implement or integrate. I'm thinking more along the lines of using Cellular Automata instead since the simulation need only look realistic to the untrained eye. Do you think this might be a better choice for me?
malice is offline   Reply With Quote

Old   April 17, 2006, 15:38
Default A cellular-automata-like solut
  #4
brooksmoses
Guest
 
Posts: n/a
A cellular-automata-like solution is probably the easiest way, yeah. You don't need cellular automata as such; mostly what you need is to approximate the Navier-Stokes equations in such a way that all the time-consuming parts are gone.

The big time-consuming part is the pressure equation in an incompressible flow, because that requires a simultaneous solution across the entire flowfield for each timestep. To eliminate that, you want to use an "artificial compressibility" approximation, which adds in the right amount of compressibility such that the pressure waves (the fastest information transfer in the system) travel at a speed of one grid cell per timestep.

Similarly, you can probably eliminate viscosity. Or, better yet, eliminate any explicit calculation of viscosity, and use a first-order upwind calculation of the convection derivatives, which gives you enough viscosity as a side effect to make the calculation unconditionally stable.

Turbulence is going to be tricky; you don't want to try to simulate it unless you really need it. The "turbulent viscosity" effect of it can probably be rolled into the rest of the viscosity calculation (which is, if you're doing first-order upwinding, very approximate anyway). The other effect you may want is dispersion of particles carried by the flow; just approximate this by adding a random perturbation to the flow velocity each one sees at each timestep.

You should use the 3D mesh of cubes that you already have as your computational mesh. Look into some sort of immersed-boundary method for handling the location of solid objects within it, or to a first approximation just divide all the cubes into "object" or "fluid", and set the fluid velocity in the "object" cubes to zero (or whatever the object velocity is) rather than the fluid velocity.

As a completely different approach, though, you might look at using a "meshfree" method that simulates the motion of particles without using a mesh at all; see Brian Schlatter's project at http://www.physics.oregonstate.edu/~...ian/index.html for one example.
  Reply With Quote

Old   April 17, 2006, 16:03
Default Also, it occurs to me that the
  #5
brooksmoses
Guest
 
Posts: n/a
Also, it occurs to me that there are some important questions to ask:

Are you wanting a steady-state solution, or one that changes with time? (Steady-state solutions are actually harder; essentially, you have to take an unsteady one and run it until it stops changing, though there are ways to make it a bit faster than that.)

What is the desired output from the simulation? Are you tracking particles moving passively in the flow? Computing the force exerted by the flow on small self-propelled particles? Computing the force exerted by the flow on large things? Computing the amount of flow that will go into different holes? Or something else? The sort of accuracy you need depends quite a bit on what exactly you're doing.
  Reply With Quote

Old   April 17, 2006, 20:35
Default FYI, the CSIRO maths division
  #6
New Member
 
Richard Morgans
Join Date: Mar 2009
Posts: 16
Rep Power: 17
rmorgans is on a distinguished road
FYI, the CSIRO maths division are working on smooth particle hydrodynamics for movies - there's a small grab at the bottom of this page

.html,http://www.csiro.au/csiro/content/standard/ps58,,.html

not sure how far it's gone - I've seen an animation of water falling down stairs & a box floating in a stream of water - looking pretty realistic.

Cheers

Rick
rmorgans is offline   Reply With Quote

Old   April 17, 2006, 20:43
Default That link doesn't work if you
  #7
New Member
 
Richard Morgans
Join Date: Mar 2009
Posts: 16
Rep Power: 17
rmorgans is on a distinguished road
That link doesn't work if you click it - for some reason it gets mangled as I post it and cant correct it... you'll have to cut and paste from the "http... onwards.

R
rmorgans is offline   Reply With Quote

Old   April 18, 2006, 05:16
Default Hi Richard! If I get it rig
  #8
Member
 
Petr Vita
Join Date: Mar 2009
Posts: 59
Rep Power: 17
pvita is on a distinguished road
Send a message via MSN to pvita Send a message via Skype™ to pvita
Hi Richard!

If I get it right, did you asked if you can import your 3D models from 3D Studio Max/Maya for further in game simulations?

I am not sure what the game sort you are exactly trying to do, but as far as I know, typical game physics gets no more as 20% of CPU at most as the rest is going on graphics, AI and scene/world updates, networking. My personal point of view is that men here are those who gets mostly 100% time for their simulations and that are simulating (or at least trying it) near any possible physical interaction. Be aware of them!

I am not sure about that blender plugin mentioned above, but I am afraid it can take its time as well to compute whole scene animation. I would suggest you simply fake it in some very primitive manner even on the level of secondary school that will just provide a small feel of physics or you will get lost...

PV
pvita is offline   Reply With Quote

Old   April 23, 2006, 15:47
Default Thanks all for the feedback, t
  #9
New Member
 
Daniel Olausson
Join Date: Mar 2009
Location: Sweden
Posts: 3
Rep Power: 17
malice is on a distinguished road
Thanks all for the feedback, this is exactly the kind of information I'm looking for.

Now to answer questions:

Moses 1 - I'm looking for an unsteady state solution yes.

Moses 2 - I'm tracking particles moving passivly in the flow for large volumes of water, such as an underwater canal where some large bedrock sticks up. (Not that there are canals with that appearance, but that's about the precision I need.) The particles themselves won't affect the flow, everything affecting the flow will be static.

Vita- Yes, the physics part won't be getting that much time on the cpu. My question regarding models from maya/3ds max was concerning openfoam, if there are plugins for these programs to convert my models to a format that openfoam uses.
malice is offline   Reply With Quote

Old   April 24, 2006, 08:13
Default I'm afraid you will need some
  #10
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
I'm afraid you will need some other program apart from maya/3ds: these programs are only interested in the surface of things (sounds real philosophical): this means that they will only generate a mesh on the surface. For the CFD calculation you need a mesh of the volume too. So you'll need at least a program that can read the maya-surface, generate a volume mesh and write it to OF (or in a format that OF understands). (Might exist, but I don't know any)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   May 2, 2006, 09:54
Default Blender looks really nice!!!
  #11
frank1
Guest
 
Posts: n/a
Blender looks really nice!!!
  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 12:35.