fluidsim
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.
Best use case
fluidsim is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. 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.
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.
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "fluidsim" skill to help with this workflow task. Context: 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.
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/fluidsim/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How fluidsim Compares
| Feature / Agent | fluidsim | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
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.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 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:
```bash
# Basic installation
uv uv pip install fluidsim
# With FFT support (required for most solvers)
uv uv pip install "fluidsim[fft]"
# With MPI for parallel computing
uv uv pip install "fluidsim[fft,mpi]"
```
Set environment variables for output directories (optional):
```bash
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
```python
from fluidsim.solvers.ns2d.solver import Simul
```
**Step 2**: Create and configure parameters
```python
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
```python
sim = Simul(params)
```
**Step 4**: Execute
```python
sim.time_stepping.start()
```
**Step 5**: Analyze results
```python
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
```python
from fluidsim.solvers.ns2d.solver import Simul
```
**3D Navier-Stokes** (`ns3d`): 3D turbulence, realistic flows
```python
from fluidsim.solvers.ns3d.solver import Simul
```
**Stratified flows** (`ns2d.strat`, `ns3d.strat`): Oceanic/atmospheric flows
```python
from fluidsim.solvers.ns2d.strat.solver import Simul
params.N = 1.0 # Brunt-Väisälä frequency
```
**Shallow water** (`sw1l`): Geophysical flows, rotating systems
```python
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**:
```python
params.oper.nx = 256 # grid points
params.oper.Lx = 2 * pi # domain size
```
**Physical parameters**:
```python
params.nu_2 = 1e-3 # viscosity
params.nu_4 = 0 # hyperviscosity (optional)
```
**Time stepping**:
```python
params.time_stepping.t_end = 10.0
params.time_stepping.USE_CFL = True # adaptive time step
params.time_stepping.CFL = 0.5
```
**Initial conditions**:
```python
params.init_fields.type = "noise" # or "dipole", "vortex", "from_file", "in_script"
```
**Output settings**:
```python
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
```python
sim.output.phys_fields.plot("vorticity")
sim.output.phys_fields.plot("vx")
```
**Spatial means**: Time series of volume-averaged quantities
```python
sim.output.spatial_means.plot()
```
**Spectra**: Energy and enstrophy spectra
```python
sim.output.spectra.plot1d()
sim.output.spectra.plot2d()
```
**Load previous simulations**:
```python
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
```python
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
```python
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
```bash
mpirun -np 8 python simulation_script.py
```
**Parametric studies**: Run multiple simulations with different parameters
```python
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
```python
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
```python
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
```python
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:
```bash
mpirun -np 64 python script.py
```
### Taylor-Green Vortex Validation
```python
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 solversRelated Skills
azure-quotas
Check/manage Azure quotas and usage across providers. For deployment planning, capacity validation, region selection. WHEN: "check quotas", "service limits", "current usage", "request quota increase", "quota exceeded", "validate capacity", "regional availability", "provisioning limits", "vCPU limit", "how many vCPUs available in my subscription".
raindrop-io
Manage Raindrop.io bookmarks with AI assistance. Save and organize bookmarks, search your collection, manage reading lists, and organize research materials. Use when working with bookmarks, web research, reading lists, or when user mentions Raindrop.io.
zlibrary-to-notebooklm
自动从 Z-Library 下载书籍并上传到 Google NotebookLM。支持 PDF/EPUB 格式,自动转换,一键创建知识库。
discover-skills
当你发现当前可用的技能都不够合适(或用户明确要求你寻找技能)时使用。本技能会基于任务目标和约束,给出一份精简的候选技能清单,帮助你选出最适配当前任务的技能。
web-performance-seo
Fix PageSpeed Insights/Lighthouse accessibility "!" errors caused by contrast audit failures (CSS filters, OKLCH/OKLAB, low opacity, gradient text, image backgrounds). Use for accessibility-driven SEO/performance debugging and remediation.
project-to-obsidian
将代码项目转换为 Obsidian 知识库。当用户提到 obsidian、项目文档、知识库、分析项目、转换项目 时激活。 【激活后必须执行】: 1. 先完整阅读本 SKILL.md 文件 2. 理解 AI 写入规则(默认到 00_Inbox/AI/、追加式、统一 Schema) 3. 执行 STEP 0: 使用 AskUserQuestion 询问用户确认 4. 用户确认后才开始 STEP 1 项目扫描 5. 严格按 STEP 0 → 1 → 2 → 3 → 4 顺序执行 【禁止行为】: - 禁止不读 SKILL.md 就开始分析项目 - 禁止跳过 STEP 0 用户确认 - 禁止直接在 30_Resources 创建(先到 00_Inbox/AI/) - 禁止自作主张决定输出位置
obsidian-helper
Obsidian 智能笔记助手。当用户提到 obsidian、日记、笔记、知识库、capture、review 时激活。 【激活后必须执行】: 1. 先完整阅读本 SKILL.md 文件 2. 理解 AI 写入三条硬规矩(00_Inbox/AI/、追加式、白名单字段) 3. 按 STEP 0 → STEP 1 → ... 顺序执行 4. 不要跳过任何步骤,不要自作主张 【禁止行为】: - 禁止不读 SKILL.md 就开始工作 - 禁止跳过用户确认步骤 - 禁止在非 00_Inbox/AI/ 位置创建新笔记(除非用户明确指定)
internationalizing-websites
Adds multi-language support to Next.js websites with proper SEO configuration including hreflang tags, localized sitemaps, and language-specific content. Use when adding new languages, setting up i18n, optimizing for international SEO, or when user mentions localization, translation, multi-language, or specific languages like Japanese, Korean, Chinese.
google-official-seo-guide
Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation
github-release-assistant
Generate bilingual GitHub release documentation (README.md + README.zh.md) from repo metadata and user input, and guide release prep with git add/commit/push. Use when the user asks to write or polish README files, create bilingual docs, prepare a GitHub release, or mentions release assistant/README generation.
doc-sync-tool
自动同步项目中的 Agents.md、claude.md 和 gemini.md 文件,保持内容一致性。支持自动监听和手动触发。
deploying-to-production
Automate creating a GitHub repository and deploying a web project to Vercel. Use when the user asks to deploy a website/app to production, publish a project, or set up GitHub + Vercel deployment.