• 검색 결과가 없습니다.

All About Volume for Houdini Artists

N/A
N/A
Protected

Academic year: 2021

Share "All About Volume for Houdini Artists"

Copied!
200
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

All About Volume for Houdini Artists

Wanho Choi

(2)

The Assumption

여러분들은 사칙연산을 할 줄 안다.

(3)

Houdini

(4)
(5)
(6)
(7)
(8)
(9)
(10)
(11)
(12)
(13)
(14)
(15)
(16)
(17)
(18)

Computer Graphics

(19)

Four Types of CG Data

volume surface

particles

(20)

Four Types of CG Data

volume particles

curves

(21)

Surface Data Structure p0 p1 p2 p3 vertex position: [x0, y0, z0, x1, y1, z1, x2, y2, z2, x3, y3, z3] vertex connection: [v0, v1, v3, v0, v3, v2]

polygon vertex count:

[3, 3]

other attributes:

(22)

Surface Data Visualization

(23)

Four Types of CG Data

volume surface

particles

(24)

Curve Data Structure p0 p1 p2 p3 p4 p5

control vertex position:

[x0, y0, z0, x1, y1, z1, …, x5, y5, z5]

control vertex count

[3, 3]

width

[w0, w1, w2, w3, w4, w5]

other attributes:

(25)

Curve Data Visualization

(26)

Four Types of CG Data

volume

surface curves

(27)

Particle Data Structure position: [x0, y0, z0, x1, y1, z1, x2, y2, z2, x3, y3, z3] velocity: [u0, v0, w0, u1, v1, w1, u2, v2, w2, u3, v3, w3] radius: [r0, r1, r2, r3] other attributes: […], […], […], … p0 p1 p2 p3

(28)

Particle Data Visualization

(29)

Four Types of CG Data

volume

surface

particles

(30)

Volume Data Structure

(31)

Volume Data Visualization

(32)

And… How to Animate Them

Keyframe animation

Data driven animation

Procedural animation

(33)

Physics

(34)

Physical Quantity (물리량, 物理量)

측정 가능한 물리적 속성 (measurable physical property)

스칼라 물리량 (scalar physical quantities)

(35)

Scalar vs Vector 시간 (time) 길이 (length) 각도 (angle) 면적 (area) 부피 (volume) 질량 (mass) 온도 (temperature) 밀도 (density) 변위 (displacement) 속도 (velocity) 가속도 (acceleration) 힘 (force) 운동량 (momentum) 위치 (position) 법선 (normal) 접선 (tangent) 스칼라 (scalar) 벡터 (vector) 하나숫자로 표기가 가능한 물리량 “크기”를 가짐 N(=차원)숫자로 표기가 가능한 물리량 “크기”“방향”을 가짐

(36)

Newton's 1st Law of Motion

새로운 외력이 존재하지 않는 한

(37)

Newton's 2nd Law of Motion

애석하게도…

(38)

Mathematics

(39)

Trigonometry

삼(tri) + 각형(gon) + 측정법(metry)

삼각형(triangle)에 대해서 연구하는 수학의 한 분야

(40)

직각 삼각형 (Right Triangle)

모든 삼각형은 두 개의 직각 삼각형으로 분리할 수 있다.

(41)

Trigonometric Function

cos𝜭 = x ( |밑변| / |빗변| )

sin𝜭 = y ( |높이| / |빗변| ) 1 cosθ sinθ θ

(42)

z

Applications

(43)

Pythagorean Theorem a2 b2 c2 a a b b a a b b a b c c2 = a2 + b2

(44)

Magnitude

3D

2D x y x2 + y2 (x, y) (x, y, z) l = m2 + y 2 = x2 + y2 + z 2 x y z m l

(45)

Addition / Subtraction

각 성분별(component-wise) 연산 A B A + B −B A − B B A −B A B A + B

(46)

Multiplication 1: Scalar × Vector v = (x, y,z) ⇒ α v = (α x,α y,α z)x,α y) (x, y) m α m 1: α α x x α y y O

(47)

Normalization v v = x x2 + y2 + z2 , y x2 + y2 + z2 , z x2 + y2 + z2 ⎛ ⎝ ⎜ ⎞ ⎠ ⎟ ∴ ˆv = x2 x2 + y2 + z2 + y2 x2 + y2 + z2 + z 2 x2 + y2 + z2 = 1

(48)

