太极图形课S1-tiSPHi: from 0 to 0.1

背景简介

The logo is modified from a basic SPH logo by MichellLaurence on DeviantArt

HINT

Know almost nothing of SPH → Learn basic SPH theory → Learn basic WCSPH codes → First try: adding dummy particles → Learn standard SPH theory for soil → Try to implement SOILSPH code → Failed to understand D-P criterion for soil and also cannot implement it in SPH → Failed to adapt the stress and other paras of soil → Failed to add repulsive forces in repulsive particles, so cannot delete the collision code in `SPHBASE`Failed to finally use RK4 to advect soil particles → Return to add repulsive forces in WCSPH to delete the collision code but again FailedTry to use RK4 to update particles instead of Symp Euler method, and finally succeedIt comes to the deadline

作业来源

文献

1. 待复现的目标文献 (CM Chalk 2020): Stress-Particle Smoothed Particle Hydrodynamics: An application to the failure and post-failure behaviour of slopes
2. CM Chalk的博士论文2019(包含在Stress Particle SPH的GitHub内)
3. Ha H Bui 2021: Smoothed particle hydrodynamics (SPH) and its applications in geomechanics: From solid fracture to granular behaviour and multiphase flows in porous media
4. Ha H Bui 2008: Lagrangian meshfree particles method (SPH) for large deformation and failure flows of geomaterial using elastic-plastic soil constitutive model

运行方式

运行环境：

`[Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, win, python 3.8.1`
`[Taichi] Starting on arch=cuda`

运行方式

1. `world`: 容器的物理边界尺寸，单位m
2. `particle_radius`: 物质点粒子半径
3. `kh`: 支持域半径对物质点粒子半径的倍数
4. `cube_size`: 水柱的宽度与高度
5. `flag_pause`: 模拟开始时的暂停状态
6. `add_cube`函数中可调整初始速度、初始压力、密度、颜色等属性

快捷键

1. `SPACE`控制模拟的开始/暂停
2. `ESC`停止并退出模拟

效果展示

my WCSPH

Advect with Symplectic Euler
Video of WCSPH with Symp Euler

Video of WCSPH with RK4

Compare the specific frames of these two result: (RK4 on the left and Symp Euler on the right)

(I think the RK4 advection represents a better result, BUT really it is very very very very very slow!!!)

SPlisHSPlasH

WCSPH in SPlisHSPlasH (also I think my wcsph simulation looks better than that in SPlisHSPlasH)
Video of WCSPH in SPlisHSPlasH

DFSPH in SPlisHSPlasH (but still not as good as DFSPH)
Video of DFSPH in SPlisHSPlasH

整体结构

``````-LICENSE
-|data   --存放动图、视频等数据
-|eng    --存放engine代码
---__init__.py
---particle_system.py
---sph_solver.py
---wcsph.py
---soilsph.py
-|img    --存放图片
-|temp   --存放测试代码、学习资料、算法流程图、草稿、临时文件等
-draft0.py        --最初的测试代码，无用
-draft1_soil.py   --测试SOILSPH使用的代码，目前尚未完成且存在错误
-draft2_water.py  --测试更新后WCSPH使用的代码，目前尚可正常运行
-Hint.py          --记录编程过程中的一些烦恼以及锻炼英语
-note_SPH.md      --学习笔记
``````

实现细节：

1. `ParticleSystem`中加入了边界`dummy particles`的生成(基于`add_cube`函数)
2. `SPHSolver`中加入了速度等重要信息最大值的每一步的输出，用于检查
3. `WCSPHSolver`中加入了文献中的边界处理方法，即在对每一个流体粒子`i`的循环过程中，处理`i`的支持域中存在的`dummy particles`
4. `WCSPHSolver`中实现了RK4时间积分方法(尽管它巨慢无比，尚未知为什么4倍的计算量导致计算速度降低至少20倍)
8 Likes

Congrats! Now achieve the very first successful step:

A 0.4m*0.2m dambreak of sand (ρ=1680kg/m3, φ=29°) with the pure μ(I) model, leap frog time integration, Wendland C2 kernel, normalised approximation of the gradient of velocity, and coloured by velocity. Please see the video.

However, there is still many problems in the code. BUT now, go ahead to improve my tiSPHi!

Screenshots:

2 Likes