Robert S. Laramee 1 Visualization, Lecture Flow visualization, Part 2 (of 3)
Robert S. Laramee 2 Retrospect: Previous Lecture Flow Visualization, Part 1: introduction, overview simulation vs. measurement vs. modelling 2D vs. surfaces vs. 3D steady vs time-dependent direct vs. geometric FlowVis experimental FlowVis PIV + example Vortices behind wing tips
Robert S. Laramee 3 Overview: Lecture Flow Visualization, Part 2: direct FlowVis with arrows numerical integration Euler-integration Runge-Kutta-integration streamlines in 2D particle paths in 3D, sweeps illuminated streamlines streamline placement
Robert S. Laramee 4 Direct Flow Visualization with Arrows Hedgehog plots, etc.
Robert S. Laramee 5 Direct FlowVis with Arrows Properties: direct FlowVis normalized arrows vs. velocity coding 2D: quite useful, 3D: often problematic often difficult to understand, mentally integrate (time component missing) frequently used!
Robert S. Laramee 6 Arrows in 2D Scaled arrows vs. color-coded arrows
Robert S. Laramee 7 Arrows in 3D Common problems: ambiguity perspective shortening 1D objects generally difficult to grasp in 3D Remedy: 3D-Arrows (are of some help )
Robert S. Laramee 8 Arrows in 3D Compromise: arrows only in layers
Robert S. Laramee 9 Arrows in 3D Combines well with other 3D vis.:
Robert S. Laramee 10 Integration of Streamlines Numerical Integration
Robert S. Laramee 11 Streamlines – Theory Correlations: flow data v: derivative information dx/dt = v(x); spatial points x R n, Time t R, flow vectors v R n streamline s: integration over time, also called trajectory, solution, curve s(t) = s 0 + 0 u t v(s(u)) du; seed point s 0, integration variable u difficulty: result s also in the integral analytical solution usually impossible.
Robert S. Laramee 12 Streamlines – Practice Basic approach: theory: s(t) = s 0 + 0 u t v(s(u)) du practice: numerical integration idea: (very) locally, the solution is (approx.) linear Euler integration: follow the current flow vector v(s i ) from the current streamline point s i for a very small time (dt) and therefore distance Euler integration: s i+1 = s i + v(s i ) · dt, integration of small steps (dt very small)
Robert S. Laramee 13 Euler Integration – Example 2D model data: v x = dx/dt = y v y = dy/dt = x/2 Sample arrows: True solution: ellipses
Robert S. Laramee 14 Euler Integration – Example Seed point s 0 = ( 0 | -1 ) T ; current flow vector v(s 0 ) = ( 1 | 0 ) T ; dt = ½ v x = dx/dt = y v y = dy/dt = x/
Robert S. Laramee 15 Euler Integration – Example New point s 1 = s 0 + v(s 0 ) · dt = ( 1/2 | -1 ) T ; current flow vector v(s 1 ) = ( 1 | 1/4 ) T ; v x = dx/dt = y v y = dy/dt = x/
Robert S. Laramee 16 Euler Integration – Example New point s 2 = s 1 + v(s 1 ) · dt = ( 1 | -7/8 ) T ; current flow vector v(s 2 ) = ( 7/8 | 1/2 ) T ; v x = dx/dt = y v y = dy/dt = x/
Robert S. Laramee 17 Euler Integration – Example s 3 = ( 23/16 | -5/8 ) T ( 1.44 | ) T ; v(s 3 )= ( 5/8 | 23/32 ) T ( 0.63 | 0.72 ) T ; v x = dx/dt = y v y = dy/dt = x/
Robert S. Laramee 18 Euler Integration – Example s 4 = ( 7/4 | -17/64 ) T ( 1.75 | ) T ; v(s 4 )= ( 17/64 | 7/8 ) T ( 0.27 | 0.88 ) T ;
Robert S. Laramee 19 Euler Integration – Example s 9 ( 0.20 | 1.69 ) T ; v(s 9 ) ( | 0.10 ) T ;
Robert S. Laramee 20 Euler Integration – Example s 14 ( | ) T ; v(s 14 ) ( 0.10 | ) T ;
Robert S. Laramee 21 Euler Integration – Example s 19 ( 0.75 | ) T ; v(s 19 ) ( 3.02 | 0.37 ) T ; clearly: large integration error, dt too large, 19 steps
Robert S. Laramee 22 Euler Integration – Example dt smaller (1/4): more steps, more exact. s 36 ( 0.04 | ) T ; v(s 36 ) ( 1.74 | 0.02 ) T ; 36 steps
Robert S. Laramee 23 Comparison Euler, Step Sizes Euler quality is proportional to dt
Robert S. Laramee 24 Euler Example – Error Table dt#stepserror 1/219~200% 1/436~75% 1/1089~25% 1/100889~2% 1/ ~0.2%
Robert S. Laramee 25 Runge-Kutta Integration -Better than Euler Runge-Kutta Approach: theory: s(t) = s 0 + 0 u t v(s(u)) du Euler:s i = s 0 + 0 u<i v(s u ) dt Runge-Kutta integration: idea: cut short the curve arc RK-2 (second order RK): 1.: do half a Euler step 2.: evaluate (interpolate) flow vector there 3.: use it at the origin RK-2 (two evaluations of v per step): s i+1 = s i + v(s i +v(s i )·dt / 2) · dt
Robert S. Laramee 26 RK-2 Integration – One Step Seed point s 0 = ( 0 | -2 ) T ; current flow vector v(s 0 ) = ( 2 | 0 ) T ; preview vector v(s 0 +v(s 0 )·dt / 2) = (2|0.5) T ; dt = 1
Robert S. Laramee 27 RK-2 – One more step Seed point s 1 = ( 2 | -1.5 ) T ; current flow vector v(s 1 ) = ( 1.5 | 1 ) T ; preview vector v(s 1 +v(s 1 )·dt / 2) (1|1.4) T ; dt =
Robert S. Laramee 28 RK-2 – A Quick Round RK-2: even with dt = 1 (9 steps) better than Euler with dt = 1/8 (72 steps)
Robert S. Laramee 29 RK-4 vs. Euler, RK-2 Even better: fourth order RK: four vectors a, b, c, d one step is a convex combination: s i+1 = s i + (a + 2·b + 2·c + d)/6 vectors: a = dt·v(s i )… original vector b = dt·v(s i +a/2)… RK-2 vector c = dt·v(s i +b/2)… use RK-2 … d = dt·v(s i +c)… and again
Robert S. Laramee 30 Euler vs. Runge-Kutta RK-4: pays off only with complex flows Here approx. like RK-2
Robert S. Laramee 31 Integration, Conclusions Summary: analytic determination of streamlines usually not possible hence: numerical integration various methods available (Euler, Runge-Kutta, etc.) Euler: simple, imprecise, esp. with small dt RK: more accurate in higher orders furthermore: adaptive methods, implicit methods, etc.
Robert S. Laramee 32 Flow Visualization with Streamlines Streamlines, Particle Paths, etc.
Robert S. Laramee 33 Streamlines in 2D Adequate for overview
Robert S. Laramee 34 Visualization with Particles Particle paths = streamlines (steady flows) Variants (time- dependent data): streak lines: steadily new particles path lines: long-term path of one particle click2demo (F9!)
Robert S. Laramee 35 Streamlines in 3D Color coding: Speed Selective Placement
Robert S. Laramee 36 Illuminated Streamlines Illuminated 3D curves better 3D perception
Robert S. Laramee 37 Streamline Placement in 2D
Robert S. Laramee 38 Problem: Choice of Seed Points Streamline placement: If regular grid used: very irregular result
Robert S. Laramee 39 Overview of Algorithm Idea: streamlines should not lie too close to one another Approach: choose a seed point with distance d sep from an already existing streamline forward- and backward-integration until distance d test is reached (or …). two parameters: d sep … start distance d test … minimum distance
Robert S. Laramee 40 Algorithm – Pseudo-Code Compute initial streamline, put it into a queue current streamline = initial streamline WHILE not finished DO: TRY: get new seed point which is d sep away from current streamline IF successful THEN compute new streamline AND put to queue ELSE IF no more streamline in queue THEN exit loop ELSE next streamline in queue becomes current streamline
Robert S. Laramee 41 Streamline Termination When to stop streamline integration: when distance to neighboring streamline ≤ d test when streamline leaves flow domain when streamline runs into fixed point (v = 0) when streamline gets too near to itself (loop) after a certain amount of maximal steps
Robert S. Laramee 42 New Streamlines
Robert S. Laramee 43 Different Streamline Densities Variations of d sep relative to image width: 6% 3% 1.5%
Robert S. Laramee 44 d sep vs. d test d test = 0.9 · d sep d test = 0.5 · d sep
Robert S. Laramee 45 Tapering and Glyphs Thickness in relation to distance Directional glyphs:
Robert S. Laramee 46 Literature For more information, please see: B. Jobard & W. Lefer: “Creating Evenly-Spaced Streamlines of Arbitrary Density” in Proceedings of 8th Eurographics Workshop on Visualization in Scientific Computing, April 1997, pp Data Visualization: Principles and Practice, Chapter 6: Vector Visualization by A. Telea, AK Peters 2008 FlowVis Videos available on Bob's web page.
Robert S. Laramee 47 Acknowledgements We thank the following for material used in this lecture: Bruno Jobard Malte Zöckler Georg Fischel Frits H. Post Roger Crawfis Helwig Hauser