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 nektar.info. 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.
Homebrew: brew install homebrew/science/oce
MacPorts: port install oce
Ubuntu/Debian: sudo apt-get install liboce-foundation-dev
liboce-modeling-dev
Other Linux installations have a version of OCE in their package manager, usually
called liboce
.
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:
Nektar++ IncNavierStokesSolver with pre- and post-processing tools,
After the completion of this tutorial, you will be familiar with:
the generation of a 2D mesh from a CAD file;
the visualisation of the mesh in Paraview or VisIt
running a simple simulation on this mesh with IncNavierStokesSolver; and
the post-processing of the data and the visualisation of the results in Paraview or VisIt.
Installed and tested Nektar++ v5.6.0 compiled from source. We will refer to the
directory where you installed Nektar++ as $NEK
for the remainder of the tutorial.
Make a directory of your choosing, for example tutorial
, and download the
tutorial files from mesh-generation-2d-step.tar.gz into this directory.
Unpack the tutorial files by using
tar -xzvf mesh-generation-2d-step.tar.gz
to produce a directory 2d-step
with subdirectories called tutorial
and complete
.
The tutorial folder contains:
a .stp file of a 2D cylinder geometry;
an .mcf file;
a session file which will run the mesh.
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:
1<NEKTAR> 2 <MESHING> 3 <INFORMATION> 4 <I PROPERTY="CADFile" VALUE="cyl.stp" /> 5 <I PROPERTY="MeshType" VALUE="2D" /> 6 </INFORMATION> 7 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> 15</NEKTAR>
Six key pieces of information are required to run the mesh generator:
CADFile
specifies the geometry file which will be meshed;
MeshType
tells the mesher what type of elements to produce: 3D, 3DBndLayer,
2D, 2DBndLayer;
MinDelta
, MaxDelta
and EPS
determine the minimum and maximum element sizes;
and
Order
defines the order of the high-order mesh.
The system automatically determines element sizing, δ as
δ = 2R | (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
.