Вы находитесь на странице: 1из 40

Elliptic Mesh Generation

An introduction to mesh generation


Part IV : elliptic meshing
Jean-Franois Remacle
Department of Civil Engineering,
Universit catholique de Louvain, Belgium

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Curvilinear Meshes
Basic concept
A curvilinear mesh is build using a parametric space
Sponge analogy
Let us consider the real coordonates (x, y) and a parametric space (u, v).
The transformation x = x(u, v) and y = y(u, v) has to be build.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Curvilinear Meshes

The transformation transforms a cartesian mesh in the parametric space into


a structured mesh in the real space with the following properties:
Two non intersecting lines in the parametric space do not cross in the
real space,
The mesh adapts to the boundary of on the real space,
The mesh has not to be orthogonal in the real space.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Curvilinear Meshes

The transformation transforms a cartesian mesh in the parametric space into


a structured mesh in the real space with the following properties:
Two non intersecting lines in the parametric space do not cross in the
real space,
The mesh adapts to the boundary of on the real space,
The mesh has not to be orthogonal in the real space.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Curvilinear Meshes

The transformation transforms a cartesian mesh in the parametric space into


a structured mesh in the real space with the following properties:
Two non intersecting lines in the parametric space do not cross in the
real space,
The mesh adapts to the boundary of on the real space,
The mesh has not to be orthogonal in the real space.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Curvilinear Meshes
The transformation transforms a cartesian mesh in the parametric space into
a structured mesh in the real space with the following properties:
Two non intersecting lines in the parametric space do not cross in the
real space,
The mesh adapts to the boundary of on the real space,
The mesh has not to be orthogonal in the real space.
The advantage of curvilinear meshes are numerous. They are usually high
quality/very regular meshes. Yet, the sponge analogy cannot be applied
easily to complex domains.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Transfinite Interpolation

Let us consider a simply connected 2D manifold that is bounded by 4


curves ~ci (t), i = 1 . . . , 4.
We consider the four corners ~Pi,j that are the intersections if curves ~ci
and ~cj .
We look for a transformation that maps the unit square in the
parametric space into the domain of interest.
We suppose that curves ~c1 and ~c3 will be the mapping of the vertical
segments v = 0 and v = 1.
We suppose that curves ~c2 and ~c4 will be the mapping of the horizontal
segments u = 0 and u = 1.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Transfinite Interpolation
Let us try the following intuitive formula
~S(u, v) = (1 v)~c1 (u) + v~c3 (u) + (1 u)~c4 (v) + u~c2 (v)

Let us see if we get back the boundaries of the domain


~S(u, 0) = ~c1 (u) + (1 u)~c4 (0) + u~c2 (0)
~S(u, 1) = ~c3 (u) + (1 u)~c4 (1) + u~c2 (1)
~S(0, v) = (1 v)~c1 (0) + v~c3 (0) +~c4 (v)
~S(1, v) = (1 v)~c1 (1) + v~c3 (1) +~c2 (v)

Let us identify the four corners


~c1 (0) = ~c4 (0) = ~P1,4 ~c1 (1) = ~c2 (0) = ~P1,2
~c2 (1) = ~c3 (1) = ~P2,3 ~c3 (0) = ~c4 (1) = ~P3,4
Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Transfinite Interpolation

Taking into account the corners


~S(u, 0) = ~c1 (u) + (1 u)~P1,4 + u~P1,2 6= ~c1 (u)
~S(u, 1) = ~c3 (u) + (1 u)~P3,4 + u~P2,3 6= ~c3 (u)
~S(0, v) = (1 v)~P1,4 + v~P3,4 +~c4 (v) 6= ~c4 (v)
~S(1, v) = (1 v)~P1,2 + v~P2,3 +~c2 (v) 6= ~c2 (v)

Let us try an alternative formula


~S(u, v)

(1 v)~c1 (u) + v~c3 (u) + (1 u)~c2 (v) + u~c4 (v)


h
i
(1 u)(1 v)~P1,4 + uv~P2,3 + u(1 v)~P1,2 + (1 u)v~P3,4 .

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Transfinite Interpolation

~S(u, v)

(1 v)~c1 (u) + v~c3 (u) + (1 u)~c2 (v) + u~c4 (v)


