| name | vibeflow-fenics |
| description | Use when preparing, running, debugging, validating, or developing VibeFlow/VibeCAE FEniCS or FEniCSx finite-element PDE workflows, including Python weak forms, dolfinx/dolfin environments, mesh and boundary-tag handoff, solver setup, post-processing, reusable PDE modules, and traceability to 0-caseDict/caseDict. |
VibeFlow FEniCS
This skill is responsible for integrating FEniCS/FEniCSx into VibeCAE as a Python-driven FEM/PDE backend.
- Usage mode: generate runnable Python FEM solver scripts from
caseDict.
- Development mode: develop reusable weak forms, boundary mappings, material models, solver wrappers, or post-processing modules.
When to Use
- The current backend is FEniCS or FEniCSx.
- A PDE weak form, research FEM model, multiphysics prototype, or custom variational form needs to be implemented quickly.
dolfinx, dolfin, ufl, basix, ffcx, or MPI/PETSc issues need to be handled.
- Gmsh/XDMF/mesh tags need to be mapped into a Python FEM script.
First Decide: Usage Mode or Development Mode
- Implementing the PDE/FEM solver script for the current case: use usage mode.
- Writing reusable weak-form libraries, material models, boundary-condition generators, or solver adapters: use development mode.
- Python packages cannot be imported: switch to
vibeflow-toolchain.
- Mesh tags or dimensions are incorrect: switch to
vibeflow-mesh.
What to Read First
0-caseDict/caseDict
references/fenics-playbook.md
references/fenics-practical-tips.md: software knowledge base, key concepts, failure interpretation, and adapter design points.
- XDMF, MSH, VTU, and mesh-tag files in
B-mesh/
- Existing scripts in
C-run/fenics/ and post-processing under D-post/
Inputs
- Unified physical description, materials, boundaries, initial conditions, and numerical settings
- FEM mesh and boundary tags
- Python environment and FEniCS/FEniCSx packages
Outputs
C-run/fenics/case-1/solve.py
C-run/fenics/case-1/mesh.xdmf and tag files
C-run/fenics/case-1/results/
- Post-processing scripts under
D-post/fenics/
- Solver logs and error/convergence records
Recommended Structure
C-run/fenics/case-1/
├── solve.py
├── inputs/
├── mesh/
├── results/
└── logs/
Usage Mode Workflow
- Confirm the backend and FEniCS version: prefer FEniCSx/dolfinx; legacy dolfin may be used for older projects.
- Read the PDE type, weak-form variables, materials, boundaries, and target quantities from
caseDict.
- Check mesh dimension, element type, cell tags, and facet tags.
- Generate
solve.py, keeping parameters centralized and paths relative to the case.
- Run import checks and a minimal solve.
- Output XDMF/VTK/CSV/JSON results.
- Write run status, error norms, residuals, or target quantities back to
caseDict.
Development Mode Workflow
- Define the development target: weak-form library, material model, boundary generator, mesh conversion, PETSc solver configuration, or post-processing.
- Write a minimal manufactured solution or benchmark first.
- Split UFL forms, function spaces, boundary tags, and solver parameters into small functions.
- Do not mix FEniCSx and legacy FEniCS APIs.
- Under MPI, do not rely on single-process file-writing assumptions.
- Record versions, dependencies, commands, and validation results.
Core Rules
- The FEniCS skill is not responsible for CAD modeling; geometry and mesh are provided by the geometry/mesh skills.
caseDict is the source of truth for physical and numerical intent; the Python script is the backend implementation.
- Mesh tag names or IDs must be traceable to the regions/boundaries in
caseDict.
- Solver convergence, errors, and unit assumptions must be recorded.
- Do not treat a notebook as the only reproducible run entry point; a script entry point is required.
Validation
import dolfinx or import dolfin succeeds.
- Mesh and tags are readable.
- The minimal solve completes.
- Result files exist and can be read by post-processing.
- For a benchmark or manufactured solution, an error check or physical-consistency check exists.
Fallback Rules
- Unclear PDE/boundaries: return to
vibeflow-case-dict
- Python/FEniCS environment unavailable: return to
vibeflow-toolchain
- Mesh/tag problems: return to
vibeflow-mesh
- Post-processing: switch to
vibeflow-postprocess