You are on page 1of 100

Grid Generation Schemes

Outline

• Significance of grid generation


• Grid generation models
• Structured grid generation
– Algebraic grid generation
– Conformal mapping
– Differential equation based schemes
• Unstructured grid generation
– Delaunay Triangulation
Modelling Steps

• Pre-processing
– Geometry modelling
– Grid generation
– Boundary conditions
• Solution
– Solution of the governing equations
• Post-processing
– Presenting the results
– Computations of desired quantities
Grid Generation

• Also called the Discretization of the domain

OR

Identifying some points in the domain at which the


solution of the physical problem has to be computed
Some Comments

• A well constructed grid greatly improves the


quality of the solution

• A poorly constructed grid a major contributor to a


poor result
Choice of the Points

• Can we select the points randomly?

No!

It depends on the numerical method we are going to


use to discretize the governing equations
Simple Examples

• One Dimensional Interval

• Two Dimensional Square (Rectangle)


Cylindrical Annulus
Not So Easy Examples
Choices

Body Fitting Superimposing a Rectangular grid

Good Not so Good


Classification

• Structured grids
• The grid points follow certain pattern and hence is
possible to use some simple notation to represent the
grid points.

• Unstructured grids
• No pattern is followed by the grid points and its
neighbors hence the nodal points have to be counted
serially.
Structured Grids

In structured grid generation, the complex


geometries (physical domain) is
transformed into a simple shaped ( usually
rectangular) computational domain and
the computations are carried out in the
computational domain.

Needed to transform the governing equations into new


coordinates.
Categories

• Algebraic methods

• Conformal mapping methods

• Differential equations based methods


Algebraic Methods Example 1
y = x2 Transformation

1≤ ξ ≤ 2
0 ≤η ≤1

Physical Plane

Computational Plane
Algebraic Methods Example 2
Transformation

ξ= +x 0.5 0 ≤ ξ ≤1
η=
y 0 ≤η ≤1
1 − x2

Physical
Plane

Computational Plane
Grid Clustering

ξ= +x 0.5
y2
η=
1 − x2

For a constant step length in η direction, the grid


lines will be clustered more towards the arc region.
Algebraic Mapping

η=1 D η=1 C
D C

ξ=0 ξ=1
ξ=1
ξ=0

η=0
B
A A η=0 B

(x,y) (ξ,η)
Algebraic Mapping
Consider the simply connected domain with sides AB, BC,
CD and DA are given by the equations f1 (x, y) = 0, f2(x, y) = 0,
f3(x, y) = 0 and f4(x, y) = 0 respectively.

Without loss of generality; one can map the curves AB and


CD onto the lines η = 0 and η= 1.0, using a transformation of the
form
η = f 1 ( x , y ) / { f 1 ( x , y ) − f 3 ( x , y )}

Similarly, it can be assumed that

ξ −f 4 ( x, y ) /{ f 4 ( x, y ) f 2 ( x, y )}
Transfinite Interpolation

• Apply unidirectional interpolation in ξ-direction (or η-


direction) between the boundary grid data given on the curves ξ = 0
and ξ = 1 (or η = 0 and η = 1) and obtain the coordinates x'p yp' for
every interior and boundary point.

• Calculate the mismatch between the interpolated and the actual


coordinates on the η= 0 and η= I (or ξ = 0 and ξ= 1) boundaries.

• Linearly interpolate the difference in the boundary point


coordinates in η (or ξ) direction and find the correction to be applied
to the coordinates of every interior point.
Transfinite Interpolation
Computation of the Metrics

1≤ ξ ≤ 2
0 ≤η ≤1

1 1
=
=ξ x 1, ξy 0, η=
= and
y
ymax ξ 2

d ( ymax )
  −
d 1 dx 2 xy 2η
ηx =
y  =y = −2 =
dx  ymax  ( ymax ) 2
( ymax ) ξ
Transformation Relation
Coordinate transformation implies

ξ=ξ(x, y) and η= η(x, y)

Or

x =x(ξ, η) and y = y(ξ, η)

(x,y) physical coordinates


(ξ,η) body-fitting coordinates
Metric Derivatives

dξ  ξx dx + ξ y dy  ξx ξ y  dx 


 =  = η
η
   x
d η dx + η x dy   x η y  dy 

dx   xξ xη   dξ 
 = y  
dy   ξ yη  dη 

−1
ξ x ξ y   xξ xη  1  yη − xη 
η = =
 x η y   yξ yη  
