{"id":37750940,"url":"https://github.com/cemlyn007/water-simulator","last_synced_at":"2026-01-16T14:21:59.675Z","repository":{"id":196304897,"uuid":"695701913","full_name":"cemlyn007/water-simulator","owner":"cemlyn007","description":"Height-Field Water Simulator","archived":false,"fork":false,"pushed_at":"2025-02-27T21:05:33.000Z","size":930,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T06:00:05.674Z","etag":null,"topics":["jax","opengl","physics","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"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/cemlyn007.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}},"created_at":"2023-09-24T00:15:59.000Z","updated_at":"2025-02-27T21:05:36.000Z","dependencies_parsed_at":"2023-10-14T17:15:55.956Z","dependency_job_id":"926d2e84-6d96-4bea-8750-62a263a46889","html_url":"https://github.com/cemlyn007/water-simulator","commit_stats":{"total_commits":105,"total_committers":1,"mean_commits":105.0,"dds":0.0,"last_synced_commit":"0fa2b7ccf81ed1fa2dbbc2a890392454f4c11e59"},"previous_names":["cemlyn007/water-simulator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cemlyn007/water-simulator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemlyn007%2Fwater-simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemlyn007%2Fwater-simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemlyn007%2Fwater-simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemlyn007%2Fwater-simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cemlyn007","download_url":"https://codeload.github.com/cemlyn007/water-simulator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemlyn007%2Fwater-simulator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["jax","opengl","physics","python"],"created_at":"2026-01-16T14:21:59.617Z","updated_at":"2026-01-16T14:21:59.669Z","avatar_url":"https://github.com/cemlyn007.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JAX OpenGL Height-Field Water Simulator\n\n[![Simulation YouTube Video](images/simulation.jpeg)](https://youtu.be/Vrl7CklleO4?si=gBdu8EDwAdmfNjJm)\n\nThis is a simple height-field water simulator written in Python using `JAX` and `OpenGL`. It is based on the awesome work of [Matthias](https://www.youtube.com/watch?v=hswBi5wcqAA) which was implemented using `three.js`.\n\nThe main differences:\n* Python\n* Uses JAX so simulator code can run on CPU, GPU, METAL and TPU (TPU untested)\n* Uses pure OpenGL with no external libraries\n\nThis application has been tested with Python 3.14 on CPU and METAL GPU on MacOS. It should work on any platform that supports `JAX` and `OpenGL`. On my MacBook Pro (M1) it runs at 492fps with 101x101 grid when using JAX CPU.\nOn a Linux x86_64 machine with a NVIDIA 1080, I was also able to achieve ~350fps with 101x101 grid when using JAX CUDA. Tested with an NVIDIA 4090 and Ryzen 7950X3D, I achieved ~770 FPS with GPU and ~363 FPS with CPU-only. Since [a32fe50](https://github.com/cemlyn007/water-simulator/commit/3c1f9726edd4727edee4f645afba509144c44728), I was able to profile and optimise the code a bit and can now achieve ~2000 FPS with the NVIDIA 4090.\n\n## Run Instructions\n\n### Using UV (Recommended)\nFirst [install UV](https://docs.astral.sh/uv/getting-started/installation/). Then:\n```bash\n# Clone and setup\ngit clone https://github.com/cemlyn007/water-simulator\ncd water-simulator\nuv sync\n\n# Run the simulator\nuv run water-simulator --n 101\n```\n\n### Using pip\nFirst make sure you have Python. You may want to change how you install JAX so that you can run on CPU, GPU or METAL GPU. By default I have assumed you want to run the simulator code CPU which is easiest and fastest.\n```bash\npip install git+https://github.com/cemlyn007/water-simulator \"jax[cpu]\"\nwater-simulator --n 101\n```\n\n## Ubuntu\nTo install this to run, I found that I needed the following packages from `apt`:\n```\napt install python3-dev gcc g++\n```\n\n## Profiling\n### Using JAX native profiling\n```\nwater-simulator --n 501 --enable_jax_profiling\n```\n### Using nsys\n```\nnsys profile --capture-range=cudaProfilerApi --cuda-graph-trace=node --capture-range-end=stop -e JAX_TRACEBACK_IN_LOCATIONS_LIMIT=-1,DISPLAY=:1 water-simulator --n 501 --enable_nvidia_profiling\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcemlyn007%2Fwater-simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcemlyn007%2Fwater-simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcemlyn007%2Fwater-simulator/lists"}