CNO
Model Introduction
CNO (Convolutional Neural Operator) is a neural operator model for learning partial differential equation (PDE) operators, proposed by Bogdan Raonić et al. and published at NeurIPS 2023. CNO combines convolutional neural networks with operator learning in continuous function spaces. Its anti-aliased activations and filtered upsampling and downsampling operations reduce errors caused by discretization and changes in resolution. The model can directly predict PDE solutions from initial conditions, source terms, or parameter fields. Using the OneScience skill workflow, this project independently reproduces the CNO experiment that predicts the horizontal velocity component of the two-dimensional incompressible Navier–Stokes equations from (t=0) to (T=1).
Paper: Convolutional Neural Operators for Robust and Accurate Learning of PDEs
Model Description
CNO uses a U-Net-like multiscale encoder-decoder architecture that combines local convolutions, skip connections, and filtered upsampling and downsampling to learn function-to-function mappings for PDEs. Its key feature is an anti-aliasing mechanism in nonlinear activations and scale transformations. This reduces errors caused by discretization and resolution changes, better preserves the properties of continuous operators, and improves both operator-learning accuracy and cross-resolution robustness.
Use Cases
| Use case | Description |
|---|---|
| PDE solution-operator learning | Learns mappings from initial conditions, source terms, or parameter fields to PDE solutions. |
| Fluid-dynamics prediction | Provides fast surrogate predictions for problems such as Navier–Stokes and compressible Euler equations. |
| Multiscale physical-field modeling | Handles complex PDE solutions containing both low- and high-frequency spatial structures. |
| Cross-resolution prediction | Supports inference at different spatial discretization resolutions to evaluate resolution generalization. |
| ID/OOD generalization | Evaluates model robustness under in-distribution and out-of-distribution PDE parameters or physical conditions. |
Usage
1. Using OneCode
Try intelligent, one-click AI4S programming in the OneCode online environment:
Try intelligent, one-click AI4S programming
2. Manual Installation and Usage
Hardware requirements
- A GPU or DCU is recommended.
- A CPU can be used for import checks and small-scale connectivity tests, but full training and inference will be slow.
- DCU users must install DTK in advance. DTK 25.04.2 or later, or the OneScience-recommended version for the current cluster, is recommended.
Download the Model Package
modelscope download --model OneScience/CNO --local_dir ./CNO
cd CNO
Set Up the Runtime Environment
DCU environment
# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# Installation with uv is also supported
pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
GPU environment
# Activate Conda first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
# Installation with uv is also supported
pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
Training Data
The experiment uses two-dimensional incompressible Navier–Stokes data from the RPB_CNO dataset. The training file is NavierStokes_64x64_IN.h5. Each sample contains:
input: the horizontal velocity component at (t=0), with shape(64, 64);output: the horizontal velocity component at (T=1), with shape(64, 64).
A channel dimension is added after loading, so both inputs and labels in each training batch have shape (batch_size, 1, 64, 64).
The current configuration uses 750 training samples, 128 validation samples, and 128 in-distribution test samples. The out-of-distribution test set contains 128 samples from NavierStokes_128x128_OUT.h5.
Download the data with:
modelscope download --dataset OneScience/RPB_CNO --local_dir ./data
After downloading, set paths.data_dir in config/config.yaml to the directory containing the HDF5 files.
Training
The default configuration corresponds to the two-dimensional incompressible Navier–Stokes experiment in the paper, with spectral viscosity approximately (\nu=4\times10^{-4}). The model learns the mapping from the initial horizontal velocity component at (t=0) to the velocity component at (T=1).
python scripts/train.py --config config/config.yaml --device auto
The complete training state with the lowest median relative L1 error in physical space on the validation set is saved to weight/best_model.pth. It includes the model, optimizer, learning-rate scheduler, and normalization parameters.
Trained Weights
weight/best_model.pth contains the best weights from the full training run and can be used directly for inference.
Inference
Before running inference, make sure the configured data path is valid and weight/best_model.pth exists. The model performs a single-step prediction from the initial horizontal velocity component at (t=0) to the velocity component at (T=1). It does not perform closed-loop multistep or trajectory rollout prediction. The default inference batch size is 16.
python scripts/inference.py --config config/config.yaml
Evaluation and Visualization
After training and inference, run:
python scripts/result.py --config config/config.yaml --sample-index 0
Official OneScience Resources
| Platform | OneScience Main Repository | Skills Repository |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
Citation and License
- Original paper: Convolutional Neural Operators for Robust and Accurate Learning of PDEs
- This project is an independent reproduction of the CNO paper. The official implementation is licensed under the MIT License. The project code, model weights, training data, and third-party dependencies remain subject to their respective license terms.