SuperAPI AI 工具集

numerical-stability

通用与其它

查看项目

更新于 10-15 20:06

技能介绍

用途:为时间相关PDE仿真提供可重复的稳定性检查清单与脚本化检查,涵盖显式/隐式格式选择、时间步长选择与失稳诊断,使仿真结果稳定且可辩护。

主要能力:内置CFL/Fourier/反应数快速参考(1D下CFL C≤1、Fourier Fo≤0.5、反应R≤1;d维扩散限制Fo≤1/(2d))。脚本cfl_checker.py输出metrics.cfl、metrics.fourier、recommended_dt、stable;von_neumann_analyzer.py输出results.max_amplification、results.stable;matrix_condition.py输出results.condition_number、results.is_symmetric;stiffness_detector.py输出results.stiffness_ratio、results.stiff、results.recommendation。

使用方式:需Python 3.8+与NumPy,依赖见scripts/requirements.txt。需要收集dx、dt、速度v、扩散系数D、反应速率k、维度、格式类型等输入。工作流:识别主导物理,运行CFL检查器,对比限制并调整dt,多尺度时检查刚性,用Von Neumann分析自定义格式,隐式求解检查条件数,记录稳定性结论与推荐时间步。

CLI示例: python3 scripts/cfl_checker.py --dx 0.1 --dt 0.01 --velocity 1.0 --diffusivity 0.1 --dimensions 2 --json python3 scripts/von_neumann_analyzer.py --coeffs 0.2,0.6,0.2 --dx 1.0 --nk 128 --json python3 scripts/stiffness_detector.py --eigs=-1,-1000 --json python3 scripts/matrix_condition.py --matrix A.npy --norm 2 --json

适用场景:CFL/Fourier/反应数满足性判断、刚性检测(比值>1000建议隐式)、条件数评估(>1e6建议缩放/预处理)、自定义格式放大因子验证。

限制:CFL/Fourier检查仅针对显式格式;Von Neumann分析假设线性、常系数、周期边界;刚性检测需用户提供特征值估计;dx与dt须为正,需至少提供一个物理参数。