Skip to main content
gamedev.net
🔒 Locked

backwards euler question

Started by justo May 10, 2006 at 11:55 AM 1 replies 1.1k views
Original Post
justo
justo
[wrong forum before] hey guys, i've been doing some gpgpu programming for work recently, and i'm just in the last week using some of the quick prototyping tools i've developed for fun. a couple of years ago i put together a stam-style fluid simulator, and i had read the gpu gems article a while back from mark harris, so i figured that would be fun to implement. *however*, my advection code is not working, and while it's probably just a bug (though the shader code is very simple), now that i think about it, i don't understand how it could work at all (which it clearly does, as my cpu based version works great). basically i'm getting discontinuities in the flow, where on one cell the velocity field will be pointed to the right and in the next it will still be 0, and any force added to the field will only move up to that discontinuity and not pass it, unless you put a force right on top of it. this is the wrong behavior (as far as i can tell), but it got me thinking about how it should work in general. my question: if a cell's velocity is based on a sample of the field located at its position - (dt*its current velocity) but its current velocity is zero, how could it ever sample anything but itself? is diffusion the only mechanism to combat this (it can't be since harris doesnt even implement diffusion due to inaccuracy in the advect step)? i know theres probably a simple explanation and my brain is just blanking, so any help would be greatly appreciated! [Edited by - justo on May 10, 2006 12:46:46 PM]
StormArmageddon
StormArmageddon
If I'm not mistaken, your problem actually rests with your projection code. You can test this by setting the velocity to some fixed value everywhere and seeing if the density moves correctly (thus testing avection). The projection code makes the velocity field divergenceless, meaning given an input velocity of a single velocity at one point, the pressure field will create other velocities which you subtract from the input velocity using the Helmholtz-Hodge Decomposition to make it divergenceless.

Hope I explained that ok.
justo
justo
yep, thats perfect...my projection code was sampling wrong. i was completely correct in my assesment of the backwards euler method in this case, just forgot a pretty vital part of the process :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.