Skip to content

About

Project to learn paraview

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Scientific Visualization Pipeline — Counter-Rotating Vortex Field

A complete scientific visualization project built with ParaView, VTK, and Python.
The pipeline takes a 3-D fluid simulation from raw numerical data to publication-ready renders using the same tools and workflows used in CFD, climate modeling, and plasma physics research.


Visualizations

Isosurface — Vortex Core Detection

Extracts surfaces of constant vorticity magnitude at three threshold levels (ω = 0.4, 0.8, 1.2), revealing the nested structure of each vortex core.

Vorticity Isosurface


Slice Plane — Pressure Field Cross-Section

A horizontal cut at Z = 0 exposes the low-pressure cores created by the two counter-rotating vortices. Contour lines overlay the filled colour map to show gradient magnitude.

Pressure Slice


Streamlines — Velocity Field Integration

Particle paths integrated through the velocity vector field, seeded inside each vortex core. Coloured by speed magnitude to show acceleration and deceleration zones.

Streamlines


Volume Rendering — Speed Magnitude

Semi-transparent stacked slices with opacity transfer function mapped to speed, revealing the full 3-D structure without occluding internal features.

Volume Rendering


2-D Summary Panel

Quick-reference cross-section showing all four fields side by side at Z = 0.

Matplotlib Preview


What This Project Covers

Concept Where
VTK data model (vtkStructuredGrid, vtkPolyData) generate_field.py
Exporting .vts and .vtp files generate_field.py
ParaView Python pipeline (paraview.simple) visualize_paraview.py
Isosurfaces (Contour filter) visualize_paraview.py — View 1
Slice planes (Slice filter) visualize_paraview.py — View 2
Streamlines (StreamTracerWithCustomSource) visualize_paraview.py — View 3
Volume rendering + opacity transfer functions visualize_paraview.py — View 4
Camera animation → ffmpeg video scripts/export_animation.py
Programmatic data QA scripts/vtk_inspection.py
Colormap selection for scientific communication all render scripts

Project Structure

.
├── generate_field.py              # Step 1 — generate VTK data files
├── visualize_paraview.py          # Step 2 — ParaView pipeline (pvpython)
├── scripts/
│   ├── generate_portfolio_images.py   # Render all output images
│   ├── vtk_inspection.py              # Data QA without ParaView
│   ├── matplotlib_preview.py          # 2-D cross-section plots
│   └── export_animation.py            # Orbital camera animation
├── data/                          # VTK files (generated by Step 1)
│   ├── velocity_field.vts         # 60×60×40 structured grid — velocity, speed, vorticity
│   ├── pressure_field.vts         # same grid — pressure scalar
│   └── streamline_seeds.vtp       # seed points for streamline integration
└── outputs/                       # Rendered images
    ├── 01_vorticity_isosurface.png
    ├── 02_pressure_slice.png
    ├── 03_streamlines.png
    ├── 04_speed_volume.png
    └── matplotlib_preview.png

Quick Start

Requirements

pip install numpy vtk scipy matplotlib

ParaView for pvpython and GUI usage.

1 — Generate field data

python generate_field.py

Creates three VTK files in data/. The field is a pair of counter-rotating Rankine vortices on a 60×60×40 structured grid (144,000 points), with:

  • Velocity — 3-component vector field
  • Speed — scalar magnitude
  • VorticityMagnitude — ∂V/∂x − ∂U/∂y
  • Pressure — Bernoulli-derived synthetic scalar

2 — Inspect the data

python scripts/vtk_inspection.py

Loads both VTS files and prints per-array statistics without opening ParaView:

Grid dimensions : 60 x 60 x 40
Total points    : 144,000

[Velocity]  (vector, 3 components)
  |v|: min=0.027  max=0.616  mean=0.136

[VorticityMagnitude]  (scalar)
  min=0.000  max=1.327  mean=0.082

3 — Quick matplotlib preview

python scripts/matplotlib_preview.py

4 — Full ParaView render pipeline

pvpython visualize_paraview.py

Or load data/velocity_field.vts in the ParaView GUI and use Tools → Python Shell to run the script interactively — every filter maps 1-to-1 with a GUI operation.

5 — Animated rotation (optional)

pvpython scripts/export_animation.py
ffmpeg -r 30 -i outputs/frames/frame_%04d.png -c:v libx264 -pix_fmt yuv420p vortex_rotation.mp4

The Physics

Two counter-rotating Rankine vortices offset along the X-axis. Each vortex has a solid-body rotation core (radius = 0.6 m) surrounded by irrotational flow. A gentle sinusoidal axial velocity component in Z adds 3-D structure.

The induced velocity field from vortex A wraps around vortex B and vice versa — the pair translates and stretches in a pattern common in turbulent shear layers, aircraft wake vortices, and atmospheric phenomena like tornadoes.

Key observable features in the renders:

  • Pressure minima at the two core centres (Bernoulli: high speed → low pressure)
  • Vorticity shells tightly wrapped around each core, decaying radially
  • Streamlines spiral into and around each core, with braiding between the two vortices
  • Speed gradients strongest at the core boundary, weakest in the far field

Key Concepts for ParaView Work

VTK pipeline model — every operation (Contour, Slice, StreamTracer, Clip) is a filter that reads an upstream dataset and passes a modified dataset downstream. Scripts reproduce exactly what the GUI pipeline editor does, making workflows reproducible and batch-scriptable for HPC environments.

Colormap selection — Cool to Warm for divergent signed fields; Inferno/Hot for magnitude; Blue–Orange for pressure deviation. Colormap choice is a core skill in communicating scientific results without misleading the viewer.

Opacity transfer functions — volume rendering maps scalar value → opacity, allowing internal structure to show through without clipping or slicing.

Seed geometry — streamlines depend critically on seed placement; the .vtp seed file places points in a ring inside each vortex core to capture the full spiral trajectory.

About

Project to learn paraview

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages