Skip to content

.397395619494580:e589aa2f1246dcb64182b291ddc4a559_69e6210c180bcf8a442e5ffe.69e62c42180bcf8a442e60b6.69e62c42966af563bdeec98f:Trae CN.T(2026/4/20 21:38:10)#115

Open
yangou-hash wants to merge 3 commits intotaichi-dev:masterfrom
yangou-hash:ouyu_trae_3
Open

.397395619494580:e589aa2f1246dcb64182b291ddc4a559_69e6210c180bcf8a442e5ffe.69e62c42180bcf8a442e60b6.69e62c42966af563bdeec98f:Trae CN.T(2026/4/20 21:38:10)#115
yangou-hash wants to merge 3 commits intotaichi-dev:masterfrom
yangou-hash:ouyu_trae_3

Conversation

@yangou-hash
Copy link
Copy Markdown

@yangou-hash yangou-hash commented Apr 20, 2026

Note

Medium Risk
Adds a new force application path into the core MPM timestep via grid_postprocess, which can affect simulation stability/behavior. The PR also vendors substantial third-party code under local_packages, increasing repo size and potential for dependency/packaging issues.

Overview
Adds a new MPMSolver.add_wind_field() helper that injects a Taichi kernel into grid_postprocess to apply a constant force to grid nodes within an axis-aligned bounding box each substep.

Updates demo_3d.py to run on CPU, adjust sys.path for local_packages, and showcase the new wind field; adds test_wind_field.py (print-based sanity check) and wind_field_visual_test.py (GUI visualization) for validating motion under wind.

Also vendors additional tooling/dependencies under local_packages (notably colorama and dill plus scripts), which is a large non-functional code addition to the repo.

Reviewed by Cursor Bugbot for commit 6d6c9a2. Bugbot is set up for automated code reviews on this repo. Configure here.

实现风场效果功能,允许在特定区域内施加风力。新增add_wind_field方法,通过指定区域边界和风力向量来创建风场效果,并在网格后处理阶段应用风力影响。
本次提交新增了多个Python包和工具模块,包括numpy、taichi、rich、markdown_it等核心库及其相关依赖。主要包含以下内容:

1. 新增numpy核心库及其类型检查、测试工具
2. 添加taichi图形计算框架及其UI、数学、线性代数模块
3. 引入rich终端格式化输出库
4. 集成markdown_it Markdown解析器
5. 包含colorama、pygments等辅助工具
6. 添加各类测试用例和示例代码
7. 完善构建配置和文档说明

这些新增内容为项目提供了强大的科学计算、图形渲染和文档处理能力。
添加新的风场可视化测试脚本 wind_field_visual_test.py,包含完整的粒子模拟和交互界面
修改 test_wind_field.py 配置,忽略警告并设置日志级别为 ERROR
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 6d6c9a2. Configure here.

Comment thread engine/mpm_solver.py
if inside:
grid_v[I] += dt * ti.Vector(force)

self.grid_postprocess.append(apply_wind)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wind field runs after boundary box, overriding enforcement

Medium Severity

The add_wind_field method appends the wind kernel to grid_postprocess, which places it after the bounding box (added first in __init__). Unlike existing postprocessors (colliders) that only remove/zero velocity, wind adds velocity via grid_v[I] += dt * ti.Vector(force). This can re-introduce velocity at boundary grid nodes that grid_bounding_box just zeroed out, allowing particles to escape the simulation domain when the wind zone overlaps boundary regions with a force component pushing toward a wall.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6d6c9a2. Configure here.

Comment thread demo/demo_3d.py
@@ -1,12 +1,16 @@
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'local_packages'))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entire local virtual environment committed to repository

High Severity

The local_packages/ directory contains a full Python virtual environment (numpy, taichi, rich, pygments, colorama, dill, markdown-it, mdurl, and more) — none of which are imported by the project code. The sys.path.insert calls referencing local_packages are added to demo files, and the bin/ scripts contain hardcoded Windows paths like E:\ProgramFiles\Anaconda\python.exe. This massively bloats the repository with redundant vendored copies of packages already listed in requirements.txt.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6d6c9a2. Configure here.

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

Successfully merging this pull request may close these issues.

1 participant