Skill Tracer
Skills › Scientific Agent Skills › fluidsim › solvers.md

solvers.md

196 lines · skills/fluidsim/references/solvers.md at 5f2bc03

Open on GitHub
1# Solver registry and selection
2

Solver registry and selection

Raw lines 1 to 2
3## Do not select by name alone
4
5A solver key only identifies an implementation. Before use, verify in the
6solver's 0.9.0 API/source:
7
81. Governing equations and prognostic variables.
92. Dimensional or nondimensional parameter definitions.
103. Geometry and boundary conditions.
114. Spatial discretization, truncation, and dealiasing.
125. Time integration and stability constraints.
136. Initial-condition and forcing classes registered for that solver.
147. Conserved/dissipated quantities and output definitions.
158. Known validation examples and limits of applicability.
17Most primary FluidSim package CFD solvers use periodic domains and Fourier
18pseudospectral methods. They are not general wall-bounded, free-surface,
19industrial-geometry, multiphase, compressible, or shock-capturing solvers.

Do not select by name alone

A solver key only identifies an implementation. Before use, verify in the solver's 0.9.0 API/source:

  1. Governing equations and prognostic variables.
  2. Dimensional or nondimensional parameter definitions.
  3. Geometry and boundary conditions.
  4. Spatial discretization, truncation, and dealiasing.
  5. Time integration and stability constraints.
  6. Initial-condition and forcing classes registered for that solver.
  7. Conserved/dissipated quantities and output definitions.
  8. Known validation examples and limits of applicability.

Most primary FluidSim package CFD solvers use periodic domains and Fourier pseudospectral methods. They are not general wall-bounded, free-surface, industrial-geometry, multiphase, compressible, or shock-capturing solvers.

Raw lines 3 to 20
21## FluidSim 0.9.0 registry
23The following keys/modules come from the official 0.9.0 `pyproject.toml` entry
24points and were cross-checked with the installed pinned package.

FluidSim 0.9.0 registry

The following keys/modules come from the official 0.9.0 pyproject.toml entry points and were cross-checked with the installed pinned package.

Raw lines 21 to 25
26### Cartesian fluid and wave solvers
28| Key | Direct import | Scope to verify |
29|---|---|---|
30| `ns2d` | `fluidsim.solvers.ns2d.solver.Simul` | 2D incompressible Navier–Stokes |
31| `ns2d.bouss` | `fluidsim.solvers.ns2d.bouss.solver.Simul` | 2D Boussinesq variant |
32| `ns2d.strat` | `fluidsim.solvers.ns2d.strat.solver.Simul` | 2D stratified Boussinesq, constant `N` |
33| `ns3d` | `fluidsim.solvers.ns3d.solver.Simul` | 3D incompressible Navier–Stokes |
34| `ns3d.bouss` | `fluidsim.solvers.ns3d.bouss.solver.Simul` | 3D Boussinesq variant |
35| `ns3d.strat` | `fluidsim.solvers.ns3d.strat.solver.Simul` | 3D stratified Boussinesq, constant `N` |
36| `sw1l` | `fluidsim.solvers.sw1l.solver.Simul` | One-layer shallow-water equations |
37| `sw1l.exactlin` | `fluidsim.solvers.sw1l.exactlin.solver.Simul` | SW1L exact-linear variant |
38| `sw1l.modified` | `fluidsim.solvers.sw1l.modified.solver.Simul` | Modified SW1L equations |
39| `sw1l.onlywaves` | `fluidsim.solvers.sw1l.onlywaves.solver.Simul` | SW1L wave-only variant |
40| `plate2d` | `fluidsim.solvers.plate2d.solver.Simul` | 2D Föppl–von Kármán elastic plate |
41| `waves2d` | `fluidsim.solvers.waves2d.solver.Simul` | 2D wave model |
43`fvk` is **not** the current entry-point key. Use `plate2d` after verifying its
44equations and parameters.

Cartesian fluid and wave solvers

