使用平滑粒子流体动力学进行流体模拟

发布于 2024-12-06 09:09:54 字数 916 浏览 3 评论 0原文

实际上,我正在使用 C++ 和 openGL 开发 SPH 模拟器。我现在遇到了几个问题,

我在盒子的一侧制作引发流体粒子(我将盒子作为边界体积),将它们塑造成盒子的形状,并赋予它们初始速度为零 。然后我开始主循环,中提琴,液体开始移动,这里出现了一个奇怪的现象。液体开始向各个方向扩散。

请看图片:

在此处输入图片描述 http://i278.photobucket.com/albums/kk86/ anggytrisnawan/Screenshot-UntitledWindow-2.png

从模拟开始几秒钟后拍摄的图片。对我来说这似乎很奇怪。这是我用于模拟的参数:

#define H                   0.040   // Smoothing Length
#define Rho0            1000    // (kg/m^3) water particle rest density
#define Mass                    0.012       // (kg)
#define DT                  0.001       // time step
#define TotalParticles      5000        // total number of particle

注意:目前我还没有计算表面张力。

已解决:我的错在这里..它们一开始就相互重叠..所以压力使它们散开..

Actually, I'm developing an SPH simulator using C++ and openGL. There are several problem I've encountered right now,

I make initiation fluid particles on one side of the box (I make box as boundary volume), shape them like box, and give them initial velocity equal zero. Then I start the main loop, viola, the fluids start moving, and there's a weird phenomena here. The fluids start spreading over all direction.

Please look at the picture :

enter image description here
http://i278.photobucket.com/albums/kk86/anggytrisnawan/Screenshot-UntitledWindow-2.png

That picture taken after several seconds from the beginning of simulation. It's seems weird for me. Here is the parameter I used for the simulation:

#define H                   0.040   // Smoothing Length
#define Rho0            1000    // (kg/m^3) water particle rest density
#define Mass                    0.012       // (kg)
#define DT                  0.001       // time step
#define TotalParticles      5000        // total number of particle

Note : currently I don't calculate surface tension force yet.

SOLVED : My fault here..they overlapping each other at the beginning..so pressure force make them spread..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

時窥 2024-12-13 09:09:54

从您提供的图像来看,模拟似乎是从所有粒子都在一个角落开始的。由于粒子可能必须具有一定的排斥势才能相互重叠,因此一旦模拟开始,这种排斥力将迫使粒子分开。

再说一次,您还没有显示任何代码,因此以上只是一个合格的猜测。

From the image you provided it seems that the simulation started with all the particles in one corner. Since the particles presumably must have some repulsive potential in order to not overlap each other, once the simulation starts this repulsion will force the particles apart.

Then again, you haven't shown any code, so the above is just a qualified guess.

∞琼窗梦回ˉ 2024-12-13 09:09:54

边界条件的值是多少,即哪些数字坐标是框限制?我假设,由于系统舍入误差,您的模拟会朝某个方向发展。

如果我看图片,我会觉得我正在沿着 -Z 方向向下看,并且框的左下角位于 (0, 0, 0)。如果是这种情况,那么您的粒子模拟并不保守,即倾向于将粒子推向数值 0,就像存在力场一样。

What are the boundary conditions' values, i.e. at which numerical coordinates are the box limits? I assume, that your simulation runs off into a certain direction due to systematic rounding errors.

If I look at the picture I get the impression I'm looking down along -Z direction and the lower left corner of the box is at (0, 0, 0). If that's the case, then your particle simulation is not conservative, i.e. tends to push the particles towards to numerical 0, like if there was a force field.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文