# DrummerB

Members

2

104 Neutral

• Rank
Newbie
1. ## Realistic Fluid Simulation

Well, that could work in theory, but I have trouble implementing it. I tried both of the methods you mentioned using the fixed grid approach. Redirecting velocity vectors at the screen boundaries is how people usually implement a simulation where the smoke isn't supposed to leave the screen. This could probably be applied to objects in the simulation that are placed exactly on cell boundaries, but what if that not the case? [img]http://i.imgur.com/XnkQp.png[/img] Imagine an upstream airflow in the above situation. At the rectangle's bottom edge, in which cells would I redirect the vectors? The ones that are completely outside (below) the rectangle, the ones on the edge or the ones inside? None of these seem to be a good idea, because either the smoke would be redirected early (making it look like the rectangle had some repellent force on it), or the smoke would go inside of the box. At least that's how I see it. This is what I meant, when I said that a way too high grid resolution would be needed to get rid of artifacts. And once you add arbitrary polygons and rotations it really looks like a lost cause. [img]http://i.imgur.com/wgOJy.png[/img] This is why I started investigating the vortex method. Even though you still have to calculate a velocity grid from all the vortons, you can place the vortons at any position, not just on the grid. This made me think I could get better results. But I'm still not any closer to a working prototype.
2. ## Realistic Fluid Simulation

Hi, I'm new to this forum, but I thought this might be the right place to ask for advice. I'm trying to create a realistic, physically correct (looking) smoke effect in 2D. For more than a week now, I've been experimenting with different approaches in the fluid dynamics field. I successfully implemented an Eulerian fixed-grid algorithm (based on [url="http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf"]this[/url] and [url="http://cowboyprogramming.com/2008/04/01/practical-fluid-mechanics/"]this[/url] article) and it works as expected. [img]http://i.imgur.com/s9IsV.png[/img] (The cells are not smoothed for debugging purposes). However I just can't figure out how to implement boundary conditions for rigid bodies in the simulation. Being able to simulate realistic airflow around a ball and turbulences behind a moving object is why I started working on this in the first place. I spent hours googling and reading through countless articles and papers, but all of them just say that you have to account for boundary conditions when setting up the velocity equations or apply a poststep fix, but they never go into details. I'm also starting to think that a grid based method is not the best for simulating airflow around arbitrary placed and shaped objects, because you would have to use a very high resolution grid to get rid of artifacts. Correct me if I'm wrong. I also investigated vortex based methods, where you use an array of vortex particles (vortons) to represent the airflow. The vortons aren't fixed, because they are affected by the velocity field they create. So they move around and change their angular velocities. It's a bit more complicated then a fixed velocity grid method, but the real problems only arise once I want to add rigid bodies to the simulation. Let's say I just calculated the velocity field for the current frame from all the vortons in my simulation and it turns out to be a very simple one: [img]http://i.imgur.com/I7gjn.png[/img] Now I want to account for the orange ball in this flow. Wether the ball is stationary and the air is moving past it, or the ball is moving to the left in a non-moving field doesn't really matter. In some articles they suggest adding auxiliary vortons somewhere along the surface of the body to redirect the airflow and satisfy the boundary conditions. But I couldn't yet figure out where and what kind of vortons have to be added. [img]http://i.imgur.com/l1sy1.png[/img] In the above case we could determine the ambient air velocity [i]V[sub]A[/sub][/i] at a point [i]P [/i]on the ball surface and place a vorton alongside a line normal to the airflow. Then we specify a vorticity (angular velocity) of the vorton, so that the velocity it creates equals [i]V[sub]V [/sub]= -V[sub]A[/sub][/i] at [i]P[/i]. This way all velocity at [i]P[/i] is canceled and the boundary conditions are satisfied at [i]P[/i]. The problem is, that there are two possible ways to place the vorton (to the right or to the left of the airflow vector). Placing the vorton on the other side also means we have to reverse it's vorticity. How to we find out where to place the vorton? We could use the angle between the normal vector at [i]P[/i] and the airflow to separate the vortons into clockwise and counter-clockwise vortons. This would result in something like this (blue: clockwise vorton, red: counter-clockwise vorton): [img]http://i.imgur.com/fAYtZ.png[/img] This looks like to could work, but I'm not sure. What do you think? The air infront of the ball is pushed away, and it sucks in some air behind it. However in the case of a rectangle it won't work: [img]http://i.imgur.com/TF0ZN.png[/img] Using the surface normals to categorize the vortons into CW and CCW ones will result in a row of vortons all turning in the same direction. Instinctively I would categorize them like this: [img]http://i.imgur.com/OZDTg.png[/img] This looks more like what one would expect (although I'm really not sure), but how could this be implemented? One could use the distance from the edges, but that sounds more like a hack then something stable. Or maybe I'm completely on the wrong track and there is a better way to do all of this? Any hint, advice or useful link would be very appreciated. Thanks for reading.