Multiplication 2: Dot Product A = (ax ,ay ,az ) B = (bx ,by ,bz ) A ⋅B = axbx + ayby + azbz = abcosθ θ a b abcosθ = ab a 2 + b2 − (b − a)2 2ab = 1 2 a 2 + b2 − (b − a)2 { } = 1 2 ⋅ (ax 2 + a y 2 + a z 2) + (b x 2 + b y 2 + b z 2) − (a x − bx ) 2 + (a y − by ) 2 + (a z − bz ) 2 { } ⎡ ⎣ ⎤⎦ = axbx + ayby + azbz

(49)
(50)

Multiplication 3: Cross Product A × B = (aybz − azby ,azbx − axbz ,axby − aybx ) = absinθ ⋅n A × B 2 = A 2 B 2 − A i B( )2 = A 2 B 2 − A 2 B 2 cos2θ = A 2 B 2 (1− cos2θ ) = A 2 B 2 sin2θ ∴A × B = A B sinθ

(51)

Triangle Normal Its Applications ˆv = ˆω × ˆr u = normalize(B − A) v = normalize(C − A) n = u × v

(52)

Calculus

(53)

Quiz

130 km/h의 속력으로 주행중인 자동차에 타고 있다.

1시간 뒤에는 현재 위치로부터 얼마나 멀어져 있을까?

(54)

Quiz

130 km/h의 속력으로 주행중인 자동차에 타고 있다.

1시간 뒤에는 현재 위치로부터 얼마나 멀어져 있을까?

(단, 직선경로, 정속주행 가정)

(55)

Quiz

130 km/h의 속력으로 주행중인 자동차에 타고 있다.

1시간 뒤에는 현재 위치로부터 얼마나 멀어져 있을까?

(단, 직선경로, 정속주행 가정)

(56)

Quiz

130 km/h의 속력으로 주행중인 자동차에 타고 있다. 1시간 뒤에는 현재 위치로부터 얼마나 멀어져 있을까? (단, 직선경로, 정속주행 가정) 이 문제를 풀 수 있다면 ... 여러분은 이미 미분과 적분의 개념을 알고 있다. 답) 130 km = 0 km + 1h x 130 km/h

(57)

Quiz

130 km/h의 속력으로 주행중인 자동차에 타고 있다. 1시간 뒤에는 현재 위치로부터 얼마나 멀어져 있을까? (단, 직선경로, 정속주행 가정) p1 = p0 + Δt ⋅ v ⇐ v = Δp Δt = p1 − p0 t1 − t0 답) 130 km = 0 km + 1h x 130 km/h

(58)

Quiz

130 km/h의 속력으로 주행중인 자동차에 타고 있다. 1시간 뒤에는 현재 위치로부터 얼마나 멀어져 있을까? (단, 직선경로, 정속주행 가정) p1 = p0 + Δt ⋅ v ⇐ v = Δp Δt = p1 − p0 t1 − t0 미분 (differentiation) 적분 (integration) 답) 130 km = 0 km + 1h x 130 km/h

(59)

Differentiation (미분) / Integration (적분) slope (= tanθ ) : Δy

Δx ≡ ∂ y ∂x

next value : y2 = y1 + Δy

ΔxΔx 미분 (differentiation) 적분 (integration) 가 충분히 작으면 직선으로 간주할 수 있다. Δx x y

(60)

A Particle Motion

위치 p에 질량 m과 속도 v를 갖는 입자(particle)가 하나 있다.

v: 1초 뒤에는 이 방향으로 이 만큼 위치가 변화한다. (속도: 위치의 시간에 대한 변화량) p = p0 v = v0 m

(61)

A Particle Motion

따라서, ∆t초 후에는 ∆t·v만큼 위치가 변하게 된다.

외력이 없는 한 이 입자는 속도 v를 갖는 등속도 운동을 하게 된다. v = v0 p1 = p0 + Δt ⋅v 속도와 위치의 관계 (적분) 뉴턴 운동의 제 1법칙 스칼라와 벡터의 곱 p = p0 m

(62)

A Particle Motion

그런데, 만약 외력(external force)이 존재한다면…

이 방향으로 가속도(속도의 시간에 대한 변화량)가 발생한다. a = F / m v = v0 p1 = p0 + Δt ⋅v 뉴턴 운동의 제 2법칙 p = p0 m

(63)

A Particle Motion

가속도에 ∆t를 곱하면(시간에 대해 적분하면) 속도를 구할 수 있다. a = F / m v = v0 p1 = p0 + Δt ⋅v p = p0 v = Δt ⋅a 스칼라와 벡터의 곱 가속도와 속도의 관계 (적분) m

