#### Archived

This topic is now archived and is closed to further replies.

# Modelling viscosity in fluid

This topic is 5073 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am working on a project based on the "Real-time fluid dynamics for games", and I have reached a point where I need a second opinion. In the paper the diffusion of density is based on densities. It is stated that the density out of one of the sides of a cube with sidelength h is: densitychange=some_diffusion_constant*the_density*timestep/h^2 This lead to the following formula for the 3D case (diffusion through 6 cubesides) (z = some_diffusion_constant*timestep/h^2) density_next = density_prev - 6*density_prev*z + z*density_neighbour_prev_1 + z*density_neighbour_prev_2 + z*density_neighbour_prev_3 + z*density_neighbour_prev_4 + z*density_neighbour_prev_5 + z*density_neighbour_prev_6 => density_next = density_prev*(1-6)+z*( density_neighbour_prev_1 + density_neighbour_prev_2 + density_neighbour_prev_3 + density_neighbour_prev_4 + density_neighbour_prev_5 + density_neighbour_prev_6) This is solved in a special way in the paper, but that is besides the point. The point is that it is stated that the same formula is used to account for viscous diffusion between the velocity components seperatly. I cant figure out if it is just an assumption that it is so, or it has basis on a formula. My knowledge of viscosity is that it is defined by this. The force needed to drag a plate with area A on top of some fluid at a given velocity: F=(constant*velocity*area)/fluid_thickness Can anyone see the why the density diffusion can be used to account for viscosity?

##### Share on other sites
Interesting, I''m a little short of time at the moment, but I''ll probably look back in the next few days...currently I do study fluids as part of my uni course;

In the mean while a couple of questions for you;

When you refer to a paper, I assume its a paper you''ve read ? might be useful to know what the paper''s title was & who the authors where (especially if they were related to the fluids field rather than the programming field)

If you don''t mind my asking, what are you trying to achieve with this ? some kind of pollutant dispersion simulation (including things such as smoke & heat) ? is this the most appropriate solution to the problem in hand ?

My feeling about the viscosity issue is that the paper is trying to account for dispersion of the pollutant caused by turbulance (eddies) in the fluid that could occur due to the effects of viscosity esp. on interfaces.

Wrt. the assumptions; usually diffusion is expressed as something along the lines of:
dC/dt = D * C
- the rate of change of concentration (C) of a pollutant is proportionate to the existing concentration times a diffusion constant (D); I guess you could estimate the pollutant transport rates between cells by finding the concentration gradient that exists between the ajacent cells, multiplying that by a constant & then appling that rate between the cells.

One thing that does concern me about the equation you have; this is highly dependant on the fluid that everything is in not moving, otherwise the pollutant could be expected to advect (ie move with the flow).

##### Share on other sites
The paper: Real-time fluid dynamics for games by Jos Stam
http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf

I have built a 3D (simplified) fluid simulator on the principles presented in the paper.

Actually it''s a mix between that paper and "Visual simulation of smoke"
http://graphics.stanford.edu/~fedkiw/papers/stanford2001-01.pdf

It is designed for real-time computergraphics, and partly implemented on the GPU.

I am writing a report on the work done, and I am not sure why viscosity is handled the way it is.

Perhaps its just a simple (non-physical) way to model viscosity.

##### Share on other sites
I''ve read that paper, and it does not appear that the viscosity model that Stam uses is necessarily the same as what you would learn in fluid mechanics (dynamics?)

In that paper, viscosity is implemented more as velocity bleeding (for a lack of a better term). I think it''s essentially like a blur operation done on an image. Basically if two adjacent cells have different velocities, a fraction of the difference is applied to each one, reducing the difference. This is analogous to the engineering model where the difference of velocities times a modulus times an area induces a shear force that acts on the cell.

James

##### Share on other sites
The paper''s definatelly interesting! I think that James (the last AP) is probably on the money there where he says that viscosity is being implemented as energy bleeding from one cell to another.

I assume you''re planning to validate your model? It would be interesting to try some real fluids cases to see what happens. A particually good one is the Von Karmen vortex street, as illustrated in the first paper - in 3d I''d suggest using a cylinder extending all the way through and perpendicular to a flow across it. If you''ve got the right flow speed relative to the cylinder dimension you should get a rather pretty looking pattern in the flow (you''ll need a tracer in the flow for this too, release it in a small area just upstream of the cylinder to visualise the flows. The flow speed required can be found from the Rayleigh number (Ra = u*l/v - u = velocity, l=characterstic length scale (diameter here) and v = dynamic viscosity) - I''m sure you can find the range required somewhere on the internet - I''ll dig out my fluids notes sometime in the near future. The reason this would be an interesting case to try is because it does have a practical engineering significance, as you''ll see you get eddies shearing off alternately from the sides of the cylinder, that in a real structure cause vibrating forces to be applied to the cylinder, that can excite vibrations and cause structural problems.

Other interesting cases to try might be things such as the ''filling box'' problem - a closed box that contains a buoyant plume. Also try some gravity currents (like avalances) - having a relativelly dense substance decend and then spread out on to a boundary (oil slicks on water are this problem inverted - the oil floats rather than sinks).

Good luck!!

##### Share on other sites
Try this for an explaination of viscosity & hence why the assumptions made in the paper''s model''s assumptions are reasonable - I think it explains it reasonably well:

http://scienceworld.wolfram.com/physics/DynamicViscosity.html