The graphical toolkit {\bf TclTk} developed by John Ousterhout
(available from \htmladdnormallink{http://www.scriptics.com/}{http://www.scriptics.com/}) and its extension {\bf Tix} available from \htmladdnormallink{http://www.sourceforge.com}{http://www.sourceforge.com/}) by Iam Lan.
Netgen has been tested with version TclTk 8.0 - TclTk 8.4 and Tix 4.6. - Tix 8.2
\end{itemize}
You can also download these packages from the Netgen site.
To install NETGEN please move into the directory ng4.
You set the Unix-variable MACHINE according to
your machine/operating system, e.g.
\begin{quote}
\tt
setenv MACHINE LINUX
\end{quote}
%
(in bash shell you type {\tt export MACHINE=LINUX}).
The Makefile includes the makefile-include
\begin{quote}
\tt
libsrc/makefile.mach.\$(MACHINE)
%$
\end{quote}
Please create/modify the according file,
(e.g. copy makefile.mach.LINUX to makefile.mach.SUN). Then you enter
{\bf\tt make} to build the executable.
\medskip
To make NETGEN globally available you just copy the binary ``ng''
to the global bin - directory. In difference to earlier versions,
it needs no additional files.
\subsection{Installing NETGEN for Windows}
NETGEN is available now for Windows in binary form. You download
the zip - archive {\tt ng4win.zip}. After unpacking it with winzip,
you can start the executable ``ng4.exe''.
\subsection{Adding IGES/STEP file support via OpenCascade}
\label{subsec_occ}
NETGEN is capable of importing IGES and STEP geometry files. If you want to use this functionality you have the add the OpenCascade library to your NETGEN distribution.
OpenCascade is an open source 3D solid modeller library by OpenCASCADE S.A. You can obtain it from \htmladdnormallink{http://www.opencascade.org}{http://www.opencascade.org/} (Linux and Windows).
To compile NETGEN with OpenCascade for Windows just choose the project settings ``Release (OCC)'' and adjust the proper search paths.
For Linux adjust the directory search paths OCC\_DIR, OCCINC\_DIR and OCCLIB\_DIR in the Makefile and in libsrc/makefile.inc. Then add -DOCCGEOMETRY to the CPLUSPLUSFLAGS2 in libsrc/makefile.mach.\$(MACHINE). If you use OpenCascade version 5.2 also add -DOCC52 and -DHAVE\_IOSTREAM to the CPLUSPLUSFLAGS2.
\subsection{Testing Netgen}
Please start Netgen by entering ``ng'' or clicking the ``ng.exe'' icon.
A white window with menu items should appear. Please load a geometry
file by selecting "File {\tt ->} Load Geometry", choose e.g.
tutorials/cube.geo. Then press the button "Generate Mesh". By keeping
pressed the left, middle or right button of your mouse you can rotate,
move or zoom the object. With ``File {\tt->} Export Mesh'' you can
save the mesh file.
\chapter{Constructive Solid Geometry (CSG)}
\label{chap_csg}
%
The CSG input format is a useful geometry format for small and
medium size geometries. One defines the geometry by writing an
ASCII file in a text editor.
The geometry is defined by the Eulerian operations (union,
intersection and complement) from primitives. A complete list of
availabe primitives is given in Section~\ref{sec_primitives}.
The following input describes a cube:
\begin{quote}
\begin{verbatim}
# A cube
algebraic3d
solid cube = orthobrick (0, 0, 0; 1, 1, 1);
tlo cube;
\end{verbatim}
\end{quote}
Lines starting with $\#$ are comment lines. Every CSG file must contain the
keyword {\tt algebraic3d} before any non-comment line.
The keyword {\tt solid} defines a named solid, here the solid {\it cube}
is defined. A solid is defined by the Eulerian operations applied to
primitives. Here, the solid is just the primitve defined by {\tt orthobrick}.
This is a brick parallel to the axis, specified by the minimal $x$, $y$, and
$z$ coordinates, and the maximal $x$, $y$, and $z$ coordinates. The present
definition gives the cube $[0,1]^3$. Finally, the definition {\tt tlo cube}
declares the solid {\it cube} as a top-level-object, what is necessary for
meshing.
Please start netgen with the geometry file above by entering
\begin{quote}
ng cube.geo
\end{quote}
Instead, you can also load the geometry from the file menu. You will
see a blue cube, which you can rotate by keeping the left mouse button
pressed. Pressing the big {\bf generate mesh} button will result in a
(very coarse) mesh of that cube.
Instead of using the primitive {\tt orthobrick}, one can also specify
a cube by intersecting six halfspaces (called planes). Each primitive
{\tt plane} is given by an arbitrary point in the plane, and a outward
vector, not necessarily a unit vector. The six halfspaces are intersected
by the keyword {\tt and}. The following input gives an equivalent result:
\begin{quote}
\begin{verbatim}
# A cube
algebraic3d
solid cube = plane (0, 0, 0; 0, 0, -1)
and plane (0, 0, 0; 0, -1, 0)
and plane (0, 0, 0; -1, 0, 0)
and plane (1, 1, 1; 0, 0, 1)
and plane (1, 1, 1; 0, 1, 0)
and plane (1, 1, 1; 1, 0, 0);
tlo cube;
\end{verbatim}
\end{quote}
To drill a hole though the cube, we will intersect the cube
and the complement of a cylinder. A cylinder is defined by two points
on the central axis, and the radius. Please note, a cylinder is
understood as an infinitely long cylinder (although the visualization
may suggest a finite cylinder):
\begin{quote}
\begin{verbatim}
# cube with hole
algebraic3d
solid cubehole = orthobrick (0, 0, 0; 1, 1, 1)
and not cylinder (0.5, 0.5, 0; 0.5, 0.5, 1; 0.1);
tlo cubehole;
\end{verbatim}
\end{quote}
Like {\tt and} denotes the intersection, {\tt or} denotes the union:
The problem is, that a domain is an open domain. Thus, the domain
{\it air} is not only the outer part, but also the interface between
{\it part1} and {\it part2}. The result is unspecified. To fix this
problem, one can define the {\it air}-domain by cutting out one big
brick:
\begin{quote}
\begin{verbatim}
solid air = cube and not othrobrick (0.2, 0.2, 0.2; 0.8, 0.8, 0.8);
\end{verbatim}
\end{quote}
\subsection{Degenerated edges}
Degenerated edges are found sometimes, but some still cause troubles.
A sphere on top of a cylinder my be described by:
\begin{quote}
\begin{verbatim}
solid cyl = cylinder (0, 0, 0; 1, 0, 0; 0.5)
and plane (0, 0, 0; -1, 0, 0)
and plane (1, 0, 0; 1, 0, 0);
solid main = cyl or sphere (1, 0, 0; 0.5);
tlo main;
\end{verbatim}
\end{quote}
The edge is a degenerated one. A work-around is to split the
domain (artificially) into two non-degenerated parts:
\begin{quote}
\begin{verbatim}
solid cyl = cylinder (0, 0, 0; 1, 0, 0; 0.5)
and plane (0, 0, 0; -1, 0, 0)
and plane (1, 0, 0; 1, 0, 0);
solid hemisphere = sphere (1, 0, 0; 0.5) and not plane (1, 0, 0; -1, 0, 0);
tlo cyl;
tlo hemisphere;
\end{verbatim}
\end{quote}
\chapter{Other Geometry Formats}
\section{Using IGES/STEP Geometries}
%
IGES and STEP are standard exchange formats for CAD files. Contrary to the STL format, IGES and STEP deliver an exact representation of the geometry and do not approximate it. In order to use IGES/STEP geometries you have to install NETGEN with the OpenCascade Geometry Kernel as described in \ref{subsec_occ}. Most solid modellers can export IGES or STEP files. However, often these files are not as exact as a mesher needs them to be. So is meshing fails, try repairing the model via {\bf IGES/STEP Topology Explorer/Doctor}.
\section{Using STL Geometries}
%
STL is a standardized file format to describe (approximate) geometies
by triangulated surfaces. It is useful to describe complicated parts
which are modeled with some CAD programmes. Also, some users have written
their own (C) programmes to define STL geometries, where was not so easy
to use the CSG format. The syntac of STL files is as follos
\begin{quote}
(not available yet. please figure out the syntax from the examples)
\end{quote}
We found that many STL geometries have some difficulties. Some of them
can be corrected (removed) by the {\bf STL - Doctor}. Please see the
corresponding manual pages (not available yet).
\section{2D Spline Geometry}
%
The extension for 2D spline geometry is ``.in2d''.
The boundary is given in terms of straight lines and of quadratic rational
spline patches.
A line is given by the two endpoints, a spline patch by 3 d'Boor
points. The patch is an elliptic arc from point 1 to point 3, such that
the lines 1-2 and 2-3 are tangents.
It is possible to use different subdomains with this format.
This file format also supports a priori mesh grading. To the spline
point i one adds a local refinement factor {\tt rp}$_i$ . Close to
this point the mesh-size $h(x)$ is {\tt h}$_{Glob}$ / {\tt rp}$_i$ .
The global parameter {\tt grading} describes how fast the mesh-size decreases.
The gradient of the local mesh-size function $h(x)$ is bounded by
$| \nabla_x h(x)| \leq\mbox{grading}^{-1}$
Also a refinement by a factor {\tt rs}$_i$ > 1 along the whole
{\tt np} is the number of points, {\tt ns} the number of spline segments.
Every segment starts with the domain numbers at the left and at the
right sides of the segment. Domain number 0 is reserved for the exterior.
Then the number of points and two or three point indices follow.
Finally, the refinement factor along the line follows.
\chapter{Mesh and Solution Formats}
You can export meshes to a couple of file formats. Some are self-defined,
some other are standard formats. The self-defined are the followings:
\section{Mesh Size File}
By means of a mesh size file you can provide a local mesh size density. The file extension must be {\it .msz}. If you want to use the mesh size file, you specify it in the ``Meshing Options'', doalog box, page ``Mesh Size''.
The syntay is:
\begin{verbatim}
np
x1 y1 z1 h1
x2 y2 z2 h2
....
xnp ynp znp hnp
nl
xs1 ys1 zs1 xe1 ye1 ze1 h1
xs2 ys2 zs2 xe2 ye2 ze2 h2
....
xsnl ysnl zsnl xenl yenl zenl hnl
\end{verbatim}
You specify {\tt np} points, given by the $(x_i,y_i,z_i)$-coordinates,
where the mesh size will be reduced at least to $h_i$. You specify
also {\tt nl} line-segments by the start-point and end-point
coordinates. The mesh-size along the whole line will be reduced to the given $h_i$.
\section{Neutral Format}
The neutral volume mesh format contains the following sections:
\begin{enumerate}
\item
nodes \\
After the number of nodes there follows a list of $x$, $y$,
and $z$-coordinates of the mesh-nodes.
\item
volume elements \\
After the number of volume elements there follows the list of tetrahedra.
Each element is specified by the sub-domain number, and 4 node indices. The
node indices start with 1.
\item
surface elements \\
After the number of surface elements there follows
the list of triangles. Each element is specified by the boundary
condition number, and 3 node indices. The node indices start with 1.
\end{enumerate}
\section{Fepp Format 2D}
The Fepp 2D format contains the following sections:
\begin{enumerate}
\item
boundary segmetns \\
After the number of boundary segments there follows a list of
segments. Each segment is specified by the spline - patch number,
and the two node indices. Counting starts with 1
\item
domain elements \\
After the number of domain elements there follows the list of elements.
Each element is specified by the sub-domain number, the number of nodes (3 or 4) and the node indices. Counting starts with 1
\item
nodes \\
After the number of nodes there follows a list of $x$ and $y$
-coordinates of the mesh-nodes.
\item
geometric information \\
After the number of spline patches there follows a list of spline specifications. Each spline patch is given by the 6 coefficients of the descibing
quadratic polynomial equation
$$
c_1 x^2 + c_2 y^2 + c_3 xy + c_4 x + c_5 y + c_6 = 0
$$
\end{enumerate}
\section{Surface triangulaton file}
One can export to and import from a surface mesh file. It´s structure
is as follows:
\begin{enumerate}
\item
{\tt surfacemesh}\\
starts with that keyword
\item
number of points \\
point coordinates $(x,y,z)$.
\item
number of surface triangles, \\
surface triangles oriented counter-clock wise when looking at the
object, index starts from 1.
\end{enumerate}
\section{Solution File Format}
The Netgen software includes also a simple visualizer for finite
element gridfunctions. It supports scalar fields (e.g. temperature),
and vector valued fields (flow velocities, mechanical deformations).
The solution field is imported by the menu item File $->$ Import Solution.
It is important to load the corresponding mesh in advance.
The format of the solution file is as follows. It consists of an
arbitrary number of blocks of this structure:
\begin{enumerate}
\item
{\tt solution}{\it function-name} flags
{\tt solution} is the keyword, {\it function-name} is a string to
refer to that functions. The supported flags are
\begin{enumerate}
\item -size=s \\
number of entries (default: number of mesh-points)
\item -components=c \\
number of components (default: 1). Mechanical deformations have 3 components.
\item -type=[nodal,element,surfaceelement] \\
the grid-funciton has nodal values, or one value per volume element,
or one value per surface element (default: nodal)
\end{enumerate}
\item
block of $size \times components$ values
\end{enumerate}
Please try out to import the solution file 'tutorials/cube.sol' fitting
to the mesh 'tutorials/cube.vol'.
\chapter{Netgen operations}
You can use netgen in interactive mode using its menus, or, you
can run netgen in batch-mode using command line arguments.
\section{Command line arguments}
Command line arguments are specified as {\it -flag=value}.
\begin{itemize}
\item -help \newline
Prints the availabel command line arguments
\item -geofile=filename \newline
Specifies geometry file. Is equivalent to {\it filename}, i.e., you can
scip {\it -geofile=}.
\item -meshfile=filename \newline
Mesh file will be stored in file {\it filename}.
\item -batchmode \newline
Exit after mesh generation. Otherwise, the GUI will be started