Applied-Scientific-Research / Omega2D

Two-dimensional flow solver with GUI using vortex particle and boundary element methods
GNU General Public License v3.0
28 stars 5 forks source link

Write high-order elements to VTK files #41

Open markstock opened 4 years ago

markstock commented 4 years ago

Omega2D will soon support volumetric computational elements, and ultimately high-order elements. VTK has supported biquadratic quads in the past, which aid visualization in ParaView, but not smooth contours. Since 5.5.0, ParaView has supported additional high-order elements. Here are some links pertaining to the support and definition of these elements.

Arbitrary order Lagrange finite element support in PV 5.5 Detailed discussion and node ordering of Lagrange elements in VTK from Kitware Discussion and links from GLVis issue Code specifying VTK element IDs and node order from MFEM - shows VTK_QUAD is 9 and HO Quad is 70 List of standard VTK element types C++ code to create quad and hex meshes in legacy VTK format FMS as an interchange format for HO elements

Also, look at Process_Results.f90 for quick-and-dirty node ordering (not sure where this is).

markstock commented 4 years ago

After generating test files for Lagrange elements of order 2 and 3 (9 and 16 points, respectively), I learned that ParaView 5.5.0 and 5.8.0 can read them. The elements can be automatically subdivided for smoother surface rendering as well. This looks nice. But contours are still terrible. In fact, they are even worse for these Lagrangian HO elements than for the standard bicubic quads! The contour lines are still jagged, and do not even fall onto the non-subdivided surface (i.e. some run beneath the surface and some above). It is essentially unusable.


<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32">
    <UnstructuredGrid>
        <Piece NumberOfPoints="16" NumberOfCells="1">
            <Points>
                <DataArray NumberOfComponents="3" Name="position" type="Float32" format="ascii"> 0.15 0.1 0.0 0.85 0.1 0.0 0.95 0.9 0.0 0.05 0.9 0.0 0.35 0.11 0.0 0.55 0.11 0.0 0.88 0.35 0.0 0.92 0.65 0.0 0.35 0.92 0.0 0.65 0.92 0.0 0.12 0.35 0.0 0.08 0.65 0.0 0.35 0.36 0.05 0.58 0.36 0.05 0.35 0.67 0.05 0.62 0.67 0.05 </DataArray>
            </Points>
            <Cells>
                <DataArray Name="connectivity" type="Int32" format="ascii"> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 </DataArray>
                <DataArray Name="offsets" type="Int32" format="ascii"> 16 </DataArray>
                <DataArray Name="types" type="UInt8" format="ascii"> 70 </DataArray>
            </Cells>
            <PointData Scalars="density">
                <DataArray Name="density" type="Float32" format="ascii"> 0.2 0.3 0.7 0.5 0.23 0.27 0.4 0.5 0.57 0.62 0.3 0.4 0.4 0.45 0.45 0.5 </DataArray>
            </PointData>
        </Piece>
    </UnstructuredGrid>
</VTKFile>```
markstock commented 4 years ago

My conclusion is that, given the current state, we should internally subdivide our HO elements into linear quads at higher resolution than the Legendre or Lagrange points themselves, and just write a larger number of VTK_QUAD elements into our vtu files.

markstock commented 4 years ago

AH! I spoke/wrote too soon. These higher-order elements are useful, but one must first "Tesselate" the elements, then apply Contour. image

markstock commented 4 years ago

Old-style bicubic quads are now supported as measurement features and writing to vtu with 4ad8baec399f5fc733a51cd99e55e3f51a878b50 Not closing this issue because we still do not support the arbitrary-order Lagrange elements (but is that necessary?)