{"id":26561874,"url":"https://github.com/burnycoder/fluid-dynamics-simulation","last_synced_at":"2025-03-22T14:18:38.835Z","repository":{"id":282074353,"uuid":"947406018","full_name":"BurnyCoder/fluid-dynamics-simulation","owner":"BurnyCoder","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-12T16:41:22.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T17:34:22.462Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/BurnyCoder.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":"2025-03-12T16:29:09.000Z","updated_at":"2025-03-12T16:41:26.000Z","dependencies_parsed_at":"2025-03-12T17:44:59.539Z","dependency_job_id":null,"html_url":"https://github.com/BurnyCoder/fluid-dynamics-simulation","commit_stats":null,"previous_names":["burnycoder/fluid-dynamics-simulation"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurnyCoder%2Ffluid-dynamics-simulation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurnyCoder%2Ffluid-dynamics-simulation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurnyCoder%2Ffluid-dynamics-simulation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurnyCoder%2Ffluid-dynamics-simulation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BurnyCoder","download_url":"https://codeload.github.com/BurnyCoder/fluid-dynamics-simulation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244966520,"owners_count":20539797,"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":[],"created_at":"2025-03-22T14:18:38.348Z","updated_at":"2025-03-22T14:18:38.827Z","avatar_url":"https://github.com/BurnyCoder.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fluid Dynamics Simulation\n\nA real-time fluid dynamics simulation using Three.js. This interactive web application visualizes fluid behavior using WebGL.\n\n![image](https://github.com/user-attachments/assets/3c1d1940-83d1-4962-8c4a-2cc280acd4bd)\n\n## Online Repository\n\nThis project is available on GitHub at: https://github.com/BurnyCoder/fluid-dynamics-simulation\n\nTo clone this repository:\n```bash\ngit clone https://github.com/BurnyCoder/fluid-dynamics-simulation.git\ncd fluid-dynamics-simulation\n```\n\n## Features\n\n- Real-time 2D fluid simulation\n- Interactive fluid disturbance with mouse drag\n- Beautiful visualization using Three.js and WebGL shaders\n- Physically-based simulation using the Navier-Stokes equations\n- Interactive control panel for tuning simulation parameters\n- Preset fluid types (water, smoke, fire, oil)\n- Touch support for mobile devices\n\n## How to Run (Single Command)\n\nChoose one of the following methods based on your preference and system:\n\n### Method 1: Using Node.js\n\nIf you have Node.js installed:\n\n```bash\n# Install dependencies (first time only)\nnpm install\n\n# Run the simulation\nnpm start\n```\n\nThen open your browser to http://localhost:3000\n\n### Method 2: Using the Shell Script (Linux/Mac)\n\n```bash\n# Make sure the script is executable (first time only)\nchmod +x run.sh\n\n# Run the simulation\n./run.sh\n```\n\nThen open your browser to http://localhost:3000\n\n### Method 3: Using Batch File (Windows)\n\nOn Windows, simply double-click the `run.bat` file or run it from the command prompt:\n\n```\nrun.bat\n```\n\nThen open your browser to http://localhost:3000\n\n### Method 4: Using Python (Cross-platform)\n\nIf you prefer Python over Node.js:\n\n```bash\n# Make sure the script is executable on Linux/Mac (first time only)\nchmod +x run.py\n\n# Run the simulation\npython run.py\n# OR on Linux/Mac:\n./run.py\n```\n\nThis will automatically open your browser to http://localhost:8000\n\n## Interactive Parameters\n\nThe simulation includes a control panel with tunable parameters, allowing you to experiment with different fluid behaviors:\n\n### Physics Parameters\n\n- **Time Step**: Controls the size of each simulation step (affects simulation speed)\n- **Diffusion**: Controls how quickly properties spread through the fluid\n- **Viscosity**: Controls the \"thickness\" of the fluid\n- **Solver Iterations**: Higher values increase accuracy but decrease performance\n- **Density Persistence**: How long density (dye) remains visible\n- **Velocity Persistence**: How long velocity remains active\n\n### Interaction Parameters\n\n- **Force Strength**: Controls how strongly your mouse movements affect the fluid\n- **Force Radius**: Controls the area of influence of your mouse movements\n\n### Visualization Parameters\n\n- **Show Velocity Field**: Toggle to visualize the velocity field\n- **Color 1 \u0026 Color 2**: Customize the fluid's color gradient\n- **Velocity Color**: Customize the color of the velocity visualization\n- **Background Opacity**: Adjust the background transparency\n- **Fluid Opacity**: Adjust the fluid's transparency\n\n### Presets\n\nChoose from predefined fluid types:\n- **Water**: Default fluid with low viscosity and bluish colors\n- **Smoke**: Higher diffusion with grayscale colors\n- **Fire**: Lower viscosity with orange/yellow colors\n- **Oil**: Higher viscosity with brown/amber colors\n\n## How It Works\n\nThe simulation is based on the following core components:\n\n1. **Advection**: Transport of density and velocity through the fluid\n2. **Diffusion**: Viscous spreading of the fluid properties\n3. **Projection**: Ensuring mass conservation (incompressibility)\n\nThe implementation follows Jos Stam's approach to stable fluid simulations, which uses a semi-Lagrangian advection scheme and a Jacobi iteration for the pressure solver.\n\n## Controls\n\n- **Mouse drag/touch**: Add force and dye to the fluid\n- **R key**: Reset the simulation\n- **Control panel**: Adjust simulation parameters in real-time\n\n## Technical Details\n\n- Grid size: 256×256\n- Visualization: WebGL shaders via Three.js\n- Implemented using ES6 JavaScript modules\n- Cross-platform: Run on Windows, Mac, or Linux with a single command\n- Interactive UI built with dat.GUI for parameter tuning\n\n## References\n\n- Jos Stam's \"Stable Fluids\" paper (1999)\n- GPU Gems Chapter 38: Fast Fluid Dynamics Simulation on the GPU \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburnycoder%2Ffluid-dynamics-simulation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fburnycoder%2Ffluid-dynamics-simulation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburnycoder%2Ffluid-dynamics-simulation/lists"}