fluidsim

K-Dense Inc./fluidsim · updated May 19, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill fluidsim
0 commentsdiscussion
summary

Framework for computational fluid dynamics simulations using Python, supporting various solvers and high-performance computing.

skill.md
name
fluidsim
description
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.
license
CeCILL FREE SOFTWARE LICENSE AGREEMENT
metadata
skill-author: K-Dense Inc.

FluidSim

Overview

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:

  • Multiple solvers: 2D/3D Navier-Stokes, shallow water, stratified flows
  • High performance: Pythran/Transonic compilation, MPI parallelization
  • Complete workflow: Parameter configuration, simulation execution, output analysis
  • Interactive analysis: Python-based post-processing and visualization

Core Capabilities

1. Installation and Setup

Install fluidsim using uv with appropriate feature flags:

# 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):

export 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.

2. Running Simulations

Standard workflow consists of five steps:

Step 1: Import solver

from fluidsim.solvers.ns2d.solver import Simul

Step 2: Create and configure parameters

params = 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

sim = Simul(params)

Step 4: Execute

sim.time_stepping.start()

Step 5: Analyze results

sim.output.phys_fields.plot("vorticity")
sim.output.spatial_means.plot()

See references/simulation_workflow.md for complete examples, restarting simulations, and cluster deployment.

3. Available Solvers

Choose solver based on physical problem:

2D Navier-Stokes (ns2d): 2D turbulence, vortex dynamics

from fluidsim.solvers.ns2d.solver import Simul

3D Navier-Stokes (ns3d): 3D turbulence, realistic flows

from fluidsim.solvers.ns3d.solver import Simul

Stratified flows (ns2d.strat, ns3d.strat): Oceanic/atmospheric flows

from fluidsim.solvers.ns2d.strat.solver import Simul
params.N = 1.0  # Brunt-Väisälä frequency

Shallow water (sw1l): Geophysical flows, rotating systems

from fluidsim.solvers.sw1l.solver import Simul
params.f = 1.0  # Coriolis parameter

See references/solvers.md for complete solver list and selection guidance.

4. Parameter Configuration

Parameters are organized hierarchically and accessed via dot notation:

Domain and resolution:

params.oper.nx = 256  # grid points
params.oper.Lx = 2 * pi  # domain size

Physical parameters:

params.nu_2 = 1e-3  # viscosity
params.nu_4 = 0     # hyperviscosity (optional)

Time stepping:

params.time_stepping.t_end = 10.0
params.time_stepping.USE_CFL = True  # adaptive time step
params.time_stepping.CFL = 0.5

Initial conditions:

params.init_fields.type = "noise"  # or "dipole", "vortex", "from_file", "in_script"

Output settings:

params.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.

5. Output and Analysis

FluidSim produces multiple output types automatically saved during simulation:

Physical fields: Velocity, vorticity in HDF5 format

sim.output.phys_fields.plot("vorticity")
sim.output.phys_fields.plot("vx")

Spatial means: Time series of volume-averaged quantities

sim.output.spatial_means.plot()

Spectra: Energy and enstrophy spectra

sim.output.spectra.plot1d()
sim.output.spectra.plot2d()

Load previous simulations:

from 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.

6. Advanced Features

Custom forcing: Maintain turbulence or drive specific dynamics

params.forcing.enable = True
params.forcing.type = "tcrandom"  # time-correlated random forcing
params.forcing.forcing_rate = 1.0

Custom initial conditions: Define fields in script

params.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

mpirun -np 8 python simulation_script.py

Parametric studies: Run multiple simulations with different parameters

for 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.

Common Use Cases

2D Turbulence Study

from 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)

Stratified Flow Simulation

from 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")

High-Resolution 3D Simulation with MPI

from 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:

mpirun -np 64 python script.py

Taylor-Green Vortex Validation

from 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

Quick Reference

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")

Resources

Documentation: https://fluidsim.readthedocs.io/

Reference files:

  • references/installation.md: Complete installation instructions
  • references/solvers.md: Available solvers and selection guide
  • references/simulation_workflow.md: Detailed workflow examples
  • references/parameters.md: Comprehensive parameter documentation
  • references/output_analysis.md: Output types and analysis methods
  • references/advanced_features.md: Forcing, MPI, parametric studies, custom solvers
how to use fluidsim

How to use fluidsim on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add fluidsim
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill fluidsim

The skills CLI fetches fluidsim from GitHub repository K-Dense Inc./fluidsim and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/fluidsim

Reload or restart Cursor to activate fluidsim. Access the skill through slash commands (e.g., /fluidsim) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Accelerate Code Development

Use skill to generate boilerplate code, refactor legacy code, and write tests faster

Example

Generate React component with TypeScript types, styled-components, and comprehensive test suite in minutes

Reduce development time by 40-60% for repetitive coding tasks

Code Review Automation

Systematically review code for bugs, security issues, and style violations

Example

