--- license: other language: - en tags: - OneScience - cavity-flow - physics-informed-neural-network - quantum-machine-learning --- # QCPINN-CavityFlow ## Model Introduction This package reproduces the unsteady lid-driven cavity experiment in [QCPINN: Quantum-Classical Physics-Informed Neural Networks for Solving PDEs](https://arxiv.org/abs/2503.16678), Table 3. The Angle-Cascade quantum-classical PINN maps `(t, x, y)` to `(u, v, p)`. Sobol-sampled PDE and boundary points drive training; the author's reference field is used for validation and evaluation, not gradient updates. Ten independent runs of 20,000 epochs were completed on CPU quantum simulation. The included `weight/best_model.pt` is the validation-selected checkpoint from seed 6, epoch 1, not a claim of paper-level accuracy. Only the reference-data path in its checkpoint metadata was changed for portability; all nine parameter tensors are unchanged. The published checkpoint SHA256 is `498bcc0dbfc053ca4824b1b6cd2914e85536d0aed1e07ad50d5ef3b4a0b11b87`; the original training checkpoint SHA256 was `f24e5f3357b045ed2a49fdb8a377cd3668a5cbb8100ff3c13906e3bfce9aff11`. ## Intended Use | Task | Description | | --- | --- | | Cavity-flow field inference | Predict velocity and pressure at spatiotemporal coordinates | | PINN research | Examine a quantum-classical Navier-Stokes training protocol | ## Usage ### Download the Model Package ```bash hf download OneScience-Group/QCPINN-CavityFlow --local-dir ./QCPINN-CavityFlow cd QCPINN-CavityFlow ``` ### Install Dependencies The formal run used Python 3.10, CPU PyTorch 2.6.0 and PennyLane 0.40.0. The `+cpu` PyTorch wheel requires the official CPU index: ```bash conda create -n qcpinn-cavity python=3.10 -y conda activate qcpinn-cavity pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu pip install 'modelscope[datasets]' ``` ### Reference Data Hugging Face hosts only the model package. Obtain the author's `cavity.mat` from [OneScience/QCPINN-Cavity on ModelScope](https://www.modelscope.cn/datasets/OneScience/QCPINN-Cavity): ```bash modelscope download --dataset OneScience/QCPINN-Cavity --local_dir ./data ``` The expected file is `data/cavity.mat`, SHA256 `4010d55dc23aa0f8ba79b24baf75e3903044bc4333d772168121cd30bc95c3ba`. It contains `cavity_internal`, `cavity_gamma0`, and `cavity_gamma1` in MATLAB v7.3/HDF5 format. No external labeled training dataset is needed. ### Train From a fresh package copy on a SLURM compute cluster, with the Python environment activated: ```bash sbatch scripts/run_all.slurm ``` The script runs ten seeds, 20,000 epochs per seed, then reloads checkpoints for inference and figures. Adjust the cluster's time/partition settings as needed. Preserve the bundled weight and results before retraining. ### Inference and Results ```bash python scripts/inference.py --checkpoint weight/best_model.pt python scripts/result.py ``` The selected checkpoint's internal-field relative L2 errors for `(u, v, p)` were `(123.70%, 121.43%, 164.19%)`. Across ten validation-best checkpoints, the means were `(200.42%, 274.73%, 148.86%)`, versus `(25.73%, 38.00%, 42.65%)` in paper Table 3. The full training was completed, but the paper accuracy was not reproduced. Historical `results/best_model/metrics.json` records the original checkpoint hash; rerunning inference records the published checkpoint hash. ## OneScience Repositories | Platform | Main repository | Skills repository | | --- | --- | --- | | Gitee | [OneScience](https://gitee.com/onescience-ai/onescience) | [OneSkills](https://gitee.com/onescience-ai/oneskills) | | GitHub | [OneScience](https://github.com/onescience-ai/OneScience) | [OneSkills](https://github.com/onescience-ai/oneskills) | ## Citation and License - Paper: [QCPINN](https://arxiv.org/abs/2503.16678). - Reference field: [authors' QCPINN repository](https://github.com/afrah/QCPINN/tree/main/data). The repository has an MIT software license; the data is distributed separately with its own provenance information.