| J | − yξ xξ 

−1
ξ x ξy ξ z   xξ xη xζ 
   
η x ηy η z  =  yξ yη yζ 
ζ
 x ζy ζ z   zξ zη zζ 
Lengths, Areas and Volumes

 = e dl × e dl
kdA ξ ξ η η

    
eξ dlξ = i dx + jdy = i xξ dξ + jyξ dξ

    
eη dlη = i dx + jdy = i xη dη + jyη dη

( )
  
kdA = eξ dlξ × eη dlη = k xξ yη − yξ xη dξdη = k | J | dξdη
 


( )(
 
)
dv = eζ dlζ . eξ dlξ × eη dlη =| J | dξdηdζ
Transformation of Derivatives

∂ ∂ ∂ ∂ ∂ ∂
= +ξ x ηx = +ξ y ηy
∂x ∂ξ ∂η ∂y ∂ξ ∂η
∂2 ∂  ∂ ∂  ∂  ∂ ∂  ∂  ∂ ∂ 
=  ξx + ηx =  ξx ξx +ηx  +ηx ξx +ηx
∂x 2
∂x  ∂ξ ∂η  ∂ξ  ∂ξ ∂η  ∂η  ∂ξ ∂η 

∂2 ∂  ∂ ∂  ∂  ∂ ∂  ∂  ∂ ∂ 
= ξy + ηy =  ξy ξ y +η y  +η y ξ y +η y
∂y 2
∂y  ∂ξ ∂η  ∂ξ  ∂ξ ∂η  ∂η  ∂ξ ∂η 

∂ ∂
∇ 2 = (∇ 2ξ ) + ( ∇ 2η ) +
∂ξ ∂η
∂ 2
∂ 2
∂ 2

(ξ x2 + ξ y2 ) ∂ξ 2 + (η x2 + η y2 ) ∂η 2 + 2 (ξ xη x + ξ yη y ) ∂ξ∂η
Drawback of the Algebraic grids

• The generated grids need not be smooth


Conformal Mapping
• Uses mapping transformation of the form

W = F(Z) or Z = G(W)
where Z = X+iY and W = U+iV

• Depending on the transformation function used the complex


geometry in (X,Y) domain can be mapped into a simpler shape
in (U,V) domian

• Mapping is conformal except at a few singular points

• Can be used for 2_D domains


Conformal Mapping
w = u + iv = f (z)

w = u+ iv = z2 = (x2 - y2) + 2ixy


Conformal Mapping
Consider z = (w + 1 / w) / 2

z = x + iy = ½ (ρεiφ + ε-iφ / ρ)
x = ½ (ρ + 1 / ρ) cos φ; y = ½ (ρ − 1 / ρ) sin φ
Schwartz Christoffel Transformation

z = C ∫ ( w − u1 ) k1 ( w − u2 ) k2 ...( w − un ) kn dw + K

Where ki = αι / π −1


n
It is easy to show that , i =1
ki = − 2
Schwartz Christoffel Transformation
Differential Equation Based Schemes

•Elliptic PDE based schemes


•Hyperbolic PDE based schemes
•Parabolic PDE based schemes
Transformation Function
ξ  ξ ( x, y )  d ξ  ξ x dx + ξ y dy  ξ x ξ y   dx 
η= η ( x, y )  ⇒ dη=
 
η + η
= η η  dy 
       x dx x dy   x y 

 x   x(ξ ,η )   dx   xξ xη  d ξ  ∂( f , y)
 y=  y (ξ ,η )  ⇒ dy=
   
yη  dη  ∂ (ξ ,η ) ( yη fξ − yξ fη )
       yξ =fx =
∂ ( x, y ) J
ξ x ξ y   xξ xη 
−1
1  yη − xη  ∂ (ξ ,η )
η = =
 x η y   yξ yη  
| J | − yξ xξ  ∂ ( x, f )
∂ (ξ ,η ) (− xη fξ + xξ fη )
=fy =
ξ x ξy ξ z   xξ xη xζ 
−1
∂ ( x, y ) J
   
η x ηy η z  =  yξ yη yζ  ∂ (ξ ,η )
ζ
 x ζy ζ z   zξ zη zζ 
Inverse Mapping Theorem
ξ  ξ ( x, y ) 
If the component functions of η  = η ( x, y )  are continuously
   

 xξ xη 
differentiable at a point, say, (x0, y0), and the Jacobi matrix y yη 
is
 ξ

non singular at (x0, y0) then there exists a disk N0 about (x0, y0) such
 x   x(ξ ,η )  ξ x ξ y   xξ xη 
−1
that the inverse function  y  =  y (ξ ,η )  holds good and η η  =  y
holds
     x y  ξ yη 

for all [x,y] in N0.

It is apparent that the IMT guarantees the existence only in a local fashion.
Elliptic Solvers

• If the component functions are solutions of


an elliptic Dirichlet boundary value
problem then
– they are either harmonic, sub-harmonic or
super-harmonic
– they have continuous derivatives of all orders
– they obey maximum principle
Elliptic PDE Based Schemes

ξXX + ξYY + ξZZ = P (ξ, η, ζ)


ηXX + ηYY + ηZZ = Q(ξ,η,ζ)
ζXX + ζYY + ζZZ = R (ξ, η, ζ)

Where P, Q, R are control functions


Elliptic Solvers in 2D

March 25, 2011


Demonstration
Physical and Computational Planes
Unstructured Mesh Generation

Two dominant methods of unstructured mesh


generation
• Advancing-front method
The method of generating triangles sequentially from
an ever shrinking set of dynamic curves that start at
the boundaries and advance into its interior.

• Delaunay triangulation
What is Delaunay Triangulation?

A triangulation of the given domain with the


property that

“no node of the given domain falls in the interior of the


circumcircle (circle that passes through all three vertices) of any
triangle in the triangulation”
DELAUNAY TRIANGULATION

Delaunay triangulation consists of four main steps


1. Boundary Triangulation
2. Circum-circle test
3. Mesh refinement
4. Mesh relaxation and mesh smoothing
DELAUNAY TRIANGULATION

Step 1 : Boundary Triangulation

To discretize the given domain with Delaunay triangles,


first for the given nodes and edges, boundary
triangulation is done.
Results in Boundary Triangulation

Triangulation of
• an n-sided polygon contains n-2 triangles

• a multiply connected domain by ‘m’ closed polygons and


n edges on all its boundaries contains n+2(m-2) triangles

• m boundaries with nb nodes on the boundary and ni nodes in


its interior contains nb+2(m-2) + 2ni triangles
Boundary triangulation

3 2 3 2

T2

4 1 4 T3 T1 1

T4

5 6 5 6
Number of Nodes : 6
Number of Triangles : 4
Result

Boundary triangulation
- need not be geometrically the best
- skewed triangles lead to bad approximation
DELAUNAY TRIANGULATION

Step 2 : Circum - circle test


Circum - circle condition : The interior of the circum-circle of any
triangle in the triangulation should not contain the vertex of any
other triangle.

Objective : The triangles not satisfying the circum - circle condition


have to be modified inorder to achieve the boundary Delaunay
triangulation.
Delaunay triangulation

Max - min triangulation


One of the ways to achieve the Delaunay triangulation is to
maximize the minimum angle for all triangular elements

Such triangulations are locally equiangular.

Procedure : The common edge of two triangles is swapped if it


results in an increment of the minimum angle or a decrease in the
maximum angle of the existing two triangles.
Max - min triangulation

α β2
2
α
β1
6
α
1
e β4 e'
α β3
5 Edge - flip
α β5
3 α
β6
4

An increment in the minimum angle


and a decrease in the maximum angle
MIN - MAXIMIZATION
ALGORITHM

Basic Idea : To identify all triangles opposite to i and swap


edges opposite to i until none of them needs swapping. It is
repeated for all nodes

Stopping criterion : Process continues iteratively till no


edge is swapped in an iteration.
Data Structure

nn : Number of nodes
nt : Number of triangles

• Coordinate arrays x[nn] and y[nn]

• Nodal Connectivity NC[nt][3]


(3 vertices of a triangle)

• Adjacency List AL[nt][3]


(3 neighbours of a triangle)

• Type of a node type[nn]


(0 for boundary node and 1 for internal node)

• A Triangle Connected to a Node TCN[nn]


Min-maximization Algorithm

Step 1 3 2

Perform boundary T2

triangulation of the
4
T3 T1 1
given domain and obtain the
lists NC,AL,TCN
T4

5 6
Min-maximization Algorithm

Step 2
Initialise flag = no;

Where
flag = yes if an edge swapping occurs in that iteration
no otherwise
Min-maximization Algorithm…(contd)

