Native TorchLean FNO1D Burgers #
Read this after the basic CNN/MLP examples if you want the operator-learning path. The Python
scripts do the two jobs Lean should not own here: download and reshape the public
burgers_data_R10.mat file, then plot the prediction CSV. The model, loss, optimizer, and training
loop stay in TorchLean.
This executable uses real-split Fourier arithmetic because the Burgers data are real-valued. CPU and GPU execution use the same full-spectrum model and spectral parameter layout, with separate real and imaginary tensors. The runtime selects how the operations are executed.
The training task follows the standard FNO Burgers setup: learn the operator
$u_0(x)\mapsto u(x,T)$ on a fixed periodic grid. The default grid and row counts are modest enough
for a local run while still exercising the real operator-learning path. Larger runs can raise
--steps, export more rows, and bump the constants below.
References for the dataset/training convention:
- Li et al., “Fourier Neural Operator for Parametric Partial Differential Equations”, 2020/2021.
- MathWorks’ Burgers FNO example and the
burgers_data_R10.matpublic dataset. - SciML FNO tutorials using fields
afor initial conditions andufor final solutions.
CLI subcommand name used in terminal banners and errors.
Instances For
Spatial grid resolution used by the prepared Burgers .npy slices.
Instances For
Channel width inside the compact FNO block.
Instances For
Spectral mode budget.
The full-spectrum model uses this as the width of each end band on both CPU and GPU.
Instances For
Number of spectral blocks used by the compact training run.
Instances For
Default number of training rows expected from the preparation script.
Instances For
Default number of held-out rows expected from the preparation script.
Instances For
FNO configuration shared by the constructor and sample loaders.
Instances For
Model input shape: one sampled initial condition on the fixed grid.
Instances For
Model output shape: one predicted terminal solution on the same grid.
Instances For
Directory where the preparation script writes Burgers tensors by default.
Instances For
Default training input tensor path.
Instances For
Default training target tensor path.
Instances For
Default held-out input tensor path.
Instances For
Default held-out target tensor path.
Instances For
Default CSV path for the prediction-vs-target plot script.
Instances For
Default JSON training-log path.
Instances For
User-facing hint printed when the prepared Burgers tensors are missing.
Instances For
FNO Burgers command-line options: training flags, data paths, and artifact paths.
The record keeps optimizer/log settings, tensor paths, and output artifacts as separate named concerns.
- training : TorchLean.CLI.Training.OptimizerOptions
Optimizer, step, batching, and logging controls.
- data : Support.Npy.SplitOptions
Prepared train/test tensors and evaluation row counts.
- plotCsv : System.FilePath
Output path for the prediction diagnostic.
Instances For
Instances For
All required dataset files for this run.
Instances For
Effective CUDA-memory-watch cadence for this run.
Instances For
The experiment record of one run: the model and run settings as config entries, the train and test curves, and the dataset files as notes.
Instances For
The Fourier neural operator this example trains, at the width, mode count and depth fixed by
modelConfig.
Instances For
Load one fixed-grid Burgers split as supervised TorchLean samples.
Instances For
Write one FNO prediction row to CSV for the companion plotting script.
Instances For
Two tracked curves, train and test MSE, with the colours the log viewer will use.
Instances For
Persist the train/test MSE history as an experiment record.
Instances For
Loaded train/test splits before evaluation prefixes and cycling streams are derived.
Training split as supervised samples.
Held-out split as supervised samples.
Instances For
Validate paths and load both Burgers splits.
Instances For
Deterministic evaluation prefixes and cycling stream derived from the loaded train/test sets.
- sample : TorchLean.Sample.Supervised Float input output
Training sample used to initialize the runtime's compiled evaluation path.
Held-out sample used for the prediction CSV.
- next : ℕ → TorchLean.Sample.Supervised Float input output
Instances For
Prepare deterministic evaluation prefixes and a cycling stream of training samples.
Instances For
Push one train/test MSE point into the metric history and print the tagged report line.
Instances For
Train the same full-spectrum model through the shared trainer on CPU or GPU.
Instances For
Print the run's configuration: device, model geometry, row counts and file paths.
An FNO run that silently loaded the wrong split can look like a training problem. Printing the paths and row counts helps identify the data error.