Analyze pull requests for common anti-patterns, suggest performance improvements, flag security vulnerabilities

Catch 70%+ of code issues before human review, improve code quality

Debug Complex Issues

Trace errors through stack traces and identify root causes faster

Example

Analyze error logs, suggest probable causes, recommend fixes with code examples

Cut debugging time by 30-50%, especially for unfamiliar codebases

Learn New Technologies

Get explanations, examples, and best practices for unfamiliar frameworks

Example

Understand Next.js app router, learn Rust ownership, grasp Kubernetes concepts with practical examples

Accelerate learning curve by 2-3x, reduce onboarding time for new tech stacks

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill installation support
  • Basic understanding of programming concepts and version control (Git)
  • Code editor or IDE for testing generated code (VS Code, JetBrains, etc.)
  • Test environment separate from production for validating skill outputs

Time Estimate

15-30 minutes to install and see first useful output

Installation Steps

  1. 1.Install the skill using provided installation command
  2. 2.Verify skill is loaded in Claude Desktop (check ~/.claude/skills directory)
  3. 3.Test skill with simple prompt: 'Help me review this code snippet'
  4. 4.Gradually increase complexity: code generation → refactoring → architecture advice
  5. 5.Review all generated code before committing to repository
  6. 6.Iterate on prompts to improve output quality and relevance
  7. 7.Share effective prompts with team for consistency

Common Pitfalls

  • Blindly trusting generated code without testing—always run tests and manual review
  • Not providing enough context about your project structure and coding standards
  • Expecting perfection on first generation—iteration and refinement are normal
  • Sharing proprietary code or API keys in prompts—maintain confidentiality
  • Over-relying on skill for critical security or business logic code
  • Skipping documentation of why AI-generated code was chosen over alternatives

Best Practices

✓ Do

  • +Always review and test AI-generated code before merging
  • +Provide clear context: language, framework, coding standards, constraints
  • +Use for boilerplate, tests, docs—areas where mistakes are easily caught
  • +Iterate on prompts: start broad, refine with specific requirements
  • +Combine AI suggestions with human judgment and domain expertise
  • +Document successful prompt patterns for team reuse
  • +Keep version control so you can rollback if needed
  • +Use skill for learning and exploration, not production-critical features initially

✗ Don't

  • Don't commit AI code without thorough testing and review
  • Don't expose sensitive code, credentials, or proprietary algorithms
  • Don't use for security-critical code (auth, crypto, payments) without expert review
  • Don't skip peer review process just because AI generated it
  • Don't assume code follows your team's conventions—verify
  • Don't let junior developers skip learning fundamentals by relying solely on AI
  • Don't ignore compiler warnings or test failures in generated code

💡 Pro Tips

  • Describe desired patterns explicitly: 'Use async/await, avoid callbacks'
  • Ask for alternatives: 'Show 3 approaches to solve this, with tradeoffs'
  • Request explanations: 'Explain why this approach is better than X'
  • Use skill for 70% generation + 30% manual refinement for best results
  • Build a prompt library for common patterns (API endpoints, components, tests)
  • Pair program with AI: describe problem → review solution → iterate → refine

When to Use This

✓ Use When

Use coding skills for boilerplate generation, code reviews, refactoring legacy code, writing tests, learning new frameworks, and debugging non-critical issues. Best for repetitive tasks where errors are easy to catch.

✗ Avoid When

Avoid for production security features (auth, encryption, payment processing), complex business logic requiring deep domain knowledge, performance-critical algorithms, or when learning fundamentals is more valuable than speed.

Learning Path

  1. 1Start with simple tasks: generate functions, write tests, explain code
  2. 2Progress to code review: analyze PRs, suggest improvements
  3. 3Advanced: architectural decisions, refactoring strategies, performance optimization
  4. 4Expert: use for exploring new paradigms, researching best practices, mentoring juniors

Integration

  • VS Code
  • JetBrains IDEs
  • Cursor
  • GitHub Copilot
  • Git workflows

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.539 reviews
  • Ganesh Mohane· Dec 24, 2024

    fluidsim reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Camila Tandon· Dec 24, 2024

    Useful defaults in fluidsim — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Sakura Diallo· Nov 15, 2024

    fluidsim has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Sakura Khan· Oct 6, 2024

    Solid pick for teams standardizing on skills: fluidsim is focused, and the summary matches what you get after install.

  • Sophia Bhatia· Sep 21, 2024

    fluidsim fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Yusuf Gill· Sep 17, 2024

    Registry listing for fluidsim matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Piyush G· Sep 1, 2024

    We added fluidsim from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Ren Zhang· Sep 1, 2024

    fluidsim reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Sophia Dixit· Sep 1, 2024

    Solid pick for teams standardizing on skills: fluidsim is focused, and the summary matches what you get after install.

  • Shikha Mishra· Aug 20, 2024

    fluidsim fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

showing 1-10 of 39

1 / 4