📄 Paper
This repository contains the official source code for the paper "Spectral vs. Fourier Neural Operators in Parametric PDE Modeling: Analysis and Experiments".
This project conducts a systematic comparison between Fourier Neural Operators (FNOs) and Spectral Neural Operators (SNOs) for learning solution operators of parametric PDEs.
-
aliasing.py: A script to visually demonstrate the aliasing phenomenon. It shows how the frequency band of a band-limited function widens significantly after passing through common activation functions (e.g., ReLU, GeLU), which is a core issue in FNOs. -
models.py: Contains the PyTorch implementation of the 1D Fourier Neural Operator (FNO) and the 1D Spectral Neural Operator (SNO) used in the experiments. -
generate_data.py: Used to generate the training and testing datasets for the Burgers' equation, Korteweg-de Vries (KdV) equation, and Kuramoto-Sivashinsky (KS) equation. The data is generated using a high-fidelity IMEX-RK2 numerical solver to ensure accuracy. -
train_eval.py: The main script for training and evaluating the FNO and SNO models on the three PDE datasets. It handles data loading, model initialization, training loops, and final performance evaluation.
-
Clone the repository:
git clone https://github.com/aster2024/SNO_vs_FNO.git cd SNO_vs_FNO -
Create a virtual environment and install dependencies: We recommend using a virtual environment. The required packages can be installed from
requirements.txt.python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate` pip install -r requirements.txt
The typical workflow is to first generate the data, and then train the models.
Use generate_data.py to create datasets for each equation.
Use train_eval.py to train and evaluate FNO or SNO on a specific dataset.
To run the aliasing visualization script:
python aliasing.pyThis will generate plots showing the band-widening effect of activation functions.
This project is licensed under the MIT License. See the LICENSE file for details.
If you find this work useful in your research, please consider citing our paper:
@article{guo2025two,
author = {Guo, Jizhou},
title = {{Spectral vs. Fourier Neural Operators in Parametric PDE Modeling: Analysis and Experiments}},
year = {2025},
publisher = {Zenodo},
doi = {10.5281/zenodo.15757863},
url = {https://doi.org/10.5281/zenodo.15757863}
}