chore: SR pipeline restructuring + DRL training infrastructure

SR_analysis restructured:
- Stage 1/2/3/4 unified pipeline with per-stage docs
- Old scripts/sindy/validate moved to old/archive
- Results reorganized: formulas/validations/figures with scene_registry.json
- Added diagnostic plots and PIPELINE.md

drl_pinball/train:
- New illusion training pipeline: env_illusion.py, train_illusion.py
- Cross-Re transfer: crossre_transfer.sh, extend_transfer.sh
- Calibration data: 0.75L/1L/1.5L/2L + re60/re100/re200/re400
- Launch scripts for multi-GPU training

Cleaned 100+ intermediate/dead files from SR_analysis.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Frank14f
2026-07-05 17:36:29 +08:00
co-authored by Cursor
parent 5f061bec06
commit 1835f517e9
215 changed files with 2230 additions and 2376 deletions
+57 -60
View File
@@ -1,84 +1,81 @@
# SR_analysis: Symbolic Regression Analysis Pipeline
# SR_analysis: Symbolic Regression for DRL Flow Control
Extracts interpretable control laws (`obs -> act`) from DRL-trained policies for the
fluidic pinball. Uses **PySR symbolic regression** on dimensionless physical features with
G-equivariant structural constraints (v23: front no-bias, rear shared-head).
Extracts interpretable control laws (obs -> act) from DRL-trained PPO policies
for the fluidic pinball using PySR symbolic regression. Validates all formulas
in CFD closed-loop and produces publication-quality figures.
## Pipeline
```
stage_1_infer.py -> stage_2_fit.py -> stage_3_validate.py -> stage_4_analyze.py
(PPO data) (PySR formula) (CFD closed-loop) (paper figures)
```
## Quick Start
```bash
# 1. Generate PPO data
# Generate PPO inference data
conda run -n pycuda_3_10 python stage_1_infer.py --scene karman_re100 --device 2
# 2. Fit formula
conda run -n sr_env python stage_2_fit.py --scene karman_re100 --mode per-scene
# Fit symbolic formula
conda run -n sr_env python stage_2_fit.py --scenes illusion_0.75L,illusion_1L --mode joint --deep
# 3. Validate in CFD
conda run -n pycuda_3_10 python stage_3_validate.py \\
--scene karman_re100 --device 2 --mode pysr \\
--formula-front results/formulas/karman_joint_front.json \\
--formula-top results/formulas/karman_joint_top.json
# Validate in CFD
conda run -n pycuda_3_10 python stage_3_validate.py \
--scene illusion_1L --device 2 --mode pysr \
--formula-front results/formulas/illusion_joint_front.json \
--formula-top results/formulas/illusion_joint_top.json
# 4. Analyze
conda run -n pycuda_3_10 python stage_4_analyze.py --scene karman_re100 --mode ppo-viz
```
## Pipeline Architecture
```
stage_1_infer.py → stage_2_fit.py → stage_3_validate.py → stage_4_analyze.py
(PPO数据) (PySR拟合) (CFD闭环验证) (分析/画图)
# Generate figures
conda run -n pycuda_3_10 python stage_4_analyze.py
```
## Directory Structure
```
SR_analysis/
PIPELINE.md # 总览文档 (入口)
README.md # 本文件
sindy_sr_knowledge.md # 知识库 (bugs, 事实, 结果)
sindy_sr_notes.md # 任务清单
scene_registry.json # 所有场景的规范结果索引
configs.py # 场景注册表
core/ # 共享工具库
features.py # 特征构建 (无量纲化+phase-state)
fitting.py # STLSQ拟合+特征矩阵
cfd.py # LegacyCelerisLab接口
g_operator.py # G-mirror变换
data/ # 运行时生成的.npz数据
stage_1_infer.py # PPO inference (all scenes)
stage_2_fit.py # PySR symbolic regression fitting
stage_3_validate.py # CFD closed-loop validation
stage_4_analyze.py # Publication figure generation
configs.py # All scene definitions (19 scenes)
scene_registry.json # Canonical results registry
utils/ # Shared library (features, CFD, fitting)
data/ # Runtime .npz data per scene
results/
formulas/ # 规范公式JSON
validations/ # CFD闭环验证结果
archive/ # 归档的中间文件
stage_1_infer.py # Stage 1: 统一PPO推理入口
STAGE_1_INFER.md
stage_2_fit.py # Stage 2: 统一PySR拟合入口
STAGE_2_FIT.md
stage_3_validate.py # Stage 3: 统一CFD闭环验证入口
STAGE_3_VALIDATE.md
stage_4_analyze.py # Stage 4: 统一分析/画图入口
STAGE_4_ANALYZE.md
formulas/ # Canonical formula JSONs
validations/ # CFD validation outputs
figures/ # Publication-quality PNG/PDF
FIGURE_INDEX.md # Figure catalog with captions
README.md # Formula + validation index
docs/
SR_analysis_report.md # Full analysis report
illusion_joint_formula_analysis.md
PIPELINE.md # Detailed reproduction guide
literature_note.md # Paper writing + literature positioning
old/ # Archived historical files
```
---
## Key Results
## Key Design Decisions
| Scene | Formula | CFD Similarity |
|-------|---------|:---:|
| Karman cross-Re (joint) | alpha_F = daF_dt - 14.95*mu*Cl_tot | avg 0.847 |
| Illusion joint (0.75L+1L) | alpha_F = Cd_tot - Cd_err - 5.43 + 0.01*(du_a_dt+u_a) | 0.978/0.970 |
| Vortex lamb (Karman formula) | Karman joint, zero retraining | 0.949 (exceeds PPO) |
1. **Feature levels**: Static (8-dim) -> Phase-state (6-dim) -> Illusion-phase (10-dim)
2. **Output target**: Non-dimensional alpha, not physical omega
3. **v23 structure**: Front no-bias, rear shared-head (Bottom = -Top(Gx))
4. **Final judge**: CFD closed-loop similarity, not one-step R2
## Environments
## Key Documentation
- `pycuda_3_10`: CFD + DRL model loading + visualization (stages 1, 3, 4)
- `sr_env`: PySR symbolic regression (stage 2)
- GPU: device 2 recommended
## Documentation
| File | Content |
|------|---------|
| `PIPELINE.md` | **Primary entry** — pipeline overview, environment, conventions |
| `sindy_sr_knowledge.md` | Bug history, confirmed facts, known limitations |
| `sindy_sr_notes.md` | Task list, current status |
| `docs/SR_analysis_report.md` | Full report (465+ lines) |
| `docs/illusion_joint_formula_analysis.md` | Illusion joint formula deep dive |
## Core Files (≤20)
`stage_1_infer.py`, `stage_2_fit.py`, `stage_3_validate.py`, `stage_4_analyze.py`, `configs.py`, `scene_registry.json`, `core/features.py`, `core/fitting.py`, `core/cfd.py`, `core/g_operator.py` + 8 docs.
| `PIPELINE.md` | Full reproduction guide with all commands |
| `docs/SR_analysis_report.md` | Complete methodology + results + discussion |
| `results/figures/FIGURE_INDEX.md` | All figures with paper-ready captions |
| `literature_note.md` | Literature positioning + writing guidance |
| `results/README.md` | Formula + validation file index |