Open the Gambit GUI by clicking on the Gambit icon in Windows or typing gambit at the Linux prompt.
Step 1: Importing geometry
Figure 1, Onera M6 geometry 
2. Import the wing geometry by going to File/Import/IGES and pick the file oneraM6.igs file from the computer.
Imported geometry is in millimeters as shown in the Fig. 1. Its a volume with a surface at the root.
Step 2: Building the Computational Domain
1. Let the domain be a box of side 40c, which means the farfield distance from wing geometry is 20c. Go to Geometry/Volume/Create Real Brick. For Width(X) input 40,000 and press Apply. A box volume as shown in Fig. 2 is created.


2. Create a dummy rectangular surface on xy plane. Go to Geometry/Face/Create Real Rectangular Face, input 60,000 under Width and press Apply. A face as shown in Fig. 3 is created.
3. Split the volume by this plane. Go to Geometry/Volume/Split Volume. Under Volume pick the box volume. Choose Faces(Real) under Split With. Lastly pick the dummy face under Faces and press Apply. Fig. 4, shows the Box volume splitted into two. Retain the volume in which the Wing is sitting and delete the other volume as shown in Fig. 5.



4. Use boolean operation to subtract Wing volume form this box volume. Go to Geometry/Volume/Subtract Real Volumes. Under Volume pick the box volume and under Subtract Volume pick Wing volume and press Apply. Geometric domain as shown in Fig. 6, is ready for generating the mesh.
Step 3: Surface meshing of Wing
1. We can have 6 group names for faces/edges namely Leading Edge, Tip, Trailing Edge and Wing, Symmetry and Farfield.
Under Leading Edge there are front 2 faces, Tip has 4 faces, Trailing Edge has one edge and Wing has one Upper and one Lower faces, Symmetry has one face and Farfield has 5 faces.
2. Wing Leading Edge:
We will generate ordered triangles for Leading Edge. This helps to generate stretched triangles which captures the high curvature Leading Edge with optimum cells. Go to Mesh/Edge/Mesh Edges pick Leading Edge upper curve at the root as shown in Fig. 7. Under Type pick Successive Ratio, Under Ratio input 0.9 and for Interval count input 15 and press Apply.



Copy this edge meshing parameters to lower curve at the root by going to Mesh/Edge/Link Edge Meshes and linking the upper curve with lower curve with a reverse direction for lower curve. Similarly do the linking to the 2 edges Leading Edge attached to Tip.
Edge mesh the spanwise 3 edges with 150 points with a Successive Ratio of 0.997 with a direction towards Tip.
With this all the edges of the 2 faces of Leading Edges are meshed as shown in Fig. 8.
Mesh the face by going to Mesh/Mesh Faces. Pick the 2 Leading Edge faces under Faces, let the Elements be Tri and Type be Map Split. Press Apply, face mesh as shown in Fig. 9 is generated.
3. Wing Tip
Surface Meshing of the Tip faces are done by using Sizing Function. Before we start using the sizing function we will make some modifications in the default settings. Go to Edit/Defaults/TOOLS/SFUNCTION. Change BGRID_MAX_TREE_DEPTH to 20 and BGRID_NONLINEAR_ERR_PERCENT to 15. Press modify to accept the changes. These options which control the sizing functions helps to get better and smoother grids.
Now lets start applying sizing function. Under Operation pick Tools/Size Function/Create Size Function.





Sizing function 1:
Fixed Type, Source: Tip Trailing Edge vertex [Fig. 10], Attachment: 4 faces of Tip [Fig. 11].
Start size = 3, Growth rate = 1.15, Max. size = 6.
Sizing function 2:
Figure 14, Surface mesh for Wing Tip 
Growth rate = 1.15, Max. size = 6
Mesh the face by going to Mesh/Mesh Faces. Pick the 4 faces of Tip under Faces, let the Elements be Tri and Type be Pave. Press Apply, mesh as shown in Fig. 14 is generated.
Sizing Function 3: Fixed Type, Source: Trailing Edge Tip vertex [Fig. 15], Attachment: Edge of Trailing Edge [Fig. 16].
Start Size = 1, Growth rate = 1.18, Max. size = 5.2.



Mesh the edge by going to Mesh/Edge/Mesh Edges. Pick Trailing Edge under Edges and let rest of the options be default. Press Apply. Edge mesh as shown in Fig. 17 is created.
5. Wing Upper and Lower



Mesh the face by going to Mesh/Mesh Faces. Pick the Upper and Lower faces of Wing under Faces, let the Elements be Tri and Type be Pave. Press Apply, mesh as shown in Fig. 20 is generated.
With this all the faces of the Wing is meshed. Figs. 2124 shows surface mesh at various regions of the Wing.





Step 4: Viscous padding
Figure 25, Boundary layer template applied 
Algorithim: Aspect ratio (last), First row (a) = 0.0024, Rows = 25, Last percent (c/w) = 35. Activate the button Internal continuity and under Attachment, pick all the faces of the Wing. Press Apply to get boundary layer template as shown in Fig. 25.
Step 5: Volume meshing
As a last step we will invoke a sizing function to generate volume mesh.



Next go to surface meshing option and pick the Symmetry face and press Apply. Surface mesh is generated. Zoom into the Leading Edge near the Symmetry plane as shown in Fig. 26. As you can see the cells in the viscous padding is distorted. To improve the cell quality go to Move Face Nodes under face meshing option. Under Face pick the Symmetry face and from the screen pick the node and move it to reduce the skewness as shown in Fig. 27. Let the button Smooth be active. Press Apply. Grid with improved quality as shown in Fig. 28 is obtained.
Figure 29, Volume mesh 
Step 6: Quality check
Now lets check the grid quality. Go to Global Control/Examine Mesh. Under Display Type pick Range. Under 3D Element activate tet and prism buttons and under Quality Type choose EquiSize Skew. Click Update. Total Elements as 1,661,478 is displayed.
Activate the Show worst element button, the element with maximum skewness is visually displayed and under Transcript the skewness quality value of 0.981347 is displayed. This value is quite acceptable for this configuration. Usually for zero thickness trailing edges skewed cells in the viscous padding are bound to come all along the trailing edges. Most of the commercial codes can accept this quality.
Step 7: Apply BC and Export mesh
To apply boundary conditions go to Operation/Zones/Specify Boundary Types. Under Name type onera_wing, Type = WALL, Entity: all the faces of the Wing. Press Apply.
Next, Name: Symmetry, Type: SYMMETRY, Entity: pick the symmetry face.
Lastly, Name: farfield, Type: PRESSURE_FARFIELD, Entity: pick the 5 faces of the outer domain box.
Under Zones go to Specify Continuum Types. Here pick the Domain Volume under Entity, let the Type be FLUID and type Name as Air. Press Apply.
As a last step, lets export the grid. Go to File/Export/Mesh. Type the name oneraM6.msh and press Accept. If the meshing is done properly and the boundary conditions are applied correctly the message "Mesh was successfully written to oneraM6.msh" will be displayed under Transcript.
This completes the tutorial for viscous grid for Onera M6 Wing.