Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何处理边界条件 #2

Open
zhang-qiang-github opened this issue Nov 19, 2022 · 2 comments
Open

如何处理边界条件 #2

zhang-qiang-github opened this issue Nov 19, 2022 · 2 comments

Comments

@zhang-qiang-github
Copy link

在现有的条件下,边界条件比较好处理,如下所示:

SandyFluid/src/simulator.py

Lines 407 to 429 in 460bc68

if pos[0] <= self.cell_extent * 2 or pos[0] >= self.grid_extent[0]-2 * self.cell_extent:
vn = v[0]
v[0] = 0.0
vt = ti.Vector([0.0, v[1], v[2]], dt=ti.f32)
vt = ti.max(0, 1 - self.b_mu * ti.abs(vn) / vt.norm()) * vt
v[1] = vt[1]
v[2] = vt[2]
if pos[1] <= self.cell_extent * 2 or pos[1] >= self.grid_extent[1]-2 * self.cell_extent:
vn = v[1]
v[1] = 0.0
vt = ti.Vector([v[0], 0.0, v[2]], dt=ti.f32)
vt = ti.max(0, 1 - self.b_mu * ti.abs(vn) / vt.norm()) * vt
v[0] = vt[0]
v[2] = vt[2]
if pos[2] <= self.cell_extent * 2 or pos[2] >= self.grid_extent[2]-2 * self.cell_extent:
vn = v[2]
v[2] = 0.0
vt = ti.Vector([v[0], v[1], 0.0], dt=ti.f32)
vt = ti.max(0, 1 - self.b_mu * ti.abs(vn) / vt.norm()) * vt
v[1] = vt[1]
v[0] = vt[0]

我想请教一下,如果边界条件是复杂的三角面片,那么需要怎么处理呀?

@bobboli
Copy link
Contributor

bobboli commented Nov 30, 2022

粒子和mesh像刚体一样处理碰撞就应该可以了。碰撞点、法线、速度之类的信息都是可以算出来的。
混合方法下要处理固体边界恐怕更麻烦的是和grid相关的计算。比如,一个cell被固体占据了一部分,那么要计算某个物理量的通量,要积分的边界就不是正方体的六个面了,Poisson方程的系数会出现分数。具体的我也没有实现过,也许可以看看
Fluid Engine Development这本书,是根据代码讲解的,可能会有一些有参考价值的实现方法。

@k-y-He
Copy link

k-y-He commented Aug 5, 2023

slip boundary 是如何实现的呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants