Skip to content

pascalbartschi/fno-wave-equation

Repository files navigation

Training the Fourier Neural Operator to Solve the 1D Wave Equation

This repository contains the implementation and results of training a Fourier Neural Operator (FNO) to approximate solutions of the 1D wave equation. Two training approaches are evaluated:

  • One-to-one training: Predicts ( u(t=1) ) from ( u(0) ), achieving lower errors.
  • All-to-all training: Learns multiple future steps but fails to generalize well.

Problem Statement

The 1D wave equation is defined as:

$$\frac{\partial^2 u}{\partial t^2} = c^2 \frac{\partial^2 u}{\partial x^2}, \quad t \in (0,1], \quad x \in [0,1], \quad c = 0.5$$

with boundary conditions:

$$u(0, t) = u(1, t) = 0, \quad u(x, 0) = u_0(x), \quad u_t(x, 0) = 0.$$

Methods

FNOs approximate the solution operator using Fourier transforms:

$$u(x) = \mathcal{F}^{-1} \left( R(k) \cdot \mathcal{F}(a(x)) \right).$$

The error metric used is the relative ( L_2 ) error:

$$\text{err} = \frac{1}{128} \sum_{n=1}^{128} \frac{\|u_{\text{pred}}^{(n)}(t) - u_{\text{true}}^{(n)}(t)\|_2}{\|u_{\text{true}}^{(n)}(t)\|_2}, \quad t = 1.$$

Results

  • One-to-one training: Achieved 9.34% relative $L_2$ error on in-distribution data.
  • All-to-all training: Struggled to learn wave dynamics, showing high errors.

For more details, refer to the project report.

About

Modelling dynamics governing the wave equation using a Fourier Neural Operator trained with One-to-One and All2All training.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors