Building Geometry for CAE Applications - Focus on 2D
Copyright © 1998 by MSTR Technology
Introduction
This document explains how to create 2D (and simple 3D) geometric models for the MSTR Technology FEWaves program.
The purpose of creating a geometric model is not only to draw an object on the screen as with a drafting-oriented
CAD package, but also to define the geometric boundaries of the problem efficiently and uniquely so that other
modules in the MSTR Technology analysis system can use the geometric information to attach properties, drive the
finite element mesh generation process, and display results. Therefore, creating a geometric model is
the foundation of the entire analysis process. Prior thought into the geometric model is necessary
to properly define the "real" model to solve.
Any geometric model contains two types of data: coordinate mapping functions and topology, Coordinate mapping functions
describe where the geometric objects are located in space. The simplest example is a geometric vertex, which is
simple a point in space with three real values giving its (X,Y,Z) coordinates. A more complex example would be
a geometric edge (or, in our nomenclature, a "g_edge") for which there are three mapping functions: FX(u),
FY(u), and FZ(u). As the dimensionless parameter, u, varies from 0 (the beginning of the g_edge) to 1 (the end
of the g_edge), these three functions trace a trajectory in space. Depending on the function, the g_edge can be
a straight line, cubic spline, rational cubic, conic arc, or any other curve.
If displaying the objects on a computer screen or paper was the only consideration, the coordinate mapping functions
would be sufficient. However, for analysis we need to know more about the geometric model in order to answer questions
like these: For a given point in space, (X,Y,Z), which geometric object is the point inside? Or, what geometric
entities are on the outer bounder of the problem? To answer these and similar questions, we need to know how the
geometric objects are connected to define the regions of interest to our analysis problem. These connections are
known as topology and we use the connections to build the geometric model from objects of lower dimension to objects
of higher dimension. For example, two vertices (0 dimension define the end points of a g_edge (1 dimension). Several
g_edges together form the boundary of a geometric face (or "g_face" = 2 dimensions). Finally, several
g_faces together form the boundary of a geometric volume (3 dimensions). Because the focus of this document is
on building 2D geometric models, we will concentrate on vertices, g_edges, and g_faces.
Before we begin a detail discussion of how to build models, we should note that the best results will be obtained
when geometric models are built using the ability of the MSTR Technology "s_parser" to evaluate input
lines in terms of user-defined constants and functions, rather than hard-coding the numerical data directly, enabling
you to change the dimensions of the model easily. This is discussed in a companion document, "Symbolic Parser
for CAE Applications." If you have not yet read this document, please take a few minutes now to scan it before
continuing.
The Geometric Definition File
All geometric model building in the MSTR Technology analysis system is controlled by the geometric definition file.
This is an ASCII (text) file that you can create or modify with any text editor on your computer. The default file
name extension is ".geo". For our present purposes, this file contain only two types of information.
First, it it an ideal place to define the constant and functions that will be used when building the model. Second,
it contains one line (the last line in the file) that directs the MSTR Technology analysis system to build a geometric
model in "2D style" from two additional input files. (Other commands will be used for building full 3D
models.) These two files, respectively, define the vertex locations and the g_edges. In "2D style," creation
of g_faces is implicit in the creation of g_edges, as will be discussed below.
As an example, consider a simple 2D model of a square box. You create a geometric definition file called "box.geo"
as follows:
x0 = 0 # X value of center of box
y0 = 0 # Y value of center of box
side = 1 # length of a size of the box
half = side/2 # half of the length
@2d_style "box.pts" "box.edg"
The first four lines define the parameters that will be used to build the model. The fifth line tells the MSTR
Technology geometry builder module to use the "2D_Style" to create the model from two files, the vertex
("points") definition file and the g_edges definition file, respectively. Note that the file names defined
on the last line are enclosed in quotes. Although by convention they have the same root name as the geometry definition
file and the respective extension, ".pts" and ".edg", the actual names can be any valid file
names.
The Vertex ("Points") File
The vertex file contains the ID numbers and location of vertices. Although the vertex locations are normally given
in order, it is permissible to list the vertices out of order. A vertex definition line consists of a positive
ID number followed by zero, one. two, or three coordinates. Coordinates not given on the line are assumed to be
zero. Note that although the focus of this document is 2D, all vertices have 3D location. Normally, in a 2D model
all Z coordinates will be omitted and will therefore default to zero.
In addition to vertex definition lines, the vertex file can contain constant/function definitions. One reason to
place some definitions in the vertex file rather than the geometry file would be to define those parameters that
only affect the vertex locations. Once a parameter is defined, its value is available for all subsequent inputs,
even those in another file.
Here is an example of a four-line vertex file for our box model:
1, x0-half, y0-half
2, x0+half, y0-half
3, x0+half, y0+half
4, x0-half, y0+half
There are special command lines that can be inserted into the vertex file to aid in defining vertex locations.
These consist of a "@" character followed (no space) by a command keyword (upper or lower case) and,
possibly, some parameters.
@OFFSET
The first type of command line is @offset, followed by zero, one, two or three Cartesian offset coordinates. Offsets
not included on the line are assumed to be zero. These offsets are added to subsequent vertex locations until canceled
by another @offset command. Note that offsets are always in Cartesian coordinates (X,Y,Z). The our box example,
we could change the file as follows:
@offset x0,y0
1, -half, -half
2, +half, -half
3, +half, +half
4, -half, +half
@CARTESIAN
@CYLINDRICAL
@SPHERICAL
The default for entering coordinates is to use the Cartesian (X,Y,Z) system. You can switch to cylindrical coordinates
with the command line, @cylindrical. You can
also switch to spherical coordinates
with
the command line, @spherical. (This is mostly useful for 3D points.) You can switch back to Cartesian coordinates
with the @cartesian command. Here is the above example in cylindrical coordinates:
diag2 = sqrt(2)*half
@offset x0,y0
@cylindrical
#degrees
1, diag2, -135
2, diag2, -45
3, diag2, +45
3, diag2, +135
Note that angles for cylindrical and spherical coordinate systems are in radians unless overridden by one of the
commands listed below.
Angle Units
It is often convenient in model building or other CAE activities to use angle units other than the default radian units normally associated with cylindrical or spherical angular coordinates. The following commands change the degree units for subsequent input lines:
#degree
#degrees
#grad
#grads
#radian
#radians
These commands set the angle units to (respectively) degrees, grads, or radians. Both the singular and plural forms
are acceptable, and upper/lower case letters are equivalent. Note that these commands actually apply to the s_parser
module itself ("#" instead of "@"), and so they also affect the math functions sin, cos, tan,
asin, acos, atan, and atan2. If no commands to override are given, the default units are radians.
The G_Edge File
The g_edge file contains the definitions of g_edges. It also contains, by implication, definitions of g_faces as
will be made clear below. The basic format of a g_edge line is a sequence ID number, vertex-1 ID number, vertex-2
ID number, and (optional) radius of curvature.
The sequence ID number is included for reasons of historical compatibility. Fore each g_face, one starts at sequence
number 1 and traverses the boundary of the face in counter-clockwise order. However, the sequence numbers are for
the user’s convenience only and are not used by the MSTR Technology geometry generator (other than as a place holder).
Vertex-1 and vertex-2 define the end vertices of the g_edge. G_edges are listed in counter-clockwise order around
the boundary of a g_face, with vertex-2 of the previous g_edge being the same as vertex-1 of the first current
g_edge. When vertex-2 of a g_edge is the same as vertex-1 of the first g_edge, the loop is complete and the g_face
is defined.
The following is the g_edge file for our example box model:
1, 1, 2
2, 2, 3
3, 3, 4
4, 4, 1
Multiple g_faces (loops) are defined one after the other in the g_edge file. If a g_edge is interior to the model,
it will be listed twice in the file. The second time, the vertices will be given in reverse order. Note that each
g_edge is uniquely defined by its two end vertices, in either order. For this reason, it is incorrect modeling
practice to create two different edges with the same end vertices. It is also incorrect to create a g_edge that
intersects a third vertex or another g_edge.
Radius of Curvature
If a g_edge is assigned no radius of curvature, or equivalently a zero radius of curvature, it is a straight line
segment. If it has a positive radius of curvature, it is a convex circular arc, in other words, it curves out from
g_face. If it has a negative radius of curvature, it is a concave circular arc. An arc, positive or negative, should
span less than (not equal to) 180 degrees. If a g_edge is defined twice, the second (reversed) time should have
a curvature of the same magnitude as the first time but reversed sign.
The following g_edge file would turn the box in our example into a circle:
1, 1, 2, diag2
2, 2, 3, diag2
3, 3, 4, diag2
4, 4, 1, diag2
Holes and Islands
A hole is a region inside a g_face that represents removed material. It should be contained completely within a
previously-defined g_face, not touching the boundary. To create the hole, simply define the connected boundary
edges in clockwise order.
An island is a g_face that is completely surrounded by a previously defined g_face. You must define the outer g_edge
first. Then you simply define the second g_face in the usual counter-clockwise sense and a corresponding hole will
be automatically created.
An automatic algorithm in the MSTR Technology geometry builder connects holes and islands with each other and the
outer boundary to create a final boundary that is one continuous sequence of edges. (Some are traversed twice.)
3D Features
The "2D style" method of geometric modeling permits a limited range of 3D surface model creation. By
default, all g_faces are created in the XY plane, with a normal vector of (0,0,1). It is possible to change the
normal vector with a command line, as follows:
@normal nx,ny,nz
where nx, ny, and nz comprise a Cartesian vector defining a new normal direction. This vector is internally scaled
to units length.
Three types of g_faces are allowed in the "2D-style" method of 3D model building. The three types are
differentiated by whether the normal vector changes during the g_face creation, and if so, how many g_edges bound
the g_face. If the normal vector does not change, the g_face is planar. In this case, the g_face can have any number
and types of edges.
The other two types are surface patches bounded by exactly three or four g_edges. The g_edges can be of any type,
linear or curved. The surface of the patch is determined using blending functions that create a smooth 2D surface
in 3D space. In order to ensure that these functions are well-behaved, it is strongly recommended that no single
g_edge curve should cover more than 90 degrees. Also, for four-sided surfaces, the interior angles at the vertices
should be as close to 90 degrees as possible.
Because the modeling of these surfaces has been derived from simpler 2D modeling techniques, it is essential to
include and "@normal" command during the definition of the curved surfaces of the three- or four-sided
types. In some cases, defining a patch on a cylinder, for example, this is not mathematically necessary. However,
it is syntactically necessary in order to signal the model builder to switch out of a simple planar g_face and
into a curved g_face.
Note the 3D models created with this method are surface models only. If meshed with the MSTR Technology automatic
2D mesher, a surface or shell grid will result. Please contact MSTR Technology if you are interested in obtaining
some example 3D shell models created with the techniques of this note.