domains / science / fluidsim-cfd-simulation / fluidsim
The two skills cover the same domain (FluidSim CFD) but diverge significantly in procedure, safety constraints, and technical accuracy. The first skill (K-Dense-AI) is a rigorous, safety-focused workflow that mandates explicit resource planning, pilot runs, and specific version pins (0.9.0), while explicitly correcting API field names (e.g., `cfl_coef` vs `CFL`). The second skill (Vibe-Skills) is a general-purpose guide that includes a broader solver list (shallow water, stratified) and a simpler 5-step workflow, but it contains a likely API error (using `CFL` instead of `cfl_coef` for 0.9.0) and lacks the strict HPC safety checks. Because the first skill's safety constraints are critical for HPC usage and the second skill provides broader solver context, neither is a pure reproduction of the other. Combining them allows for a robust workflow that includes the safety checks of the first and the solver breadth of the second, while resolving the API conflict in favor of the version-specific correction in the first.
| Repository | Path |
|---|---|
| K-Dense-AI/scientific-agent-skills | skills/fluidsim/SKILL.md |
| foryourhealth111-pixel/Vibe-Skills | bundled/skills/fluidsim/SKILL.md |
| Role | Repository | Path |
|---|---|---|
| peer | K-Dense-AI/scientific-agent-skills | skills/fluidsim/SKILL.md |
| peer | foryourhealth111-pixel/Vibe-Skills | bundled/skills/fluidsim/SKILL.md |
---
name: fluidsim
description: Plans, configures, runs, and analyzes FluidSim CFD simulations with HPC safety checks and broad solver support.
license: MIT
---
# FluidSim
Use FluidSim (targeting 0.9.0) for pseudospectral CFD. This skill covers Navier-Stokes (2D/3D), shallow water, and stratified flows.
## Safety & Validity
- Do not treat a completed run or stable time step as evidence of convergence.
- Always verify physical assumptions, units, and boundary conditions before execution.
- Never submit MPI jobs automatically; always prepare a site-specific script for manual review.
## Installation
Prefer a project lock for reproducibility:
```bash
uv init --python 3.12
uv add "fluidsim[fft]==0.9.0" "fluidfft==0.4.5" "pyFFTW==0.15.1"
uv lock
uv sync --frozen
```
## Workflow
1. **Define Problem**: State equations, geometry, boundaries, and acceptance criteria.
2. **Select Solver**: Choose from `ns2d`, `ns3d`, `sw1l`, or `ns2d.strat` based on physics.
3. **Configure Parameters**:
- Use `Simul.create_default_params()`.
- Set resolution (`params.oper.nx`), domain (`params.oper.Lx`), and physics (`params.nu_2`).
- **Critical**: Use `params.time_stepping.cfl_coef` (not `CFL`) for adaptive time stepping in 0.9.0.
- Set `params.time_stepping.USE_CFL = True` and `params.time_stepping.deltat0`.
4. **Resource Planning**: Estimate CPU, RAM, and disk. Create a strict JSON plan with bounds.
5. **Pilot Run**: Run a tiny serial pilot (e.g., 32x32 grid). Inspect budgets, divergence, and spectral tails.
6. **Refine**: Adjust grid and time step independently. Check conservation residuals.
7. **Production Run**: Prepare MPI script. Submit manually.
8. **Analysis**:
- Plot fields: `sim.output.phys_fields.plot("vorticity")`.
- Plot spectra: `sim.output.spectra.plot1d()`.
- Load previous runs: `from fluidsim import load_sim_for_plot`.
## Solver Selection Guide
- **2D Turbulence**: `fluidsim.solvers.ns2d.solver.Simul`
- **3D Turbulence**: `fluidsim.solvers.ns3d.solver.Simul`
- **Shallow Water**: `fluidsim.solvers.sw1l.solver.Simul` (set `params.f` for Coriolis)
- **Stratified**: `fluidsim.solvers.ns2d.strat.solver.Simul` (set `params.N` for Brunt-Väisälä)
## API Notes (0.9.0)
- `ParamContainer` rejects undeclared attributes.
- Output files default to `state_phys_t*.nc` and `spectra1D.h5`.
- `params.output.sub_directory` is relative to `FLUIDSIM_PATH`.