Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FYI/Docs: Non-binary VTU export for readable XML result files #461

Open
bc0n opened this issue Apr 5, 2024 · 1 comment
Open

FYI/Docs: Non-binary VTU export for readable XML result files #461

bc0n opened this issue Apr 5, 2024 · 1 comment

Comments

@bc0n
Copy link

bc0n commented Apr 5, 2024

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>
@raback
Copy link
Contributor

raback commented May 15, 2024

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.

http://www.elmerfem.org/forum/viewtopic.php?p=30053#p30053

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants