Skip to content

rianino/FD-visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CFD Visualizer — Quick Guide

Run fluid simulations in your browser. Pick a scenario, choose a fluid and speed, click Run, and watch the flow.


First time setup

You only need to do this once.

1. Install Python dependencies

pip3 install flask numpy --break-system-packages

2. Start the app

python3 webapp.py

3. Open your browser and go to:

http://localhost:5000

You will see a dark interface with three tabs along the top. That's it — you're ready.


Running your first simulation (takes 30 seconds)

  1. Click the Lid-Driven Cavity tab at the top.
  2. Leave everything at its defaults.
  3. Click the green ▶ Run button on the right.
  4. Watch the log output fill in at the bottom right. When it stops, the plot on the left updates automatically.
  5. You should see a smooth colour gradient — blue in the corners, yellow near the top. This is the velocity field: yellow = fast, blue = slow.

That's a working CFD simulation. The fluid is being dragged around by the moving top wall, forming a circular vortex.


Changing things

Pick a different fluid

The Fluid dropdown on the right lets you choose Water, Air, Olive Oil, Glycerin, or Honey.

Thicker fluids (Honey, Glycerin) make the flow slower and smoother. Thinner fluids (Air, Water) make the flow faster and more chaotic at the same speed.

Change the speed

Drag the velocity slider. The number next to it shows the speed in metres per second.

Below the slider you'll see Re = [number]. This is the Reynolds number — a single number that summarises whether the flow is smooth (low Re) or turbulent (high Re).

Keep Re below 1000. Above that the flow becomes turbulent, which these solvers are not designed to handle. If Re is too high, the simulation will fail.

Apply and re-run

After changing any settings, click Apply Parameters, then ▶ Run again.

Before re-running you can optionally click Clean to delete the previous results.

To undo all your changes, click Reset.


What you're looking at

The colour plot

The plot shows one property of the flow at once. Switch between them using the buttons at the top left:

Button What it shows
|U| velocity How fast the fluid is moving — start here
Uₓ How fast the fluid is moving left/right
Uᵧ How fast the fluid is moving up/down
Pressure Where pressure is high or low

The arrows

Small arrows on the plot show which direction the fluid is moving at each point. Toggle them with the flow arrows checkbox.

The time slider

The simulation runs through time. Drag the slider at the bottom of the plot to scrub back and forward. The last position is always the final, settled result.


The three scenarios

Lid-Driven Cavity

A sealed box of fluid. The top wall slides to the right at the speed you set — everything else is fixed. The moving lid drags the fluid along, creating a large circular vortex.

Try this: increase the velocity slider to about 1.5 m/s with Water selected. You'll see the vortex shift upward and strengthen.


Planar Poiseuille Flow

Fluid enters from the left at a constant speed. As it travels down the channel, the walls slow it down. By the time it reaches the right side, the profile is parabolic: fastest in the middle, almost zero at the walls.

The dashed orange line on the plot is the exact mathematical answer. Your simulation should match it closely.

Try this: switch the field to Uₓ. You'll see the parabolic profile very clearly as a smooth gradient.


Backward-Facing Step

Fluid flows through a narrow channel, then suddenly the channel gets wider because of a step. The flow can't turn the corner, so it separates and forms a trapped spinning bubble just behind the step.

The bubble gets longer as you increase Re. At Re = 100 it is short; at Re = 500 it stretches most of the way down the channel.

Try this: compare |U| velocity and Uₓ — in Uₓ the recirculation zone shows as a blue patch (flow going backwards).


Advanced options

Click Advanced options (below the velocity slider) to access:

  • N / Nx / Ny — number of grid cells. Higher = more detail, slower to run. Start with defaults.
  • L / H / h — domain dimensions in metres.
  • endTime — how long to simulate in seconds.

You do not need to set deltaT — it is calculated automatically to keep the simulation stable.


Something went wrong?

Solver exited with an error The most common cause is Reynolds number too high. Lower the velocity or switch to a thicker fluid (Glycerin, Honey). Click Clean, then Run again.

Plot shows only one flat colour The simulation probably failed before writing any results. Check the solver log for lines starting with [ERROR]. Then click Clean and try again at lower velocity.

blockMesh fails / library not found OpenFOAM is not set up correctly. Confirm it is installed:

ls /usr/lib/openfoam/openfoam2412/

If that folder does not exist, reinstall OpenFOAM v2412.

About

A visualizer for standard Fluid Dynamics academic exercises.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors