Hi everyone,
With the recent merge of PR 195, PyFR
is now capable of exporting solution and grid data in vtu
format using high-order VTK cells, referred to as Lagrange cells in VTK
[1]. This allows VTK
(and therefore ParaView
) to utilize the same interpolation polynomials than those found in PyFR to represent high order solution data without explicit element sub-division. The order of the solution data found in the post-processing vtu
files may be controlled by the user as it will be explained further in this post. The advantages of the high-order VTK output method compared to the original subdivision method are
- Reduction of the size of post-processing files.
- Accurate computation of solution data gradients using the
Gradient of Unstructured Dataset
filter, without the need of directly storing the gradients in the output. - Enhancement of the visualization of solution data within the grid elements.
- Improved visual representation of curved non-linear elements (see all attached images for some examples of these benefits).
To display the solution in grids with high-order cells, VTK will internally sub-divide non-linear cells and then interpolate the solution to the the sub-division nodes (which are not visible unless the Point
representation option is activate within Paraview
) using Lagrange polynomials correspondent to the order of the considered element. The level of internal subdivision of ParaView
can be controlled using the Nonlinear Subdivision level
parameter which can be found within the Display
menu in Paraview as shown in the following image
See the Examples
section for more information on how the influence of this option in the visualization of high-order data.
Moreover, ParaView
will now directly read the physical time information of output vtu
files containing instantaneous solution data. This allows to utilize the physical time to improve the generation of animations within ParaView
and to better distinguish the information found in each solution snapshot. The user may discard the physical time information by selecting the Time Array
option in the Properties
widget.
These new additions are only compatible with ParaView >= 5.9.0
and VTK>=9.0
. If you do not have access to such versioning of the aforementioned tools, the subdivision method, which is activated with the -d
argument in the export
command, must be used. Refer to the following section for more information.
Usage
An example of the export
command which allows to obtain solution data with high-order cells in vtu
format is
pyfr export --order 4 mesh.pyfrm solution.pyfrs solution.vtu
The previous command will output the solution data using fourth order non-linear cells. The --order
argument may also be replaced with -k
. The subdivision argument -d
functionality remains unchanged although it is worth noting that it cannot be combined with the --order
argument. The former argument must be used if the post-procesing is not performed with ParaView >= 5.9.0
.
With this new implementation, some API changes have been introduced to the export
command. For example, if no arguments are provided then the solution will be exported in vtu
format using non-linear cells of order equal to the solution order. This might incur some regression issues as the export
command defaulted to one explicit subdivision before the implementation of this new functionality. Further information of the new export
command API will be available in the User Guide of the next release of PyFR
.
Examples
- Visualization of the curved shape of non-linear cells of a grid made up of degree 2 hexahedron (
hex27
elements) with different choices ofNonlinear Subdivision level
.
Nonlinear Subdivision level = 0
Nonlinear Subdivision level = 3
- Visualization of the
Density
variable in theeuler_vortex_2d
test case with different choices ofNonlinear Subdivision level
. The dots indicate the internal subdivision points thatParaView
generates to improve the visualization of high-order data.
Nonlinear Subdivision level = 0
Nonlinear Subdivision level = 1
Nonlinear Subdivision level = 2
Recommended practices in ParaView
:
- Utilize the
Clean to Grid
filter ofParaView
before proceeding with any operation, unless point merging results in unwanted visualization artifacts due to solution discontinuities (which might be the case for very high-order and/or under-resolved simulations). - Do not increase the
Nonlinear Subdivision Level
in intermediate steps of your postprocessing pipeline to avoid increasing the memory footprint and computational cost of your post-processing procedures. - Always activate the
Crinkle
option in theSlice
andClip
filters whenever possible to ensure that the resulting grid is made up high-order elements, otherwiseParaView
will output a triangulated grid without high-order data. - Activate the
Enable Auto-MPI
option inEdit->Settings
to speed-up the post-processing operations whenever possible.
Future work
- Choose the order of the non-linear cells based on the modal expansion of the solution within each element. If the solution at a given element is close to constant, there is no need to utilize a very high-order non-linear
VTK
cell to represent the solution within the considered element. - Compatibility with pyramid elements.
VTK
currently only supportsVTK_QUADRATIC_PYRAMID
as high-order pyramid element. Therefore, we have decided to drop support for high-order pyramid cells and we always use explicit subdivision for pyramid elements. - Allow to use explicit sub-division in combination with high-order
VTK
elements. - Add point merging functionality to the export procedure in
PyFR
. - Monitor possible changes and improvements of the implementation of high-order cells in
VTK
.
Acknowledgments
@GonzaloS: Implementation, Validation and Testing
@fdw: Implementation, Refactoring, Review and Testing
@Giorgio_Giangaspero: Review, Testing
@WillT: Review and Testing
Feedback
Please let us know if you find any bugs and do not hesitate to provide us with feedback to improve this newly added functionality.