2 Mesh - UPRM

erectboboSoftware and s/w Development

Dec 14, 2013 (3 years and 7 months ago)

88 views

Universidad de Puerto Rico


Mayagüez

Mathematics Department

COMP 6838
Computational Geometric

Course Professor: Robert Acar, PhD.







Non
-
Uniform
Mesh Generation

based in Quadtrees

Project Report


Project’s owner: Paul Castillo, PhD.




Yurin Holguino

Borda
, Grad. Student


y
urin_hb@math.uprm.edu

Hillary Caituiro Monge
, Grad. Student

hcaituiro@ece.uprm.edu





December, 2004


2

Contents



Introduction

................................
................................
................................
................................
.....

3

1.1

Roadmap

................................
................................
................................
.........................

4

2

Mesh

................................
................................
................................
................................
........

4

2.1

Mesh Classification

................................
................................
................................
.........

5

2.1.
1

Structured meshes

................................
................................
................................
...

5

2.1.2

Non
-
structured meshes
................................
................................
............................

6

2.1.3

Hybrid meshes

................................
................................
................................
........

7

3

Numerical Considerations

................................
................................
................................
.......

7

4

Generation Methods

................................
................................
................................
................

7

4.1

Two dimensional structured meshes

................................
................................
...............

7

4.2

Non
-
structured meshes
................................
................................
................................
....

8

4.2.1

Tree based

................................
................................
................................
...............

8

4.2.2

Node intersection

................................
................................
................................
....

9

4.2.3

Advancing Front Methods

................................
................................
......................

9

5

Quadtree

................................
................................
................................
................................
..

9

6

Design and Implementation

................................
................................
................................
..

10

6.1

Quadtree generation algorithms

................................
................................
....................

11

6.2

Balancing quadtrees

................................
................................
................................
......

13

6.3

From quadtrees to meshes

................................
................................
.............................

14

6.4

Mesh visualization

................................
................................
................................
........

14

7

Future Work

................................
................................
................................
..........................

15

References

................................
................................
................................
................................
.....

16


Appendix

................................
................................
................................
................................
...........


Presentation

................................
................................
................................
................................
.......


Java Implementation

................................
................................
................................
.........................


C++ Implementation

................................
................................
................................
.........................


CD

................................
................................
................................
................................
.....................



3

In
troduction


Engineers and scientists used to
build simplistic but expensive prototypes of real models with the
purpose of realiz
ing

studies

and experiments
. Some of them
were used to
cover the study of
models properties and the analysis of how external phe
nomena
interact with the model.
Such
practices are very expensive and limiting
. S
ometimes the prototypes remain
unusable
after few
uses.
Fortunately with the appearing of computers
,

complex and cheaper models are being built.
T
hose models allow large amoun
t of detail
that permit more precise and faster studies and test
.
There are several techniques for modeling using computers
.

Such techniques
include the
simulation and the development of models using meshes

for example
.



Mesh Generation is a useful
techni
que

that is
widely used in the solid model
ing
,
computer
aided

design (CAD), geographic information systems (GIS), virtual reality (VR),
games, and others.
But, where mesh generation has a real significance is in the process of finding
a solution for PDEs i
n Scientific Computing.
The problems that such PDEs solve are those
relates with
physic

phenomena

simulation. Although, our mesh generation model is intended for
general purposes

it provides
commodity for PDEs.





Mesh generation is about partitioning

a

geometric domain
in small sub domains also
known as elements. Such elements can be triangle
s
,
quadrilateral
s
,
tetrahedra
ls
,
and so on.
Meshing can also be a mix combination of the aforementioned forms. The way in which the
mesh is done depends in
the dime
nsion and the nature of the problem to be solved.
Also, the outcome
of the meshing technique affects the precision and efficiency of the final solution. In that sense the
technique and algorithm selection process should be taken carefully.


In this work we

address
the
mesh generation
process
through a technique that partitions
the geometric domain

