FYI/Docs: Non-binary VTU export for readable XML result files
bc0n opened this issue · 1 comments
This issue is most likely a request for better documentation of result export and Solvers; at the least this will show up in searches.
Many xml readers error when encountering the binary formatted of the AppendedData block described here, making it difficult read result files in other programs. In tracing this 'invalid xml', I discovered the Solver options Ascii Output = True
and inverse Binary Output = False
, which lead to the AddVtuOutputSolverHack in ElmerSolver.F90. This was guided by setting Simulation.Max Output Level = 100
in the sif so that elmersolver.log
has all info messages.
This further showed that vtu files are written by an 'InternalVtuOutputSolver' Solver which doesn't receive the Ascii Output if set by the user's Solver section.
My workaround is to manually add a second Solver copied from the InternalVtuOutputSolver at L1397 via
Solver 2
Equation = InternalVtuOutputSolver
Save Geometry IDs = True
Output File Name = case_internalVtuOutputSolver.vtu
Ascii Output = True
Binary Output = False
No Matrix = True
Variable = -global vtu_internal_dummy
Procedure = "ResultOutputSolve" "ResultOutputSolver"
Exec Solver = after saving
Output Format = vtu
End
This then produces a readable xml result file with all of the result data in the xml DataArrays:
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
<UnstructuredGrid>
<Piece NumberOfPoints="166" NumberOfCells="905">
<PointData>
<DataArray type="Float64" Name="stress_xx" NumberOfComponents="1" format="ascii">
-2.9435022E+000 1.2484146E+000 -4.2152277E+000 7.0749965E-001 -1.8502473E+000 -1.2130537E+000 ...
</DataArray>
This is True. A .vtu ending activates a ResultOutputSolver instance and keywords with namepace "vtu:" are passed alongside. So "vtu: ascii output = logical true" should work.
The original error that broke binary reading in some versions of paraview is super annoying. It worked nicely for several years and I don't know when a fix to the expat library is to be expected.