Skip to content

[Core][IO] Implement EnSight 6/Gold output for simulation results#13787

Open
loumalouomega wants to merge 60 commits intoKratosMultiphysics:masterfrom
loumalouomega:core/io/encas-support
Open

[Core][IO] Implement EnSight 6/Gold output for simulation results#13787
loumalouomega wants to merge 60 commits intoKratosMultiphysics:masterfrom
loumalouomega:core/io/encas-support

Conversation

@loumalouomega
Copy link
Member

@loumalouomega loumalouomega commented Sep 9, 2025

📝 Description

Introduction

After what was discussed in last Kratos workshop, this PR introduces EnSightOutput, a new class for exporting simulation results to the EnSight 6/Gold file format. This implementation allows users to generate a complete EnSight dataset, including case, geometry, and variable files, enabling advanced post-processing and visualization with the EnSight software or other compatible tools like ParaView or Hyperview (reason why this format was chosen).

Source: https://fr.scribd.com/document/156786965/Ensight-File-Format-Manual

The generated output files have been successfully loaded and visualized in ParaView and Hyperview to confirm the correctness of the mesh geometry and the plotted nodal/elemental data.

Sans titre

The EnSightOutput class provides a comprehensive solution for writing mesh geometry, along with both nodal and elemental results. It is designed to handle transient simulations by tracking and outputting data at different time steps. The input is very simiar and compatible with the one used in the VtkOutput.

Key features

  • EnSight 6/Gold compatibility: Generates standard .case, .geo, and variable files (.scl, .vec, .ten, etc.).
  • Nodal and elemental/conditional data: Supports the output of variables defined at nodes and elements. It includes functionality to extrapolate results from integration (Gauss) points to nodes before writing.
  • Transient analysis: Correctly handles time-dependent data by managing time step information within the case file.
  • Flexible configuration: Output behavior, including file format (ASCII/Binary) and variables to be printed, can be controlled via the Parameters object.
  • Structured & modular: The implementation is encapsulated within the EnSightOutput class, providing a clean interface for integration into the simulation workflow. The core logic is initiated by calling the PrintOutput() method at each desired step.

This feature significantly enhances the post-processing capabilities of the application by interfacing with a powerful, industry-standard visualization tool.

TODO

  • Binary output to be corrected (right now it is a corrupt output)
  • EnSight Gold implementation is done, but requires to implement the proper check and testing (requires to rewrite output check).

🆕 Changelog

…ilities::SkippableEntity for improved geometry handling
- Introduced a new header file `ensight_output.h` containing the EnSightOutput class for exporting simulation results in EnSight 6/Gold format.
- Implemented the EnSightOutput class with methods for writing case, geometry, and variable files, supporting both ASCII and binary formats.
- Added Python bindings for the EnSightOutput class in `add_io_to_python.cpp` to enable usage in Python scripts.
- Created a new Python script `ensight_output_process.py` to manage the output process, including folder handling and output frequency control.
- Enhanced the overall I/O capabilities of Kratos for better integration with EnSight visualization software.
…ableToFile methods to improve data writing logic and enhance clarity
…ableToFile methods to improve counter initialization and add new line handling
… from "per condition" to "per element" for clarity
…th fewer decimal places for improved readability and consistency across node vectors and scalars. Updated files include Main.0001.geo, Main.0002.geo, Main.DISPLACEMENT.0000.node.vec, Main.DISPLACEMENT.0001.node.vec, Main.DISPLACEMENT.0002.node.vec, Main.PRESSURE.0000.node.scl, Main.PRESSURE.0001.node.scl, Main.PRESSURE.0002.node.scl, Main.VELOCITY.0000.node.vec, Main.VELOCITY.0001.node.vec, and Main.VELOCITY.0002.node.vec.
…s and include the main model part in the output list.
- Introduced new reference files for QuadraticPrism3D and ascii3D geometries.
- Updated existing geo files to include submodel parts and corrected part indices.
- Added scalar and vector output files for BOUNDARY, DISPLACEMENT, PRESSURE, and VELOCITY variables in ascii3D.
- Enhanced the test suite to include tests for ascii output in 3D and specific geometries like QuadraticPrism3D and QuadraticHexahedra3D.
- Adjusted output precision in the test configuration for better accuracy.
@loumalouomega
Copy link
Member Author

loumalouomega commented Oct 3, 2025

NOTE: Deploy will never work because these chanegs come from my fork, and I am not going to cherry-pick to a branch in Kratos because is to many commits.

@RiccardoRossi
Copy link
Member

this is cool ... is it fast?

@loumalouomega
Copy link
Member Author

this is cool ... is it fast?

Well, it is more or less like legacy VTK, not particularly fast.

@RiccardoRossi
Copy link
Member

@sunethwarna @matekelemen you have a lot of experience with vtk output, can you take a look here in particularly to see if there can be some reuse of the vtu stuff?

@sunethwarna
Copy link
Member

Thanks for this nice feature @loumalouomega . I have the following concerns before doing a thorough review.

  • I would not put the format examples on the cpp, I think it is sufficient to have example files (which you have for testing) to know what the format looks like.
  • I would reformulate the code such that, most of the code duplications can be removed by using templating or creating methods.

The cpp itself is 3k+ lines, I would reduce the number of lines by doing the above mentioned things.

@sunethwarna
Copy link
Member

Another small question, does this support mpi ?

@loumalouomega
Copy link
Member Author

Another small question, does this support mpi ?

No, sorry

@loumalouomega
Copy link
Member Author

Thanks for this nice feature @loumalouomega . I have the following concerns before doing a thorough review.

* I would not put the format examples on the cpp, I think it is sufficient to have example files (which you have for testing) to know what the format looks like.

The problem is that there are different formats in here, the gold (7) and classic (6), and to actually implement without become crazy I think is relevant to have it there.

* I would reformulate the code such that, most of the code duplications can be removed by using templating or creating methods.

Which code duplications? (the data is written in a different manner depending of the data type, I cannot reuse code there)

The cpp itself is 3k+ lines, I would reduce the number of lines by doing the above mentioned things.

@loumalouomega
Copy link
Member Author

Any advance on this?

@loumalouomega
Copy link
Member Author

What is the status of this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Enhancement FastPR This Pr is simple and / or has been already tested and the revision should be fast IO Kratos Core Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants