Chapter 1

This tutorial covers the basic functionalities of the curvilinear mesh generator that is provided with NekMesh, the mesh utility program provided with Nektar++. This tutorial is designed to show the main features of the two-dimensional mesh generator.

To achieve the goals of this tutorial you will need an installation of the latest master version of Nektar++, available at This is because the features you will be using are relatively new and have yet to be included in the latest release. Standard installation instructions are applicable as described in the user guide, with one addition that CMake should be configured to include NEKTAR_USE_MESHGEN=ON. This will activate the installation of the relevant meshing routines.

Tip: When using the mesh generation routines Nektar++ will require an OpenCascade installation to be present on your machine. Nektar++ is capable of downloading and installing OpenCascade for you, but this is highly not recommended as the installation time is very large. OpenCascade Community Edition (OCE) can be installed through package managers:

Nektar++ will be able to pick up on any of these OCE installations. Installation of NekMesh on Windows with mesh generation is not possible due to the OpenCascade requirements at this time.

This tutorial additionally requires:

1.1 Goals

After the completion of this tutorial, you will be familiar with:

Task: 1.1 Prepare for the tutorial. Make sure that you have:

The tutorial folder contains:

1.2 Background

Curvilinear mesh generation capability was recently added to NekMesh. These routines aim to take a geometric definition, which is usually in the form of a CAD STEP file, and produce a valid curvilinear mesh. This is not always an easy task, but the system is fast and robust in 2D, so in this tutorial we shall focus our efforts there.

The design of the mesh generation system focuses on automation. As such, once provided with a CAD description of the domain only 4 numerical parameters are required to produce a mesh. The system uses a curvature based refinement and smoothness algorithms to obtain mesh sizings automatically. In this tutorial you will be introduced to using manual refinement fields to achieve more control over the mesh sizing.

NekMesh works on input and output files and both need to be specified as command line arguments. In the case of mesh generation the input is a .mcf, mesh configuration file, which is formatted similarly to the Nektar++ XML. This file contains the instructions and parameters the mesh generation system needs.

A barebones example of an .mcf file is:

2   <MESHING> 
4        <I PROPERTY="CADFile" VALUE="cyl.stp" /> 
5        <I PROPERTY="MeshType" VALUE="2D" /> 
6      </INFORMATION> 
8      <PARAMETERS> 
9        <P PARAM="MinDelta" VALUE="0.5" /> 
10        <P PARAM="MaxDelta" VALUE="3.0" /> 
11        <P PARAM="EPS" VALUE="0.1" /> 
12        <P PARAM="Order" VALUE="4" /> 
13      </PARAMETERS> 
14   </MESHING> 

Six key pieces of information are required to run the mesh generator:

The system automatically determines element sizing, δ as

δ = 2R  --------
  ε(2 - ε) (1.1)

where R is the radius of curvature of the CAD entity and MinDelta and MaxDelta place limits on the value of δ. It should be noted that, in the case of constant radius geometries, such as cylinders, changing the value of MaxDelta and MinDelta may not alter the mesh. That is because in this setting, EPS is controlling the sizing.

Currently the preferred CAD file format for use with NekMesh is the step203 format, which is a standard CAD format. This is because it contains topological information that makes high-order meshing much easier compared to other open CAD formats such as IGES.