(64)

A Particle Motion

두 속도를 합하면 이 입자의 새로운 속도를 구할 수 있다. a = F / m v = v0 v = v0 + Δt ⋅a p1 = p0 + Δt ⋅v 두 벡터의 합 p = p0 v = Δt ⋅a m

(65)

A Particle Motion

따라서, ∆t초 후에는 ∆t·v만큼 위치가 변하게 된다. p1 = p0 + Δt ⋅ v a = F / m v = v0 v = v0 + Δt ⋅a p1 = p0 + Δt ⋅v 속도와 위치의 관계 (적분) v = Δt ⋅a p = p0 m

(66)

외력 (force) 가속도 (acceleration) 속도 (velocity) 위치 (position) Visualization Rendering A Particle Motion

(67)

Numerics

(68)

Field (장, 場)

장(field) = 함수(function) (ex) y=f(x,y,z,t)

속해 있는 모든 지점마다 하나의 물리량이 정의되어 있는 공간

중력장(gravitational field), 자기장(magnetic field),

온도장(temperature field), 속도장(velocity field), 압력장(pressure field), 밀도장(density field), …

(69)

Scalar Field vs Vector Field

(70)

Continuous vs Discrete

연속장(continuous field): 무한개의 지점에 정의되어 있는 모든 물리량을 저장하는 것은 불가능하며, 설령 저장이 가능하다고 하더라 도 무한개의 물리량을 대상으로 계산을 수행하는 것은 매우 많은 시 간이 소요됨

이산장(discrete field): 유한개의 지점에서만 물리량을 정의하고, 그 사이 지점에서 물리량이 필요한 경우 인근의 물리량이 정의되어 있는 지점들로 부터 값을 추정하여 사용함

(71)

from Continuous to Discrete

Lagrangian (particles)

(72)
(73)

Eulerian vs Lagrangian Eulerian 교통 정보 시스템 Lagrangien 교통 정보 시스템 지점에서의 속력은?

(74)

Lagrangian::getValue(x)

f (x) = fi