h
i
(1 u)(1 v)~P1,4 + uv~P2,3 + u(1 v)~P1,2 + (1 u)v~P3,4 .

Taking into account corners


~S(u, 0) = ~c1 (u) + (1 u)~P1,4 + u~P1,2 (1 u)~P1,4 u~P1,2 = ~c1 (u)
~S(u, 1) = ~c3 (u) + (1 u)~P3,4 + u~P2,3 (1 u)~P3,4 u~P2,3 = ~c3 (u)
~S(0, v) = (1 v)~P1,4 + v~P3,4 +~c4 (v) (1 v)~P1,4 v~P3,4 = ~c4 (v)
~S(1, v) = (1 v)~P1,2 + v~P2,3 +~c2 (v) (1 v)~P1,2 v~P2,3 = ~c2 (v)

This formula is correct, it is called the transfinite interpolation formula.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Transfinite Interpolation

Using a transfinite interpolation does not guarantee that the mapping is


positive, i.e. the relation det |i Sj | > 0 is not guaranteed, see some examples
with gmsh.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Transfinite Interpolation
Transfinite interpolation exists for 3-sides shapes,
~S(u, v)

u~c2 (v) + (1 v)~c1 (u) + v~c3 (v)


h
i
u(1 v)~P1,2 + uv~P2,3 .

Transfinite interpolation exists for 3D shapes.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes
It is not always simple to devise an explicit formula for the mesh
mapping,
With the transfinite interpolation, mesh lines may cross each others,
leading to a wrong mesh
PDE based mesh have been developped in order to avoid those
difficulties
Two kind of approaches are possible, using either an hyperbolic PDE,
or using an elliptic PDE. This last approach is now studied.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Thermal Analogy


Let us consider the same 4-sided domain as the one we used for
transfinite meshing,
We build mesh lines using a thermal analogy : mesh lines are
superimposed with the isolines of temperature.
Steady state heat equation has to be solved.
Two sides of the domain are adiabatical and a constant temperature is
imposed on the two other sides.
!

"
Jean-Franois Remacle

"
Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Thermal Analogy


We have to build up a PDE system that will lead to two families of
(orthogonal) mesh lines. Fo that purpose, two thermal problems will be
defined:
1
The first family is constructed using the isolines of temperatures 1 of
a thermal problem in which two opposite sides are adiabatical, i.e.
n 1 = 0. The temperature is set to be constant on each of the two
other sides: 1 = 1 on the first side and 1 = 0 on the other side. The
temperature field 1 has to satisfy the Laplace equation inside the
domain :
2 1 = 0
2

The second family is constructed using the isolines of temperatures 2


of the adjoint thermal problem in which adiabatic sides are replaced by
constant temperature sides and where constant temperature sides are
replaced by adiabatic sides. The co-temperature field 2 satisfies the
Laplace equation as well :
2 2 = 0
Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Thermal Analogy


The two families of mesh lines will have the right properties, thanks to the
properties of the solutions of the Laplace equation:

The maximum principle : any solution of the Laplace equation has its
maximum on the boundaries (no local maxima is allowed),
The solution is unique,
The solution belongs to H 1 , it is smooth,
Iso-contours cannot intersect,
Iso-contours stay inside the domain (obvious for a PDE, not for a

general mapping),

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Thermal Analogy


The two families of mesh lines will have the right properties, thanks to the
properties of the solutions of the Laplace equation:

The maximum principle : any solution of the Laplace equation has its
maximum on the boundaries (no local maxima is allowed),
The solution is unique,
The solution belongs to H 1 , it is smooth,
Iso-contours cannot intersect,
Iso-contours stay inside the domain (obvious for a PDE, not for a

general mapping),

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Formulation


The resulting mesh equations are two boundary value problems. We
have to find 1 and 2 solution of
2 i = 0

, i = 1, 2.

boundary conditions are

Boundary
~c1
~c2
~c3
~c4

1
1 (x, y) = 0
n 1 (x, y) = 0
1 (x, y) = 1
n 1 (x, y) = 0

Jean-Franois Remacle

2
n 2 (x, y) = 0
2 (x, y) = 0
n 2 (x, y) = 0
2 (x, y) = 1

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Formulation


