0% found this document useful (0 votes)
14 views

IN4089 - Lecture 08 - Indirect Volume Visualization and Vectorfields-Pdfjam

Uploaded by

frankxlebrun
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

IN4089 - Lecture 08 - Indirect Volume Visualization and Vectorfields-Pdfjam

Uploaded by

frankxlebrun
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Volume visualization

2D visualization of slice
images
Indirect Volume arbitrary cut planes (multi
planar reconstruction, MPR)
Visualization
Indirect 3D visualization
Extract and reformat
structures: isosurfaces
IN4089 Data Visualization
Martin Skrodzki – Computer Graphics & Visualization Direct 3D visualization
Interactively classify
structures: direct volume
rendering (DVR)

Isosurface Raycasting

Intensity

Iso Surfaces in Direct Volume Rendering


Iso value

Eye

Pixel

4
Indirect Volume Visualization
Idea: Make the inner parts of the volume
visible by extracting contours/surfaces of
features and visualize these
contours/surfaces (indirect)
Back to Indirect Volume Rendering

Iso-contours, level sets, etc.

Iso-contours Iso-contours

set of points where set of points where


the scalar field f the scalar field f
has a given iso-value c has a given iso-value c
→ → → →
{𝑥𝑥 ∈ ℝ𝑛𝑛 : 𝑓𝑓(𝑥𝑥 ) = 𝑐𝑐} {𝑥𝑥 ∈ ℝ𝑛𝑛 : 𝑓𝑓(𝑥𝑥 ) = 𝑐𝑐}

8 9
Iso-contours Recap: Volume data
• 3D grid of data points, indices: m, n, k
• one scalar value per data point
set of points where • density, concentration
the scalar field f • pressure
has a given iso-value c • temperature →
→ → 𝑓𝑓 𝑥𝑥 : ℝ3 → ℝ
{𝑥𝑥 ∈ ℝ𝑛𝑛 : 𝑓𝑓(𝑥𝑥 ) = 𝑐𝑐} • velocity
• etc … 𝑓𝑓[𝑚𝑚, 𝑛𝑛, 𝑘𝑘]: ℕ3 → ℕ

10 11

Volume data Iso-contours • Discrete Case

set of points where


the scalar field f
has a given iso-value c
→ →
{𝑥𝑥 ∈ ℝ𝑛𝑛 : 𝑓𝑓(𝑥𝑥 ) = 𝑐𝑐}

Voxel Cell
Sampled data point Voxel centers = Vertices of the cube
example: iso-value c = 8

12 13
Marching Squares Algorithm (2D) Marching Squares Algorithm (2D)
v3 v4 grid value v3 v4 grid value
• For all cells with data values larger and ≥c • For all cells with data values larger and ≥c
<c <c
smaller than iso-value c at the grid points vi smaller than iso-value c at the grid points vi
v1 v2 v1 <c v1 v2 v1 <c
v2 <c v3 v4 v2 <c
v3 >c v3 >c
v4 >c • Find cell edges with intersection v4 >c

v1 v2

14 15

Marching Squares Algorithm (2D) Marching Squares Algorithm (2D)


v3 v4 grid value v3 v4 grid value
• For all cells with data values larger and ≥c • For all cells with data values larger and ≥c
<c <c
smaller than iso-value c at the grid points vi smaller than iso-value c at the grid points vi
v1 v2 v1 <c v1 v2 v1 <c
v3 v4 v2 <c v3 v4 v2 <c
v3 >c v3 >c
• Find cell edges with intersection v4 >c • Find cell edges with intersection v4 >c

• Connect intersection points • Connect intersection points


v1 v2 v1 v2
v3 v4

v1 v2

16 17
Marching Squares Algorithm (2D) Iso-contours • Discrete Case
v3 v4 grid value
• For all cells with data values larger and ≥c • For all cells with data values larger and
<c
smaller than iso-value c at the grid points vi smaller than iso-value 8 at the grid points vi
v1 v2 v1 <c
v3 v4 v2 <c 10 10
v3 >c
• Find cell edges with intersection v4 >c • Find cell edges with intersection
• Connect intersection points • Connect intersection points
v1 v2 10 10
v3 v4

• Interpolate along the cell edges • Interpolate along the cell edges
v1 v2
example: iso-value c = 8

18 19

Iso-contours • Discrete Case Marching Squares Algorithm (2D)

