k-dense-ai/fluidsim
Plan, configure, inspect, restart, and analyze bounded FluidSim computational-fluid-dynamics simulations with explicit numerical-validity and HPC safety checks. Use for FluidSim solver selection, parameter review, FFT/MPI setup, output diagnostics, or restart compatibility.
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill fluidsim
Use FluidSim 0.9.0 as a framework for Python-defined numerical solvers, especially
periodic Cartesian pseudospectral CFD. Upstream FluidSim is CeCILL-2.1; the MIT
frontmatter license applies only to this skill.
This skill does not treat a completed run, a stable time step, a smooth plot,
or a closed program exit as evidence of numerical convergence or physical
validity.
initial conditions, forcing, observables, and acceptance criteria.
timestep, CFL, resolution, and dealiasing bounds.
explicit config-ID acknowledgement.
tails, CFL/time-step history, and output growth.
and observable sensitivity.
automatically.
uv.lock, package/platform/backend versions, logs,output inventory, checksums, and restart lineage.
Stop if physical assumptions, units, boundary conditions, forcing semantics,
resolution criteria, resource limits, or acceptance criteria are missing.
As verified on 2026-07-23:
fluidsim==0.9.0 (2025-12-04).>=3.11 and lists Python 3.11–3.14.fluidsim imported inthe smoke test, but ns2d.create_default_params() failed until the fft extra
was installed.
fluidfft==0.4.5 andpyFFTW==0.15.1.
Prefer a project lock:
uv init --python 3.11
uv add "fluidsim[fft]==0.9.0" "fluidfft==0.4.5" "pyFFTW==0.15.1"
uv lock
uv sync --frozen
For an isolated disposable environment:
uv venv --python 3.11
uv pip install "fluidsim[fft]==0.9.0" "fluidfft==0.4.5" "pyFFTW==0.15.1"
The project lock is the reproducibility record; direct pins alone do not freeze
all transitive artifacts. Do not reuse a lock across incompatible platforms or
MPI ABIs.
MPI is optional and native:
uv add "mpi4py==4.1.2" "fluidfft-mpi-with-fftw==0.0.1" "fluidfft-fftwmpi==0.0.1"
uv lock
Those packages still require a compatible MPI runtime and FFTW development
libraries. The optional native plugins are:
fluidfft-fftw==0.0.1: sequentialfft2d.with_fftw1d, fft2d.with_fftw2d, fft3d.with_fftw3d.
fluidfft-mpi-with-fftw==0.0.1: MPIfft2d.mpi_with_fftw1d, fft3d.mpi_with_fftw1d.
fluidfft-fftwmpi==0.0.1: MPI-enabled FFTWfft2d.mpi_with_fftwmpi2d, fft3d.mpi_with_fftwmpi3d.
fluidfft-p3dfft==0.0.1: fft3d.mpi_with_p3dfft; requires P3DFFT.stacks for the target cluster.
FluidFFT documents cuFFT historically, but FluidFFT 0.4.5 declares no CUDA extra
or installed GPU plugin in its package metadata, and its CUDA installation page
is unfinished. Do not claim GPU acceleration or install an unrelated CUDA wheel
as a FluidSim backend. Treat GPU work as source-level experimental integration
requiring separate validation.
See installation for system dependencies, MPI ABI,
HDF5-MPI, backend discovery, and verification.
Use direct, versioned imports:
from fluidsim.solvers.ns2d.solver import Simul
params = Simul.create_default_params()
params.oper.nx = params.oper.ny = 32
params.oper.Lx = params.oper.Ly = 2 * 3.141592653589793
params.oper.coef_dealiasing = 2 / 3
params.time_stepping.USE_CFL = True
params.time_stepping.cfl_coef = 0.5
params.time_stepping.deltat0 = 0.001
params.time_stepping.deltat_max = 0.01
params.time_stepping.t_end = 0.1
params.time_stepping.max_elapsed = "00:05:00"
params.init_fields.type = "noise"
params.init_fields.noise.velo_max = 0.01
params.output.HAS_TO_SAVE = False
params.output.ONLINE_PLOT_OK = False
Important 0.9 corrections:
params.time_stepping.cfl_coef, not CFL.params.forcing.tcrandom.time_correlation, not a flat
tcrandom_time_correlation.
constant, noise, jet, dipole,from_file, from_simul, and in_script; do not invent a universal list for
every solver.
state_phys_t*.nc; spectra usespectra1D.h5/spectra2D.h5; scalar means are solver-dependent
spatial_means.txt or JSON-lines.
params.output.sub_directory is relative under FLUIDSIM_PATH.ParamContainer rejects undeclared attributes. Always generate defaults from the
selected Simul class and inspect them before changing values. See
parameters.
Primary Cartesian CFD keys and imports:
from fluidsim.solvers.ns2d.solver import Simul # ns2d
from fluidsim.solvers.ns2d.bouss.solver import Simul # ns2d.bouss
from fluidsim.solvers.ns2d.strat.solver import Simul # ns2d.strat
from fluidsim.solvers.ns3d.solver import Simul # ns3d
from fluidsim.solvers.ns3d.bouss.solver import Simul # ns3d.bouss
from fluidsim.solvers.ns3d.strat.solver import Simul # ns3d.strat
The 0.9 registry also includes plate2d, sw1l variants, waves2d, 1D models,
0D models, spherical solvers, and framework adapters. Availability in the
registry does not make a solver appropriate for a scientific question. Verify
equations, variables, geometry, boundaries, and diagnostics in the solver
source. See solvers.
Forcing is solver-specific. A current normalized random example is:
params.forcing.enable = True
params.forcing.type = "tcrandom"
params.forcing.forcing_rate = 1.0
params.forcing.nkmin_forcing = 4
params.forcing.nkmax_forcing = 5
params.forcing.tcrandom.time_correlation = "based_on_forcing_rate"
Record the forced variable, normalization definition, wave-number band, random
seed/state, injection target, and measured injection. FluidSim 0.9 saves state
parameters for restart; 0.8.6 fixed time-correlated forcing restart behavior.
Available pseudospectral schemes include Euler/RK2 phase-shift variants,
RK2_trapezoid, and RK4. A named order does not establish accuracy. Check CFL,
fast-wave/diffusive limits, deltat_max, and time-step refinement. See
advanced features.
For read-only analysis:
from fluidsim import load_sim_for_plot
sim = load_sim_for_plot("run-directory", hide_stdout=True)
sim.output.spatial_means.plot()
sim.output.spectra.plot1d()
sim.output.phys_fields.plot(time=1.0)
load_sim_for_plot uses a coarse operator and disables saving/online plotting.
For a state-bearing object:
from fluidsim import load_state_phys_file
sim = load_state_phys_file("run-directory", t_approx="last")
For a controlled restart, prefer load_for_restart or first run
fluidsim-restart --only-check. Do not use --modify-params with untrusted text:
the upstream CLI executes Python code supplied to that option. This skill's
generator never emits it. Verify solver, grid/domain, state variables, versions,
forcing state, checksum, target time, output destination, and resource bounds.
Resolution changes require the dedicated reviewed workflow, not a silent grid
edit. See simulation workflow and
output analysis.
Before interpreting results, require:
diagnostic definitions.
solver-appropriate small-scale criteria.
smaller-step comparison.
residuals.
observables.
independently reproduced result where appropriate.
Never label a run “DNS,” “converged,” “validated,” “steady,” or “physically
correct” from parameter values or plots alone.
All tools emit strict JSON, reject URLs/traversal/symlinks, enforce hard bounds,
use no network or subprocess, and never launch a simulation:
python3 scripts/solver_config_validator.py --example
python3 scripts/solver_config_validator.py --config config.json
python3 scripts/grid_resource_estimator.py --config config.json
python3 scripts/simulation_dry_run.py --config config.json --output run.py
python3 scripts/output_inventory.py --path run-directory
python3 scripts/budget_summary.py --path run-directory
python3 scripts/restart_compatibility.py --source state.nc --target-config config.json
The HDF5 tools lazily require h5py, inspect bounded metadata/hyperslabs, and
never follow external links or load full field arrays.
Verified 2026-07-23 against
FluidFFT 0.4.5 docs, and the
primary FluidSim (DOI 10.5334/jors.239)
and FluidFFT (DOI 10.5334/jors.238)
papers. API claims use official docs/source; method/performance claims in the
references are scoped to the cited primary papers and their benchmark setups.
Take k-dense-ai/fluidsim from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference pip, uv.
Without those the skill loads but fails at the first command.