Problem : the equations have to be solved in the real space.
Disappointingly, solving such PDE requires... a mesh !

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Formulation


This issue is addresded by the inversion of variables x and y and 1 and
2 ,
The problem is solved in the space of temperatures 1 and 2 and the
unknowns are the positions of the mesh in the real space x and y,
For a pair of temperatures (1 , 2 ), we look the point (x, y) in the
physical space where this temperature occurs.
Because of the properties of the Laplace operator, the exist such a
point (x, y) for any pair (1 , 2 ) for which 0 6 1 6 1 and for which
0 6 2 6 1
This is equivalent to the following change of variables
x = x1 = x1 (1 , 2 ) and y = x2 = x2 (1 , 2 )

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Formulation


This issue is addresded by the inversion of variables x and y and 1 and
2 ,
The problem is solved in the space of temperatures 1 and 2 and the
unknowns are the positions of the mesh in the real space x and y,
For a pair of temperatures (1 , 2 ), we look the point (x, y) in the
physical space where this temperature occurs.
Because of the properties of the Laplace operator, the exist such a
point (x, y) for any pair (1 , 2 ) for which 0 6 1 6 1 and for which
0 6 2 6 1
This is equivalent to the following change of variables
x = x1 = x1 (1 , 2 ) and y = x2 = x2 (1 , 2 )

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Formulation


This issue is addresded by the inversion of variables x and y and 1 and
2 ,
The problem is solved in the space of temperatures 1 and 2 and the
unknowns are the positions of the mesh in the real space x and y,
For a pair of temperatures (1 , 2 ), we look the point (x, y) in the
physical space where this temperature occurs.
Because of the properties of the Laplace operator, the exist such a
point (x, y) for any pair (1 , 2 ) for which 0 6 1 6 1 and for which
0 6 2 6 1
This is equivalent to the following change of variables
x = x1 = x1 (1 , 2 ) and y = x2 = x2 (1 , 2 )

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Formulation


This issue is addresded by the inversion of variables x and y and 1 and
2 ,
The problem is solved in the space of temperatures 1 and 2 and the
unknowns are the positions of the mesh in the real space x and y,
For a pair of temperatures (1 , 2 ), we look the point (x, y) in the
physical space where this temperature occurs.
Because of the properties of the Laplace operator, the exist such a
point (x, y) for any pair (1 , 2 ) for which 0 6 1 6 1 and for which
0 6 2 6 1
This is equivalent to the following change of variables
x = x1 = x1 (1 , 2 ) and y = x2 = x2 (1 , 2 )

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Formulation


This issue is addresded by the inversion of variables x and y and 1 and
2 ,
The problem is solved in the space of temperatures 1 and 2 and the
unknowns are the positions of the mesh in the real space x and y,
For a pair of temperatures (1 , 2 ), we look the point (x, y) in the
physical space where this temperature occurs.
Because of the properties of the Laplace operator, the exist such a
point (x, y) for any pair (1 , 2 ) for which 0 6 1 6 1 and for which
0 6 2 6 1
This is equivalent to the following change of variables
x = x1 = x1 (1 , 2 ) and y = x2 = x2 (1 , 2 )

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Formulation


We use the chain derivative rule to compute
X j
X X 2 l j

2
=
and
=
xj
j xi
xi xk
j l xk xi
2

j=1

j=1 l=1

In expanded form
2
2
= 2
2
x1
1

2
2
= 2
2
x2
1

1
x1

2

1
x2

2

2
1 2

+2

2
1 2

+2

Jean-Franois Remacle

1 2
x1 x1

1 2
x2 x2

Mesh Generation

2
22

2
22

2
x1

2

2
x2

2

Elliptic Mesh Generation

Elliptic meshes : Formulation


The Laplace operator is written as
2

2
21
+

2
22

 
 !


1 2
2
1 2 1 2
1 2
+
+2
+
+
x1
x2
1 2 x1 x1 x2 x2

 
 !
2 2
2 2
+
.
x1
x2

Therefore, in 2D, the PDEs that have to be solved can be written as

2 x
2 x
2
1

21
2 x2
21

+ 2

x1
1 2
2 x2
1 2

22
2 x2
22

= 0.

with

 


 

1 2 1 2
1 2
1 2
2 2
2 2
=
+
, =
+
+
, =
x1
x2
x1 x1 x2 x2
x1
x2
Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Formulation


Note that
=J

"

x1
1

2


+

x1
2

2 #


=

1
x1

2


+

1
x2

2



x1 x2 x1 x2

+
= 1 2 + 1 2,
1 1 2 2
x1 x1 x2 x2
"
 
 # 
 

x2 2
x2 2
2 2
2 2
2
=J
+
+
,
=
1
2
x1
x2

= J 2

with
J = det[j xi ]

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Formulation


The equations that have to be solved for the mesh problem are coupled and
non-linear! They can only be solved using numerical methods. There exists
several techniques to solve such systems. We are not going to detail all the
methods that are available (this is could be the subject of another course).
We are going to illustrate some basic principles. Two items will be detailed
here
The numerical discretization of the mesh equations in the parametric
space (1 , 2 ),
Their resolution.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Formulation


We assume that the mesh in the parametric space is a m n finite
difference mesh. The mesh is uniform in the sense that the spacings and
in both directions are constant.
f

2f
2
2f
2
2f

fi+1,j fi1,j
2
fi,j+1 fi,j1
2
fi+1,j 2fi,j + fi1,j
2
fi,j+1 2fi,j + fi,j1
2
fi+1,j+1 fi+1,j1 fi1,j+1 + fi1,j1
4

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Formulation


We recall the mesh equations

2 x1
2 x1
2 x1
2
21
2 + 2
+ 2 12
x2
2 x2
2 x2
2
2
2 2

21 L =
+ 22
+1 2 2
2

= 0.

Their discrete version can be written, for any vertex (i, j) of the mesh in the
(i, j)
parametric space, as
x

[xi+1,j 2xi,j + xi1,j ] + " [xi,j+1 2xi,j + xi,j1 ]


"

2 " [xi+1,j+1 xi1,j+1 xi+1,j1 + xi1,j1 ] =

" [yi+1,j 2yi,j + yi1,j ] + " [yi,j+1 2yi,j + yi,j1 ]

2 " [yi+1,j+1 yi1,j+1 yi+1,j1 + yi1,j1 ] =

Jean-Franois Remacle

#
Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Resolution


With the numerical evaluation of coefficients , and

(xi,j+1 xi,j1 )2 + (yi,j+1 yi,j1 )2


(2 )2
(xi+1,j xi1,j )2 + (yi+1,j yi1,j )2
(2 )2
(xi+1,j xi1,j )(xi,j+1 xi,j1 )
2

(yi+1,j

(4 )
yi1,j )(yi,j+1 yi,j1 )
(4 )

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Resolution


Applying the formulation to the m n nodes of the finite difference mesh,
we obtain a coupled system of non linear equations. In fact, 0 , 0 and 0
are all functions of the unknowns, i.e. the position of the nodes in the real
space. Several methods are available for solving such a system. They can be
classified in two categories:
1

direct methods,

iterative methods.

The choice of the method is essentially based on the following criterion


The CPU time cost and the memory cost,
The ability of the method to converge to the solution,
The relative ease of programming !

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Resolution


Direct methods are not the choice that is usually made for building elliptic
meshes. Direct methods have the advantage of ensuring the convergence in
a finite number of step (yet this not true for non-linear systems). Their
principal drawback is their memory signature and their (relative)
complexity.
Iterative methods have the following advantages:
1

They are usually easier to code,

They are well adapted to structured grids,


The following smoothers are often used for building elliptic meshes
2

Point Jacobi iteration,


Block Jacobi iteration (the block may be a line or a column of nodes),
ADIs, i.e. alternated direction implicit !

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Point Jacobi Iteration


We look for the values of the variables x and y, noted x andy atnode
x
y
(i, j)
x
y
(i, j) verifying
!
"
!
"
+

+
"
" xi+1,j 2x
i,j + xi1,j + xi,j+1 2xi,j + xi,j1
!
"
+
2 " xi+1,j+1 xi1,j+1 x+
i+1,j1 + xi1,j1

!
"
!
"

+
+ " yi,j+1 2yi,j
" yi+1,j 2yi,j
+ yi1,j
+ yi,j1
!
"
+
+
+ yi1,j1
2 " yi+1,j+1 yi1,j+1 yi+1,j1
n

y+

Here,
and
are for the values of x and
n +y 1at the previous sweep and x

"
"
"
and y are the values atthe present
sweep. The linearization

x y of the
coefficients consist in using previous values of x and y in 0 , 0 and 0 .

Jean-Franois Remacle

Mesh Generation

(x x)

(y y)

Elliptic Mesh Generation

Elliptic meshes : Over relaxation


We know that x and y are updated by doing
x = x + (x x) and y = y + (y y).
Over relaxing the system consist in doing
x+ = x + (x x) and y+ = y + (y y).
with > 1. Current values are computed as

xi,j
= xi,j + Cx i, j/ and y
i,j = yi,j + Cy i, j/.

with the corrections


+
Cx i, j = xi,j
xi,j and Cy i, j = y+
i,j yi,j .

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Over relaxation


Replacing in the discrete form of the equations, we obtain
2(" + " )
Cx i, j
" "

2( + )
Cx i, j
"
"

Rx i, j + " Cx i 1, j

"

jCx i + 1, j 1) + " Cx i, j 1
R
j x+i
"1,
Cxj i1 1,
x i,(C

2(" + " )
Cy i, j

2( + )
Cy i, j

with the residuals


Rx i, j

"
=
Ry i," (C
j+
1,1j Cx i + 1, j 1) + " Cx i, j 1
y i j
x iC1,
"
i,
(Cy i "1, j 1 Cy i + 1, j 1) + " Cy i, j 1
R
y j + Cy i 1, j

" (Cy i 1, j 1 Cy i + 1, j 1) + " Cy i, j 1

[xi+1,j 2xi,j + xi1,j ] + " [xi,j+1 2xi,j + xi,j1 ]


"

2 " [xi+1,j+1 xi1,j+1 xi+1,j1 + xi1,j1 ]

RR
" [x
2xi,j + xi1,j ] +" " [xi,j+1 2xi,j + xi,j1 ]
x i,i,j j =
= " [yi+1,j
y
i+1,j 2yi,j + yi1,j ] + [yi,j+1 2yi,j + yi,j1 ]
"
yxi1,j+1
xi+1,j1
xi1,j1 ]
2
i+1,j+1
i1,j+1
[yi+1,j+1

yi+1,j1
+ y+
2 " [x
i1,j1 ]
Ry i, j

" [yi+1,j 2yi,j + yi1,j ] + " [yi,j+1 2yi,j + yi,j1 ]


2 " [yi+1,j+1 yi1,j+1 yi+1,j1 + yi1,j1 ]

'

$
%

'

Jean-Franois Remacle

#
$

Mesh Generation

Elliptic Mesh Generation

Cx i, j

Elliptic meshes : Boundary conditions

We do not want to move the boundary nodes. The way to implement it is


very simple : do not apply any corrections to those nodes

Cx 1, j

Cx m, j

Cy 1, j

Cy m, j

Those are Dirichlet boundary conditions.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Example


Here is an example of a transfinite mesh and an elliptic mesh, both based
on the same 1D discretization.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Line Jacobi Iteration


Iterative process can be accelerated using a more implicit method. We
cound compute one line at a time

j+1
j

valeurs ltape n + 1

j-1

valeurs courantes
valeurs ltape n

i-1

i+1

The resulting system is tridiagonal and ad hoc linear solvers can be used for
accelerating the process.

Jean-Franois Remacle

Mesh Generation

Elliptic Mesh Generation

Elliptic meshes : Line Jacobi Iteration


The system of equations can be assembled solved using the following finite
difference formula.
!
"
!
"

+
!
! x
i+1,j 2xi,j + xi1,j + xi,j+1 2xi,j + xi,j1
!
"
+
+
!
2 xi+1,j+1 xi1,j+1 xi+1,j1 + xi1,j1
!
"
!
"

+
+ ! yi,j+1 2yi,j
! yi+1,j
2yi,j
+ yi1,j
+ yi,j1
!
"
+
+
2 ! yi+1,j+1 yi1,j+1 yi+1,j1 + yi1,j1

Jean-Franois Remacle

Mesh Generation

Вам также может понравиться