STAR-CCM+ 批量案例生成脚本
作用:
- 读取Excel参数配置表,基于Java宏模板和SIM文件模板自动生成多个仿真案例
- 通过config.ini配置文件配置参数映射和替换规则
- 可添加多个需要替换参数的模板
使用流程:
- 准备CasePlan.xlsx算例规划参数表
- 准备template_Case.sim算例模板文件
- 通过STARCCM+录制template_Macro.java宏模板文件
- 准备其他需要替换参数的模板文件(可选)
- 修改config.ini配置文件,配置参数映射和替换规则
- 运行脚本
注意事项:
- 需要安装第三方依赖库:pandas
- Excel文件需包含标题行,数据从第二行开始
- 模板文件与此脚本在同一目录下
- 所有要进行批量替换的模板文件都要以 template_ 开头,并放在脚本所在目录
- 需要手动修改 template_Macro.java 中待替换的字符,包括:
- 模板文件名必须修改为 template_Macro
- 计算结果自动导出的文件名必须修改为 CaseName
- 算例保存路径必须修改为 SavePath
- 待替换的值必须修改为不与宏文件中其他字符冲突的占位符
STAR-CCM+ Batch Case Generation Script
Purpose:
- Read an Excel parameter configuration table and automatically generate multiple simulation cases based on Java macro templates and SIM file templates.
- Configure parameter mappings and replacement rules via the
config.iniconfiguration file. - Support adding multiple template files requiring parameter replacements.
Workflow:
- Prepare the
CasePlan.xlsxcase planning parameter table. - Prepare the
template_Case.simcase template file. - Record the
template_Macro.javamacro template file via STAR-CCM+. - Prepare other template files requiring parameter replacements (optional).
- Modify the
config.inifile to configure parameter mappings and replacement rules. - Run the script.
Notes:
- Requires installation of third-party dependency libraries:
pandas. - The Excel file must include a header row, with data starting from the second row.
- Template files must be located in the same directory as the script.
- All template files requiring batch replacements must start with
template_and be placed in the script directory. - Manual modifications are required in
template_Macro.java:- The template file name must be set to
template_Macro. - The auto-exported result file name must be set to
CaseName. - The case save path must be set to
SavePath. - Replaceable values must use placeholders that do not conflict with other characters in the macro file.
- The template file name must be set to