HPC OpenFOAM
Follow a progressive loading workflow.
Start
- 1. Read
references/case-setup.md before creating or editing any OpenFOAM case. - Read
references/solver-selection.md when selecting a solver family or pressure convention. - Read
references/boundary-condition-playbook.md when mapping physical boundaries to field files. - Read
references/turbulence-bc-recipes.md when selecting turbulence models, wall treatment, or near-wall fields. - Read
references/turbulence-and-numerics.md when choosing schemes, algorithm controls, turbulence models, or decomposition. - Read
references/case-recipes.md when assembling a canonical internal-flow, external-aero, or free-surface case. - Read
references/function-object-recipes.md when instrumenting a case with forces, probes, or solver diagnostics. - Read
references/validation-parallel-and-observability.md when validating, instrumenting, or post-processing a case. - Read
references/cluster-execution-playbook.md when staging an OpenFOAM case for scheduler-backed cluster execution. - Read
references/error-recovery.md when a log contains crashes, divergence, or bounded-field warnings.
Work sequence
- 1. Classify the case first: steady or transient, incompressible or compressible, single-phase or multiphase, laminar or turbulent.
- Generate the minimum consistent file set across
0/, constant/, and system/. Do not edit one layer in isolation if it changes the required fields elsewhere. - Match solver family and fields:
-
simpleFoam: steady incompressible RANS; expect
U,
p, and turbulence fields if
RAS.
-
pimpleFoam: transient incompressible; review timestep control and outer correctors.
-
interFoam: multiphase; control both
maxCo and
maxAlphaCo.
- 4. Validate mesh and numerics before a long run:
- run
blockMesh or the mesh generator
- run
checkMesh
- refuse to keep orthogonal-only schemes on poor-quality meshes
- 5. Keep parallel settings aligned:
- make
numberOfSubdomains match the intended MPI rank count
- prefer
scotch for complex geometries unless the user requests a manual layout
Guardrails
- - Do not invent dictionary keys, patch types, or solver names.
- Do not use turbulence fields that do not match the chosen model family.
- Do not keep aggressive second-order convection schemes during first-pass stabilization on a fragile case.
- Do not treat
checkMesh warnings as optional if the log is already diverging.
Additional References
Load these on demand:
- -
references/mesh-and-blockmeshdict-manual.md for mesh generation, vertex ordering, and mesh-quality workflow - INLINECODE27 for thermophysical, buoyant, and compressible setups
- INLINECODE28 for algorithm loops, solver blocks, and case termination logic
- INLINECODE29 for solver-to-field and file-to-parameter matrices
- INLINECODE30 for decomposition, solver launch, reconstruction, and restart sequencing on clusters
Reusable Templates
Use assets/templates/ when a concrete case skeleton is needed, especially:
- -
simplefoam-minimal/ for a minimal steady incompressible case - INLINECODE33 for a minimal two-phase transient case
- INLINECODE34 for a minimal scheduled parallel run scaffold
Outputs
Produce a short case summary that states:
- - solver and physics family
- required fields and dictionaries touched
- validation commands run or still needed
- stability risks and the next recovery step if the case is failing
HPC OpenFOAM
遵循渐进式加载工作流程。
开始
- 1. 在创建或编辑任何 OpenFOAM 算例前,先阅读 references/case-setup.md。
- 选择求解器系列或压力约定时,阅读 references/solver-selection.md。
- 将物理边界映射到场文件时,阅读 references/boundary-condition-playbook.md。
- 选择湍流模型、壁面处理或近壁场时,阅读 references/turbulence-bc-recipes.md。
- 选择格式、算法控制、湍流模型或分解时,阅读 references/turbulence-and-numerics.md。
- 组装标准内流、外气动或自由表面算例时,阅读 references/case-recipes.md。
- 为算例配置力、探针或求解器诊断时,阅读 references/function-object-recipes.md。
- 验证、检测或后处理算例时,阅读 references/validation-parallel-and-observability.md。
- 准备 OpenFOAM 算例以在调度器支持的集群上执行时,阅读 references/cluster-execution-playbook.md。
- 当日志包含崩溃、发散或有界场警告时,阅读 references/error-recovery.md。
工作顺序
- 1. 首先对算例进行分类:稳态或瞬态、不可压缩或可压缩、单相或多相、层流或湍流。
- 在 0/、constant/ 和 system/ 目录下生成最小一致的文件集。如果修改某一层会改变其他层所需的场,则不要孤立地编辑该层。
- 匹配求解器系列和场:
- simpleFoam:稳态不可压缩 RANS;如果使用 RAS,则需要 U、p 和湍流场。
- pimpleFoam:瞬态不可压缩;检查时间步控制和外部修正器。
- interFoam:多相;同时控制 maxCo 和 maxAlphaCo。
- 4. 在长时间运行前验证网格和数值方法:
- 运行 blockMesh 或网格生成器
- 运行 checkMesh
- 拒绝在质量较差的网格上使用仅正交格式
- 5. 保持并行设置一致:
- 使 numberOfSubdomains 与预期的 MPI 进程数匹配
- 对于复杂几何体,优先使用 scotch,除非用户要求手动布局
防护措施
- - 不要发明字典键、边界类型或求解器名称。
- 不要使用与所选模型系列不匹配的湍流场。
- 在脆弱的算例上进行首次稳定化时,不要保留激进的二阶对流格式。
- 如果日志已经发散,不要将 checkMesh 警告视为可选项。
附加参考
按需加载:
- - references/mesh-and-blockmeshdict-manual.md:网格生成、顶点排序和网格质量工作流程
- references/heat-transfer-and-compressible-cases.md:热物理、浮力和可压缩设置
- references/fvsolution-and-residual-control.md:算法循环、求解器块和算例终止逻辑
- references/field-and-dictionary-matrix.md:求解器到场以及文件到参数的矩阵
- references/cluster-execution-playbook.md:集群上的分解、求解器启动、重构和重启顺序
可复用模板
当需要具体的算例框架时,使用 assets/templates/,特别是:
- - simplefoam-minimal/:最小稳态不可压缩算例
- interfoam-minimal/:最小两相瞬态算例
- openfoam-parallel-slurm.sh:最小调度并行运行框架
输出
生成简短的算例摘要,说明:
- - 求解器和物理系列
- 所需的场和修改的字典
- 已运行或仍需运行的验证命令
- 稳定性风险以及如果算例失败时的下一步恢复步骤