normal orientation should be consistent now
[engrid.git] / manual / tutorial_01.tex
blob22a9ff33c7f0a675aa6b6a1412f22d577ca6796c
1 \section{Tutorial 1: Creating a First Mesh}
3 \begin{figure}
4 \begin{centering}
5 \includegraphics{figures/Throttle}
6 \par\end{centering}
7 \caption{Throttle geometry}
8 \label{fig:throttle1}
9 \end{figure}
11 \subsection{Description}
13 This tutorial will demonstrate how to read a surface mesh and create a volume mesh for a CFD simulation. Figure \ref{fig:throttle1}shows the geometry which will be used for this tutorial; it represents an adjustable throttle. The file containing the surface mesh for this tutorial is called \sqt Throttle.msh\eqt and it can be downloaded from the \eg download page.
15 \subsection{Importing the Surface Mesh}
16 To start, please import the file choosing
18 \menu{Import \arr Gmsh \arr v2.0 (ASCII)}
20 from the menu bar. A file-dialogue will show and you can browse for the file and open it. Figure \ref{fig:T1_scr01} shows a screen-shot of \eg after importing the file. You can use the mouse to rotate, move, and zoom the view. This mouse interaction is the default mouse interaction provided by VTK.
22 \eg colours the faces of the surface grid in order to determine which side of the surface is inside a flow domain and which is outside. The outside is coloured in a pale green, but figure \ref{fig:T1_scr01} shows pale yellow; this means the surface is wrongly oriented and it needs to be corrected. To do this, please choose
24 \menu{Mesh \arr change surface orientation}
26 from the menu-bar. Afterwards the surface will be oriented correctly.
29 \begin{figure}
30 \begin{centering}
31 \includegraphics[width=14cm]{figures/tutorials/T1/scr01}
32 \par
33 \end{centering}
34 \caption{After importing the surface mesh}
35 \label{fig:T1_scr01}
36 \end{figure}
38 \subsection{Defining Boundary Conditions}
39 Unfortunately all faces belong to the same boundary condition and thus it is not possible to see inside the domain. To change this you can pick a surface on the side of the cylindrical geometry and then change its boundary condition to a different value. To pick a face, please point the mouse over a triangle and press the {}``P'' key on your keyboard. Afterwards you should see something similar to figure \ref{fig:T1_scr02}. To change the boundary code, please select
41 \menu{Mesh \arr set boundary code}.
43 A small dialogue will pop up and it offers to select a feature angle and a new boundary code. The new boundary code should be set to \sqt 2\eqt and the feature angle can remain at 45 degrees. With this setting you should set the whole side of the cylinder to a new boundary code and the faces should disappear, because they have not been selected for viewing yet. Now, do the same with the top (boundary condition 3) and the bottom (boundary condition 4) of the cylinder. To get rid of the red box, please point the mouse into an empty space and press {}``P'' again. Now would be a good time to save your work. Select
45 \menu{File \arr Save Grid As}
47 to save the file.
49 \begin{figure}
50 \begin{centering}
51 \includegraphics[width=14cm]{figures/tutorials/T1/scr02}
52 \par
53 \end{centering}
54 \caption{After picking a face}
55 \label{fig:T1_scr02}
56 \end{figure}
58 \begin{figure}
59 \begin{centering}
60 \includegraphics[width=14cm]{figures/tutorials/T1/scr03}
61 \par
62 \end{centering}
63 \caption{Physical walls for prismatic boundary layer}
64 \label{fig:T1_scr03}
65 \end{figure}
67 \clearpage
68 \subsection{Create Volume Mesh}
69 Creating a first volume mesh, including the boundary layer, is fairly easy now. First choose
71 \menu{View \arr boundary codes}
73 and select the boundary conditions 1 and 2, because these represent the physical walls of the geometry. You should now have something similar to figure \ref{fig:T1_scr03}. To create the grid, simply select
75 \menu{Mesh \arr create prismatic boundary layer},
77 select the boundary conditions 1 and 2 and click {}``OK''. You can watch the progress in the output window on the left side of the screen. This output window can be detached, moved somewhere else, or hidden completely. \eg indicates that it is busy in the status line at the bottom of the window. After \eg has finished you can select {}``tetras'' and {}``wedges'' from
78 the available options on the right side of \eg's main window. In order to see inside you should also enable the clipping options. The origin of the clipping plane can be set to (0,0,0) and the normal vector to (0,0,-1). If you now select to view only boundary condition 1 and choose
80 \menu{View \arr redraw}
82 your screen should look similar to figure \ref{fig:T1_scr04}. To get a nice tetrahedral part of the grid it is advisable to execute
84 \menu{Mesh \arr create improve volume mesh (NETGEN)}
86 once or twice. The mesh size distribution is not ideal for the first run of NETGEN. \eg uses an existing volume grid to compute a mesh size distribution and uses this as input for the next call of NETGEN. Normally you get a rather coarse tetrahedral grid together with the prismatic layer. The next call will produce a grid that might be somewhat too fine. Starting from the second call of
88 \menu{Mesh \arr create improve volume mesh (NETGEN)}
90 the grid should look rather nice (see figure \ref{fig:T1_scr04}).
92 \begin{figure}
93 \begin{centering}
94 \includegraphics[width=14cm]{figures/tutorials/T1/scr04}
95 \par
96 \end{centering}
97 \caption{First volume grid}
98 \label{fig:T1_scr04}
99 \end{figure}
101 \clearpage
102 \subsection{Refining the Boundary-Layer}
103 At the moment the boundary layer consists of a single layer of prisms. Refining the boundary layer is a straightforward process.
105 \important
107 Save the grid with the refined boundary layer to
108 a different file name, or don't save it at all (just export). At the
109 moment the refinement cannot be reversed and thus the grid spacing
110 cannot be changed. To do this, load the file with the initial one-layer
111 boundary layer and refine again.
114 To refine the boundary layer, choose
116 \menu{Mesh \arr divide prismatic boundary layer}.
117 \begin{figure}
118 \begin{centering}
119 \includegraphics[width=84mm]{figures/tutorials/T1/scr05}
120 \par
121 \end{centering}
122 \caption{Parameters for boundary layer}
123 \label{fig:T1_scr05}
124 \end{figure}
126 A small pop-up dialogue appears, where you can enter how many layers and how to space them. Relative spacing means, that the initial step size (on the wall) is a fraction of the average local edge length around a node. Absolute spacing uses a fixed distance for all first layer prisms; this will lead to a first layer of prisms which is parallel to the wall. Not all step sizes are possible and \eg will issue a warning if it cannot refine your boundary layer. For this tutorial the settings in figure \ref{fig:T1_scr05} should result in a decent boundary layer mesh.
128 \clearpage
129 \subsection{Applying a few Simple Modifications}
130 \eg offers the possibility to modify the grid by extruding certain boundaries. First we will add a pipe bend by applying a rotational extrusion to the upper boundary (code 3). Afterwards we will add straight sections for the in-flow and out-flow boundaries with the help of a normal extrusion. Please select
132 \menu{Mesh \arr extrusion}
134 and enter the parameters exactly as shown in figure \ref{fig:T1_scr06}. After clicking OK you should get a grid like the one shown in figure \ref{fig:T1_scr07}. The extrusion adds a new boundary code (5) which needs to be enabled with
136 \menu{View \arr boundary codes}
138 in order to view the newly created geometry. The layer height in figure \ref{fig:T1_scr06} corresponds to an angle in degrees for a rotational extrusion. To extend the pipe at the inlet a normal extrusion with the parameters from figure \ref{fig:T1_scr08} shall be used. If you do the same for boundary code 4 the grid should look like in figure \ref{fig:T1_scr09}. To simplify the later setup of a simulation it is advisable to reset the newly created boundary codes (5,6,8) to the initially set value of 2 for the pipe.
140 \begin{figure}
141 \begin{centering}
142 \includegraphics[width=132mm]{figures/tutorials/T1/scr06}
143 \par
144 \end{centering}
145 \caption{Parameters for rotational extrusion}
146 \label{fig:T1_scr06}
147 \end{figure}
148 \begin{figure}
149 \begin{centering}
150 \includegraphics[width=14cm]{figures/tutorials/T1/scr07}
151 \par
152 \end{centering}
153 \caption{Grid after rotational extrusion}
154 \label{fig:T1_scr07}
155 \end{figure}
156 \begin{figure}
157 \begin{centering}
158 \includegraphics[width=132mm]{figures/tutorials/T1/scr08}
159 \par
160 \end{centering}
161 \caption{Parameters for normal extrusion}
162 \label{fig:T1_scr08}
163 \end{figure}
164 \begin{figure}
165 \begin{centering}
166 \includegraphics[width=14cm]{figures/tutorials/T1/scr09}
167 \par
168 \end{centering}
169 \caption{Grid after normal extrusion}
170 \label{fig:T1_scr09}
171 \end{figure}
172 \clearpage
174 \subsection{Export the Grid to \foam}
175 Please select
177 \menu{Tools \arr edit boundary conditions}
179 and edit the boundary names and types according to figure \ref{fig:T1_scr10}. You can export the mesh using:
181 \menu{Export \arr OpenFOAM \arr OpenFOAM}.
183 This will prompt you for an \foam case directory and the mesh will be directly imported to the \foam format, using the boundary names and types you have defined earlier.
185 \important
187 OpenFOAM's checkMesh utility might report a bad mesh
188 in case of very thin prisms. A good strategy is to export the mesh
189 before the boundary layer is refined, run the checkMesh utility, and
190 then - if everything looks alright - refine the boundary layer.
192 \begin{figure}
193 \begin{centering}
194 \includegraphics[width=74mm]{figures/tutorials/T1/scr10}
195 \par
196 \end{centering}
197 \caption{Editing the boundary conditions}
198 \label{fig:T1_scr10}
199 \end{figure}