{"id":24113687,"url":"https://github.com/narasan49/bevy_eulerian_fluid","last_synced_at":"2026-04-03T01:18:05.004Z","repository":{"id":247491586,"uuid":"816288486","full_name":"narasan49/bevy_eulerian_fluid","owner":"narasan49","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-21T12:08:57.000Z","size":150515,"stargazers_count":20,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-19T01:34:14.877Z","etag":null,"topics":["bevy","fluid-simulation"],"latest_commit_sha":null,"homepage":"https://narasan49.github.io/bevy_eulerian_fluid/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/narasan49.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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-06-17T12:41:49.000Z","updated_at":"2025-08-08T15:43:14.000Z","dependencies_parsed_at":"2024-08-05T18:31:47.920Z","dependency_job_id":"77adc9b9-a78d-4f47-9cff-3e1fdc4f9caa","html_url":"https://github.com/narasan49/bevy_eulerian_fluid","commit_stats":{"total_commits":67,"total_committers":2,"mean_commits":33.5,"dds":0.05970149253731338,"last_synced_commit":"bd4e9d4306e5a3e35d2043d6b189e13a6f2e30c0"},"previous_names":["narasan49/bevy-fluid-sample","narasan49/bevy_eulerian_fluid"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/narasan49/bevy_eulerian_fluid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/narasan49%2Fbevy_eulerian_fluid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/narasan49%2Fbevy_eulerian_fluid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/narasan49%2Fbevy_eulerian_fluid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/narasan49%2Fbevy_eulerian_fluid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/narasan49","download_url":"https://codeload.github.com/narasan49/bevy_eulerian_fluid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/narasan49%2Fbevy_eulerian_fluid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275695805,"owners_count":25511349,"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-09-17T02:00:09.119Z","response_time":84,"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":["bevy","fluid-simulation"],"created_at":"2025-01-11T04:24:16.678Z","updated_at":"2026-04-03T01:18:04.996Z","avatar_url":"https://github.com/narasan49.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bevy_eulerian_fluid\n\nGPU-accelerated 2D fluid simulation plugin for [Bevy](https://bevyengine.org/) with real-time performance and good mass conservation\n\n![img](./docs/bevy_fluid_various_shapes.gif)\n\nTry it on [here](https://narasan49.github.io/bevy_eulerian_fluid/)!\n\n## Basic Usage\n1. Add `FluidPlugin` and `PhysicsPlugins` to the app with the same length unit.\n2. Spawn `FluidSettings`, then `FluidSimulationBundle` will be inserted automatically to the entity. By querying components `FluidTextures`, the simulation results can be retrieved.  \n\nHere is a short example. See [examples](./examples/) for the detailed implementation!  \n\n```rust\nuse avian2d::PhysicsPlugins;\nuse bevy_eulerian_fluid::{\n    settings::{FluidSettings, FluidTextures},\n    FluidPlugin,\n};\n\nfn main() {\n    App::new()\n        .add_plugins(DefaultPlugins)\n        // Specify length unit same as PhysicsPlugins\n        .add_plugins(FluidPlugin::new(10.0))\n        .add_plugins(PhysicsPlugins::default().with_length_unit(10.0))\n        .add_systems(Startup, setup_scene)\n        .add_systems(Update, on_fluid_setup)\n        .run();\n}\n\nfn setup_scene(\n  mut commands: Commands,\n  mut meshes: ResMut\u003cAssets\u003cMesh\u003e\u003e,\n) {\n    commands.spawn(Camera2d);\n\n    let mesh = meshes.add(Rectangle::from_size(Vec2::splat(512.0)));\n    commands.spawn((\n        FluidSettings {\n            rho: 99.7, // water density in 2D\n            gravity: Vec2::Y * 9.8,\n            size: UVec2::splat(512),\n            initial_fluid_level: 0.9,\n        },\n        Mesh2d(mesh),\n    ));\n}\n\nfn on_fluid_setup(\n    mut commands: Commands,\n    query: Query\u003c(Entity, \u0026FluidTextures), Added\u003cFluidTextures\u003e\u003e,\n    mut materials: ResMut\u003cAssets\u003cCustomMaterial\u003e\u003e,\n) {\n    for (entity, fluid_textures) in \u0026query {\n        // Implement your own code to visualize the results.\n    }\n}\n```\n\n### Interact to the fluid\nThe simulation entity has `LocalForces` component, which holds arrays of forces (in m/s^2) and position (in pixels). forces can be applied to the simulation domain by setting `LocalForces`.\n\nSee also an [example](./examples/various_shapes.rs) for the detailed implementation.\n\n## Features\n- [x] Incompressible 2D fluid simulation\n  - GPU Red-Black Gauss-Seidel pressure solve\n- [x] Fluid surface\n  - Level Set interface tracking\n- [x] Area-fraction based fluid-rigid body two-way coupling\n  - Various shape support: Circle, Rectangle, Capsule, Triangle\n- [ ] Fluid source/drain\n- [ ] Viscosity\n\n## Examples\nThere are some examples to demonstrate how to visualize and interact with the simulation results:  \n- **Fluid-Solid two-way interaction**\n\n  ```ps1\n  cargo run --example various_shapes\n  ```\n  ![img](./docs/bevy_fluid_various_shapes.gif)\n\n- **Imposing forces with mouse and touch input**\n  ```ps1\n  cargo run --example interaction\n  ```\n  ![img](./docs/bevy_fluid_interaction.gif)\n\n## Versions\n| Bevy | Bevy Eulerian Fluid |\n| --- | --- |\n| 0.18 | 0.4 |\n| 0.17 | 0.2, 0.3 |\n| 0.15 | 0.1 |\n\n## References\nThis simulation is inspired by and based on the algorithms described in these books, papers and source codes:\n\n- [Fluid Simulation for Computer Graphics](https://www.amazon.co.jp/dp/1482232839) by Robert Bridson\n- [GPU Gems Chapter 38](https://developer.nvidia.com/gpugems/gpugems/part-vi-beyond-triangles/chapter-38-fast-fluid-dynamics-simulation-gpu) by Mark J. Harris\n- [FluidRigidCoupling2D](https://github.com/christopherbatty/FluidRigidCoupling2D) by Cristopher Batty for velocity extrapolation\n- [A fast iterative method for eikonal equations](https://scholar.archive.org/work/ckx4xnjo6rbljdac4ng75mwy5a/access/wayback/http://people.seas.harvard.edu:80/~wkjeong/publication/wkjeong-sisc-fim.pdf) by Jeong, Won-Ki, and Ross T. Whitaker.\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarasan49%2Fbevy_eulerian_fluid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnarasan49%2Fbevy_eulerian_fluid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarasan49%2Fbevy_eulerian_fluid/lists"}