Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Framework for computational fluid dynamics simulations using Python. Use when running fluid dynamics simulations including Navier-Stokes equations (2D/3D), shallow water equations, stratified flows, or when analyzing turbulence, vortex dynamics, or geophysical flows. Provides pseudospectral methods with FFT, HPC support, and comprehensive output analysis.
.claude/skills/lingxling-fluidsim/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | -33% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 26% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 69% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 115% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 74% | 0% |
FluidSim is an object-oriented Python framework for high-performance computational fluid dynamics (CFD) simulations. It provides solvers for periodic-domain equations using pseudospectral methods with FFT, delivering performance comparable to Fortran/C++ while maintaining Python's ease of use.
Key strengths:
Install fluidsim using uv with appropriate feature flags:
bash# Basic installation uv pip install fluidsim # With FFT support (required for most solvers) uv pip install "fluidsim[fft]" # With MPI for parallel computing uv pip install "fluidsim[fft,mpi]"
Set environment variables for output directories (optional):
bashexport FLUIDSIM_PATH=/path/to/simulation/outputs export FLUIDDYN_PATH_SCRATCH=/path/to/working/directory
No API keys or authentication required.
See references/installation.md for complete installation instructions and environment configuration.
Standard workflow consists of five steps:
Step 1: Import solver
pythonfrom fluidsim.solvers.ns2d.solver import Simul
Step 2: Create and configure parameters
pythonparams = Simul.create_default_params() params.oper.nx = params.oper.ny = 256 params.oper.Lx = params.oper.Ly = 2 * 3.14159 params.nu_2 = 1e-3 params.time_stepping.t_end = 10.0 params.init_fields.type = "noise"
Step 3: Instantiate simulation
pythonsim = Simul(params)
Step 4: Execute
pythonsim.time_stepping.start()
Step 5: Analyze results
pythonsim.output.phys_fields.plot("vorticity") sim.output.spatial_means.plot()
See references/simulation_workflow.md for complete examples, restarting simulations, and cluster deployment.
Choose solver based on physical problem:
2D Navier-Stokes (ns2d): 2D turbulence, vortex dynamics
pythonfrom fluidsim.solvers.ns2d.solver import Simul
3D Navier-Stokes (ns3d): 3D turbulence, realistic flows
pythonfrom fluidsim.solvers.ns3d.solver import Simul
Stratified flows (ns2d.strat, ns3d.strat): Oceanic/atmospheric flows
pythonfrom fluidsim.solvers.ns2d.strat.solver import Simul params.N = 1.0 # Brunt-Väisälä frequency
Shallow water (sw1l): Geophysical flows, rotating systems
pythonfrom fluidsim.solvers.sw1l.solver import Simul params.f = 1.0 # Coriolis parameter
See references/solvers.md for complete solver list and selection guidance.
Parameters are organized hierarchically and accessed via dot notation:
Domain and resolution:
pythonparams.oper.nx = 256 # grid points params.oper.Lx = 2 * pi # domain size
Physical parameters:
pythonparams.nu_2 = 1e-3 # viscosity params.nu_4 = 0 # hyperviscosity (optional)
Time stepping:
pythonparams.time_stepping.t_end = 10.0 params.time_stepping.USE_CFL = True # adaptive time step params.time_stepping.CFL = 0.5
Initial conditions:
pythonparams.init_fields.type = "noise" # or "dipole", "vortex", "from_file", "in_script"
Output settings:
pythonparams.output.periods_save.phys_fields = 1.0 # save every 1.0 time units params.output.periods_save.spectra = 0.5 params.output.periods_save.spatial_means = 0.1
The Parameters object raises AttributeError for typos, preventing silent configuration errors.
See references/parameters.md for comprehensive parameter documentation.
FluidSim produces multiple output types automatically saved during simulation:
Physical fields: Velocity, vorticity in HDF5 format
pythonsim.output.phys_fields.plot("vorticity") sim.output.phys_fields.plot("vx")
Spatial means: Time series of volume-averaged quantities
pythonsim.output.spatial_means.plot()
Spectra: Energy and enstrophy spectra
pythonsim.output.spectra.plot1d() sim.output.spectra.plot2d()
Load previous simulations:
pythonfrom fluidsim import load_sim_for_plot sim = load_sim_for_plot("simulation_dir") sim.output.phys_fields.plot()
Advanced visualization: Open .h5 files in ParaView or VisIt for 3D visualization.
See references/output_analysis.md for detailed analysis workflows, parametric study analysis, and data export.
Custom forcing: Maintain turbulence or drive specific dynamics
pythonparams.forcing.enable = True params.forcing.type = "tcrandom" # time-correlated random forcing params.forcing.forcing_rate = 1.0
Custom initial conditions: Define fields in script
pythonparams.init_fields.type = "in_script" sim = Simul(params) X, Y = sim.oper.get_XY_loc() vx = sim.state.state_phys.get_var("vx") vx[:] = sin(X) * cos(Y) sim.time_stepping.start()
MPI parallelization: Run on multiple processors
bashmpirun -np 8 python simulation_script.py
Parametric studies: Run multiple simulations with different parameters
pythonfor nu in [1e-3, 5e-4, 1e-4]: params = Simul.create_default_params() params.nu_2 = nu params.output.sub_directory = f"nu{nu}" sim = Simul(params) sim.time_stepping.start()
See references/advanced_features.md for forcing types, custom solvers, cluster submission, and performance optimization.
pythonfrom fluidsim.solvers.ns2d.solver import Simul from math import pi params = Simul.create_default_params() params.oper.nx = params.oper.ny = 512 params.oper.Lx = params.oper.Ly = 2 * pi params.nu_2 = 1e-4 params.time_stepping.t_end = 50.0 params.time_stepping.USE_CFL = True params.init_fields.type = "noise" params.output.periods_save.phys_fields = 5.0 params.output.periods_save.spectra = 1.0 sim = Simul(params) sim.time_stepping.start() # Analyze energy cascade sim.output.spectra.plot1d(tmin=30.0, tmax=50.0)
pythonfrom fluidsim.solvers.ns2d.strat.solver import Simul params = Simul.create_default_params() params.oper.nx = params.oper.ny = 256 params.N = 2.0 # stratification strength params.nu_2 = 5e-4 params.time_stepping.t_end = 20.0 # Initialize with dense layer params.init_fields.type = "in_script" sim = Simul(params) X, Y = sim.oper.get_XY_loc() b = sim.state.state_phys.get_var("b") b[:] = exp(-((X - 3.14)**2 + (Y - 3.14)**2) / 0.5) sim.state.statephys_from_statespect() sim.time_stepping.start() sim.output.phys_fields.plot("b")
pythonfrom fluidsim.solvers.ns3d.solver import Simul params = Simul.create_default_params() params.oper.nx = params.oper.ny = params.oper.nz = 512 params.nu_2 = 1e-5 params.time_stepping.t_end = 10.0 params.init_fields.type = "noise" sim = Simul(params) sim.time_stepping.start()
Run with:
bashmpirun -np 64 python script.py
pythonfrom fluidsim.solvers.ns2d.solver import Simul import numpy as np from math import pi params = Simul.create_default_params() params.oper.nx = params.oper.ny = 128 params.oper.Lx = params.oper.Ly = 2 * pi params.nu_2 = 1e-3 params.time_stepping.t_end = 10.0 params.init_fields.type = "in_script" sim = Simul(params) X, Y = sim.oper.get_XY_loc() vx = sim.state.state_phys.get_var("vx") vy = sim.state.state_phys.get_var("vy") vx[:] = np.sin(X) * np.cos(Y) vy[:] = -np.cos(X) * np.sin(Y) sim.state.statephys_from_statespect() sim.time_stepping.start() # Validate energy decay df = sim.output.spatial_means.load() # Compare with analytical solution
Import solver: from fluidsim.solvers.ns2d.solver import Simul
Create parameters: params = Simul.create_default_params()
Set resolution: params.oper.nx = params.oper.ny = 256
Set viscosity: params.nu_2 = 1e-3
Set end time: params.time_stepping.t_end = 10.0
Run simulation: sim = Simul(params); sim.time_stepping.start()
Plot results: sim.output.phys_fields.plot("vorticity")
Load simulation: sim = load_sim_for_plot("path/to/sim")
Documentation: https://fluidsim.readthedocs.io/
Reference files:
references/installation.md: Complete installation instructionsreferences/solvers.md: Available solvers and selection guidereferences/simulation_workflow.md: Detailed workflow examplesreferences/parameters.md: Comprehensive parameter documentationreferences/output_analysis.md: Output types and analysis methodsreferences/advanced_features.md: Forcing, MPI, parametric studies, custom solvers| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | fail→pass | 32,605 | 11,248 | -66% | 1 | 1 | 0% | 6,967 | 4,691 | -33% | 0 | 0 | — |
case-04 | pass→pass | 11,858 | 9,437 | -20% | 1 | 1 | 0% | 1,619 | 4,172 | +158% | 0 | 0 | — |
case-02 | fail→pass | 22,139 | 12,757 | -42% | 1 | 1 | 0% | 4,312 | 5,454 | +26% | 0 | 0 | — |
case-01 | fail→fail | 23,492 | 15,213 | -35% | 1 | 1 | 0% | 3,589 | 5,039 | +40% | 0 | 0 | — |
case-05 | pass→pass | 32,532 | 20,439 | -37% | 1 | 1 | 0% | 4,731 | 7,421 | +57% | 0 | 0 | — |
case-06 | pass→pass | 6,179 | 7,184 | +16% | 1 | 1 | 0% | 1,259 | 3,982 | +216% | 0 | 0 | — |
case-07 | fail→pass | 15,912 | 3,677 | -77% | 1 | 1 | 0% | 1,996 | 3,380 | +69% | 0 | 0 | — |
case-08 | fail→pass | 9,062 | 2,924 | -68% | 1 | 1 | 0% | 1,502 | 3,229 | +115% | 0 | 0 | — |
case-09 | fail→pass | 10,494 | 4,414 | -58% | 1 | 1 | 0% | 2,055 | 3,576 | +74% | 0 | 0 | — |
case-10 | pass→pass | 8,227 | 3,482 | -58% | 1 | 1 | 0% | 1,153 | 3,192 | +177% | 0 | 0 | — |
case-11 | fail→pass | 10,782 | 4,639 | -57% | 1 | 1 | 0% | 2,047 | 3,323 | +62% | 0 | 0 | — |
case-12 | pass→pass | 13,916 | 4,981 | -64% | 1 | 1 | 0% | 1,922 | 3,404 | +77% | 0 | 0 | — |
case-13 | pass→pass | 8,955 | 1,767 | -80% | 1 | 1 | 0% | 1,737 | 3,047 | +75% | 0 | 0 | — |
case-14 | pass→pass | 9,866 | 4,659 | -53% | 1 | 1 | 0% | 1,745 | 3,372 | +93% | 0 | 0 | — |
case-15 | fail→pass | 11,873 | 2,775 | -77% | 1 | 1 | 0% | 1,529 | 3,214 | +110% | 0 | 0 | — |
case-16 | pass→pass | 34,653 | 55,657 | +61% | 1 | 1 | 0% | 2,012 | 4,738 | +135% | 0 | 0 | — |
case-17 | pass→pass | 13,992 | 5,277 | -62% | 1 | 1 | 0% | 2,031 | 3,719 | +83% | 0 | 0 | — |
case-18 | fail→fail | 19,384 | 10,134 | -48% | 1 | 1 | 0% | 2,919 | 4,908 | +68% | 0 | 0 | — |
case-19 | pass→pass | 12,279 | 7,459 | -39% | 1 | 1 | 0% | 2,222 | 3,967 | +79% | 0 | 0 | — |
case-20 | fail→pass | 7,370 | 5,045 | -32% | 1 | 1 | 0% | 1,107 | 3,448 | +211% | 0 | 0 | — |
case-21 | pass→pass | 14,046 | 6,158 | -56% | 1 | 1 | 0% | 1,992 | 3,767 | +89% | 0 | 0 | — |
case-22 | pass→pass | 7,136 | 6,029 | -16% | 1 | 1 | 0% | 1,288 | 3,507 | +172% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +36 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.