KeyDirect importScope to verify
ns2dfluidsim.solvers.ns2d.solver.Simul2D incompressible Navier–Stokes
ns2d.boussfluidsim.solvers.ns2d.bouss.solver.Simul2D Boussinesq variant
ns2d.stratfluidsim.solvers.ns2d.strat.solver.Simul2D stratified Boussinesq, constant N
ns3dfluidsim.solvers.ns3d.solver.Simul3D incompressible Navier–Stokes
ns3d.boussfluidsim.solvers.ns3d.bouss.solver.Simul3D Boussinesq variant
ns3d.stratfluidsim.solvers.ns3d.strat.solver.Simul3D stratified Boussinesq, constant N
sw1lfluidsim.solvers.sw1l.solver.SimulOne-layer shallow-water equations
sw1l.exactlinfluidsim.solvers.sw1l.exactlin.solver.SimulSW1L exact-linear variant
sw1l.modifiedfluidsim.solvers.sw1l.modified.solver.SimulModified SW1L equations
sw1l.onlywavesfluidsim.solvers.sw1l.onlywaves.solver.SimulSW1L wave-only variant
plate2dfluidsim.solvers.plate2d.solver.Simul2D Föppl–von Kármán elastic plate
waves2dfluidsim.solvers.waves2d.solver.Simul2D wave model

fvk is not the current entry-point key. Use plate2d after verifying its equations and parameters.

Raw lines 26 to 45
46### Lower-dimensional models
48| Key | Module |
49|---|---|
50| `ad1d` | `fluidsim.solvers.ad1d.solver` |
51| `ad1d.pseudo_spect` | `fluidsim.solvers.ad1d.pseudo_spect.solver` |
52| `burgers1d` | `fluidsim.solvers.burgers1d.solver` |
53| `burgers1d.skew_sym` | `fluidsim.solvers.burgers1d.skew_sym.solver` |
54| `nl1d` | `fluidsim.solvers.nl1d.solver` |
55| `models0d.lorenz` | `fluidsim.solvers.models0d.lorenz.solver` |
56| `models0d.predaprey` | `fluidsim.solvers.models0d.predaprey.solver` |
58These are useful for model studies, testing, and teaching. Do not apply the
59Cartesian CFD configuration schema mechanically to 0D/1D solvers.

Lower-dimensional models

KeyModule
ad1dfluidsim.solvers.ad1d.solver
ad1d.pseudo_spectfluidsim.solvers.ad1d.pseudo_spect.solver
burgers1dfluidsim.solvers.burgers1d.solver
burgers1d.skew_symfluidsim.solvers.burgers1d.skew_sym.solver
nl1dfluidsim.solvers.nl1d.solver
models0d.lorenzfluidsim.solvers.models0d.lorenz.solver
models0d.predapreyfluidsim.solvers.models0d.predaprey.solver

These are useful for model studies, testing, and teaching. Do not apply the Cartesian CFD configuration schema mechanically to 0D/1D solvers.

Raw lines 46 to 60
61### Spherical solvers
63| Key | Module |
64|---|---|
65| `sphere.ns2d` | `fluidsim.solvers.sphere.ns2d.solver` |
66| `sphere.sw1l` | `fluidsim.solvers.sphere.sw1l.solver` |
68FluidSim 0.9.0 source contains these entry points, but the `sphere` optional
69dependency is commented out in package metadata. Confirm and pin compatible
70`fluidsht`/spherical-harmonic dependencies before import. Spherical resolution,
71operators, geometry, and diagnostics differ from Cartesian `nx`/`ny` plans.

Spherical solvers

KeyModule
sphere.ns2dfluidsim.solvers.sphere.ns2d.solver
sphere.sw1lfluidsim.solvers.sphere.sw1l.solver

FluidSim 0.9.0 source contains these entry points, but the sphere optional dependency is commented out in package metadata. Confirm and pin compatible fluidsht/spherical-harmonic dependencies before import. Spherical resolution, operators, geometry, and diagnostics differ from Cartesian nx/ny plans.

Raw lines 61 to 72
73### Framework/base adapters
75The registry also declares:
77- `Base` → `fluidsim.base.solvers.base`
78- `BasePS` → `fluidsim.base.solvers.pseudo_spect`
79- `BaseSH` → `fluidsim.base.sphericalharmo.solver`
80- `basil` → `fluidsim.base.basilisk.solver`
81- `dedalus` → `fluidsim.base.dedalus.solver`
83These are framework/base or external-interface entry points, not evidence that
84all external runtimes are installed. Check the external project's current API,
85license, and environment separately.

Framework/base adapters

The registry also declares:

  • Base → fluidsim.base.solvers.base
  • BasePS → fluidsim.base.solvers.pseudo_spect
  • BaseSH → fluidsim.base.sphericalharmo.solver
  • basil → fluidsim.base.basilisk.solver
  • dedalus → fluidsim.base.dedalus.solver

These are framework/base or external-interface entry points, not evidence that all external runtimes are installed. Check the external project's current API, license, and environment separately.

Raw lines 73 to 86
87## Imports
89Prefer direct imports in reproducible scripts:
91```python
92from fluidsim.solvers.ns3d.strat.solver import Simul
94params = Simul.create_default_params()
95```
97FluidSim also supports registry lookup:
99```python
100from fluidsim import import_simul_class_from_key
102Simul = import_simul_class_from_key("ns2d.strat")
103```
105Only pass a reviewed literal or a value checked against a fixed allowlist. Do not
106derive module names or solver keys from untrusted text. The bundled generator
107uses a static key-to-module map and never performs a dynamic import.

Imports

Prefer direct imports in reproducible scripts:

from fluidsim.solvers.ns3d.strat.solver import Simul

params = Simul.create_default_params()

FluidSim also supports registry lookup:

from fluidsim import import_simul_class_from_key

Simul = import_simul_class_from_key("ns2d.strat")

Only pass a reviewed literal or a value checked against a fixed allowlist. Do not derive module names or solver keys from untrusted text. The bundled generator uses a static key-to-module map and never performs a dynamic import.

Raw lines 87 to 108
109## Selection questions

Selection questions

Raw lines 109 to 110
111### NS2D versus NS3D
113- Dimensionality changes the equations and invariant/cascade structure; a 2D
114 run is not a cheaper approximation to arbitrary 3D physics.
115- NS3D memory and FFT communication grow rapidly. Estimate before
116 instantiation.
117- State keys, forcing normalization, spectra, and budget outputs differ.

NS2D versus NS3D

  • Dimensionality changes the equations and invariant/cascade structure; a 2D run is not a cheaper approximation to arbitrary 3D physics.
  • NS3D memory and FFT communication grow rapidly. Estimate before instantiation.
  • State keys, forcing normalization, spectra, and budget outputs differ.
Raw lines 111 to 118
119### Boussinesq versus stratified
121Do not use `.bouss` and `.strat` interchangeably. Inspect the solver equation
122documentation, variable definitions, background state, buoyancy sign, `N`,
123rotation, and energy definitions. Record dimensional mapping for buoyancy and
124density variables.

Boussinesq versus stratified

Do not use .bouss and .strat interchangeably. Inspect the solver equation documentation, variable definitions, background state, buoyancy sign, N, rotation, and energy definitions. Record dimensional mapping for buoyancy and density variables.

Raw lines 119 to 125
126### Shallow water
128Verify the exact SW1L variant, layer-depth/height variable, wave speed
129parameterization, Coriolis convention, potential-vorticity definition, and
130whether the planned regime satisfies the model assumptions. A SW1L run does not
131by itself validate tsunami or geophysical predictions.

Shallow water

Verify the exact SW1L variant, layer-depth/height variable, wave speed parameterization, Coriolis convention, potential-vorticity definition, and whether the planned regime satisfies the model assumptions. A SW1L run does not by itself validate tsunami or geophysical predictions.

Raw lines 126 to 132
133### Elastic plate
135Use `plate2d`, not the old `fvk` label. Verify plate parameters, forcing,
136dissipation, dimensional scaling, and whether the output represents displacement,
137velocity, or derived quantities.

Elastic plate

Use plate2d, not the old fvk label. Verify plate parameters, forcing, dissipation, dimensional scaling, and whether the output represents displacement, velocity, or derived quantities.

