Excel simulation

The Borg

Senior member
Apr 9, 2006
494
0
0
Hi all,

This has been bugging me for a long time. I love Excel, so want to try this there if possible.

If you look at water flowing across an area of loose gravel (say in your garden, or a stream across sea sand, or, on a large scale, how a delta forms) you see these grains of sand move and then fall off the edge. Then the next one comes along. You will also see the water move as a valley is filled up and another becomes the local low point.

Just for sh1ts and giggles, how would you simulate this, preferable in Excel? I am missing the calculation and the logic to proceed. The programming in Excel should not be a problem.

Any ideas? Or should I just keep imagining???
 

degibson

Golden Member
Mar 21, 2008
1,389
0
0
Thats an interesting idea. It depends on how faithfully you want to model flows, pebbles, positions, etc. After all, there are entire fields devoted to fluid mechanics. However, if you're just looking for a cool visualization, then you probably want a directional averaging function, e.g. cell x, y is assigned the value of AVG( cell(x-1,y-1), cell(x-1,y), cell(x-1,y+1) ) for left-to-right flow. I'm not sure how you want to simulate pebbles, and you'll have to bootstrap the left-most column with some update-over-time function (I'm not sure how to do that in Excel). Then have the color of the cell depend on the value of the cell, etc.
 

The Borg

Senior member
Apr 9, 2006
494
0
0
I have done something like to that years ago to simulate the flow from burners on the side wall of a boiler, but after 1000's of runs, it just does not seem to work well. Gives nice patterns if you plot the result of a large grid using the 3D graphing with a top down view. Waht seems to be the problem there is the averaging. If I understand your reference, the 'side wall burners' had high values (bootstap???) and then after many cycles, these values would average into the boiler. But this averaging drive slows down.

What I am more interested in visualising is how the particles (as they are the visible ones) move due to the local low points. Think of how water creates donga's and carvings into mountain sides. Not sure if that is making it any clearer.
 

QuixoticOne

Golden Member
Nov 4, 2005
1,855
0
0
Boy... let me first say that a truly ab initio "first principles" accurate solution to this (even with a small area of flow the size of a bathtub) is computationally intractable for the largest supercomputers on the planet. The fluid dynamics of water flowing around millions of rough surfaced somewhat porous sand / pebble grains and then taking into account granule friction, lubrication / hydroplaning effects, propagating vibrations, kinetics of moving granules, et. al. would involve probably terabytes of RAM, equations with probably billions of unknowns to be solved at timescales of like every 1/10,000 second, et. al.

Now if you want to "cheat" you can come up with a very nice "visually convincing" simulation with graphics technology using empirical models of the flows / catastrophies (avalanches, erosion processes) et. al. If you were really interested I expect I could find some references to industrial / scientific grade codes that could be (or are) used for this sort of approximate solution. You'd probably need a LINUX box to run most of the stuff and be familiar with building / using various C / Fortran types of engineering applications, OpenGL visualization tools, et. al.

If you just want to do it yourself, you could tinker around with some elementary mathematical models and see what happens. Look at the "fluids" demo from NVIDIA. In fact look at all editions of their GPU GEMS book series, (I), (II), (III), and download the code and the available chapters / articles from their web site. They have excellent tutorials on simulating fluid flows, solid particle sprays, particle dynamics, et. al. for GPUs and CPUs.
If you have a NVIDIA 8600GT or better GPU you'd be well advised to just run some of their codes and play with the math / models / equations to get an understanding and visualization of them; it will be FAR easier than trying to recreate that in EXCEL or most other packages.
Actually some of the older GPU GEMS (I/II) codes probably would run on 6600GT or 7600GT series GPU cards.
http://developer.nvidia.com/object/gpu_gems_home.html
http://developer.nvidia.com/object/gpu_gems_2_home.html
http://developer.nvidia.com/object/gpu-gems-3.html
Some of the ShaderX books are free and worth reading too:
http://www.realtimerendering.c...ble-for-free-download/
http://www.shaderx.com/
http://www.shaderx3.com/
http://www.shaderx4.com/
http://www.shaderx6.com/
http://www.cs.utk.edu/~huangj/...Shader_Programming.pdf
http://users.ece.gatech.edu/~lanterma/mpg/

Any basic physics book or online math/physics reference site will have simplified equations for drag, viscosity, kinetic energy, et. al.

As you start getting into more custom models you'll want to check out some of the game physics / dynamics engines to see what kinds of particle / fluid systems they may be capable of, however I think the best models / advice will be from places like the GPU GEMS codes since most game physics / dynamics engines are sort weak on the fluids/particles perspective especially from a pedagogogical / experimental perspectives.
http://en.wikipedia.org/wiki/Game_physics
http://www.gamedev.net/reference/list.asp?categoryid=28

