Vibeflow openfoam

From sunrise-hjx/vibeFlow-skills · View interactive version

Vibeflow openfoam is an AI agent skill from the GitHub repository sunrise-hjx/vibeFlow-skills. Use when selecting, generating, running, or debugging VibeFlow OpenFOAM cases from 0-caseDict/caseDict, and when developing, repairing, documenting, compiling, or integrating OpenFOAM UDF code under UDF/, including custom solvers, libraries, boundary conditions, functionObjects, fvOptions, source te

How to use this skill

Skill file

VibeFlow OpenFOAM

This skill covers two kinds of work:

Development mode does not replace usage mode. Development mode proves that a code capability is correct, stable, compilable, and callable; usage mode proves that the current case is closed from a unified physical description to runtime results.

When to Use

First Decide: Usage Mode or Development Mode

First decide whether the current task modifies case configuration or OpenFOAM code capability.

What to Read First

For usage mode, read:

For development mode, read:

Input

Output

VibeFlow Standard Case Structure

The generated VibeFlow C-run/ must be a complete OpenFOAM case, not a half-finished collection of only a few dictionary files. Use the following skeleton by default:

C-run/
|-- case.foam
|-- Allrun
|-- Allclean
|-- Allrun.pre                 # Optional; keep only when an independent preprocessing chain exists
|-- 0.orig/                    # Recommended by default; source of truth for initial fields
|   |-- U
|   |-- p / p_rgh
|   |-- T / h / e
|   |-- k / epsilon / omega / nut / nuTilda
|   |-- alpha.* / pointDisplacement / Yi
|   `-- ...
|-- constant/
|   |-- transportProperties / thermophysicalProperties
|   |-- turbulenceProperties
|   |-- phaseProperties
|   |-- g
|   |-- dynamicMeshDict
|   |-- regionProperties
|   |-- triSurface/            # If using snappyHexMesh
|   `-- polyMesh/              # Generated after runtime generation or import
|-- system/
|   |-- controlDict
|   |-- fvSchemes
|   |-- fvSolution
|   |-- decomposeParDict
|   |-- blockMeshDict / snappyHexMeshDict / topoSetDict / setFieldsDict
|   `-- Other auxiliary dictionaries
`-- postProcessing/            # Generated after the run

Structural Constraints

Multi-Region and Advanced Topologies

Script Conventions

`Allrun`

`Allrun.pre`

`Allclean`

Core Workflow

Usage-Mode Workflow

  1. Read physicalProblem, materials, regions, interfaces, boundariesLoadsInitials, mesh, numericalMethod, and execution.
  2. Select the closest baseline case from $WM_PROJECT_DIR/tutorials.
  3. Match directory topology first, then solver name.
  4. Copy and trim into C-run/, completing the VibeFlow standard skeleton.
  5. Import or generate the mesh, then run checkMesh.
  6. Write system/, constant/, and 0.orig/ from the unified physical/numerical description in caseDict.
  7. Write or fix Allrun, Allclean, and Allrun.pre when needed.
  8. Run the solver and monitor residuals, monitored quantities, errors, and divergence.

Development-Mode Workflow

  1. Identify the task type:
  1. Define the development boundary:
  1. Update UDF/README.md first:
  1. Reuse the smallest skeleton from the closest native OpenFOAM solver, library, utility, or tutorial; avoid writing a main loop or model framework from scratch.
  2. Place files by responsibility:
  1. Write or update Make/files and Make/options.
  2. Compile libraries before compiling solvers that call those libraries.
  3. Run minimal validation:
  1. If the result is used in the current case, update application, libs, and relevant model dictionaries under C-run/case-*.
  2. Write build commands, log locations, error fixes, validation results, and remaining risks back to UDF/README.md.
  3. If the capability advances the current workflow, write related state, assumptions, artifacts, and error records back to 0-caseDict/caseDict.

Core Rules

Local Source Observations

Based on sampling the local OpenFOAM source tree under $WM_PROJECT_DIR/tutorials:

UDF Directory and Build Conventions

Recommended structure:

UDF/
|-- README.md                  # Development source of truth: requirements, design, build, validation, risks
|-- src/                       # Custom libraries, models, boundary conditions, functionObjects, fvOptions, utilities
|   `-- <libraryName>/
|       |-- Make/
|       |   |-- files
|       |   `-- options
|       `-- ...
|-- solver/                    # Custom solvers or derived applications
|   `-- <solverName>/
|       |-- Make/
|       |   |-- files
|       |   `-- options
|       `-- ...
`-- logs/                      # Optional: build logs, smoke-test logs, error records

Compile a library:

wmake libso UDF/src/<libraryName>

Compile a solver:

wmake UDF/solver/<solverName>

Clean:

wclean libso UDF/src/<libraryName>
wclean UDF/solver/<solverName>

Use the following in UDF/src/<libraryName>/Make/files:

LIB = $(FOAM_USER_LIBBIN)/lib<libraryName>

Use the following in UDF/solver/<solverName>/Make/files:

EXE = $(FOAM_USER_APPBIN)/<solverName>

Make/options principles:

If runtime dynamic library loading is needed, add this to system/controlDict:

libs
(
    "lib<libraryName>.so"
);

When integrating a custom solver into a case, set this in system/controlDict:

application     <solverName>;

Development Documentation Requirements

UDF/README.md records at least:

For complex models, do not leave the reasoning only in the final chat response. UDF/README.md must become the development source of truth that later agents and the user can reproduce.

Validation

Usage mode validates at least:

Development mode validates at least:

Fallback Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.