using
Q
uadtrees.
A Quadtree is a tree where each internal node including
the root has four children.
This technique provides several advantages such as the precis
e
boundary detection, efficient domain fragmentation
, and others. We will recall Quadtrees later in
this document.
.



4

Also,
we have a Java and C++ implementation for
Quadtree based M
esh
G
eneration.

The
Java component is a simplified one built with the pu
rpose to show our work thought the Internet
to university students.
The C++ implementation is intended to be a tool to be used in scenarios
where a high performance is required. For this initial version we have
some
restrictions, such as
the

use of polygon
s for the

domain representation

and we only cover
bi
-
dimension
al

domains
.

However, this can be extended to a more powerful tool due to we followed a structured
and
general purpose design.




1.1

Roadmap


The rest of this

document is

organized in five section
s that intends introduce and explain the
project to the reader. Section 1 covers

meshes and their classifications. Section 2 introduces
numerical considerations which are relevant to meshes. A non avoidable topic is covered in
section 3 that is about the m
esh generation methods. We also dedicated the complete section 5
for Quadtrees. Section 6 treats the design and implementation of a mesh generator that is based
in Quadtrees. Finally in section 7 we briefly present the future work regarding this such as
in
teresting topic.


2

Mesh


A mesh is the
discretization

of a geometric domain in simple and small
shapes

such as triangles,
quadrilaterals, tetrahedrals, hexahedrals, etc.
Such geometric elements can be in two or three
dimensions. Also, in a Numeric Computat
ion context, each node
is a spot upon the PDE to be
solved. [7]


Meshes are
commonly classified in the way the points of a given region are
distributed. There are structured, non
-
structured and mixed meshes.



5

2.1

Mesh

Classification

2.1.1

Structured meshes



In s
tr
uctured meshes
each point has a constant number of neighbors across the entire mesh. This
particular type of distribution provides a simple method for accessing the data.



Fig
ure

1
Structured Mesh


Also, structured meshes

can be simple or complex. The c
omplex ones can be completely
discontinue, partially discontinue or completely continue. [6]

Completely discontinue meshes are composed of several simple meshes. The mesh
generation is easy and direct. Each simple mesh can be independently refined. There
is a
difficulty when merging each independent solution in the final solution. In this process needs be
done interpolations to transfer data from one mesh to another
. Also, the overlapping of meshes
adds

more complexity.

Partially

dis
continue meshes,
dissi
milar to

the previous one, have
not
overlapping

meshes
, but it has similar benefits and disadvantages. However, the implementation of the
boundary conditions in regions where are several simple meshes is complex.

Also,
completely continue meshes have the p
roperty that the meshes are continues in the
regions where are several meshes. These kinds of meshes are not widely used due to that they
have an a
dditional complexity. Since that derives of the regions having one or more meshes
should be continue.


The

pa
rtially continue meshes are those that only require

that the second order derives to
be continues. Thus, the implementation of the boundary conditions is easy to do in regions where
several simple meshes are. In practice it is not necessary to implement su
ch conditions due to it

6

is already done through the computation of meshes. It is possible because the second order
derives are continues in such regions.


2.1.2

Non
-
structured meshes



In contrast of the
structures meshes, in non
-
structured meshes, elements have

not a constant

number of neighbors. These kinds of meshes are preferred when adaptability is a requirement.
Also, it is strongly based in techniques of computational geometry.



Fig
ure
2
Non
-
structured mesh


Non
-
structured meshes are commonly implemented

using triangulation

a
lgorithms

such

a
s the Delaunay method. Also, algorithms such as Bowyer
-
Watson, Green
-
Sibson, Tanemurra
-
Merriam and others [6]

are used
.



Structured

Non
-
structured

Advantages



Simple generation



Support for several solution
schemas



Su
pport for complex geometric
shapes



Is adaptive

D
i
sadvantages



No suitable for complex
geometric shapes



Complicated generation



Support for few algorithms and
are sensitive to the mesh quality

Tabl
e

1
Comparison between structures and non
-
structures meshes


7

2.1.3

Hybrid
m
esh
es


A hybrid mesh
has components of structured and non
-
structured meshes.

This is done with the
purpose of gain flexibility and regularity. These properties allow a better domain representation
taking advantage from
each mesh class characteristi
cs. As a result we obtain a
mesh
with high
quality of refinement. A disadvantage on this kind of meshes is that generation is not automatic
and requires user interaction to carry on the domain decomposition.


3

Numerical Considerations


The
modeling
of phys
ics phenomena through PDEs has three phases. First,
the discretization
formulation, for example: through finite elements, finite differences, etc. Second,
mesh
generation. And third, solve PDEs. In this later phase, there are Direct Methods, Iterative
Meth
ods, and Preconditioning Methods.


Each
method has
a related computational cost, storage and memory requirements. In that
sense the mesh generations and the discretization process directly influence the method
efficiency.

For this work we are focusing
i
n the method called Multigrid. This technique
achieve a
robust convergence with iterations in the order of O(1). A Multigrid is based in a mesh hierarchy
(fine in the high level and gross in the rest of levels). Even more, domains are partitioned for
admi
tting structured meshes. As part of this technique, the Mesh Generator is part of the Solver
for Multigrids
and they work
at the same time.

The fact to have structured meshes is adequate to
the Multigrid Methods.


4

Genera
tio
n

Methods

4.1

Two dimension
al

struct
ured meshes


There are
approaches such as the interpolation, the algebraic, and the variation method or PDEs.
This last solve PDEs to
make

a mapping of a
n

initial domain in another domain having a

8

convenient coordinate system.
When
the domain is as shown a
s in the figure 3, can be done a
mapping considering the Riemman Mapping Theorem.



F
igure 3 Map of domain transformation Ω, defined by the boundary discretization in a rectangle R


In the case that the initial domain is a polygon there is the Schwarz
-
Ch
ristoffel formulation, but
it is not widely used due to there is not allowed a local spacing control.

In the case of the variation method

obviously it is very expensive in computational terms
due to there is necessary to solve Differential Equations Partia
ls to be able to distribute points in
the mesh inside the domain.




4.2

Non
-
structured meshes


For effects

of refinement and de
-
r
efinement the structured meshes

are
more useful. Also, they
behave better in complicated geometry domains.


4.2.1

Tree based



This

met
hod performs a recursive spatial sub
-
division, stored in a tree structure. The Octrees are
for three dimensions, where the domain space is divided in cubes. For two dimensions the
domain is divided in quadrilaterals
and Quadtrees are used to hold the data.


9


4.2.2

Node intersection


It is based in the Delaunay triangulation, considering two phases. First, it is based in the point
intersection of Steiner. Second, it is based in a triangulation [1]. In the first phase points are
inserted starting in the boundary of

the domain and following with the domain interior. This
intersection can be done also using simple methods such as considering the elements Centroid
along of edges.

The reason why points are inserted first is due to the Delaunay Triangulation guarantee
t
he
connection between nodes but not the creation of them. While in two dimensions triangulation is
done using triangles in three dimensions it is done using tetrahedrals.


4.2.3

Adva
ncing Front Methods


These methods
take a discretization in the boundaries and s
tarting there they create point in the
interior of the domain.
It is done from the boundary to the interior, avoiding intersections with
the existing elements. [7]

Some techniques mix Quadtrees in order to get triangulations in optimum time O(n log
n+k),
where n is the input size and k is the output size. [2]


5

Quadtree


Quadtree is a r
ecursive data structure, used for
efficient manipulation of multi
-
scale
geometric objects in the plane

[5].

Quadtree
s

Mesh Generators [8] lie in the tree
-
based generators c
ategory. This data
structure models a spatial decomposition of the domain, either in cells or quadrants, which
represents a partition of the initial cell. This is the minimum rectangle (in terms of sides’ length)
containing the domain, which is partition
ed recursively until the cell intersects on a simple form
with the domain boundary or until some criteria defined by the user is achieved.



10


Fig
ure
4
Meshing outcomes
[4]


