{"id":13409172,"url":"https://github.com/isl-org/DeepLagrangianFluids","last_synced_at":"2025-03-14T14:31:07.377Z","repository":{"id":49780677,"uuid":"258984301","full_name":"isl-org/DeepLagrangianFluids","owner":"isl-org","description":"Code repository for \"Lagrangian Fluid Simulation with Continuous Convolutions\", ICLR 2020.","archived":false,"fork":false,"pushed_at":"2024-08-13T09:08:14.000Z","size":19116,"stargazers_count":207,"open_issues_count":5,"forks_count":40,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-08-13T18:58:33.192Z","etag":null,"topics":["cnn","convnet","convolutional-neural-networks","deeplearning","fluids","simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/isl-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-CDLA-Permissive-1.0","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-26T08:57:20.000Z","updated_at":"2024-08-13T08:54:49.000Z","dependencies_parsed_at":"2024-10-26T04:53:16.119Z","dependency_job_id":"9b3ed204-11d4-4f8e-a911-d9f63617d10c","html_url":"https://github.com/isl-org/DeepLagrangianFluids","commit_stats":{"total_commits":35,"total_committers":1,"mean_commits":35.0,"dds":0.0,"last_synced_commit":"d651c6fdf2aca3fac9abe3693b20981b191b4769"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isl-org%2FDeepLagrangianFluids","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isl-org%2FDeepLagrangianFluids/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isl-org%2FDeepLagrangianFluids/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isl-org%2FDeepLagrangianFluids/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isl-org","download_url":"https://codeload.github.com/isl-org/DeepLagrangianFluids/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243593320,"owners_count":20316165,"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","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":["cnn","convnet","convolutional-neural-networks","deeplearning","fluids","simulation"],"created_at":"2024-07-30T20:00:58.519Z","updated_at":"2025-03-14T14:31:03.573Z","avatar_url":"https://github.com/isl-org.png","language":"Python","funding_links":[],"categories":["Computational Fluid Dynamics"],"sub_categories":["Neural Networks for PDE"],"readme":"# Lagrangian Fluid Simulation with Continuous Convolutions\n\n![PyTorch badge](https://img.shields.io/badge/PyTorch-supported-brightgreen?style=flat\u0026logo=pytorch)\n![TensorFlow badge](https://img.shields.io/badge/TensorFlow-supported-brightgreen?style=flat\u0026logo=tensorflow)\n\nThis repository contains code for our ICLR 2020 paper. \nWe show how to train particle-based fluid simulation networks as CNNs using \ncontinuous convolutions. The code allows you to generate data, train your own \nmodel or just run a pretrained model.\n\n\u003cp align=\"center\"\u003e \u003cimg src=\"images/canyon.gif\" alt=\"canyon video\"\u003e \u003c/p\u003e\n\nPlease cite our paper [(pdf)](https://openreview.net/pdf?id=B1lDoJSYDH) if you find this code useful:\n```\n@inproceedings{Ummenhofer2020Lagrangian,\n        title     = {Lagrangian Fluid Simulation with Continuous Convolutions},\n        author    = {Benjamin Ummenhofer and Lukas Prantl and Nils Thuerey and Vladlen Koltun},\n        booktitle = {International Conference on Learning Representations},\n        year      = {2020},\n}\n```\n\nTo stay informed about updates we recommend to watch this repository.\n\n## Dependencies\n\n- Tensorflow 2.3 or PyTorch 1.6\n- Open3D 0.11 or later with ML module (https://github.com/intel-isl/Open3D/)\n- SPlisHSPlasH 2.4.0 (for generating training data and fluid particle sampling, https://github.com/InteractiveComputerGraphics/SPlisHSPlasH)\n- Tensorpack DataFlow (for reading data, ```pip install --upgrade git+https://github.com/tensorpack/dataflow.git```)\n- python-prctl (needed by Tensorpack DataFlow; depends on libcap-dev, install with ```apt install libcap-dev``` )\n- msgpack (```pip install msgpack``` )\n- msgpack-numpy (```pip install msgpack-numpy```)\n- python-zstandard (```pip install zstandard``` https://github.com/indygreg/python-zstandard)\n- partio (https://github.com/wdas/partio)\n- SciPy\n- OpenVDB with python binding (optional for creating surface meshes, https://github.com/AcademySoftwareFoundation/openvdb)\n- plyfile (optional for creating surface meshes, ```pip install plyfile```)\n\nThe versions match the configuration that we have tested on a system with Ubuntu 18.04.\nSPlisHSPlasH 2.4.0 is required for generating training data (ensure that it is compiled in *Release* mode).\nWe recommend to use the latest versions for all other packages.\n\n\n### Installing Open3D 0.11 and later with pip\nThe ML module is included in Open3D 0.11 and later and can simply be installed with\n```bash\npip install open3d\n```\nMake sure that the version of your ML framework matches the version for which the ML ops in Open3D have been built.\nFor Open3D 0.11 this is CUDA 10.1, TensorFlow 2.3 and PyTorch 1.6.\nIf you cannot match this configuration it is recommended to build Open3D from source.\n\n\n### Building Open3D with ML module from source.\nAt the moment Open3D needs to be build from source to make the code in this \nrepo work. To build Open3D with the ML ops for Tensorflow and PyTorch do the \nfollowing\n```bash\ngit clone --recursive https://github.com/intel-isl/Open3D.git\n# check the file Open3D/util/scripts/install-deps-ubuntu.sh\n# for dependencies and install them. For more instructions see the Open3D documentation\n\nmkdir Open3D/build\ncd Open3D/build\n\n# This builds the ml ops for both TensorFlow and PyTorch.\n# If you don't need both frameworks you can disable the one you don't need with OFF.\ncmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TENSORFLOW_OPS=ON -DBUILD_PYTORCH_OPS=ON -DBUILD_CUDA_MODULE=ON -DGLIBCXX_USE_CXX11_ABI=OFF\nmake install-pip-package\n```\n\n## Running the pretrained model\n\nThe pretrained network weights are in ```scripts/pretrained_model_weights.h5``` for TensorFlow and in ```scripts/pretrained_model_weights.pt``` for PyTorch.\nThe following code runs the network on the example scene\n```bash\ncd scripts\n# with TensorFlow\n./run_network.py --weights pretrained_model_weights.h5 \\\n                 --scene example_scene.json \\\n                 --output example_out \\\n                 --write-ply \\\n                 train_network_tf.py\n# or with PyTorch\n./run_network.py --weights pretrained_model_weights.pt \\\n                 --scene example_scene.json \\\n                 --output example_out \\\n                 --write-ply \\\n                 train_network_torch.py\n```\nThe script writes point clouds with the particle positions as .ply files, which can be visualized with Open3D.\nNote that SPlisHSPlasH is required for sampling the initial fluid volumes from ```.obj``` files.\n\n\n## Training the network\n\n### Data generation\nThe data generation scripts are in the ```datasets``` subfolder.\nTo generate the training and validation data \n 1. Set the path to the ```DynamicBoundarySimulator``` of SPlisHSPlasH in the ```datasets/splishsplash_config.py``` script.\n 2. Run the script from within the datasets folder \n    ```bash\n    cd datasets\n    ./create_data.sh\n    ```\n\n### Data download\nIf you want to skip the data generation step you can download training and validation data from the links below.\n\n| default data  | 34GB | [link](https://drive.google.com/file/d/1b3OjeXnsvwUAeUq2Z0lcrX7j9U7zLO07) |\n|---------------|------|---------------------------------------------------------------------------|\n| DPI dam break | 24GB | [link](https://drive.google.com/file/d/1_-aAd_GHX8StyKWZLpvSWeGQ3vyytf7L) |\n| 6k box data   | 23GB | [link](https://drive.google.com/file/d/1eDFJD-wiTxzDzywSvXLgzffI25su1S1q) |\n\nFor the default data the training set has been generated with the scripts in this\nrepository and the validation data corresponds to the data used in the paper.\n\nThe DPI dam break data has been generated with the code from the DPI-Nets repo.\nNote that the data has been scaled to match the particle radius used for our method.\nSee the ```scripts/dambreak.yaml``` config file for more information on the scale factor.\n\nThe 6k box data is a simplified version of the default data with a constant number\nof particles and always uses a simple box as environment.\n\n\n\n### Training scripts\nTo train the model with the generated data simply run one of the ```train_network_x.py``` scripts from within the ```scripts``` folder. \n```bash\ncd scripts\n# TensorFlow version\n./train_network_tf.py default.yaml\n# PyTorch version\n./train_network_torch.py default.yaml\n```\nThe scripts will create a folder ```train_network_tf_default``` or ```train_network_torch_default``` respectively with snapshots and log files.\nThe log files can be viewed with Tensorboard.\n\n### Evaluating the network\nTo evaluate the network run the ```scripts/evaluate_network.py``` script like this\n```bash\n./evaluate_network.py --trainscript train_network_tf.py --cfg default.yaml\n# or\n./evaluate_network.py --trainscript train_network_torch.py --cfg default.yaml\n```\n\nThis will create the file ```train_network_{tf,torch}_default_eval_50000.json```, which contains the \nindividual errors between frame pairs.\n\nThe script will also print the overall errors. The output should look like \nthis if you use the generated the data:\n```{'err_n1': 0.000859004137852537, 'err_n2': 0.0024183266885233934, 'whole_seq_err': 0.030323669719872864}```\n\nNote that the numbers differ from the numbers in the paper due to changes in \nthe data generation:\n - We use Open3D to sample surface points to avoid shipping a modified \n   SPlisHSPlasH\n - The sequence of pseudorandom numbers used in the data generation is \n   different, which results in different scenes for training and testing.\n\nIf you have downloaded the validation data then the output should be similar to the numbers in the paper.\n```{'err_n1': 0.000665973493194656, 'err_n2': 0.0018649007299291042, 'whole_seq_err': 0.03081335372162257}```\n\n## Rendering\n\nSee the [scenes](scenes/README.md) directory for instructions on how to create and render the example scenes like the canyon.\n\n## Licenses\n\nCode and scripts are under the MIT license.\n\nData files in ```datasets/models``` and ```scripts/pretrained_model_weights.{h5,pt}``` are under the CDLA-Permissive-1.0 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisl-org%2FDeepLagrangianFluids","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisl-org%2FDeepLagrangianFluids","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisl-org%2FDeepLagrangianFluids/lists"}