My Fluid Simulation (SPH) Sample (1) – Rigid body model + N-S model
来源:互联网 发布:linux命令打开到文件夹 编辑:程序博客网 时间:2024/04/19 08:32
I keep a strong interest for fluid simulation (specifically water simulation) and this is my first implementation for SPH (Smoothed Particle Hydrodynamics).
This post is the first part of the whole application – SPH framework.
1) Rigid Body model
Rigid body model indicates that all particles, scene walls and barriers are not elastic – it will repel other rigid objects away when they hit it. Navier-Stokes equation will be directly applied on rigid particles, just like the real world situation : molecules cannot converge.
Collisions with walls/barriers
There are no repulsion forces. Only velocity is ‘reflected’ by the hit point normal, as light ray reflection. This works well.
Collisions with other particles
The physical model among particles is from GPU Gem 3 Chapter 29:
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch29.html
But how to get a proper spring coefficients and damping coefficients is not easy, and inappropriate configuration could make your particles crazy or sluggish.
(Rookie Hint - [Collision Detection] : |currPos – wall| < epsilon is not the correct solution that suffers from precision problem in ANY case bcz. you can never predict particle velocities. The right solution is to judge whether the predicted position in next frame is beyond the wall or not)
2) Navier-Stokes model
The basic idea is still from [Muller 2003] as mentioned before. Interestingly this paper doesn’t mention SPH is based on rigid particles and this may bring confusions to SPH beginners as me.
I refered to the following link for the maths part.
http://www.rchoetzlein.com/eng/graphics/fluids.htm
3) Grid Acceleration
I split the whole scene space by about 10*10*10 grid cells, and only particles in neighboring grid cells (27 cells) are considered when calculating pressure/viscosity kernels. This improves the performance by about 100% when particles number is about 700 on CPU.
[Screenshots]
Let me show you a sequence of screenshots here:
You can see the splashing when particles hit the ball barrier and they are ‘flowing’ on the ground – see the small waves! I think it will look much better when we have more particles like 50000.
There are total 1600 particles with FPS averaged at about 1.3 fps – I haven’t done ANY code optimizations yet.
Yes the following work is:
- Fluid surface reconstruction (it is even harder man…)
- GPU acceleration
Just wait for me…
- My Fluid Simulation (SPH) Sample (1) – Rigid body model + N-S model
- My Fluid Simulation (SPH) Sample (3) – Optical Effects using GLSL, and Integration of Physical Model
- My Fluid Simulation (SPH) Sample (2) – Curvature Flow
- TCP Fluid Model
- SPH fluid simulation methods & source codes (cpu & gpu)
- Charged Fluid Model for Brain Image Segmentation
- 局部模特 body parts model
- .NET customizedconfiguration model sample
- NAND Flash Simulation Model设计总结
- GARCH MODEL in R, Sample Code for GARCH(1,1)
- Model?
- Model
- model
- model
- Model
- model
- Model
- model
- ICFfaces框架
- Mysql-CAST/CONVERT 类型转换函数之 整型
- Devcpp(Dev C++)使用说明及技巧
- 解决datalist中radiobutton单选的问题
- 详解“InnoDB”和“MyISAM”的不同之处
- My Fluid Simulation (SPH) Sample (1) – Rigid body model + N-S model
- 下面我们将详细讲解如何在Page_Load()中对数据库的增加、删除、修改,最后我们再来总结一下ExecuteNonQuery(),ExecuteScalar(),ExecuteReader的用法
- C# 自定义异常
- IE8兼容IE7CSS
- 关于树形结构的查询——使用with cet递归(2005及以上版本)
- 基于需求的测试用例设计方法
- Linux上远程登录Windows的桌面
- 哈里
- 隐藏文件五大妙招