ρi W ( x − x i i

(75)

Eulerian::getValue(x)

1D: linear interpolation (길이비) r = (1− α ) × p + α × q α 1 α p r q

(76)

Eulerian::getValue(x)

2D: bi-linear interpolation

(면적비)

3D: tri-linear interpolation

(부피비)

(77)

Several Grid Structures

unstructured grid structured grid

(78)

Uniform Discrete Scalar Field

(79)

Uniform Discrete Vector Field

@ cell center @ node @ face center

Staggered Grid MAC Grid

(80)

Conventional Fluid Fields

@ cell center Pressure, Divergence Density, Temperature, SDF

@ face center Velocity

(81)

Uniform Grid Data

Scalar field defined @ node

Size: 4 bytes x 9 elements = 36 bytes

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 ! !

(82)

Uniform Grid Data

2D vector field defined @ node

Size: ( 4 bytes x 2 ) x 9 elements = 72 bytes

1.0 1.0 2.0 1.0 1.0 2.0 1.0 3.0 2.0 (1.0,1.0) (2.0,1.0) (1.0,2.0) (1.0,3.0) (2.0,3.0) (1.0,1.0) (1.0,1.0) (1.0,1.0) (1.0,1.0) ! !

(83)

Uniform Scalar Field Size

1003: 4 bytes × 100 × 100 × 100 = 4,000,000 bytes = 4 Mb

2563: 4 bytes × 256 × 256 × 256 = 67,108,864 bytes = 64 Mb

5123: 4 bytes × 512 × 512 × 512 = 536,870,912 bytes = 512 Mb

(84)

Uniform Vector Field Size

1003: 4 bytes × 3 × 100 × 100 × 100 = 12,000,000 bytes = 4 Mb

2563: 4 bytes × 3 × 256 × 256 × 256 = 201,326,592 bytes = 192 Mb

5123: 4 bytes × 3 × 512 × 512 × 512 = 1,610,612,736 bytes = 1,536 Mb = 1.5 Gb

(85)

Computer Graphics

(86)

2D Density Field Visualization 0.0 0.0 0.0 0.0 0.5 0.5 0.5 0.5 1.0 1.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 1.0 0.5 0.5 0.0 0.0

(87)

2D Density Field Visualization 0.0 0.0 0.0 0.0 0.5 0.5 0.5 0.5 1.0 1.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 1.0 0.5 0.5 0.0 0.0

(88)
(89)

3D Density Field Visualization

(90)

3D Density Field Visualization

(91)
(92)
(93)

Fluid Dynamics

(94)
(95)
(96)
(97)
(98)
(99)

Lagrangian Advection

(100)

Lagrangian Advection

0.5

이 속도장을 따라 움직이는 하나의 입자를 생각해 봅시다.

(101)

Lagrangian Advection

0.5

(102)

Lagrangian Advection

0.5

(103)

Lagrangian Advection

0.5

(104)

Lagrangian Advection

0.5

0.5

0.5

n frame n+1 frame n+2 frame

(105)

Semi-Lagrangian Advection (2,2) (2,2) (2,2) (2,2) (2,2) (2,2) (2,2) (2,2) (2,2) △x = 6.0 △t = 2.0

이제는 밀도장(density field)를 이동시켜 보겠습니다.

n 프레임에서의 또 다른 속도장을 생각해 봅시다.

(106)

Semi-Lagrangian Advection △x = 6.0 △t = 2.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0

n 프레임에서의 밀도장은 다음과 같습니다.

(107)

Semi-Lagrangian Advection ? ? ? ? ? ? ? ? ? △x = 6.0 △t = 2.0

n+1 프레임에서의 밀도장을 어떻게 구할 수 있을까요?

(108)

Semi-Lagrangian Advection △x = 6.0 △t = 2.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0

다시 n 프레임에서의 밀도장을 보겠습니다.

(109)

Semi-Lagrangian Advection 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 (2,2) △x = 6.0 △t = 2.0

주어진 속도장에서 Velocity(1,1) = (2,2)입니다.

(110)

Semi-Lagrangian Advection △x = 6.0 △t = 2.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 (2,2)

이 지점의 유선(streamline)은 다음과 같습니다.

(111)

Semi-Lagrangian Advection △x = 6.0 △t = 2.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 (2,2)

이 지점의 속도를 △t 만큼 반대 방향으로 가보겠습니다.

(112)

Semi-Lagrangian Advection △x = 6.0 △t = 2.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 (2,2)

이 위치에 있는 입자가 다음 프레임에서 (1,1) 지점으로 오게 됩니다.

이 위치의 밀도(density)값은 bi-linear interpolation으로

(113)

Semi-Lagrangian Advection △x = 6.0 △t = 2.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.444

이렇게 구한 밀도값이 다음 프레임에서의 density(1,1)가 됩니다.

(114)

Semi-Lagrangian Advection △x = 6.0 △t = 2.0 1.0 0.444 0.0 0.0 0.0 0.0 0.0 0.667 0.667

동일한 방식으로 모든 지점에 대해서 밀도값을 업데이트 해줍니다.

(115)

Semi-Lagrangian Advection △x = 6.0 △t = 2.0 1.0 0.444 0.0 0.0 0.0 0.0 0.0 0.667 0.667

밀도값을 색상으로 시각화하면 다음과 같습니다.

(116)

Semi-Lagrangian Advection

n frame n+1 frame

두 프레임의 밀도장을 비교하면 속도장에 의해 움직인 것을 확인할

(117)
(118)

Also, Velocity Advection

다.속도장 또한 물리량이므로 마찬가지 방법으로 이동시킬 수 있습니

(119)

Semi-Lagrangian Advection

Pros: unconditionally stable

Large time step size

Cons: numerical dissipation

Smoothing effects while interpolation

(120)

Without Sub-Time Step

v v

dt × v

v

(121)

With Sub-Time Step v dt/3 × v v dt/3 × v v1 v dt/3 × v dt/3 × v1 v dt/3 × v dt/3 × v1 v2 v dt/3 × v dt/3 × v1 dt/3 × v2 v dt/3 × v dt/3 × v1 dt/3 × v2

(122)

Comparison v dt × v v dt/3 × v dt/3 × v1 dt/3 × v2

(123)

Time Step Size

△t ↓

Accuracy ↑, but Computations ↑

△t ↑

(124)

CFL Condition Number

Courant–Friedrichs–Lewy

CFL > 1: unphysical

But, acceptable in computer graphics

Δt < CFL⋅ Δx

u

(125)

Adaptive Time Step Process 0 frame 4 sub-steps 0000.tif 1 frame 3 sub-steps 0001.tif 2 frame 2 sub-steps 0002.tif 3 frame 2 sub-steps 0003.tif 4 frame 3 sub-steps 0004.tif 5 frame 0005.tif 0000.den 0001.den 0002.den 0003.den 0004.den 0005.den

Cache

(126)

BFECC

Back and Forth Error Compensation and Correction

ˆx n+1 = Advect(x n )

ˆx n = Advect −1( ˆx n+1 )

x n = 3x( n − ˆx n ) / 2

(127)
(128)

MacCormack

No third advection step in BFECC

(129)

Runge-Kutta

Semi-Lagrangian advection scheme

RK2: Runge-Kutta 2nd order advection scheme

ρ(p,t + Δt) = ρ (p − Δt ⋅ V(p,t),t )

ρ(p,t + Δt) = ρ

(

p − Δt ⋅ ˆV(p,t),t

)

= V(p − Δt

2 ⋅ V(p,t),t)

(130)

이제 남은 문제는 ...

(131)

Calculus

(132)

Three Operators for Fluid Simulation

Input Output Physical Meaning

Gradient

(구배, 勾配) (Signed Distance Field)Scalar Field

Vector Field
 (Normal Field) 해당 지점에서
 Scalar 물리량이 가장 빠르게 증가하는 방향 Divergence

(발산, 發散) Vector Field (Velocity Field)

Scalar Field


(Divergence Field)

해당 지점에서


나가고 들어오는 양

Curl

(회전, 回轉) Vector Field (Velocity Field)

Vector Field


(Curl Field)

해당 지점에서


(133)

Gradient (구배, 勾配) s(i, j) s(i +1, j) s(i −1, j) s(i, j +1) s(i, j −1) h h

∇s(i, j) = s(i +1, j) − s(i −1, j) 2h , s(i, j +1) − s(i, j −1) 2h ⎛ ⎝⎜ ⎞ ⎠⎟ ∂s ∂x ∂s ∂y : x축 방향 기울기 : y축 방향 기울기

(134)

Divergence (발산, 發散) v(i, j) v(i +1, j) v(i −1, j) v(i, j +1) v(i, j −1) h h

(135)

Divergence (발산, 發散) u(i + 1 2 , j) u(i − 1 2 , j) v(i, j + 1 2) v(i, j − 1 2) h h u(i + 1 2 , j) = u(i, j) + u(i +1, j) 2 u(i − 1 2 , j) = u(i, j) + u(i −1, j) 2 v(i, j + 1 2) = v(i, j) + v(i, j +1) 2 v(i, j − 1 2) = v(i, j) + v(i, j −1) 2

(136)

Divergence (발산, 發散) ∇ i v(i, j) = u(i + 1 2 , j)h − u(i − 1 2 , j)h h2 + v(i, j + 1 2)h − v(i, j − 1 2)h h2

v(i, j) = u(i, j), v(i, j)( )

∂u ∂x ∂v ∂y u(i + 1 2 , j) u(i − 1 2 , j) v(i, j + 1 2) v(i, j − 1 2) h h : x축으로 나가고 들어온 양 : y축으로 나가고 들어온 양 = u(i + 1 2 , j)u(i − 1 2 , j) h + v(i, j + 1 2) − v(i, j − 1 2) h

(137)

Curl (회전, 回轉)

v(i, j) = u(i, j), v(i, j)( )

v(i + 1 2 , j) v(i − 1 2 , j) u(i, j + 1 2) u(i, j − 1 2) h h v(i + 1 2 , j) = v(i, j) + v(i +1, j) 2 v(i − 1 2 , j) = v(i, j) + v(i −1, j) 2 u(i, j + 1 2) = u(i, j) + u(i, j +1) 2 u(i, j − 1 2) = u(i, j) + u(i, j −1) 2

(138)

Curl (회전, 回轉)

v(i, j) = u(i, j), v(i, j)( )

v(i + 1 2 , j) v(i − 1 2 , j) u(i, j + 1 2) u(i, j − 1 2) h h ∇ × v(i, j) = v(i + 1 2 , j) − v(i − 1 2 , j) h + u(i, j − 1 2) − u(i, j + 1 2) h ∂v ∂x ∂u ∂y : 시계방향으로 돌리려는 x축 성분 : 시계방향으로 돌리려는 y축 성분 ∵l = rθ ⇒ "l= r "θ ( )

(139)

Quiz

(140)

Quiz

(141)

Quiz

(142)

Fluid Dynamics

(143)

질량 보존의 법칙

mass flow in = mass flow out (if and only if no source or sink)

(144)

유체의 유동 (Fluid Flow)

Incompressibility (비압축성, 非壓縮性)

Conservation of mass (질량 보존의 법칙)

(145)

유체의 속도장 (Fluid Velocity Field)

유체의 유동(fluid flow)을 나타내는 속도장(velocity field)은

어떠한 형태로 영역(control volume)을 잡더라도 해당 표면(control surface)를 통해서

나가고(output) 들어오는(input) 양(flux)이 항상 같다.

만약 같지 않다면 해당 영역 안에는 source 또는 sink가 존재한다.

(146)
(147)

Helmholtz-Hodge Decomposition

임의의 부드러운 vector field는

모든 지점에서의 divergence=0인 vector field와

모든 지점에서의 curl=0인 vector field로 분리될 수 있다.

그리고 그 분해 결과는 한 가지 밖에 없다. (유일성)

divergence-free

(148)

다음과 같이 수학적으로 증명되어 있다. ∇ ⋅( pu) = ∂( pu) ∂x + ∂ ( pv) ∂y + ∂ ( pw) ∂z = p ∂u ∂x + u ∂ p ∂x ⎛ ⎝⎜ ⎞ ⎠⎟ + p ∂ v ∂y + v ∂ p ∂y ⎛ ⎝⎜ ⎞ ⎠⎟ + p ∂ w ∂z + w ∂ p ∂z ⎛ ⎝⎜ ⎞ ⎠⎟ = p ∂u ∂x + ∂ v ∂y + ∂ w ∂z ⎛ ⎝⎜ ⎞ ⎠⎟ + u ∂ p ∂x + v ∂ p ∂y + w ∂ p ∂z ⎛ ⎝⎜ ⎞ ⎠⎟ = p ∇ ⋅u( ) + u⋅ ∇p( ) = u⋅∇p ∵∇⋅u = 0( ) ∴ (u ⋅∇p)dV D ∫ = (∇ ⋅( pu))dV D ∫ = ( pu ⋅n)dA ∂ D ∫ (∵divergence theorem) = 0 ∵u⋅n = 0 on ∂D( ) orthogonality uniqueness ∇ ⋅ w = ∇ ⋅ u + ∇p( ) = ∇ ⋅u + ∇ ⋅∇p = ∇ ⋅∇p = ∇2 p ∴u ⊥ ∇p ∵ (u ⋅∇p)dV D ∫ = 0 ( ) ∴u1 − u2 = ∇p2 − ∇p1 = ∇ p( 2 − p1) u1 − u2 ( ) D ∫ 2dV = (u1 − u2 )∇ p( 2 − p1) DdV = 0 ∵ (u ⋅∇p)dV D ∫ = 0 ( ) ∴u1 = u2 existence Suppose w = u1 + ∇p1 = u2 + ∇p2. "∇2 p = ∇ ⋅ w in D, with ∂ p ∂n = w⋅n on ∂D"

is the well-known problem. [Neumann boundary problem] The solution to this problem exists and is unique.

∴ p1 = p2

(149)

Helmholtz-Hodge Decomposition irrotational part incompressible part global constant part

(150)

Fluid Flow를 얻는 방법 = + rotation part divergence-free velocity field divergence part curl-free velocity field a given velocity field

(원본)

모든 지점에서의 divergence=0이기 때문에 질량보존의 법칙이 성립하면서

(151)
(152)

Helmholtz-Hodge Decomposition messed-up velocity field divergence-free velocity field divergence-free velocity field messed-up velocity field curl-free velocity field curl-free velocity field

(153)

Per Frame Simulation Process

External Force Step (grid)

Pressure Projection Step (grid)

Advection Step (fields & particles)

(154)

Velocity Field가 엉망이 되는 이유

Velocity advection

(155)

Why “Pressure Projection”?

divergence-free field curl-free field

projection

(156)

One Simulation Step

messed-up velocity field

(157)

One Simulation Step pressure projection messed-up velocity field divergence-free velocity field

(158)

One Simulation Step pressure projection advection messed-up velocity field divergence-free velocity field

(159)

One Simulation Step pressure projection advection adding external forces messed-up velocity field divergence-free velocity field

(160)

One Simulation Step advection adding external forces pressure projection messed-up velocity field divergence-free velocity field

(161)

Two Main Parts

Pressure projection step

주어진 velocity field를 divergence-free하게 만드는 과정

계산량이 많다. 병렬화가 어렵다.

Advection step

주어진 velocity field를 따라 물리량을 흘려 보내는 과정

(162)

Pressure Projection Methods

Jacobi Iteration

Gauss-Seidel Iteration

Conjugate Gradient Method (CG)

Preconditioned Conjugate Gradient Method (PCG)

(163)

What makes visually plausible?

Conservation of mass (질량 보존의 법칙)

Convervation of momentum (운동량 보존의 법칙)

(164)

Navier-Stokes Equations

Mass conservation (continuity equation)

Momentum conservation (Euler equation) ∇ ⋅u = 0

∂u

∂t = − u⋅∇( ) u +∇ ⋅ (ν∇u) −

1

ρ ∇p + f

advection diffusion external

force pressure

(165)

Derivation #1 ρudydz ρu + ∂( )ρu ∂x dx ⎡ ⎣ ⎢ ⎢ ⎤ ⎦ ⎥ ⎥ dydz a fluid parcel ∂( )ρu ∂x dxdydz + ∂( )ρv ∂y dxdydz + ∂( )ρ w ∂z dxdydz = 0 ∂u ∂x + ∂ v ∂y + ∂ w ∂z = 0 ∴∇ ⋅u = 0 Just trust.

(166)

Derivation #2 F = ma ρa = Fi i=1 N= fbody + fsurface = fnormal + ftangential = fpressure + fviscosity ρ Du Dt = fbody − ∇p + ∇ ⋅ ( )µ∇u ∴ ∂u ∂t = − u⋅∇( ) u + ∇ ⋅ ( )υ∇u − 1 ρ ∇p + fbodyDu Dt = ∂ u ∂t + u⋅∇( ) u ⎛ ⎝⎜ ⎞ ⎠⎟ Just trust.

(167)

Navier-Stokes Equations

Mass conservation (continuity equation)

Momentum conservation (Euler equation)

∇ ⋅u = 0

∂u

∂t = − u⋅∇( ) u +∇ ⋅ (ν∇u) −

1

ρ ∇p + f

advection diffusion external

force pressure 다음 프레임(time=t+𝚫t)에서의 물리량은 현재 프레임(time=t)에서 주변 물리량들의 변화량들로 구성된 적절한 관계식에 의해 업데이트 된다.

(168)

Operation Splitting

External force

Pressure force

Diffusion (=blur)

Divergence-free constraint

Advection ∂u ∂t = − u⋅∇( ) u + ∇ ⋅( )ν∇u − 1 ρ ∇p + f ∇ ⋅u = 0 ρ ∂u ∂t = −∇p ρ ∂u ∂t = ∇ ⋅( )µ∇u ∇ ⋅u = 0 ∂u ∂t = − u⋅∇( ) u ρ ∂u ∂t = f

(169)

The Meaning of Each Term

External force

Pressure force

Diffusion (=blur)

Divergence-free constraint

Advection ∂u ∂t = − u⋅∇( ) u + ∇ ⋅( )ν∇u − 1 ρ ∇p + f ∇ ⋅u = 0 ρ ∂u ∂t = −∇p ρ ∂u ∂t = ∇ ⋅( )µ∇u ∇ ⋅u = 0 ∂u ∂t = − u⋅∇( ) u ρ ∂u ∂t = f

(170)

중력(gravity), 부력(buoyancy) 등의 외력에 의해 가속도가 변한다.

External force

Pressure force

Diffusion (=blur)

Divergence-free constraint

Advection ∂u ∂t = − u⋅∇( ) u + ∇ ⋅( )ν∇u − 1 ρ ∇p + f ∇ ⋅u = 0 ρ ∂u ∂t = −∇p ρ ∂u ∂t = ∇ ⋅( )µ∇u ∇ ⋅u = 0 ∂u ∂t = − u⋅∇( ) u ρ ∂u ∂t = f

(171)

압력(pressure)이 높은 곳에 낮은 곳으로 가속력이 발생한다.

External force

Pressure force

Diffusion (=blur)

Divergence-free constraint

Advection ∂u ∂t = − u⋅∇( ) u + ∇ ⋅( )ν∇u − 1 ρ ∇p + f ∇ ⋅u = 0 ρ ∂u ∂t = −∇p ρ ∂u ∂t = ∇ ⋅( )µ∇u ∇ ⋅u = 0 ∂u ∂t = − u⋅∇( ) u ρ ∂u ∂t = f

(172)

주변으로 퍼지면서 확산된다.

External force

Pressure force

Diffusion (=blur)

Divergence-free constraint

Advection ∂u ∂t = − u⋅∇( ) u + ∇ ⋅( )ν∇u − 1 ρ ∇p + f ∇ ⋅u = 0 ρ ∂u ∂t = −∇p ρ ∂u ∂t = ∇ ⋅( )µ∇u ∇ ⋅u = 0 ∂u ∂t = − u⋅∇( ) u ρ ∂u ∂t = f

(173)

속도장은 어느 곳에서나 divergence=0이 되어야 한다.

External force

Pressure force

Diffusion (=blur)

Divergence-free constraint

Advection ∂u ∂t = − u⋅∇( ) u + ∇ ⋅( )ν∇u − 1 ρ ∇p + f ∇ ⋅u = 0 ρ ∂u ∂t = −∇p ρ ∂u ∂t = ∇ ⋅( )µ∇u ∇ ⋅u = 0 ∂u ∂t = − u⋅∇( ) u ρ ∂u ∂t = f

(174)

이러한 영향력들이 모두 반영된 속도장을 따라 물리량이 흘러간다.

External force

Pressure force

Diffusion (=blur)

Divergence-free constraint

Advection ∂u ∂t = − u⋅∇( ) u + ∇ ⋅( )ν∇u − 1 ρ ∇p + f ∇ ⋅u = 0 ρ ∂u ∂t = −∇p ρ ∂u ∂t = ∇ ⋅( )µ∇u ∇ ⋅u = 0 ∂u ∂t = − u⋅∇( ) u ρ ∂u ∂t = f

(175)

The Meaning of Each Term

External force

Pressure force

Diffusion (=blur)

Divergence-free constraint

Advection ∂u ∂t = − u⋅∇( ) u + ∇ ⋅( )ν∇u − 1 ρ ∇p + f ∇ ⋅u = 0 ρ ∂u ∂t = −∇p ρ ∂u ∂t = ∇ ⋅( )µ∇u ∇ ⋅u = 0 ∂u ∂t = − u⋅∇( ) u ρ ∂u ∂t = f 이렇게 움직이면 유체의 유동처럼 보인다.

(176)

Fluid Simulator Forces Black Box Emitters Colliders Div.-free Velocity Field

Fluid Simulator Incompressible

(177)

Curl Noise v(x, y, z) = ∂ψ 3 ∂y − ∂ψ 2 ∂z , ∂ψ 1 ∂z − ∂ψ 3 ∂x , ∂ψ 2 ∂x − ∂ψ 1 ∂y ⎛ ⎝⎜ ⎞ ⎠⎟ ψ 1 ψ 2 ψ 3

(178)
(179)
(180)

Vorticity Confinement

It adds paddle wheels effects back.

ω = ∇ × u η = ∇ ω N = η η fconfinment = ε h(N × ω ) N ω fconfinment ω

(181)

Houdini

(182)
(183)
(184)
(185)
(186)
(187)
(188)
(189)
(190)
(191)
(192)
(193)
(194)
(195)

Grid Index ⇆ Position

Resolution (N)

Dimension (L)

Cell Size (D)

Cell Index ! ! ! ! ! ! ! ! ! Lx Ly Dx Dy Lx = Nx × Dx Ly = Ny × Dy Dx = Lx ÷ Nx Dy = Ly ÷ Ny (Px, Py) i = (int)( Px / Dx ) j = (int)( Py / Dy )

(196)

Level Set Method

(197)

Level Set

(198)
(199)
(200)

THANKS!

참조

관련 문서

Field : Spatial distribution of scalar and vector quantity Electric field and magnetic field.. 3-1

 The curl of the velocity field of a rotating rigid body has the direction of the axis of the rotation,.  and its magnitude equals twice the angular speed

Hyung-Cheul Shin, hcshin@hallym.ac.kr, 011-9791-1645, Hallym University Duke University Medical?. Center neurobiologist Miguel Nicolelis with an owl monkey and a robot

• Resultant pressure forces on curved surfaces are more difficult to deal with because the incremental pressure forces vary continually in direction.. [Sol] Consider a free

For irrotational flow of ideal incompressible fluid, the Bernoulli’s equation applies over the whole flow field with a single energy line. Exact velocity field

• Elastic body in equilibrium under the applied body forces and surface tractions undergoing compatible strain s whose displacement field is kinematically admissible, and for

The g pressure correction so obtained is used only to correct the velocity field so that it satisfies continuity, i.e., to obtain. The new pressure field is calculated

- Prove or give a counter-example of the following statement: In three space dimensions and time, given an initial velocity field, there exists a vector velocity and