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

parameters.md

331 lines · skills/fluidsim/references/parameters.md at 5f2bc03

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1# Parameter surface and validation
2

Parameter surface and validation

Raw lines 1 to 2
3## Source of truth
4
5Create parameters from the exact selected class:
6
7```python
8from fluidsim.solvers.ns2d.solver import Simul
9
10params = Simul.create_default_params()
11print(params)
12```
14FluidSim composes parameters from registered operator, state, time-stepping,
15initialization, forcing, and output classes. The tree is solver- and
16extension-specific. There is no universal flat FluidSim parameter schema.
18`ParamContainer` rejects assignment to undeclared attributes, which catches many
19typos. It does not check units, physical interpretation, numerical convergence,
20or whether a valid option is appropriate.
22The following snapshot was introspected from a pinned
23`fluidsim[fft]==0.9.0`/`fluidfft==0.4.5` NS2D environment on 2026-09-30 and reviewed on 2026-10-01.

Source of truth

Create parameters from the exact selected class:

from fluidsim.solvers.ns2d.solver import Simul

params = Simul.create_default_params()
print(params)

FluidSim composes parameters from registered operator, state, time-stepping, initialization, forcing, and output classes. The tree is solver- and extension-specific. There is no universal flat FluidSim parameter schema.

ParamContainer rejects assignment to undeclared attributes, which catches many typos. It does not check units, physical interpretation, numerical convergence, or whether a valid option is appropriate.

The following snapshot was introspected from a pinned fluidsim[fft]==0.9.0/fluidfft==0.4.5 NS2D environment on 2026-09-30 and reviewed on 2026-10-01.

Raw lines 3 to 24
25## Top-level controls
27Common pseudospectral fields:
29```python
30params.NEW_DIR_RESULTS = True
31params.ONLY_COARSE_OPER = False
32params.short_name_type_run = ""
34params.nu_2 = 1e-3
35params.nu_4 = 0.0
36params.nu_8 = 0.0
37params.nu_m4 = 0.0
38```
40- `NEW_DIR_RESULTS` primarily controls loading/restart output behavior. Official
41 docs say a loaded simulation creates a new directory when true and appends to
42 the old directory when false. Choose explicitly and preserve the parent.
43- `ONLY_COARSE_OPER` is for fast loading/plotting and cannot process full fields.
44- `nu_2`, `nu_4`, `nu_8`, and `nu_m4` are solver dissipation coefficients. Their
45 dimensions depend on derivative order and nondimensionalization.
47Do not use higher-order dissipation merely to hide insufficient resolution.
48State its definition and verify budgets/tails/refinement.
50Solver-specific top-level examples include:
52- `N` for constant stratification in `.strat` solvers.
53- `f` for rotation where implemented.
54- `beta`, `c2`, projections, and other fields in specific solvers.
56Inspect the selected solver documentation rather than copying these blindly.

Top-level controls

Common pseudospectral fields:

params.NEW_DIR_RESULTS = True
params.ONLY_COARSE_OPER = False
params.short_name_type_run = ""

params.nu_2 = 1e-3
params.nu_4 = 0.0
params.nu_8 = 0.0
params.nu_m4 = 0.0
  • NEW_DIR_RESULTS primarily controls loading/restart output behavior. Official docs say a loaded simulation creates a new directory when true and appends to the old directory when false. Choose explicitly and preserve the parent.
  • ONLY_COARSE_OPER is for fast loading/plotting and cannot process full fields.
  • nu_2, nu_4, nu_8, and nu_m4 are solver dissipation coefficients. Their dimensions depend on derivative order and nondimensionalization.

Do not use higher-order dissipation merely to hide insufficient resolution. State its definition and verify budgets/tails/refinement.

Solver-specific top-level examples include:

  • N for constant stratification in .strat solvers.
  • f for rotation where implemented.
  • beta, c2, projections, and other fields in specific solvers.

Inspect the selected solver documentation rather than copying these blindly.