Step 3 3 2
for i = 1 to nn
T2
get a triangle T that has vertex i;
Ts := T; T3
4 T1 1

T4
Note : T is obtained from TCN[nn]
Ts : Triangle from which traversal 5 6
starts
Min-maximization Algorithm…(contd)

• Taking triangle T as
reference, left, right and
opposite neighbours of T Tl
with respect to node i are
denoted by Tl ,Tr,To T
i To
respectively.

Note : These are obtained Tr


immediately from
adjacency List AL
Min-maximization Algorithm………(contd)

Step 4
if(type[i]=0)
while(Tr != Null) T : = Tr
Ts = Null
To T 1
endif

Note: If i is a boundary vertex,


the triangles are traversed till we
reach a boundary edge with
endnode i
Min-maximization Algorithm…(contd)

Step 5
do
if (circumcircle_test ( T,To ) = YES)
flag = YES;
swap eo; To T 1
if (type[i] = 0)
while(Tr != Null) T : = Tr;
else Ts := T;
continue;
else T := Tl ;
while(T != Ts); No swapping is done
Min-maximization Algorithm………(contd)

Step 4
if (circumcircle_test (T,To) = YES)
flag = YES;
swap eo;
if (type[i] = 0)
T 1
while(Tr != Null) T : = Tr;
else Ts := T;
continue;

else T := Tl ;
while(T != Ts); No triangle to the left. Moving to node 2
Min-maximization Algorithm………(contd)

Step 3
for i = 1 to nn 2

get a triangle T that has vertex i; T


Ts := T;
T T
if (type[i] = 0)
while(Tr != Null) T : = Tr;
else Ts := T;
continue;
No opposite triangle. So move left
Min-maximization Algorithm………(contd)

Step 4
2
if (circumcircle_test (T,To) = YES)
flag = YES;
swap eo;
T
if (type[i] = 0)
eo
while(Tr != Null) T : = Tr;
To
else Ts := T;
continue;
else T := Tl;
while(T != Ts);
Min-maximization Algorithm………(contd)

Step 4
2
if (circumcircle_test (T,To) = YES)
flag = YES;
swap eo; T
if (type[i] = 0)
while(Tr != Null) T : = Tr;
else Ts := T;
continue;
else T := Tl;
while(T != Ts);
Min-maximization Algorithm………(contd)

Step 4
2
if (circumcircle_test (T,To) = YES)
flag = YES; T
swap eo;
if (type[i] = 0)
while(Tr != Null) T : = Tr;
else Ts := T;
continue;
else T := Tl;
while(T != Ts);
After Min-maximization………………

3 2

T2

4 T4 T1 1

T3

5 6

Boundary Delaunay triangulation


Step 3: Mesh refinement

The mesh has to be refined by placing internal nodes at the


appropriate points.
Selective refinement :
1. Insertion of node at the circumcentre of a triangle.
Disadvantage :The triangle may not contain the circum centre
2. Insertion of node at the centroid of a triangle.
Advantage : The centroid of a triangle is always within the
triangle.
Mesh refinement….(contd.)

A triangle is selected for refinement based on


Node spacing function (nsf)
parameter alpha

Value of the nsf at the centroid of a triangle


- average of the point distributions of the three
vertices of the triangle.
Refinement Algorithm
nt : Number of triangles
f : Value of the node spacing function at the centroid of a
triangle
alpha : parameter to control the number of nodes inserted.
r[nt] : List indicating if a triangle needs refinement
r[t] = 0 triangle t is not yet tested for refinement
= 1 triangle t can be refined
= 2 triangle t is tested already and needs no
refinement
Refinement Algorithm

Step 1
Initialise the list r[t]=0 for all triangles t
Set flag = 0

Note : Initially no triangle has been tested for refinement.


flag = 0 indicates that none of the existing triangles
needs refinement
flag = 1 indicates there is atleast one triangle that needs
refinement
Refinement Algorithm..(contd.)

Step 2 3 2

for i= 1 to nt
if (r[t] = 2) continue
4 1
find the coordinates of centroid
calculate dmin
if(dmin>alpha * f) calculate amin
5 6
Refinement Algorithm..(contd.)
Note :
dmin = min {d1,d2,d3} amin = min {a1,a2,a3}
where di = distance of vertex i of the triangle from
its centroid
ai = distance of the centroid of the triangle
from the centroids of its neighbors if they are noted
already for refinement
Refinement Algorithm..(contd.)

Step 3 3 2
if (dmin > f)
if(amin > f) 7
include the centroid as the new node
4 1
set r[t]=1, flag =1
else r[t]=2
else r[t]=2
endfor 5 6
Refinement Algorithm..(contd.)

Step 4 3 2
if (flag = 0) break;
set p = nt 7
for i = 1 to nt 4 1
if(r[t]=1)
replace triangle t by 3 triangles
set r[t]=r[p+1]=r[p+2]=0
p=p+2 5 6
endif
endfor
Refinement Algorithm..(contd.)

Step 5 3 2
set nt = p
7
min-maximize the triangles connected
to the new nodes alone* 1
4
while (flag =1) repeat steps 2 to 5

5 6
* Whenever the common edge of two triangles is swapped, set r[ ]=0
for those two triangles as they have to be tested for refinement
Refinement Algorithm..(contd.)

3 2 3 2

7 7
8 8
4 1 4 1
9 9

5 6 5 6

Insertion of nodes 8,9 After min-maximization


Refinement Algorithm..(contd.)

3 2 3 2
3
7 7
8
8
10 1 10 1
4 4
9 9

5 6 5 6

Insertion of node 10 After min-maximization


Refinement Algorithm..(contd.)

3 2

7
8

10 1
4
9

5 6
Refined mesh
Mesh Relaxation

An iterative procedure to make the mesh regular

Aim : To make the triangles close to equilateral triangles


Procedure : swap the edges if the relaxation index of
an edge exceeds a given threshold value
Mesh Relaxation

Degree of a node : number of edges P3


passing through it
d1, d2 : degree of P1, P2
d3, d4 : degree of P3, P4 P1 i P2
Relaxation index of edge i
E[i] = d1+d2-d3-d4
P4
Note : On an average if a degree of an internal node is 6, we
can have triangles close to equilateral triangles having this
point in common
Mesh Relaxation
3 2 3 2

7 7
8 8

10 1 1
4 4
9 9 10

5 6 5 6

Refined mesh After mesh relaxation


Mesh Smoothing

Aim : To improve the shapes of the existing triangles

Method adopted : Laplacian smoothing


Every internal node is repositioned at the centroid of the
polygon formed by the triangles containing the point in
common.
Mesh Smoothing…(contd.)

3 2

77
8

1
4
9 10

5 6
Mesh Smoothing…(contd.)

3 2

8
1
4
9 10

5 6
Mesh Smoothing…(contd.)

3 2

7
8
1
4 9
10

5 6
Mesh Smoothing…(contd.)

3 2

7
8
1
4 9

10

5 6
Mesh Smoothing…(contd.)

3 2

8
1
4 9

10

5 6

Mesh after Laplacian smoothing


Illustration
Illustration……..(contd.)

sryedida@iitm.ac.in
Illustration……..(contd.)

sryedida@iitm.ac.in
Illustration……..(contd.)

sryedida@iitm.ac.in
Illustration……..(contd.)

sryedida@iitm.ac.in
Illustration……..(contd.)

sryedida@iitm.ac.in
Illustration……..(contd.)

sryedida@iitm.ac.in
Illustration……..(contd.)

sryedida@iitm.ac.in
Illustration……..(contd.)

sryedida@iitm.ac.in
Illustration……..(contd.)
Illustration ……..(contd.)

sryedida@iitm.ac.in
Illustration ……..(contd.)

sryedida@iitm.ac.in
Illustration……..(contd.)

sryedida@iitm.ac.in
Illustration……..(contd.)

March 25, 2011 sryedida@iitm.ac.in


References
1. Computational Fluid Flow and Heat Transfer, Muralidharan K. &
Sunderarajan T., Narosa
2. Numerical grid generation-foundation and applications, Thompson J.F.,
Warsi Z.U.A. & Mastin C. W., North Holland publishers
3. Steger J.L. & Sorenson R.L., Use of hyperbolic PDE to generate body
fitted coordinates, in Nmerical grid generation techniques, NASA
conference publication 2166, 463-478, 1980
4. Algorithms for unstructured planar mesh generation and their time
complexities. Raveendra V. V. S., Ph.D Thesis, IIT Madras ( 1997)
5. A new technique for improving Triangulations. William H. Frey and
David A. Field, Mesh Relaxation, International journal for numerical
methods in Engineering, Vol. 31, 1121 – 1133 (1991).
Thank You

You might also like