Raw lines 133 to 138
139## Default-parameter discovery
141Every selected solver should be interrogated in the exact locked environment:
143```python
144from fluidsim.solvers.ns2d.solver import Simul
146params = Simul.create_default_params()
147print(params)
148```
150Use IPython completion or the generated parameter documentation. `ParamContainer`
151prevents silently adding unknown attributes, but it does not establish that a
152valid attribute is physically meaningful.
154For NS2D 0.9.0, the pinned smoke test found:
156- `oper`: `nx`, `ny`, `Lx`, `Ly`, `coef_dealiasing`,
157 `truncation_shape`, `type_fft`, `NO_KY0`, `NO_SHEAR_MODES`.
158- Time stepping: `USE_CFL`, `USE_T_END`, `cfl_coef`, `deltat0`,
159 `deltat_max`, `it_end`, `max_elapsed`, `t_end`, `type_time_scheme`.
160- Initial types advertised by the solver:
161 `from_file`, `from_simul`, `in_script`, `constant`, `noise`, `jet`, `dipole`.
162- Forcing types advertised:
163 `in_script`, `in_script_coarse`, `pseudo_spectral`, `proportional`,
164 `tcrandom`, `tcrandom_anisotropic`.
166Do not generalize that list to other solvers. The bundled validator now uses
167per-solver initialization, forcing, physics-parameter, and output profiles
168checked against all twelve Cartesian solver defaults. For example, NS3D does
169not register `jet`, `increments`, or `spectra_multidim`; SW1L and `waves2d`
170have different forcing/output surfaces. These checks establish API availability,
171not physical validation of every solver.

Default-parameter discovery

Every selected solver should be interrogated in the exact locked environment:

from fluidsim.solvers.ns2d.solver import Simul

params = Simul.create_default_params()
print(params)

Use IPython completion or the generated parameter documentation. ParamContainer prevents silently adding unknown attributes, but it does not establish that a valid attribute is physically meaningful.

For NS2D 0.9.0, the pinned smoke test found:

  • oper: nx, ny, Lx, Ly, coef_dealiasing, truncation_shape, type_fft, NO_KY0, NO_SHEAR_MODES.
  • Time stepping: USE_CFL, USE_T_END, cfl_coef, deltat0, deltat_max, it_end, max_elapsed, t_end, type_time_scheme.
  • Initial types advertised by the solver: from_file, from_simul, in_script, constant, noise, jet, dipole.
  • Forcing types advertised: in_script, in_script_coarse, pseudo_spectral, proportional, tcrandom, tcrandom_anisotropic.

Do not generalize that list to other solvers. The bundled validator now uses per-solver initialization, forcing, physics-parameter, and output profiles checked against all twelve Cartesian solver defaults. For example, NS3D does not register jet, increments, or spectra_multidim; SW1L and waves2d have different forcing/output surfaces. These checks establish API availability, not physical validation of every solver.

Raw lines 139 to 172
173## Evidence required before interpretation
175For any solver:
177- Map each code variable and coefficient to the stated model.
178- Verify sign conventions, normalization, and Fourier conventions.
179- Confirm periodicity and domain lengths.
180- Check initial-condition constraints (for example divergence-free velocity).
181- Check forcing injection in measured output, not only requested parameters.
182- Check all relevant invariant/budget residuals.
183- Inspect spectral support and dealiased tails.
184- Repeat at refined grid and time step.
185- Compare with a suitable independent benchmark.

Evidence required before interpretation

For any solver:

  • Map each code variable and coefficient to the stated model.
  • Verify sign conventions, normalization, and Fourier conventions.
  • Confirm periodicity and domain lengths.
  • Check initial-condition constraints (for example divergence-free velocity).
  • Check forcing injection in measured output, not only requested parameters.
  • Check all relevant invariant/budget residuals.
  • Inspect spectral support and dealiased tails.
  • Repeat at refined grid and time step.
  • Compare with a suitable independent benchmark.
Raw lines 173 to 186
187## Sources (verified 2026-10-01)
189- [FluidSim 0.9.0 package entry points](https://github.com/fluiddyn/fluidsim/blob/0.9.0/pyproject.toml).
190- [FluidSim solver API index](https://fluidsim.readthedocs.io/en/latest/generated/fluidsim.solvers.html).
191- [NS2D solver API](https://fluidsim.readthedocs.io/en/latest/generated/fluidsim.solvers.ns2d.solver.html).
192- [NS3D solver API](https://fluidsim.readthedocs.io/en/latest/generated/fluidsim.solvers.ns3d.solver.html).
193- [FluidSim documentation overview](https://fluidsim.readthedocs.io/en/latest/).
194- Mohanan et al., [FluidSim primary paper](https://doi.org/10.5334/jors.239),
195 published 2019-04-26. Method and performance statements in this reference are
196 limited to the implementations and benchmarks described there.

Sources (verified 2026-10-01)

Raw lines 187 to 196