Raw lines 25 to 57
58## Operators
60NS2D defaults:
62```python
63params.oper.nx = 48
64params.oper.ny = 48
65params.oper.Lx = 8
66params.oper.Ly = 8
67params.oper.coef_dealiasing = 2 / 3
68params.oper.truncation_shape = "cubic"
69params.oper.type_fft = "default"
70params.oper.NO_KY0 = False
71params.oper.NO_SHEAR_MODES = False
72```
74NS3D adds `nz`/`Lz` and solver-specific options. Never infer physical spacing
75without the domain convention. Record:
77- `nx`, `ny`, `nz` and `Lx`, `Ly`, `Lz`.
78- Grid spacing and maximum represented/dealiased wave numbers.
79- `coef_dealiasing`, truncation shape, and phase-shift scheme if used.
80- Actual selected FluidFFT method and decomposition.
81- Removed modes/symmetries.
83Powers of two are not a universal requirement or guarantee of fastest FFT.
84Benchmark representative allowed shapes on the target backend.
86`type_fft="default"` delegates selection. For provenance-critical runs, inspect
87and record the actual method; set an explicit tested method if the environment
88supports it.

Operators

NS2D defaults:

params.oper.nx = 48
params.oper.ny = 48
params.oper.Lx = 8
params.oper.Ly = 8
params.oper.coef_dealiasing = 2 / 3
params.oper.truncation_shape = "cubic"
params.oper.type_fft = "default"
params.oper.NO_KY0 = False
params.oper.NO_SHEAR_MODES = False

NS3D adds nz/Lz and solver-specific options. Never infer physical spacing without the domain convention. Record:

  • nx, ny, nz and Lx, Ly, Lz.
  • Grid spacing and maximum represented/dealiased wave numbers.
  • coef_dealiasing, truncation shape, and phase-shift scheme if used.
  • Actual selected FluidFFT method and decomposition.
  • Removed modes/symmetries.

Powers of two are not a universal requirement or guarantee of fastest FFT. Benchmark representative allowed shapes on the target backend.

type_fft="default" delegates selection. For provenance-critical runs, inspect and record the actual method; set an explicit tested method if the environment supports it.

Raw lines 58 to 89
90## Time stepping
92NS2D 0.9.0 defaults:
94```python
95params.time_stepping.USE_CFL = True
96params.time_stepping.USE_T_END = True
97params.time_stepping.cfl_coef = None
98params.time_stepping.deltat0 = 0.2
99params.time_stepping.deltat_max = 0.2
100params.time_stepping.it_end = 10
101params.time_stepping.max_elapsed = None
102params.time_stepping.t_end = 10.0
103params.time_stepping.type_time_scheme = "RK4"
104```
106The current field is `cfl_coef`, **not** `CFL`.
108For reproducible bounded plans, set explicitly:
110```python
111params.time_stepping.USE_CFL = True
112params.time_stepping.cfl_coef = 0.5
113params.time_stepping.deltat0 = 1e-3
114params.time_stepping.deltat_max = 1e-2
115params.time_stepping.USE_T_END = True
116params.time_stepping.t_end = 0.1
117params.time_stepping.max_elapsed = "00:05:00"
118```
120`cfl_coef=0.5` here is an explicit pilot choice, not a universal recommendation.
121The acceptable value depends on equations, scheme, waves, dissipation, and
122resolution. Check recorded `deltat` and refine.
124Current pseudospectral scheme names documented in 0.9:
126- `Euler`
127- `Euler_phaseshift`
128- `Euler_phaseshift_random`
129- `RK2`
130- `RK2_trapezoid`
131- `RK2_phaseshift`
132- `RK2_phaseshift_random`
133- `RK2_phaseshift_random_split`
134- `RK2_phaseshift_exact`
135- `RK4`
137Random phase-shift schemes also expose:
139```python
140params.time_stepping.phaseshift_random.nb_pairs = 1
141params.time_stepping.phaseshift_random.nb_steps_compute_new_pair = None
142```
144Do not infer exact dealiasing or convergence from a scheme name. Verify its
145implementation and test a smaller time step.

Time stepping

NS2D 0.9.0 defaults:

params.time_stepping.USE_CFL = True
params.time_stepping.USE_T_END = True
params.time_stepping.cfl_coef = None
params.time_stepping.deltat0 = 0.2
params.time_stepping.deltat_max = 0.2
params.time_stepping.it_end = 10
params.time_stepping.max_elapsed = None
params.time_stepping.t_end = 10.0
params.time_stepping.type_time_scheme = "RK4"

The current field is cfl_coef, not CFL.

For reproducible bounded plans, set explicitly:

params.time_stepping.USE_CFL = True
params.time_stepping.cfl_coef = 0.5
params.time_stepping.deltat0 = 1e-3
params.time_stepping.deltat_max = 1e-2
params.time_stepping.USE_T_END = True
params.time_stepping.t_end = 0.1
params.time_stepping.max_elapsed = "00:05:00"

cfl_coef=0.5 here is an explicit pilot choice, not a universal recommendation. The acceptable value depends on equations, scheme, waves, dissipation, and resolution. Check recorded deltat and refine.

Current pseudospectral scheme names documented in 0.9:

  • Euler
  • Euler_phaseshift
  • Euler_phaseshift_random
  • RK2
  • RK2_trapezoid
  • RK2_phaseshift
  • RK2_phaseshift_random
  • RK2_phaseshift_random_split
  • RK2_phaseshift_exact
  • RK4

Random phase-shift schemes also expose:

params.time_stepping.phaseshift_random.nb_pairs = 1
params.time_stepping.phaseshift_random.nb_steps_compute_new_pair = None

Do not infer exact dealiasing or convergence from a scheme name. Verify its implementation and test a smaller time step.

Raw lines 90 to 146
147## Initial fields
149NS2D advertises:
151```python
152params.init_fields.type = "constant"
153params.init_fields.modif_after_init = False
154```
156Available types in the pinned NS2D profile:
158- `constant`
159- `noise`
160- `jet`
161- `dipole`
162- `from_file`
163- `from_simul`
164- `in_script`
166Nested fields include:
168```python
169params.init_fields.constant.value = 0.0
170params.init_fields.noise.velo_max = 1.0
171params.init_fields.noise.length = 0.0
172params.init_fields.from_file.path = "state_phys_t001.000.nc"
173```
175Other solvers advertise different types/variables. For random initial fields,
176record seed, process count, backend, generated spectrum/amplitude, and resulting
177constraints. A seed alone may not guarantee bitwise identity across MPI
178decompositions or versions.
180For in-script initialization:
1821. Inspect `sim.state.keys_state_phys`/solver state documentation.
1832. Fill the solver's canonical variables.
1843. Use the solver's documented physical-to-spectral conversion method.
1854. Enforce divergence/constraints and dealias if required.
1865. Save and inspect the initialized state before advancement.
188Do not reuse old examples with guessed keys such as `vx` versus `ux`, or call a
189spectral-to-physical method after modifying physical fields.

Initial fields

NS2D advertises:

params.init_fields.type = "constant"
params.init_fields.modif_after_init = False

Available types in the pinned NS2D profile:

  • constant
  • noise
  • jet
  • dipole
  • from_file
  • from_simul
  • in_script

Nested fields include:

params.init_fields.constant.value = 0.0
params.init_fields.noise.velo_max = 1.0
params.init_fields.noise.length = 0.0
params.init_fields.from_file.path = "state_phys_t001.000.nc"

Other solvers advertise different types/variables. For random initial fields, record seed, process count, backend, generated spectrum/amplitude, and resulting constraints. A seed alone may not guarantee bitwise identity across MPI decompositions or versions.

For in-script initialization:

  1. Inspect sim.state.keys_state_phys/solver state documentation.
  2. Fill the solver's canonical variables.
  3. Use the solver's documented physical-to-spectral conversion method.
  4. Enforce divergence/constraints and dealias if required.
  5. Save and inspect the initialized state before advancement.

Do not reuse old examples with guessed keys such as vx versus ux, or call a spectral-to-physical method after modifying physical fields.

Raw lines 147 to 190
191## Forcing
193Base fields:
195```python
196params.forcing.enable = False
197params.forcing.type = ""
198params.forcing.forcing_rate = 1.0
199params.forcing.key_forced = None
200params.forcing.nkmin_forcing = 4
201params.forcing.nkmax_forcing = 5
202```
204NS2D advertises `in_script`, `in_script_coarse`, `pseudo_spectral`,
205`proportional`, `tcrandom`, and `tcrandom_anisotropic`.
207Nested current fields:
209```python
210params.forcing.normalized.constant_rate_of = None
211params.forcing.normalized.type = "2nd_degree_eq"
212params.forcing.normalized.which_root = "minabs"
213params.forcing.random.only_positive = False
214params.forcing.tcrandom.time_correlation = "based_on_forcing_rate"
215```
217The old flat field `tcrandom_time_correlation` is not current.
219For a time-correlated random plan:
221```python
222params.forcing.enable = True
223params.forcing.type = "tcrandom"
224params.forcing.forcing_rate = 1.0
225params.forcing.nkmin_forcing = 4
226params.forcing.nkmax_forcing = 5
227params.forcing.tcrandom.time_correlation = "based_on_forcing_rate"
228```
230The integers multiply an operator wave-number spacing; they are not necessarily
231physical wave numbers. Verify the resulting forced region. Measure actual input
232in spatial means/budgets.
234FluidSim 0.9.0 restart files store state parameters, including time-correlated
235forcing seeds/state. Do not drop these groups when copying or converting
236checkpoints.

Forcing

Base fields:

params.forcing.enable = False
params.forcing.type = ""
params.forcing.forcing_rate = 1.0
params.forcing.key_forced = None
params.forcing.nkmin_forcing = 4
params.forcing.nkmax_forcing = 5

NS2D advertises in_script, in_script_coarse, pseudo_spectral, proportional, tcrandom, and tcrandom_anisotropic.

Nested current fields:

params.forcing.normalized.constant_rate_of = None
params.forcing.normalized.type = "2nd_degree_eq"
params.forcing.normalized.which_root = "minabs"
params.forcing.random.only_positive = False
params.forcing.tcrandom.time_correlation = "based_on_forcing_rate"

The old flat field tcrandom_time_correlation is not current.

For a time-correlated random plan:

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"

The integers multiply an operator wave-number spacing; they are not necessarily physical wave numbers. Verify the resulting forced region. Measure actual input in spatial means/budgets.

FluidSim 0.9.0 restart files store state parameters, including time-correlated forcing seeds/state. Do not drop these groups when copying or converting checkpoints.

Raw lines 191 to 237
238## Output
240Common controls:
242```python
243params.output.HAS_TO_SAVE = True
244params.output.ONLINE_PLOT_OK = False
245params.output.period_refresh_plots = 1
246params.output.sub_directory = "bounded-pilot"
248params.output.periods_print.print_stdout = 0.1
249params.output.periods_plot.phys_fields = 0.0
250params.output.periods_save.phys_fields = 0.5
251params.output.periods_save.spatial_means = 0.05
252params.output.periods_save.spectra = 0.5
253params.output.periods_save.spect_energy_budg = 0.0
254```
256NS2D's 0.9 output tree also includes `increments`, `spectra_multidim`,
257`temporal_spectra`, and `spatiotemporal_spectra`. A period of zero disables that
258specific output.
260`sub_directory` is created under `FLUIDSIM_PATH`. Use a safe one-component
261identifier. Preflight quota, collision, and symlink behavior. `HAS_TO_SAVE=False`
262is the correct smoke-test setting, but produces no restart checkpoint.
264Physical-field settings include:
266```python
267params.output.phys_fields.field_to_plot = "rot"
268params.output.phys_fields.file_with_it = False
269```
271Field names are solver-specific. Disable online plotting for unattended jobs.

Output

Common controls:

params.output.HAS_TO_SAVE = True
params.output.ONLINE_PLOT_OK = False
params.output.period_refresh_plots = 1
params.output.sub_directory = "bounded-pilot"

params.output.periods_print.print_stdout = 0.1
params.output.periods_plot.phys_fields = 0.0
params.output.periods_save.phys_fields = 0.5
params.output.periods_save.spatial_means = 0.05
params.output.periods_save.spectra = 0.5
params.output.periods_save.spect_energy_budg = 0.0

NS2D's 0.9 output tree also includes increments, spectra_multidim, temporal_spectra, and spatiotemporal_spectra. A period of zero disables that specific output.

sub_directory is created under FLUIDSIM_PATH. Use a safe one-component identifier. Preflight quota, collision, and symlink behavior. HAS_TO_SAVE=False is the correct smoke-test setting, but produces no restart checkpoint.

Physical-field settings include:

params.output.phys_fields.field_to_plot = "rot"
params.output.phys_fields.file_with_it = False

Field names are solver-specific. Disable online plotting for unattended jobs.