• For all cells with data values larger and • For all cells with data values larger and
smaller than iso-value 8 at the grid points vi smaller than iso-value c at the grid points vi 0 1 2 3
10 10

• Find cell edges with intersection • Find cell edges with intersection
4 5 6 7
• Connect intersection points 10 10
• Connect intersection points
8 9 10 11

• Interpolate along the cell edges • Interpolate along the cell edges
12 13 14 15
example: iso-value c = 8

20 21
Marching Squares - Case Tables Marching Squares - Case Tables
≥c • For each vertex compute ≥c • For each vertex compute
<c <c
0 1 2 3

• For each cell: 4 5 6 7 • For each cell:


• Process vertices in given order • Process vertices in given order
̂ 𝑖𝑖 ) as the i-th bit of a 4-bit int
• Take 𝑓𝑓(𝑥𝑥 8 9 10 11 • Take (xi) as the i-th bit of a 4-bit int

12 13 14 15
____ 0101 = 5 (decimal)

22 23

Marching Squares - Problem Cases Marching Squares – Problem Cases


v3 v4 v3 v4 v3 v4 v3 v4 v3 v4 v3 v4
v1 <c v1 <c
v2 >c v2 >c
v3 >c ? v3 >c ?
v4 <c v4 <c
v1 v2 v1 v2 v1 v2 v1 v2 v1 v2 v1 v2

Solutions
• smallest change of direction
wrt neighboring cells
• ask for user input
Join Contour Break Contour Join Contour Break Contour
http://users.polytech.unice.fr/~lingrand/MarchingCubes/algo.html
• … http://users.polytech.unice.fr/~lingrand/MarchingCubes/algo.html

24 25
Marching Squares - Problem Cases Marching Squares
v3 v4 v3 v4 v3 v4
v1 <c Algorithm
v2 >c
v3 >c ? For each cell (square):
v4 <c
v1 v2 v1 v2 v1 v2 1. Classify each vertex
2. Build an index
3. Get intersected edge list 5

4. Find exact intersection by


In 2D every connection is plausible!
interpolation
Join Contour Break Contour 5. Connect intersection to iso-line
http://users.polytech.unice.fr/~lingrand/MarchingCubes/algo.html

26 27

3D – Connecting 2D Contours

Marching Cubes (2D to 3D)

Stack of 2D data planes repeatedly connect two

determine closed contours contours with triangles

28 29
Marching Cubes (3D) Marching Squares (2D) Excursus: why triangles?
• Most simple surface element
Algorithm
• Unambiguous definition with three points
• For each cell (cube): • For each cell (square):
• Historically: graphics hardware built around triangles
1. Classify each vertex 1. Classify each vertex
2. Build an index 2. Build an index
3. Get intersected edge list 3. Get intersected edge list
4. Find exact intersection by 4. Find exact intersection by
interpolation interpolation
5. Connect intersections to polygon 5. Connect intersections to iso-line
6. Triangulate polygon to iso-surface 30 https://youtu.be/U93RImC-by4 31

Marching Cubes Marching Cubes – Step 1


Create a cell (cube) Classify each vertex
Consider a cube defined Classify each vertex of the
by eight data values, four cube as to whether it lies
from slice k, and four from outside or inside the
slice k+1 surface

Inside, if grid value


Outside, if grid value

32 33
Marching Cubes – Step 2 Marching Cubes – Step 3
Build an index Get edge list
Create an index between 0 and For a given index, access a list of
255 from the binary labeling of cubes edges that contain a
each vertex triangle vertex
Using symmetry of the cube, all
256 cases can be generated
from 15 cases (14 intersected, 1
index: 00000100

not intersected)

34 35

Marching Cubes – Step 3 Marching Cubes - Step 4


Find triangle vertices by interpolation
For each edge in edge list, find the
triangle vertex position using linear
interpolation of the density values
(e.g. x-direction):

: Sample distance in x-direction


index: 01000001 index: 10110001
: Isovalue : Image value
36 37
Problematic Cases Problematic Cases
Occur on any cube face that has adjacent vertices with different
states, but diagonal vertices in same state

IN OUT OUT IN

cubeface cubeface

OUT IN IN OUT

There are six of these cases (from 15 cases)

38 39

Problematic Cases Problematic Cases

Inconsistent choice results in holes

40 41
Drawing Drawing
• Locate the surface using marching cubes • Locate the surface using marching cubes
• Draw triangles • Draw triangles
• Illuminate/Shade triangles

42 43

𝐼𝐼 💡💡
Phong Reflection Model Shading

𝐿𝐿 ⃗
𝑛𝑛

𝜃𝜃
𝜙𝜙
• Normal vector n is needed for light ⃗
𝑉𝑉
+ + = reflection calculation
• Can easily be computed per triangle
Ambient Diffuse Specular Phong Reflection (vector orthogonal to the triangle
+ + =
𝑘𝑘𝑎𝑎 (𝐼𝐼𝑎𝑎 ∘ 𝑆𝑆𝑎𝑎 ) 𝑘𝑘𝑑𝑑 (𝐼𝐼𝑑𝑑 ∘ 𝑆𝑆𝑑𝑑 )cos𝜃𝜃 𝑘𝑘𝑑𝑑 (𝐼𝐼𝑑𝑑 ∘ 𝑆𝑆𝑑𝑑 )(cos𝜙𝜙)𝑎𝑎 surface)
• Gives a 'flat' appearance with hard
𝑘𝑘𝑎𝑎 , 𝑘𝑘𝑑𝑑 , 𝑘𝑘𝑠𝑠 : Phong weights
edges
𝐼𝐼𝑎𝑎 , 𝐼𝐼𝑑𝑑 , 𝐼𝐼𝑠𝑠 : Light properties – color (RGB - vector) - typically 𝐼𝐼𝑎𝑎 = 𝐼𝐼𝑑𝑑 = 𝐼𝐼𝑠𝑠
𝑆𝑆𝑎𝑎 , 𝑆𝑆𝑑𝑑 , 𝑆𝑆𝑠𝑠 : Surface properties – color (RGB - vector) - typically 𝑆𝑆𝑎𝑎 = 𝑆𝑆𝑑𝑑 = 𝑆𝑆𝑠𝑠
44 45
Shading Shading
• Normal vector n is needed for light • Normal vector n is needed for light
reflection calculation reflection calculation
• Can easily be computed per triangle • Can easily be computed per triangle
(vector orthogonal to the triangle (vector orthogonal to the triangle
surface) surface)
• Gives a 'flat' appearance with hard • Gives a 'flat' appearance with hard
edges edges

46 47

Shading
• Normal vector n is needed for light
reflection calculation
• Normal per vertex + Interpolation
gives a much smoother impression
• Here n is approximated by the gradient
(see direct volume rendering)
Slides (partially) based on lectures by
Thomas Höllt (TU Delft)
Anna Vilanova (TU Eindhoven)
Markus Hadwiger (King Abdullah University of Science and Technology)

48
Vector Fields

Vector Field Visualization

IN4089 Data Visualization


Martin Skrodzki – Computer Graphics & Visualization

Steady vs. Unsteady Flow Direct vs. Indirect Flow Visualization


• Stead flow: time-independent • Direct flow visualization
Arrow plot
• Flow itself is static over time: 𝑣𝑣 𝑥𝑥⃗ 𝑣𝑣: ℝ𝑛𝑛 → ℝ𝑛𝑛 • Overview of current flow state

• Example: laminar flows 𝑥𝑥⃗ → 𝑣𝑣(𝑥𝑥) • Visualization of vectors: arrow plots (“hedgehog” plots), LIC

• Indirect flow visualization


• Unsteady flow: time-dependent • Use intermediate representation: vector field integration over time
LIC
• Flow itself changes over time 𝑣𝑣(𝑥𝑥)
⃗ 𝑣𝑣: ℝ𝑛𝑛 ×ℝ→ ℝ𝑛𝑛 • Visualization of temporal evolution

• Example: turbulent flows 𝑥𝑥⃗ → 𝑣𝑣(𝑥𝑥, 𝑡𝑡) • Integral curves: streamlines, pathlines, streaklines, timelines

(here just for Euclidean domain; analogous on general manifolds) • Integral surfaces: streamsurfaces, pathsurfaces, streaksurfaces
Integral curve
4 5
Flow/Vector Field Visualization: Direct/Vectors

Direct Flow Visualization

𝑥𝑥 𝑅𝑅 x
z

𝑦𝑦 = 𝐺𝐺
𝑧𝑧 𝐵𝐵
6 7

Flow/Vector Field Visualization: Glyph/Hedgehog Hedgehogs Problems in 3D


• Ambiguity
• Hedgehog plots
• Perspective
• Direct flow visualization
• 1D objects in 3D: difficult spatial perception
• Normalized arrows vs. scaling with velocity • Visual clutter
• Scaling problematic
• Limited expressivity • 3D arrows (help to a certain extent)
(temporal component missing)
• But often used as basic technique!
𝑥𝑥
𝑦𝑦 =
8 10
Hedgehogs Problems in 3D Line Integral Convolution (LIC)
• Ambiguity
• Goal: General overview of the flow
• Perspective
• 1D objects in 3D: difficult spatial perception • Idea: Flow ⬄ visual correlation
• Visual clutter

• 3D arrows (help to a certain extent)

• Compromise: Arrows only on slices

11 Cabral and Leedom, Imaging Vector Fields Using Line Integral Convolution, Proceedings of SIGGRAPH '9312

Line Integral Convolution (LIC) Line Integral Convolution (LIC)


• Goal: General overview of the flow • Start with dense flow field

• Idea: Flow ⬄ visual correlation

• Approach: Use dense textures


• Cover domain with random texture
(input texture, usually white noise)
• Blur (convolve) the input texture along stream lines
using a specified 1D (line-)kernel

Cabral and Leedom, Imaging Vector Fields Using Line Integral Convolution, Proceedings of SIGGRAPH '9313 15
Line Integral Convolution (LIC) Line Integral Convolution (LIC)
• Start with dense flow field • Start with dense flow field
• Cover the domain with noise • Cover the domain with noise
• Blur noise tangential to vector
field

16 17

Line Integral Convolution (LIC) How to Convolve?


∫ 𝑓𝑓 𝑥𝑥 𝑡𝑡 + 𝜏𝜏 ⋅ 𝑘𝑘 𝜏𝜏 𝑑𝑑𝑑𝑑

• Start with dense flow field • Convolution:


• Cover the domain with noise 𝐿𝐿
𝑓𝑓 ∗ 𝑘𝑘 𝑥𝑥 = � 𝑓𝑓 𝑡𝑡 + 𝜏𝜏 ⋅ 𝑘𝑘 𝜏𝜏 𝑑𝑑𝑑𝑑
• Blur noise tangential to vector field −𝐿𝐿

• Result:
• Along flow lines visually coherent values • For function 𝑓𝑓 and kernel 𝑘𝑘 of size 2𝐿𝐿 (1D)
• LIC: convolve along the vector field 𝑝𝑝1 𝑝𝑝2
𝑝𝑝0
𝐿𝐿
.1 .2 .4 .2 .1 𝑝𝑝−1
𝑓𝑓 ∗ 𝑘𝑘 𝑥𝑥 = � 𝑓𝑓 𝑥𝑥(𝑡𝑡 + 𝜏𝜏) ⋅ 𝑘𝑘 𝜏𝜏 𝑑𝑑𝑑𝑑
−𝐿𝐿
−𝐿𝐿 𝐿𝐿 𝑝𝑝−2
18 19
Integral Curves / Stream Objects

Indirect Flow Visualization

20 21

Flow/Vector Field Visualization: Indirect Flow/Vector Field Visualization: Indirect


• Streamline • Streamline
• Curve parallel to the vector field in each point for a fixed time • Curve parallel to the vector field in each point for a fixed time
Identical
• Pathline for • Pathline
steady
• Describes motion of a massless particle over time flow • Describes motion of a massless particle over time

• Streakline • Streakline
• Location of several particles released at a fixed position over time • Location of several particles released at a fixed position over time

• Timeline • Timeline
• Location of several particles released along a line at a fixed time • Location of several particles released along a line at a fixed time
Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 22 Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 23
Flow/Vector Field Visualization: Indirect Flow/Vector Field Visualization: Indirect
• Streamline • Streamline
• Curve parallel to the vector field in each point for a fixed time • Curve parallel to the vector field in each point for a fixed time

• Pathline • Pathline
• Describes motion of a massless particle over time • Describes motion of a massless particle over time

• Streakline • Streakline
• Location of several particles released at a fixed position over time • Location of several particles released at a fixed position over time

• Timeline • Timeline
• Location of several particles released along a line at a fixed time • Location of several particles released along a line at a fixed time
Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 24 Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 25

Flow/Vector Field Visualization: Indirect Flow/Vector Field Visualization: Indirect


• Streamline • Streamline
• Curve parallel to the vector field in each point for a fixed time • Curve parallel to the vector field in each point for a fixed time

• Pathline • Pathline
• Describes motion of a massless particle over time • Describes motion of a massless particle over time

• Streakline • Streakline
• Location of several particles released at a fixed position over time • Location of several particles released at a fixed position over time

• Timeline • Timeline
• Location of several particles released along a line at a fixed time • Location of several particles released along a line at a fixed time
Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 26 Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 27
Flow/Vector Field Visualization: Indirect Flow/Vector Field Visualization: Indirect
• Streamline • Streamline
• Curve parallel to the vector field in each point for a fixed time • Curve parallel to the vector field in each point for a fixed time

• Pathline • Pathline
• Describes motion of a massless particle over time • Describes motion of a massless particle over time

• Streakline • Streakline
• Location of several particles released at a fixed position over time • Location of several particles released at a fixed position over time

• Timeline • Timeline
• Location of several particles released along a line at a fixed time • Location of several particles released along a line at a fixed time
Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 28 Check https://www3.nd.edu/~cwang11/flowvis.html for an interactive demo 29

How to track the line/particles? Numerical Integration: Euler


• Vector field integration: • idea: (very) locally the solution is (approx.) linear
• : tracetory • Euler integration: follow the flow vector v at
• : vector field value at position x the current point p for a very small time

𝑝𝑝 𝑠𝑠 𝑝𝑝 𝑠𝑠

30 31
Numerical Integration: Euler Numerical Integration: Euler
Simple 2D model:
• Testing Example 𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0 𝑣𝑣𝑥𝑥 −𝑦𝑦
𝑣𝑣𝑥𝑥 −𝑦𝑦 𝑣𝑣𝑦𝑦 = 𝑥𝑥 ⁄2
𝑝𝑝 𝑠𝑠𝑖𝑖+1 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 𝛥𝛥𝛥𝛥
𝑣𝑣𝑦𝑦 = 𝑥𝑥/2
• Exact solution: ellipses Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5
−1

1
𝑣𝑣 𝑝𝑝0 =
0

After Helwig Hauser 32 33

Numerical Integration: Euler Numerical Integration: Euler


Simple 2D model: Simple 2D model:

𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0 𝑣𝑣𝑥𝑥 −𝑦𝑦 𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0 𝑣𝑣𝑥𝑥 −𝑦𝑦


𝑣𝑣𝑦𝑦 = 𝑥𝑥⁄2 𝑣𝑣𝑦𝑦 = 𝑥𝑥 ⁄2
𝑝𝑝 𝑠𝑠𝑖𝑖+1 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 𝛥𝛥𝛥𝛥 𝑝𝑝 𝑠𝑠𝑖𝑖+1 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 𝛥𝛥𝛥𝛥

Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5 Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5
−1 −1

1 1
𝑣𝑣 𝑝𝑝0 = 𝑣𝑣 𝑝𝑝1 =
0 0.25
0 1 0.5
𝑝𝑝 𝑠𝑠1 = + ⋅ 0.5 =
−1 0 −1

34 35
Numerical Integration: Euler Numerical Integration: Euler
Simple 2D model: Simple 2D model:

𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0 𝑣𝑣𝑥𝑥 −𝑦𝑦 𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0 𝑣𝑣𝑥𝑥 −𝑦𝑦


𝑣𝑣𝑦𝑦 = 𝑥𝑥⁄2 𝑣𝑣𝑦𝑦 = 𝑥𝑥 ⁄2
𝑝𝑝 𝑠𝑠𝑖𝑖+1 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 𝛥𝛥𝛥𝛥 𝑝𝑝 𝑠𝑠𝑖𝑖+1 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 𝛥𝛥𝛥𝛥

Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5 Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5
−1 −1

1
𝑣𝑣 𝑝𝑝1 =
0.25
0.5 1
𝑝𝑝 𝑠𝑠2 = + ⋅ 0.5
−1 0.25
1
=
−0.875
36 37

Numerical Integration: Euler Numerical Integration: Euler


Simple 2D model: Simple 2D model:

𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0 𝑣𝑣𝑥𝑥 −𝑦𝑦 𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0 𝑣𝑣𝑥𝑥 −𝑦𝑦


𝑣𝑣𝑦𝑦 = 𝑥𝑥⁄2 𝑣𝑣𝑦𝑦 = 𝑥𝑥 ⁄2
𝑝𝑝 𝑠𝑠𝑖𝑖+1 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 𝛥𝛥𝛥𝛥 𝑝𝑝 𝑠𝑠𝑖𝑖+1 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 𝛥𝛥𝛥𝛥

Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5 Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5
−1 −1
Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.25
−1

38 39
Numerical Integration: Euler Better: Runge Kutta
Simple 2D model: Simple 2D model:

𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0 𝑣𝑣𝑥𝑥 −𝑦𝑦 • Idea: cut short the curve arc 𝑣𝑣𝑥𝑥 −𝑦𝑦
𝑣𝑣𝑦𝑦 = 𝑥𝑥⁄2 • 2nd order RK: 𝑣𝑣𝑦𝑦 = 𝑥𝑥 ⁄2
𝑝𝑝 𝑠𝑠𝑖𝑖+1 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 𝛥𝛥𝛥𝛥
1. Do half Euler step
Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.5
−1 2. Evaluate flow vector there

Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.25 3. Use it at the origin
−1
𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0
Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.1
−1 𝑝𝑝 𝑠𝑠𝑖𝑖+1
Example: 𝑝𝑝0 =
0 , Δ𝑆𝑆 = 0.01 Δ𝑆𝑆
−1 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 ⋅ ⋅ 𝛥𝛥𝛥𝛥
2
40 41

Better: Runge Kutta Better: Runge Kutta


Simple 2D model: Simple 2D model:
• idea: cut short the curve arc 𝑣𝑣𝑥𝑥 −𝑦𝑦 • idea: cut short the curve arc 𝑣𝑣𝑥𝑥 −𝑦𝑦
• 2nd order RK: 𝑣𝑣𝑦𝑦 = 𝑥𝑥⁄2 • 2nd order RK: 𝑣𝑣𝑦𝑦 = 𝑥𝑥 ⁄2

1. Do half Euler step 1. Do half Euler step


2. Evaluate flow vector there 2. Evaluate flow vector there
3. Use it at the origin 3. Use it at the origin
𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0 𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0
𝑝𝑝 𝑠𝑠𝑖𝑖+1 𝑝𝑝 𝑠𝑠𝑖𝑖+1
Δ𝑆𝑆 Δ𝑆𝑆
= 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 ⋅ ⋅ 𝛥𝛥𝛥𝛥 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 ⋅ ⋅ 𝛥𝛥𝛥𝛥
2 2
42 43
Better: Runge Kutta Better: Runge Kutta
Simple 2D model: Simple 2D model:
• idea: cut short the curve arc 𝑣𝑣𝑥𝑥 −𝑦𝑦 • idea: cut short the curve arc 𝑣𝑣𝑥𝑥 −𝑦𝑦
• 2nd order RK: 𝑣𝑣𝑦𝑦 = 𝑥𝑥⁄2 • 2nd order RK: 𝑣𝑣𝑦𝑦 = 𝑥𝑥 ⁄2

1. Do half Euler step 1. Do half Euler step


2. Evaluate flow vector there 2. Evaluate flow vector there
3. Use it at the origin 3. Use it at the origin
𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0 𝑝𝑝 𝑠𝑠0 = 𝑝𝑝0
𝑝𝑝 𝑠𝑠𝑖𝑖+1 𝑝𝑝 𝑠𝑠𝑖𝑖+1
Δ𝑆𝑆 Δ𝑆𝑆
= 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 ⋅ ⋅ 𝛥𝛥𝛥𝛥 = 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 + 𝑣𝑣⃗ 𝑝𝑝 𝑠𝑠𝑖𝑖 ⋅ ⋅ 𝛥𝛥𝛥𝛥
2 2
44 45

Better: Runge Kutta How to track the line/particles?


Simple 2D model:
• idea: cut short the curve arc 𝑣𝑣𝑥𝑥 −𝑦𝑦 • Analytic typically not possible
• 2nd order RK: 𝑣𝑣𝑦𝑦 = 𝑥𝑥⁄2 • Instead: numerical integration
1. Do half Euler step • Several methods: Euler, Runge-Kutta, etc.
2. Evaluate flow vector there • Euler: simple, imprecise, esp. with large steps
3. Use it at the origin
• RK: more accurate with fewer steps
RK2: 𝛥𝛥𝛥𝛥 = 1 • Higher order for complex flows
Euler: 𝛥𝛥𝛥𝛥 = 1⁄8 • Downsides: error accumulates, manual seed point can introduce error

46 47
Slides (partially) based on lectures by
Thomas Höllt (TU Delft)
Anna Vilanova (TU Eindhoven)
Markus Hadwiger (King Abdullah University of Science and Technology)

48

You might also like