Quadtrees model
boundaries
better
than other techniques based on Delaunday
Triangul
ations since the division phase can automatically adapt the curvature of the boundary’s
pieces enclosed within each cell.

There exist two implementations of Quadtrees which depend on how the space
decomposition is stored [7]. If the points that are to b
e stored are denominated, the Quadtree
implementation based on points is used. Whereas if these points are determined a priori, an
implementation of Quadtrees based on regions is used instead.

The implementation based on points, can be considered as a mul
tidimensional extension
of a binary
-
tree search, therefore it has a more compact representation than the lather
implementation based regions. The problem with this implementation is that shapes are
dependent on the order in which they were inserted.
More
over, the nodes elimination process is
more complex.

For the region based implementation, the recursive partition will
be realized in four parts
of equal size, which represent intervals of the partitions. This way each node in the tree will
have four comp
onents, generally denoted by SW, SE, NW, and NE [3].


6

Design and
Implementation



11

W
e have a Java and C++ implementation for
Quadtree based M
esh
G
eneration

and a
visualization tool. For this initial version we have restrictions, such as the use of polygons

for
the domain representation and we only cover two dimensional domains. However, this can be
extended to a more powerful tool due to we followed a structured general purpose design.


The Java component is a simplified one built with the purpose to show

our work thought
the Internet to university students.
It has a GUI embed in a Java Applet that is published in the
project web page.

The C++ implementation is intended to be a tool to be used in scenarios where
a high performance is required.

Our C++ ver
sion has a visualization tool developed using
OpenGL.

Some interesting
geometric
algorithms used for this implementation are the Quadtree
based Mesh Gen
e
ration and the Segments Intersection.

6.1

Quadtree
g
eneration

algorithms





12





Figure
5

Quadtree Gener
ation







13

6.2

Balancing

q
uadtrees







Figure
6

Balancing Quadtrees



14

6.3

From quadtrees to meshes




6.4

Mesh visualization



Figure
7

Meshing
of a polygon using
our

C++ implementation



15


Figure
8

Meshing
of Tarzan the University’s p
et

using
our

Java implementation


7

Future Work


As we enjoyed this work
we are tempted to extend this version to three dimensions using Octrees
in place of Quadtrees. Also, there are several parts that can be done in parallel, so we are
thinking seriously i
n add this too.



16

References


[1]

Marshall Bern and Paul E. Plassman,
Mesh Generation
,
Tech. report CSE
-
97
-
019,
Pennsylvania

State U., Dept. of Computer Science & Engineering, 1997
.


[2]

Marshall Bern, David Eppstein, and John R. Gilbert,
Provably Good Mesh Gene
ration
,
Journal of Computer and System Sciences 48(3):384
-
409, June 1994.


[3]

Mark

de Berg, Marc van Kreveld, Mark Overmars, and Otfried Schwarzkopf.

Computational
Geometry: Algorithms and Applications
, Springer, Berlin, 1997.


[4]

Frey, Pascal J. and Loic Marec
hal
,
Fast Adaptive Quadtree Mesh Generation

Proceedings,
7th International Meshing Roundtable
, Sandia National Lab, pp.211
-
224, October 1998.


[5]

H. Samet.
The
Q
uadtree and related hierarchical data structures
. Computing Surveys 16
(1984) 188
-
260.


[6]

Choi, Taek

J.
Generating Optimal Computational Grids: Overview and Review.

Department
of Mechanical Engineering, Carnegie Mellon University. 1997.



[7]

Joe F. Thompson, Bharat K. Soni, and Nigel P
.
Weatherill
,
Handbook of Grid Generation
.

CRC Press, 1999.


[8]

M.A. Yerry a
nd M.S. Shephard.
A modifed quadtree approach to fnite element mesh
generation
. IEEE Computer Graphics and Applications 3 (January/February 1983) 39
-
46


[9]

Jonathan Shewchuk
,
Lectures Notes CS294
-
5
, 1999. Department of Computer Science
University of Californ
ia at Berkeley.




















Appendix




















Presentation





















Java Implementation





















C++ Implementation





















CD