Raw lines 238 to 272
273## Strict JSON validator
275The bundled validator covers reviewed Cartesian CFD profiles and requires
276scientific and resource metadata in addition to FluidSim parameters:
278```bash
279python3 scripts/solver_config_validator.py --example
280python3 scripts/solver_config_validator.py --config config.json
281```
283It rejects:
285- Options absent from the selected released solver: for example NS3D has no
286 `periods_save.increments`, and `waves2d` has no `periods_save.spectra`.
287 Do not reuse the whole NS2D JSON example after changing only the solver key.
289- Unknown keys and old `CFL`.
290- Non-finite numbers and duplicate JSON keys.
291- Unbounded grid/resources/output.
292- Unsafe output or restart paths.
293- Missing units/nondimensionalization, boundaries, initialization, forcing,
294 resolution/dealiasing, CFL/timestep, budget, refinement, or acceptance
295 statements.
296- CPU oversubscription and inconsistent serial/MPI preview modes.
298The bundled profile covers a subset of each solver's parameters. Unsupported
299extensions need their own reviewed script. The generator refuses `in_script`
300and `from_simul` initializers, and forcing types requiring callbacks, because
301a JSON plan does not provide their implementations.
303It validates a plan mechanically. It explicitly reports that physical validity
304and numerical convergence are not established.

Strict JSON validator

The bundled validator covers reviewed Cartesian CFD profiles and requires scientific and resource metadata in addition to FluidSim parameters:

python3 scripts/solver_config_validator.py --example
python3 scripts/solver_config_validator.py --config config.json

It rejects:

  • Options absent from the selected released solver: for example NS3D has no periods_save.increments, and waves2d has no periods_save.spectra. Do not reuse the whole NS2D JSON example after changing only the solver key.
  • Unknown keys and old CFL.
  • Non-finite numbers and duplicate JSON keys.
  • Unbounded grid/resources/output.
  • Unsafe output or restart paths.
  • Missing units/nondimensionalization, boundaries, initialization, forcing, resolution/dealiasing, CFL/timestep, budget, refinement, or acceptance statements.
  • CPU oversubscription and inconsistent serial/MPI preview modes.

The bundled profile covers a subset of each solver's parameters. Unsupported extensions need their own reviewed script. The generator refuses in_script and from_simul initializers, and forcing types requiring callbacks, because a JSON plan does not provide their implementations.

It validates a plan mechanically. It explicitly reports that physical validity and numerical convergence are not established.

Raw lines 273 to 305
Runs code python3 scripts/solver_config_validator.py :279
306## Parameter provenance
308Preserve:
310- Exact parameter file from the run.
311- Canonical strict JSON plan and SHA-256.
312- Generated launch script and SHA-256.
313- `uv.lock` and SHA-256.
314- Solver module/key and package versions.
315- FFT method, MPI size, threads, hardware, compiler/native libraries.
316- Environment variables affecting FluidSim, FluidFFT, Transonic, OpenMP, MPI,
317 and HDF5.
318- Every restart parent/child and changed parameter.
320Do not rely only on directory names; they are summaries, not canonical
321configuration.

Parameter provenance

Preserve:

  • Exact parameter file from the run.
  • Canonical strict JSON plan and SHA-256.
  • Generated launch script and SHA-256.
  • uv.lock and SHA-256.
  • Solver module/key and package versions.
  • FFT method, MPI size, threads, hardware, compiler/native libraries.
  • Environment variables affecting FluidSim, FluidFFT, Transonic, OpenMP, MPI, and HDF5.
  • Every restart parent/child and changed parameter.

Do not rely only on directory names; they are summaries, not canonical configuration.

Raw lines 306 to 322
323## Sources (verified 2026-10-01)
325- [FluidSim user tutorial](https://fluidsim.readthedocs.io/en/latest/ipynb/tuto_user.html)
326 — defaults, mutation behavior, output and loaders.
327- [NS2D generated parameter documentation](https://fluidsim.readthedocs.io/en/latest/generated/fluidsim.solvers.ns2d.solver.html).
328- [Pseudospectral time-stepping API](https://fluidsim.readthedocs.io/en/latest/generated/fluidsim.base.time_stepping.pseudo_spect.html).
329- [Forcing base source](https://github.com/fluiddyn/fluidsim/blob/0.9.0/fluidsim/base/forcing/base.py).
330- [Specific forcing source](https://github.com/fluiddyn/fluidsim/blob/0.9.0/fluidsim/base/forcing/specific.py).
331- [FluidSim 0.9 package source](https://github.com/fluiddyn/fluidsim/blob/0.9.0/pyproject.toml).