2013年12月20日星期五

Problem related to the mass of each particle

When I implement the Ghost SPH, I found the mass of the particles influence the result a lot. When I dealing with 10K particles, the difference of 0.0001 in mass make the result totally different, I still can not find the perfect variables, continue working on it!

2013年12月19日星期四

Small size Ghost SPH simulation

Due to the limitation of my mac air. I start the simulation with small size , and get following results.

2013年12月17日星期二

Paper mistakes found

I follow the procedure  indicated by the paper to simulate Ghost SPH. For days, I can not get the satisfying results. After recheck other reference, I found two mistakes of the paper.

1. XSPH:
The equation used by the user is to calculate Viscosity velocity:
 however, it should be the term used to calculate viscosity force, not velocity.
In other word, in order to calculate the viscosity velocity, I need to divide this term by density and times dt

2. Missing of tension force
In the algorithm 3, there is no tension force term, however, it should be an important term to simulate the "real" fluid simulations, I add this force with gravity and pressure force. However, I am not sure if it follows the authors' idea.

2013年12月14日星期六

Sampling and Relaxation finish

Finish the part to sampling and relaxation the surface and volume.

Before:







After:

2013年12月12日星期四

neighbor search problem

When I implementing the Volume relaxation, I need to solve neighbor search problem, I use Grid search algorithm to accomplish the job. 
The neighbour search finds the neighbours of all particles in a particular grid cell.  All neighbouring particles must be contained in the current or one of the maximal 26 adjacent cells to speed up the search.

2013年12月10日星期二

Basic SPH simulation

Before, implementing the GHOST SPH.
I decide to simulate the basic SPH simulation first. Following video is the basic SPH simulation with 8K particles.



2013年12月9日星期一

Problem relative to the opengl shader choice

After I study the basics of oepngl shader programming, I found one hazard related to my project.  As we know, there are different versions of opengl shaders. From the old 120 version to the newest 430 version. In windows, all the version is backward compatible, however it is not the case in MAC. In current mac OSX, the basic opengl core is  2.1. User can enable 4.1 core by using following syntax

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

After I enable the 4.1 core, the shader is no longer backward compatible.  In other word, most of the online reference examples become useless. I have to make the choice : use old version of shader with less functions or use new version of shader with less tutorials and more complex. After one week of studying, I finally decide to use the old version, as a beginner for opengl, I need more reference examples. 

OPENGL enviromental setting on MAC

Since I only have a mac air for doing this project, I need to set up the opengl environment in Xcode. The basic opengl and glut library is easy to set up.
However, the extent library like glfw and glew takes a lot of time.
I found a useful youtube link : http://www.youtube.com/watch?v=cKA6FQ6p4Mg. Following this tutorial, The enviroment finally works.


2013年12月7日星期六

Kernal functions related to SPH

In the Ghost SPH paper, user just mention to use Monaghan's M4 cubic spline as kernel function , which did not make sense to me. I have read the original Monaghan's paper, and did not get any idea  to use this kernel function.
 After online searching I realize that we have more advanced kernel function which can be used.
Following poly6 kernel is used for density.

Following spinky kernel is used for pressure
Following kernel is used for viscosity