Lovise's summer project at Simula (DigiCells): a Fourier Neural Operator (FNO) that predicts the electric potential around a cell from an image of its shape, trained on FEniCSx solutions of the passive, steady-state EMI equations.
All settings live in config.py.
Part 1, FEniCSx (in the VS Code dev container terminal), about 15–30 min:
bash run_fenicsx.sh
Solver verification (Fig. 1), the dataset at 32/64/128/256 (Fig. 2), a mesh-density check, and the FEniCSx timing.
Part 2, PyTorch (in PowerShell on Windows, needs the GPU), a few hours:
.\run_experiments.ps1 -Tags baseline -Epochs 2 # quick test first (about a minute)
.\run_experiments.ps1 -Force # everything (-Force redoes the quick test)
Trains and evaluates all 12 runs, measures the speedup, and makes all FNO
figures and tables. If it stops, start it again without -Force: finished
runs are skipped.
If PowerShell refuses to run scripts:
powershell -ExecutionPolicy Bypass -File .\run_experiments.ps1
| Result | File |
|---|---|
| Fig. 1 MMS convergence | error_convergence.png (+ rates in logs/1_mms.log) |
| Fig. 2 dataset sample | figures/sample_verification.png |
| Fig. 3 median and worst test cell | figures/baseline_examples.png |
| Fig. 4 training curves | figures/training_curves.png |
| Fig. 5 resolution independence (E1) | figures/e1_resolution.png |
| Fig. 6 network size (E2a) | figures/e2a_network_size.png |
| Fig. 7 network size on finer grids (E2b) | figures/e2b_network_size_finer_grids.png |
| Fig. 8 training resolution (E2c) | figures/e2c_training_resolution.png |
| Tables 1–2 and numbers for the text | results/latex_tables.txt |
| Table 3 speedup, break-even | logs/benchmark.log, results/speedup.json |
| All test metrics | results/summary.csv |
| File | Role |
|---|---|
config.py |
All settings: paths, seed, physics, grids, training, list of runs |
emi_passive.py |
FEniCSx EMI solver; __main__ runs the MMS convergence study |
generate_dataset.py |
Random cells -> FEniCSx -> pixel grids (MPI-parallel) |
check_ground_truth.py |
Mesh-density study on irregular cells |
benchmark_fenicsx.py |
FEniCSx time per sample on one core |
verify_dataset.py |
Dataset checks and Fig. 2 |
dataset.py |
PyTorch dataset, fixed 80/10/10 split |
fno_model.py |
FNO model (padding scales with the grid) |
loss.py, metrics.py |
Loss functions and test metrics |
train.py, evaluate.py |
Train one run; evaluate it on the test set at several resolutions |
benchmark.py |
FNO timing and speedup table |
make_figures.py |
All FNO figures and LaTeX table rows |
run_fenicsx.sh, run_experiments.ps1 |
Run everything |