{"id":19070182,"url":"https://github.com/neuraloperator/coda-no","last_synced_at":"2025-10-06T23:18:40.090Z","repository":{"id":229114098,"uuid":"767927161","full_name":"neuraloperator/CoDA-NO","owner":"neuraloperator","description":"Codomain attention neural operator for single to multi-physics PDE adaptation.","archived":false,"fork":false,"pushed_at":"2025-06-05T17:18:21.000Z","size":27943,"stargazers_count":61,"open_issues_count":1,"forks_count":10,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-07-27T23:44:03.690Z","etag":null,"topics":["foundation-models","neural-operator","pde-solver"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neuraloperator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-03-06T06:35:34.000Z","updated_at":"2025-07-14T01:10:21.000Z","dependencies_parsed_at":"2024-03-22T05:29:02.424Z","dependency_job_id":"448320c0-9011-4049-a119-086eed604a29","html_url":"https://github.com/neuraloperator/CoDA-NO","commit_stats":null,"previous_names":["ashiq24/coda-no","neuraloperator/coda-no"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/neuraloperator/CoDA-NO","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuraloperator%2FCoDA-NO","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuraloperator%2FCoDA-NO/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuraloperator%2FCoDA-NO/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuraloperator%2FCoDA-NO/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neuraloperator","download_url":"https://codeload.github.com/neuraloperator/CoDA-NO/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuraloperator%2FCoDA-NO/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278693404,"owners_count":26029511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["foundation-models","neural-operator","pde-solver"],"created_at":"2024-11-09T01:17:26.430Z","updated_at":"2025-10-06T23:18:40.072Z","avatar_url":"https://github.com/neuraloperator.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Pretraining  Codomain Attention Neural Operators for Solving Multiphysics PDEs \n\n\u003e [Paper Link](https://arxiv.org/pdf/2403.12553.pdf)\n\n\u003e  **🚀🚀 HOW TO USE CoDA-NO MODEL USING `neuraloperator`** [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1W6Qy5Mk_vEjZgrA0tWMespXqKEYDOdc6?usp=sharing)\n\n## Model Architecture\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/ashiq24/CoDA-NO/blob/web_resources/images/pipe_line.png\" alt=\"\"\u003e\n    \u003cbr\u003e\n    \u003cem\u003e  Architecture of the Codomain Attention Neural Operator\u003c/em\u003e\n\u003c/p\u003e\nEach physical variable (or co-domain) of the input function is concatenated with variable-specific positional encoding (VSPE). Each variable, along with the VSPE, is passed through a GNO layer, which maps from the given non-uniform geometry to a latent regular grid. Then, the output on a uniform grid\nis passed through a series of CoDA-NO layers. Lastly, the output of the stacked CoDA-NO layers is mapped onto the domain of the\noutput geometry for each query point using another GNO layer.\n\nAt each CoDA-NO layer, the input function is tokenized codomain-wise to generate token functions. Each token function is passed through the K, Q, and V operators to get key, query, and value functions. The output function is calculated by extending the self-attention mechanism to the function space.\n\n\n## Navier Stokes+Elastic Wave and Navier Stokes Dataset\n\nThe fluid-solid interaction dataset is available at [HuggingFace](https://huggingface.co/datasets/ashiq24/FSI-pde-dataset). To download, please use the code\n```python\nfrom huggingface_hub import snapshot_download\n\nfolder_path = snapshot_download(\n    repo_id=\"ashiq24/FSI-pde-dataset\",\n    repo_type=\"dataset\",\n    allow_patterns=[\"fsi-data/*\"]\n)\n```\n### Data Set Structure\n\n**Displacement Field**\n![Animation](https://github.com/neuraloperator/CoDA-NO/blob/main/fsi_animation_dx.gif?raw=true)\n\n**Fluid Structure Interaction(NS +Elastic wave)**\nThe `fsi-data` folder contains simulation data organized by various parameters (`mu`, `x1`, `x2`) where `mu` determines the viscosity and `x1` and `x2` are the parameters of the inlet condition. The dataset includes files for mesh, displacement, velocity, and pressure. \n\nThis dataset structure is detailed below:\n\n```plaintext\nfsi-data/\n├── mesh.h5                         # Initial mesh\n├── mu=1.0/                         # Simulation results for mu = 1.0\n│   ├── x1=-4/                      # Inlet parameter x1 = -4\n│   │   ├── x2=-4/                  # Inlet parameter for x2 = -4\n│   │   │   └── visualization/      \n│   │   │       ├── displacement.h5 # Displacements for mu=1.0, x1=-4, x2=-4\n│   │   │       ├── velocity.h5     # Velocity field for mu=1.0, x1=-4, x2=-4\n│   │   │       └── pressure.h5     # Pressure field for mu=1.0, x1=-4, x2=-4\n│   │   ├── x2=-2/\n│   │   │   └── visualization/\n│   │   │       ├── displacement.h5\n│   │   │       ├── velocity.h5\n│   │   │       └── pressure.h5\n│   │   └── ...                     # Other x2 values for x1 = -4\n│   ├── x1=-2/\n│   │   ├── x2=-4/\n│   │   │   └── visualization/\n│   │   │       ├── displacement.h5\n│   │   │       ├── velocity.h5\n│   │   │       └── pressure.h5\n│   │   └── ...                     # Other x2 values for x1 = -2\n│   └── ...                         # Other x1 values for mu = 1.0\n├── mu=5.0/                         # Simulation results for mu = 5.0\n│   └── ...                         # Similar structure as mu=1.0\n└── mu=10.0/                        # Simulation results for mu = 10.0\n    └── ...                         # Similar structure as mu=1.0\n```\nThe dataset has a dataloader and visualization code. Also, the `NsElasticDataset` class in `data_utils/data_loaders.py` loads data automatically for all specified `mu`s and inlet conditions (`x1` and `x2`).\n\n**Fluid Motions with Non-deformable Solid(NS)** is stored in `cfd-data`\n\n## Rayleigh–Bénard convection\nHuggingface dataset link: [Rayleigh_Benard_Convection](https://huggingface.co/datasets/ashiq24/Rayleigh_Benard_Convection)\n\n\u003cimg src=\"https://github.com/user-attachments/assets/ff219086-84c9-4184-9e33-f10e916f544b\" width=\"300\"\u003e\n\n\n## Experiments\n\n\u003e ⚠️ **Note:** This repository uses an older version of the `neuralop` library. For a version compatible with the latest `neuralop` library, please refer to the following implementation:\n\n\u003e **The codomain attention layer is now available through the `neuraloperator` library** ([implementation](https://github.com/neuraloperator/neuraloperator/blob/main/neuralop/layers/coda_layer.py)).\n\n\u003e **Also, the model is available through the `neuraloperator` library, see** [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1W6Qy5Mk_vEjZgrA0tWMespXqKEYDOdc6?usp=sharing)\n\n### Installations\nThe configurations for all the experiments are at `config/ssl_ns_elastic.yaml` (for fluid-structure interaction) and `config/RB_config.yaml` (For the Releigh Bernard system).\n\nTo set up the environments and install the dependencies, please run the following command:\n```bash\npip install -r requirements.txt\n```\nIt requires `python=3.11.9`, and the `torch` installations need to be tailored to your machine's specific Cuda version. Also, the installation of torch_geometric and torch_scatter should match the local machine's Cuda version. More at the [installation guide](https://pytorch-geometric.readthedocs.io/en/latest/). \n\n**Shortcut:** If you already use the `neuraloprator` package, we have installed most of the packages. Then, you just need to execute the following line to roll back to a compatible version.\n\n```\npip install -e git+https://github.com/ashiq24/neuraloperator.git@codano_rep#egg=neuraloperator\n```\n\nWe are going to release the CoDA-NO layers and models soon as part of the `neural operator` library. \n\n### Running Experiments\nTo run the experiments, download the datasets, update the \"input_mesh_location\" and \"data_location\" in the config file,  update the Wandb credentials, and execute the following command\n\n```\npython main.py --exp (FSI/RB) --config \"config name\" --ntrain N\n```\n\n`--exp`  : Determines which experiment we want to run, 'FSI' (fluid-structure interaction) or 'RB' (Releigh Bernard)\n\n`--config`: Determines which configuration to use from the config file 'config/ssl_ns_elastic.yaml/RB_config.yaml`.\n\n`--ntrain`: Determines Number of training data points.\n\n## Scripts\nFor training CoDA-NO architecture on NS/NS+EW (FSI) and Releigh Bernard convection datasets (both pre-training and fine-tuning), please execute the following scrips:\n```\nexps_FSI.sh\nexps_RB.sh\n```\n\n\n## Reference\nIf you find this paper and code useful in your research, please consider citing:\n```bibtex\n@article{rahman2024pretraining,\n  title={Pretraining Codomain Attention Neural Operators for Solving Multiphysics PDEs},\n  author={Rahman, Md Ashiqur and George, Robert Joseph and Elleithy, Mogab and Leibovici, Daniel and Li, Zongyi and Bonev, Boris and White, Colin and Berner, Julius and Yeh, Raymond A and Kossaifi, Jean and Azizzadenesheli, Kamyar and Anandkumar, Anima},\n  journal={Advances in Neural Information Processing Systems},\n  volume={37}\n  year={2024}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuraloperator%2Fcoda-no","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneuraloperator%2Fcoda-no","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuraloperator%2Fcoda-no/lists"}