CFDRAT
CFDRAT: A Fluid Simulation Platform You Can Master in 3 Minutes
Install / Use
/learn @RatEmperior/CFDRATREADME
CFDRAT: Just Draw It, Then Simulate It.
<p align="center"> <img src="assets/hamster_flow.gif" width="700"> <img src="assets/cylinder.gif" width="700"> <br> <em>Flow Around Objects</em> </p>CFDRAT is a MATLAB solver that turns any 2D image into a fluid dynamics simulation. Here, no complex operations are needed - just an image is required to complete a simulation in minutes.
This simulation platform primarily targets laminar flow in regular regions. Created out of personal interest, it's intended for entertainment and educational purposes only.
Key Features
- Quick Start: Comes with GUI, easy to use
- Geometry Extraction: Automatically extracts object boundaries from images and generates grids.
- Interactive Post-processing: Built-in animation player with play/pause, timeline scrubbing, and playback speed adjustment.
Reproduce the Above Flow Simulations
Want to generate these interesting physical phenomena? The operation is simple:
-
Requirements: Install MATLAB R2020b or later.
-
Download Project: Get all files via
git cloneor direct ZIP download. -
Run Program: Open MATLAB, navigate to the project folder
CFDRAT/, then enter in command window:cfdrat() -
Start Simulation: At this point, the program's GUI interface will automatically open with all example parameters pre-filled. Simply click the "Start Simulation" button.
- Enjoy Results: The program will automatically perform grid generation, calculation and solving. Complete in about 3 minutes, then pop up an interactive animation playback window.
How to Define Your Own Scenarios
Simulate any scenario you're interested in, requiring only one image. Here are the steps from input image to result visualization.
- In the "Obstacle Image" area on the left side of the GUI interface, click the
Browse...button to select your own image to load the object. The computational domain origin defaults to the bottom-left corner of the image.
-
As needed, adjust parameters like "Computational Domain Height", "Inlet Velocity" and "Fluid Viscosity" in the interactive interface to adjust the fluid environment. Computational domain length, obstacle position and other information are naturally determined by the image aspect ratio.
-
Specify save location: Click the
Select...button next to "Result Save Location", specify a folder, and pre-enter the data filename to store the result data (.matfile) from this simulation. -
Grid check: Click the "Start Simulation" button, the program will automatically generate a grid for user inspection to decide whether to continue with the simulation.
-
Start calculation: After confirmation, the program will begin calculation, with progress prompts visible in the command line. Large-scale calculations require some time, please be patient.
-
Visualization: After successful simulation completion, the program will pop up an interactive animation player showing the calculated results.
How to Load Previous Simulation Results
-
In the "Result Visualization" area on the right side of the GUI interface, click the
Browse...button next to "Data File". -
In the pop-up window, find and select the result data file you previously saved (it's a
.matfile). -
Click the blue "Play Animation" button, and the program will load the data and display the corresponding flow field animation.
Technical Architecture
- Solver Algorithm: PISO.
- Spatial Discretization: Based on finite difference method, using staggered grid and second-order upwind discretization scheme
- Obstacle Boundary Processing: Staircase approximation.
- Solver: Uses preconditioned stabilized biconjugate gradient method and conjugate gradient method
Learn More
Reference usage details
- ➡️ User Guide
Author
Related Skills
clearshot
Structured screenshot analysis for UI implementation and critique. Analyzes every UI screenshot with a 5×5 spatial grid, full element inventory, and design system extraction — facts and taste together, every time. Escalates to full implementation blueprint when building. Trigger on any digital interface image file (png, jpg, gif, webp — websites, apps, dashboards, mockups, wireframes) or commands like 'analyse this screenshot,' 'rebuild this,' 'match this design,' 'clone this.' Skip for non-UI images (photos, memes, charts) unless the user explicitly wants to build a UI from them. Does NOT trigger on HTML source code, CSS, SVGs, or any code pasted as text.
openpencil
2.1kThe world's first open-source AI-native vector design tool and the first to feature concurrent Agent Teams. Design-as-Code. Turn prompts into UI directly on the live canvas. A modern alternative to Pencil.
HappyColorBlend
HappyColorBlendVibe Project Guidelines Project Overview HappyColorBlendVibe is a Figma plugin for color palette generation with advanced tint/shade blending capabilities. It allows designers to
Flyaro-waffle-app
Waffle Delight - Full Stack MERN Application Rules & Documentation Project Overview A comprehensive waffle delivery application built with MERN stack featuring premium UI/UX, admin management, a