Some rendering / scene graph tools may help too:
http://www.openscenegraph.org/projects/osg
http://en.wikipedia.org/wiki/OpenSceneGraph
http://en.wikipedia.org/wiki/OGRE
http://www.ogre3d.org/
http://en.wikipedia.org/wiki/Irrlicht_Engine
http://irrlicht.sourceforge.net/

Once you have a rough bugs bunny / cartoon level simulation working of the combined fluid + particle + erosion shaders / models going, you can always use something like povray,
yafray, gelato, or whatever free quality rendering system to do a non real time simulation and high quality rendering for a beautiful movie.

The basic physics are:
laminar fluid flow
turbulent fluid flow
kinetic energy transport between a fluid flow and a solid particle / particle flow
kinetic energy of fluid cells
kinetic energy of particles, linear momentum, angular momentum
solid rotations (tumbling, rolling)
simulated annealing / hamiltonian mechanics / minimization (grains settling into low points and mound building and so on)
time-stepping / integration / differential equation algorithms to simulate continuous physics in discrete time steps
friction
drag
stability
erosion
chaos
avalanche processes

Excel? No way.. sure you could probably write a few equations to predict erosive rate or flow rates through a sump / leech field, or so on, but it'd be horrible for visualization or complex programmatic calculations.

 

The Borg

Senior member
Apr 9, 2006
494
0
0
Just as I though. A bit much for Excel. Damn. I just get so frustrated when I can imagine better than I can program or see on a PC.

QO. Man. Thanks for an explination that is probably worth way more than my original quiestion. Thanks a million!!!
 

The Borg

Senior member
Apr 9, 2006
494
0
0
BTW, as a DC cruncher with just a little bit of PC power to my disposal, I find it furstrating I cannot us it for this type of thing. I could probably come close (well I can try) to the power you are commenting about.
 

QuixoticOne

Golden Member
Nov 4, 2005
1,855
0
0
Oh even on a modest single core Athlon PC or something you could do a very lovely visual simulation, but it'd be basically a "video game" computer graphics demo moreso than a real simulation of a real system in significant detail.

In the end the gross results (erosion, mound / channel building / drainage) would look pretty similar to what you might get in the real world, but the fine details of the process would be quite different from reality.

You could certainly do an effective simulation to get the visuals you wanted, it is just a matter of "cheating" and not trying to model it in physical reality to an unnecessary level.

I'm into DC / simulations sort of too and I agree it is frustrating to be able to think of a problem to analyze / model and find out that it is super hard to actually do that on the computer that is more than powerful enough just because the software is unavailable or very limited / difficult to use.

Even a darn *calculator* program on a PC is next to useless; I'm always whipping out my handheld scientific calculator rather than punching graphical buttons on screen and not even being able to cut / paste / scroll back / create custom memory tables and formulas etc.
Or just try using excel to do a simple worksheet like you'd do in MatLab, say,
C = e0 * A / D
where you can interactively change any one of the variables and see the dependent ones change... too primitive UI in EXCEL and too little formula / physical database integration or whatever with MatLab / SciLab, etc. etc. etc.

Heck if you have a simple formula with greek letters or subscripts / superscripts / whatever and want to calculate it in Excel even that is a pain to do "what you see is what you get" formatted in a way that you'd actually write the equation on paper, but calculated according to a spreadsheet or stored formula calculator or whatever.

We have very powerful computers (an average desktop now is better than an Cray YMP supercomputer of the 1970s), and really really really HORRIBLY hard to use software.

I just noticed your GHz sig... sounds like we probably have similar clusters.

A lot of the GPU based simulations you can run under Windows just fine. A lot of the more serious scientific modelling codes you'd want to run in LINUX even if only in a virtual machine which shouldn't be a problem given your setup (except for point loss due to resource use), though it'd still take a fair bit of effort to set up the s/w and use it.

 

The Borg

Senior member
Apr 9, 2006
494
0
0
The last link you had goes to a very intersting page which (at the bottom) describes probably what I was originally after - Hydrogeology. Hydraulic erosion. Nice name for just an idea.

My cluster is 11 x P4 3GHz, AMD 64, AMD 64 X2, and 3 other slower machines (abour 1GHz). I can see my RAC is slowing a bit now as the Core machines starting taking over. I will add 3 x Quads sometime next year and then build another 7 machine rack later.

One day: Windows XXX will have got to the point where you expand power by plugging in an extra box. One interface over many machines. I was home networks coming, I saw multimedia PC's coming, now lets see...