To convert the Nektar++ output binary files (.chk and .fld) into a format which can be read by two common visualisation softwares: Paraview (.vtu format), VisIt (.vtu format) or Tecplot (.dat or .plt format) the user can run the following commands:
Paraview or VisIt (.vtu format)
FieldConvert test.xml test.fld test.vtu
Tecplot (.dat format)
FieldConvert test.xml test.fld test.dat
Tecplot or VisIt(.plt format)
FieldConvert test.xml test.fld test.plt
where FieldConvert
is the executable associated to the utility FieldConvert, test.xml
is the
session file and test.vtu
, test.dat
, test.plt
are the desired format outputs, either
Paraview, VisIt or Tecplot formats.
When converting to .dat
or .plt
format, it is possible to enable output with double precision,
which is more accurate but requires larger disk space. For example, double precision output in
plt. format can be produced with the command:
FieldConvert test.xml test.fld test.plt:plt:double
test.xml.gz
.While the basic VTK output detailed above (.vtu unstructured grid files) works without the third party VTK library, Nektar++ can also optionally be linked with the VTK library. By enabling VTK library support the creation of the VTK output files is offloaded to the VTK library rather than being manually written by Nektar++.
If you want to build a version of Nektar++ with integrated VTK library support, you need to
turn on the NEKTAR_USE_VTK
switch in cmake. This will then look for a compatible
VTK library on the system, VTK version 8.0.0 or higher is recommended for full
functionality because this is the minimum version which allows for high-order VTK
output. Versions older than this are supported but the high-order VTK output will be
disabled.
Using the VTK library automatically enables file compression on the output .vtu file which
can substantially reduce file sizes. This can be turned off with the command line option
uncompress
when using FieldConvert
.
FieldConvert session.xml field.fld output.vtu:vtu:uncompress
If Nektar++ has been compiled with NEKTAR_USE_VTK
enabled then there are certain
situations in which the legacy VTK output (manually writing rather than using the VTK
library) must be used. The current VTK library output only supports 1D, 2D, 3D and 3DH1D
(Quasi-3D) simulations. Any simulations with expansions other than those mentioned, such as
2DH2D will need to be converted using the legacy
option to invoke the manual Nektar++
VTK output.
FieldConvert session.xml field.fld output.vtu:vtu:legacy
The VTK library also adds two new output types that can be specified by the command line when choosing to output a .vtu format file, these are detailed below.
High-order output can be enabled using the option highorder
which first runs the mesh
through the equispacedoutput
module to get a truly equispaced mesh and then constructs a
.vtu file using arbitrary-order Lagrange polynomials. This gives a more precise representation
of the curvature of elements and allows for polynomial refinement using non-linear
subdivisions. This should result in smaller output files as refinement of the mesh
geometry can be computed on the fly. This allows for faster postprocessing in software
such as Paraview due to the reduced memory requirements. High-order output is
currently only implemented for non-homogenous expansions and does not support
pyramid elements. A minimum VTK version of 8.0.0 is required for the high-order
output, any VTK versions older than this will result in the high-order output being
disabled.
FieldConvert session.xml field.fld output.vtu:vtu:highorder
Multi-block output can be enabled using the option multiblock
which splits the mesh in to
separate blocks, one block for each domain, boundary, and any other composite. This allows
each block to be toggled in the visualisation software independently.
Multi-block output uses the composite/boundary/domain names defined in the session file to
label each block, so the ID numbers above will be replaced by the name if specified. It
is also necessary to include the CONDITIONS
section in the session file supplied to
FieldConvert
because this is where the boundary definitions are stored. Multi-block
output is currently only implemented for non-homogenous expansions i.e. 1D, 2D, and
3D.
FieldConvert session.xml conditions.xml field.fld output.vtu:vtu:multiblock
An example multi-block tree structure is shown in figure 5.1, with the default output on the left and the output with the optional defined names on the right.
Mesh
__
Domains
__
Domain ID 0
__
Composite ID 0
__
Composite ID 1
__
Domain ID 1
__
Composite ID 2
__
Boundaries
__
Boundary ID 0
__
Composite ID 3
__
Composite ID 4
__
Composite ID 5
__
Boundary ID 1
__
Composite ID 6
__
Boundary ID 2
__
Composite ID 7
__
Other composites
__
Composite ID 8
__
Composite ID 9
Mesh
__
Domains
__
Domain ID 0
__
Left section unstructured
__
Right section unstructured
__
Domain ID 1
__
Cylinder structured
__
Boundaries
__
Walls
__
Top wall
__
Bottom wall
__
Cylinder wall
__
Inlet
__
Left wall
__
Outlet
__
Right wall
__
Other composites
__
Cylinder inner interface
__
Cylinder outer interface
An additional advantage of using the VTK library is that when a filter is set up with
FieldConvert
to output a .vtu file, the mesh is now cached inbetween timesteps and only the
new expansion data is written each filter call. This can provide significant speedups by keeping
the geometry in memory. An example filter specifying a high-order and uncompressed .vtu
output is shown below:
1<FILTER TYPE="FieldConvert"> 2 <PARAM NAME="OutputFile">MyFile.vtu:vtu:highorder:uncompress</PARAM> 3 <PARAM NAME="OutputFrequency">100</PARAM> 4</FILTER>