?? meshgen.html
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> The QMG Mesh Generator </title>
</head>
<body BGCOLOR="#E0FFE0" TEXT="#000000" LINK = "#0080C0" VLINK = "#004060" ALINK = "#FF0000" >
<center>
<table>
<tr>
<td>
<a href="qmg2_0_home.html"><img src=logo1.jpg alt="QMG logo"></a></td>
<td>
<h1>
The QMG Mesh Generator
</h1>
</td>
</table>
</center>
QMG 2.0 provides a quadtree/octree mesh generator. (The
Delaunay mesh generator available in QMG 1.1 has been
discontinued.)
The mesh generator
takes as input a <a href="geom.html#breps">brep</a>, that
is, a boundary representation of a two- or three-dimensional
geometric object
and produces as output a triangulation of that brep.
The mesh generator operates only on full-dimensional breps (that
is, breps whose intrinsic and embedded dimension are equal).
The
triangulation is stored as a <a href="geom.html#meshes">simplicial
complex</a>. The mesh generator introduces <em>Steiner points</em>,
that is, triangulation vertices that are not necessarily vertices
of the original brep. (Indeed, in three dimensions, it
is not possible in general to triangulate a domain
without introducing Steiner points.)
<p>
The mesh generator is invoked as follows in Matlab:
<blockquote>
<strong>
<em>s</em> = gmmeshgen(<em>brep</em>, <em>opt</em><sub>1</sub>,
<em>val</em><sub>1</sub>, ..., ,<em>opt</em><sub><em>k</em></sub>,
<em>val</em><sub><em>k</em></sub>);
</strong>
</blockquote>
or in Tcl/Tk:
<blockquote>
<strong>
gmset <em>s</em> [gmmeshgen <em>brep</em>
<em>opt</em><sub>1</sub> <em>val</em><sub>1</sub> ...
<em>opt</em><sub><em>k</em></sub> <em>val</em><sub><em>k</em></sub>]
</strong>
</blockquote>
<p>
The return variable <em>s</em> is a
simplicial complex. The first argument to the routine is the brep to
triangulate. The remaining arguments are
keyword-value pairs. Each <em>opt</em> is a string
that specifies a keyword from the list below,
and each <em>val</em> is its corresponding value.
The keywords may be abbreviated.
<h3><a name="sizecontrol">Mesh grading control</a></h3>
Two keyword arguments to the mesh generator are usedfor mesh grading control:<strong>userdata</strong> and
<strong>sizecontrol</strong>.The mesh grading control function determines an upper bound on how
big the mesh elements should be
at every point. As the mesh generator executes, it repeatedly
calls the function named
<code>gm_sizecontrol</code> and <code>gm_sizecontrol_interior</code>.
(These functions
are in m-files with the same names in Matlab and in file
<code>qmg_sizecontrol.tcl</code> for Tcl/Tk.)
The
arguments to <code>gm_sizecontrol</code> are the real coordinates of
the point in the domain, the <strong>userdata</strong>
value (currently unused
by the routine) passed into the mesh generator,
the <strong>sizecontrol</strong> value passed into the mesh generator
(either using the keyword argument or as a property-value pair
on a face),
the face containing the point,
the geometric entity index within that face
and the parametric coordinates within that geometric
entity. This function is invoked for points on the boundary.
In the case of points in the interior, there is a similar
function <code>gm_sizecontrol_interior</code> which has four arguments:
real coordinates, the
<strong>sizecontrol</strong> value,
the <strong>userdata</strong>
value (currently unused
by the routine) passed into the mesh generator,
and the topological entity (a region) containing the point.
<p>The two functions <code>gm_sizecontrol</code> and<code>gm_sizecontrol_interior</code> use this information to compute a positive number, which is themaximum allowable size of elements at the input point. The meshgenerator uses this value when deciding whether to refine thequadtree/octree.Thus, the <strong>sizecontrol</strong> keyword option isinterpreted by these two functions andcontrols the mesh
upper bound size. The option's default value is
<strong>(const 1e307)</strong>,
a huge upper bound
that essentially means no upper limit is imposed on the mesh size.
The quadtree/octree mesh generator
uses the number as an upper bound on its largest box size. Therefore,
this size control is somewhat imprecise since box sizes occur only
in powers of two.
See the <a href="userfunc.html">page</a> on user-specified
functions for the details
on how the mesh grading control works, along with examples.
<p>
If every size control value is constant,then <code>gm_sizecontrol</code> in Matlab or Tcl is
not invoked. Constant size control functions are handled entirely within
the C++ code for efficiency.
A nonconstant
size-control functionshould vary smoothly over the domain, because sharp
variations may be missed by the mesh generator.
Furthermore, sharp variations may lead to elements with badaspect ratio.
A good way to obtain very small
elements in a specific local
area in the domain is to put aboundary vertex, edge or surface (internal or external)in the location where you want the small elements and tagit with a <strong>sizecontrol</strong>
property.
<p>
As an example of a nonconstant interesting size-control function, take a look
at <code>test1</code> in the test set, which is a size function based a rule in
Claes Johnson's book <em>Numerical solutions of partial differential
equations by the finite element method,</em> Cambridge University Press,
1987.
<h3> <a name="curvecontrol">Curvature control</a></h3>
The <strong>curvecontrol</strong>
value controls how much the boundary is allowed to deviate
from being flat over each simplex in the final mesh.
A small value of curvature control forces the mesh
generator to refine the mesh at the boundary.
<p>
<a name="curvemeas"></a>
The interpretation of the curvature control argument is as follows.
Suppose the value is <em>p</em>. Let <em>x</em><sub>1</sub>,
<em>x</em><sub>2</sub>
be two distinct points lying
on the same a boundary face <em>F</em>
in an octree box. Let <em>n</em><sub>1</sub>,
<em>n</em><sub>2</sub> be the normals at
<em>x</em><sub>1</sub>, <em>x</em><sub>2</sub>
if <em>F</em> is 2-dimensional,
else let <em>n</em><sub>1</sub>, <em>n</em><sub>2</sub>
be the tangents at <em>x</em><sub>1</sub>,
<em>x</em><sub>2</sub> if <em>F</em> is 1-dimensional.
Then if
||<em>n</em><sub>1</sub>−<em>n</em><sub>2</sub>||><em>p</em>,
the box must be split. The norm
used in this comparison
is like the <em>l</em><sup>2</sup> norm but is
based on a 26-sided polyhedron rather than a sphere
(for efficiency).
<p>
Thus, if <em>p</em> is sqrt(2), this allows the boundary to bend by about 90 degrees
over one simplex (because two unit vectors at right angles are distance
sqrt(2) from each other in the usual 2-norm.)
The default value of the curvature setting is
0.5. Values larger than 1.0 are not recommended.
<p>
The format for this setting is a string that obeys similar rules
to the <strong>sizecontrol</strong> setting described above.
For instance, you
can declare
<strong>(const <em>X</em>)</strong> or
<strong>(formula <em>X</em>)</strong>
as values for curvature
control. You can also modify the <code>gm_curvecontrol</code> function
(which is in <code>gm_curvecontrol.m</code> under Matlab
and in <code>qmg_sizecontrol.tcl</code> under Tcl/Tk)
which
is responsible for interpreting these strings. You can also
tag individual topological entities with their own
<strong>curvecontrol</strong>
property-value pairs. In a situation where multiple curvature
control strings apply, the most stringent one determines the
curvature control.
<p>
For a brep
containing a face that is not <em>G</em><sup>1</sup> (i.e., the normal does not vary continuously
over the patches of that face, for instance, because the face is
made up of noncoplanar linear patches), there is a minimum positive
allowable value for
the curvature control. Below this value, the mesh generator
will fail. In particular, it will terminate with an error message
that the quadtree has been split too finely because a curvature
setting could not be met.
To help determine this
lower bound for your brep, use the
<a href="ref.html#gmchecknormals"><code>gmchecknormals</code></a>
function.
<h3><a name ="tolkey">Tolerance</a></h3>
The value of the <strong>tol</strong>
keyword controls the tolerance used by the mesh generator.
This tolerance is an indication of
how accurate the input brep's geometric data
is.
<p>
<a name="default_tol"></a>
The tolerance is
a number between 0 and 1 and is used by QMG to determine when two
items are the same and when they are different. The default value of the tol argument is the value of the global
variable <code>gm_default_tol</code> in Tcl or
<code>GM_DEFAULT_TOL</code> in Matlab.
This global variable is initialized to
1e-14 by the Matlab or Tcl/Tk startup routines.
<p>
QMG uses double precision arithmetic, so the smallest reasonable setting
for this parameter is about 1e-16. But we found that roundoff error
quickly builds, so 1e-14 seems reasonable. An error messagefrom the mesh generator like “Ray missed starting patch” indicates
tolerance is set too low.
<p>
Note that QMG routines automatically take into account the inherent
size of the object you are working with and use this number to
scale
tolerance when necessary. For example, given a cube of side length 1e10 and a tolerance of 1e-11, QMG will assume items in this brep
are the same if they are within a distance 1e-1.
<h3>Log file</h3>
Because the quadtree/octree
mesh generator is still in an experimental stage,
we have found it very handy to have log of its computations.
The value associated with keyword <strong>logfile</strong> specifies the name
of the file
in
which the log is written. Under Tcl/Tk,
the default is mglogNNN, where NNN
is the PID of the process running the mesh generator.
Under matlab, the default is mglog.
Set this value to <strong>/dev/null</strong>
in unix or <strong>nul</strong> in Windows to prevent generation of the log.
<h3>Log file verbosity</h3>
The value for
<strong>verbosity</strong> determines how much information to log.
This is a nonnegative
integer; larger integers mean that more information is logged.
For larger 3D problems, mesh generationwith the verbosity level of 4 or higher could generate a log thatfills up your disk. The default value is 1.
The logfile begins with a preamble that confirms the calling arguments
to the routine.
For verbosity 2 or higher, it traces the creation and deletion of
every single box.
<p>
If you discover a problem with the mesh generator, please save
the log file when you report the problem.
<h3> <a name="showgui">Displaying the gui</a></h3>
The keyword <strong>showgui</strong> takes either 0 or 1 as a value.
Setting showgui
to 1 (the default) causesthe quadtree/octree mesh generator to put up an informational
display as it runs to update you on its progress. This GUI is
described <a href="#gui">below</a>.
<h3><a name="expansion">Expansion factors</a></h3>
You can specify a vector of expansion factors with keyword
<strong>expansion</strong>.
The expansion factors are a decreasing sequence of <em>d</em>+1
numbers, where <em>d</em> is the dimension of the brep.
All must be positive and no more than 0.5. In the
quadtree/octree mesh generator, boxes are expanded when the
algorithm looks for crowding, and these boxes control the
degree of expansion. They also serve as upper bounds on the
warping distances. Generally these number should be left
at their defaults. Increasing these numbers in some cases may improve aspect
ratio.
<h3><a name="orientation">Orientation</a></h3>
You can specify values of either
1 (default) or 2 for keyword <strong>orientation</strong>.
A value of 1 tells
the mesh generator to generate all
<a href="geom.html#orientation">right-handed</a> elements.
A value of 2 tells the mesh generator to generate
all left-handed elements.
<h3><a name="aspdegrade">Aspect ratio degrade factors for warping</a></h3>
A tuning parameter <strong>aspdegrade</strong> should probably be left at
default values.
This parameter is an array of numbers in the interval (0,1)
(three numbers for 2D, four numbers for 3D).
<h2><a name="checktri"> Checking the output</a></h2>
The function <a href="ref.html#gmchecktri"><code>gmchecktri</code></a>
checks the output of the mesh generator.
The calling sequence is:
<blockquote>
Matlab:
<code>
gmchecktri(b, s {, checko {, tol}}) <br>
</code>
Tcl/Tk:
<code>
gmchecktri $b $s {$checko {$tol}}
</code>
</blockquote>
where b is the brep and s is the simplicial complex. It returns the
worst aspect ratio among simplicies in the triangulation, or a negative
number if there is an error in a mesh.
Because the
mesh generator is still experimental, it is recommended that you
run this utility after every single run of the mesh generator.
The optional argument checko indicates whether you want to check
simplex orientation; its value is 0, 1 or 2. If checko=0, then
correct orientation of simplices is not checked.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -