05-Computational Grid and Time Step
05-Computational Grid and Time Step
• Modeling error
– Error in the differential equation
4 deat
– ex) = , constant density for aero-acoustics, etc. gas Frealgas
– Can be human error
– Solution : 공부 & 확인
• Round-off error
– Machine epsilon : The smallest real number represented by computer
– Below this, the numeric information is lost
– Related to computer memory architecture
• The smallest number expressed by 4-byte real number : 10~
– Solution : Use 8-byte real number (long float in C, r8 in Star-CCM+)
Sources of error in CFD
• Convergence error
– Error in the numerical solution
– Only for an iterative method for solving matrix
• Simulation은 기본적으로 연립 방정식을 푸는 것
– 연립 방정식은 기본적으로 matrix식 Ax=b로 표현 가능
• Direct method * 5M .
Unknown
F
.
– Solution : Convergence
…
(residual) criterion (수렴 조건)을 낮춤
x Time 가
Why computational grid is necessary
• Governing equation for heat conduction
∇ =
– Poisson equation
– Categorized as an elliptic PDE
– q is the heat source/sink
• In 1-D
In Math class = () = + +
2
In CFD class ℎ ℎ ℎ ℎ
T i−2 T i −1 Ti T i +1 T i+2
• In 3-D
Computational grid (mesh) in 2-D or 3-D
• Terminology for computational grid
small C
O
V
node
.
y
/
ㅇ
Node = grid point.
cell
O
Edge = boundary of a face.
ㅇ
Face = boundary of a cell.
ㅇ node
O ㅇ
edge
"
face cell
3D computational grid
Computational grid in 2-D or 3-D
• Topology for computational mesh
hexahedron
… prism or wedge
~
6 5
polyhedron
ㅡ
(arbitrary)
tetrahedron
pyramid 다면체
F 5
Computational grid in 2-D or 3-D
• Examples : hexahedral mesh, trimmerftrimmed
d
Otfine
ㅇ ㅇ
ㅇ
Computational grid in 2-D or 3-D
• Examples : tetrahedral mesh
Computational grid in 2-D or 3-D
• Examples : polyhedral mesh
O
fine L
Computational grid in 2-D or 3-D
• Examples of mesh
– Tri/Tetrahedral mesh vs. Quad/Hexahedral mesh
[ *
• Tri/Tetrahedral mesh : Easier (faster) generation
• Quad/Hexahedral mesh : More accurate solution
.
다뀔 .. .
Computational grid in 2-D or 3-D
• Examples : Hybrid mesh
– Types by region
tet mesh
Specific regions can be meshed with
different cell types.
hex mesh
wedge mesh
Tvhexahedral
polyhedral >
Computational grid in 2-D or 3-D
• Structured/Unstructured mesh
Single-Block Structured Mesh
- i,j,k indexing to locate neighboring cells + +
- Grid lines must pass all through domain & + +
여
→ Obviously can’t be used for very complicated geometries 딸
Unstructured Mesh
- The cells are arranged in an arbitrary fashion
- No i,j,k grid index, no constraints on cell layout (usually 1-D index)
→ There is some memory and CPU overhead for unstructured referencing 체 N ~
Topics on computational grid
• How to make a computational grid and what is a good
grid?
텍
• How to convert a governing equation to a series of
algebraic equations?
– Discretization in space
– Finite difference method
1 –
–
Finite volume method
Finite element method
( divergenceblow )
up
-
Taylor series expansion
orlation
polynomial built using a passing point and derivative information
interl
)
at the point x
[ 보간)
present tirate
– Various forms
%
• Based on a linear polynomial (2 terms)
ㅡ
%
% ℎ = %(0) + ℎ + Ο ℎ
resent' slopetime
future
'
쁘
|
% ℎ = %(0) + ℎ +
+ Ο ℎ'
2
• Based on a cubic polynomial (4 terms) iaterporlation
ㄱ
ㅡ
% ℎ % ℎ' ' % 요
% ℎ = %(0) + ℎ +
+ '
+ Ο ℎ) X extraporlation
2 6 고
O
difficult
• In most general form, (가장 일반적인 형태로) X
. + +
ℎ %
% ℎ = %(0) + * +
+ Ο ℎ.
,!
product
+/
Error of Taylor series expansion
• From the general form of extrapolation
– Note that all derivatives are defined at x=0 ( Passing point)
.
ℎ+ + %
% ℎ = %(0) + * + 0
,! +
+/
– Error dependency on $
becomes dominan가
% ℎ % ℎ' ' % ℎ) ) %
%12345 ℎ = %(0) + ℎ + + + +⋯
2 6 ' 24 )
Extrapolation Error term exact guess
째
= -
기
– For Taylor series with 3 terms
%12345 ℎ = %(0) + ℎ
+
2
+O
% ℎ % ℎ' ' % ℎ) ) %
+
6 ' 24 )
+⋯
+/ +/.
% ℎ = %(0) + *
ℎ+ + %
,!
+/
+ + Ο ℎ. O
Extrapolation Error term
Numerical differentiation using Taylor series expansion
• Accuracy analysis of numerical derivatives 00
%(0) %(ℎ) − %(−ℎ) 뉴
=
2ℎ %(−2ℎ) %(−ℎ) %(0) %(ℎ) %(2ℎ)
% ℎ = %(0) + ℎ + + + Ο ℎ) (f 6
표
= )
2 6 '
% ℎ % ℎ' ' %
% −ℎ = %(0) ㅇ
−ℎ + − ' + Ο ℎ)
2 6
.
%(ℎ) − %(−ℎ)
=
1
%(0) + ℎ
%
+
ℎ %
2
+
ℎ' ' %
6
% ℎ % ℎ' ' %
'
+ Ο ℎ) 따빠
E"
5
2ℎ 2ℎ )
없"
"
x
− %(0) − ℎ + − + Ο ℎ
2 6 '
num ,
1 % ℎ' ' % )
% ℎ ' % '
derivative = 2ℎ + + Ο ℎ = + + Ο ℎ
2ℎ 3 ' 6 '
.
guess (exact) Derivative Second-order error term
ㅡ
Error estimation using Taylor series expansion
• Accuracy analysis of numerical derivatives
– Using Taylor series expansion
φ i −2 φ i −1 φi φ i +1 φ i+2
% % − %
= + Ο ℎ : second-order central difference
2ℎ
% % − %
= +Ο ℎ : first-order forward difference
ℎ
% % − %
= +Ο ℎ : first-order backward difference
ℎ
σC ;
>
+
;
=0 ⇒
;
>
+
; − ;
2ℎ
음.
; − ;
2ℎ
udexofgrid
=0
n. indexof fimestep
• The size of error is affected by 3 factors
; − ; ; ℎ ' ;
= + '
+ Ο ℎ'
2ℎ 6
– Accuracy ~
Second-order error term
Hofterms
– ℎ : grid spacing
– Size of derivatives
~
Conditions for a good grid in 1-D
• Good grid is one that minimizes the error
; − ; ; ℎ ' ; '
= + + Ο ℎ
2ℎ 6 '
Error term
– Smaller ℎ => error term decreases
– Smaller size of derivatives => error term decreases D
• In order to reduce the error, small ℎ is necessary in the region where
the size of derivatives is large
• So, non-uniform ℎ may be desirable
'
T i−2 T i −1 Ti T i +1 T i+2 ℎ ℎ '
= − ℎ + − + Ο ℎ)
2 6 '
'
− ℎ − ℎ 1 ℎ + ℎ' '
= + + ' + Ο ℎ'
ℎ + ℎ 2 6 ℎ + ℎ
derivative
.
II
flarge
cerivative
Conditions for a good grid in 2-D or 3-D
– Case #2 : 프로펠러 날개 끝 쪽의 속도 contours
circumcircle
actual cell
1 i 2 1 i 2
3 3
∂φi φ2 − φ1 ∂φi φ2 − φ1
∂x
=
h
+ Ο h1 ( ) = + Ο h0 ( )
∂x h
∂φi φ1 + φ2 − 2φ3 ∂φi φ1 + φ2 − 2φ3
= + Ο(h1 ) = + Ο h0 ( )
∂y 3h ∂y 3h
– For case with zero skewness, 1st order accuracy but 0th order
accuracy for skewed grid
Conditions for a good grid in 2-D or 3-D
• Good grid is one that minimizes the error
– Aspect ratio (종횡비)
• Aspect ratio is the ratio of longest edge length to shortest edge
length
• Equal to 1 (ideal) for a regular polygon (정각형)
∂ 2T ∂ 2T i − 1, j i, j i + 1, j
∇ 2T = q 2
+ 2 =q
∂x ∂y
i, j − 1
– If hx = 100hy
Ti −1, j − 2Ti , j + Ti +1, j + 10000Ti , j −1 − 20000Ti , j + 10000Ti , j +1
h2x
( ) ( )
+ Ο 10000 h 2y + Ο h 2y = qi , j
• + ??
Basics to select time step size &
grid spacing
f (t )
t
small ∆t is desirable large ∆t is fine
1
'
forsmaller error
forefficienct
General rules for computational time step
• One question: How to choose Δ>?
• Rule #3 Based on the time scale
– See the “time scale” of flow variables…
• For accuracy
– Rule #1. The smaller, the better
– Rule #2. Based on the size of time derivative
• Similar to discretization in space, we need small Δt only in the
regions where the derivative (in time) is large
– Rule #3 Based on the time scale
• Use several Δ> spacings (>=8) per an important time scale
– Rule #4 Based on CFL number
• CFL=0.1~5
Summary: Basics rules on grid for accuracy
• Rule #1. The smaller, the more accurate
• Rule #2. Based on the size of spatial derivative
• Rule #3. Based on the scale in space
– Example: A flow around a circular cylinder
• Contours of the x-velocity
m 2 ogridy
55
7
d
*
x
사례 : 벽면 격자를 위한 prism layer
• Modes of prism layer (Star-CCM+)
– Stretch factor
– Wall thickness
– Thickness ratio
Stretch factor
• Parameters
– Number of Prism Layers
– Prism Layer Stretching
– Prism Layer Total Thickness
smallest '
Wall thickness
• Surface의 첫번째 layer thickness를 우선 지정
– Properties 기반 나머지 layer들의 thickness를 자동 조정
• Parameters
– Number of Prism Layers
– Prism Layer Near Wall Thickness
– Prism Layer Total Thickness
Thickness ratio
• Parameters
– Number of Prism Layers
– Prism Layer Total Thickness
– Prism Layer Thickness Ratio
• 첫번째와 마지막 layer thickness의 비율
• 중간 layer들의 thickness는 자동의 계산
surface
(
사례 : Volumetric control of grid spacing
• 특정 영역(refinement zone)에서 격자 조밀도 변화
원래 격자
중요한
유동 특성이
나타나는 곳
Volume
설정
부분적으로 격자를
조밀하게 변화