Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,10 @@ function(MFC_SETUP_TARGET)
endif()

if (ARGS_HDF5)
find_package(HDF5 REQUIRED)
find_package(HDF5 REQUIRED COMPONENTS Fortran)
target_link_libraries(${a_target} PRIVATE HDF5::HDF5)
target_include_directories(${a_target} PRIVATE ${HDF5_Fortran_INCLUDE_DIRS})
target_link_libraries(${a_target} PRIVATE ${HDF5_Fortran_LIBRARIES})
endif()

if (ARGS_FFTW)
Expand Down
5 changes: 4 additions & 1 deletion docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,10 @@ To restart the simulation from $k$-th time step, see [Restarting Cases](running.

The table lists formatted database output parameters. The parameters define variables that are outputted from simulation and file types and formats of data as well as options for post-processing.

- `format` specifies the choice of the file format of data file outputted by MFC by an integer of 1 and 2. `format = 1` and `2` correspond to Silo-HDF5 format and binary format, respectively.
- `format` specifies the choice of the file format of data file outputted by MFC by an integer of 1, 2, or 3:
- `format = 1`: Silo-HDF5 format (default). Works with VisIt and ParaView 5.11 and earlier.
- `format = 2`: Binary format. Lightweight output for custom analysis pipelines.
- `format = 3`: Native HDF5 + XDMF format. Recommended for ParaView 5.12 and later compatibility. Produces portable, self-describing output without external library dependencies beyond HDF5.

- `precision` specifies the choice of the floating-point format of the data file outputted by MFC by an integer of 1 and 2. `precision = 1` and `2` correspond to single-precision and double-precision formats, respectively.

Expand Down
19 changes: 16 additions & 3 deletions docs/documentation/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,21 @@ To test the post-processing code, append the `-a` or `--test-all` option:
./mfc.sh test -a -j 8
```

This argument will re-run the test stack with `parallel_io='T'`, which generates silo_hdf5 files.
This argument will re-run the test stack with `parallel_io='T'`, which generates output files depending on the `format` parameter.
It will also turn most write parameters (`*_wrt`) on.
Then, it searches through the silo files using `h5dump` to ensure that there are no `NaN`s or `Infinity`s.
Although adding this option does not guarantee that accurate `.silo` files are generated, it does ensure that the post-process code does not fail or produce malformed data.

The test framework validates post-process output for the following formats:

| Format | Output Directory | Validation |
|--------|------------------|------------|
| `format=1` | `silo_hdf5/` | Checks HDF5 files for NaN/Infinity values |
| `format=3` | `hdf5_xdmf/` | Checks HDF5 files for NaN/Infinity, then validates XDMF metadata structure |

For Silo-HDF5 output (`format=1`), the test searches through the `.silo` files using `h5dump` to ensure that there are no `NaN`s or `Infinity`s.

For native HDF5+XDMF output (`format=3`), the test:
1. Validates all `.h5` files contain no `NaN` or `Infinity` values
2. Validates `.xdmf` metadata files have correct XML structure with required elements (`Domain`, `Grid`, `Topology`, `Geometry`, `Attribute`)

Although adding this option does not guarantee that fully accurate output files are generated, it does ensure that the post-process code does not fail or produce malformed data.

86 changes: 86 additions & 0 deletions docs/documentation/visualization.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,70 @@
# Flow visualization

MFC supports three output formats for post-processed simulation data. You may choose the format that best matches your visualization workflow:

| Format | Parameter | Output Directory | Best For |
|--------|-----------|------------------|----------|
| Silo-HDF5 | `format = 1` | `silo_hdf5/` | VisIt, ParaView ≤ 5.11 |
| Binary | `format = 2` | `D/` | Custom analysis scripts |
| HDF5 + XDMF | `format = 3` | `hdf5_xdmf/` | ParaView 5.12-6.0+, portable workflows |

## Output Format Details

### Format 1: Silo-HDF5 (Default)

Silo-HDF5 is the traditional MFC output format. It requires the Silo library and produces databases compatible with VisIt and older versions of ParaView.

**Directory structure:**
```
case_dir/silo_hdf5/
├── root/ # Index files for visualization
│ └── *.silo # One per time step
└── p0/, p1/, ... # Per-processor data files
```

**Pros:** Well-established, works with VisIt
**Cons:** Requires separate Silo library installation; ParaView 5.12-6.0.1 Silo reader is broken

### Format 2: Binary

Binary format writes raw floating-point data for custom analysis pipelines.

**Directory structure:**
```
case_dir/D/
└── *.dat # Raw data files
```

**Pros:** Lightweight, easy to parse programmatically
**Cons:** No built-in visualization support; requires custom readers

### Format 3: HDF5 + XDMF (Recommended for ParaView 5.12+)

Native HDF5 output with XDMF metadata provides a portable, self-describing format that works reliably with modern visualization tools without external library dependencies beyond HDF5.

**Directory structure:**
```
case_dir/hdf5_xdmf/
├── root/ # XDMF metadata files
│ ├── timestep_0.xdmf # Open these in ParaView
│ ├── timestep_100.xdmf
│ └── ...
└── p0/, p1/, ... # Per-processor HDF5 data
└── *.h5
```

**Pros:**
- Works with ParaView 5.12+ and later without Silo dependencies
- Fully portable across systems and software versions
- Self-describing via XDMF metadata
- Supports all MFC features: grid data, MHD fields, and Lagrangian bubble particles

**Cons:** Larger file sizes than Silo-HDF5 (internal compression not implemented yet)

**Usage:** Set `format = 3` in your post_process input file, then open the `.xdmf` files from `hdf5_xdmf/root/` in ParaView.

---

A post-processed database in Silo-HDF5 format can be visualized and analyzed using Paraview and VisIt.
After the post-processing of simulation data (see section [Running](running.md)), a directory named `silo_hdf5` contains a silo-HDF5 database.
Here, `silo_hdf5/` includes a directory named `root/` that contains index files for flow field data at each saved time step.
Expand All @@ -17,6 +82,27 @@ The figure below shows the iso-contour of the liquid void fraction (`alpha1`) in

![](../res/paraview.png)

### Visualizing HDF5+XDMF with ParaView 5.12+

ParaView 5.12-6.0.1 have issues with their ViSiT Silo plugin. Use `format = 3` (HDF5+XDMF) for post-processing:

1. Run post-processing with `format = 3` in your input file
2. Navigate to the `hdf5_xdmf/root/` directory
3. Open the `.xdmf` file for your desired time step (e.g., `timestep_0.xdmf`), or open the master time series file for aggregated time steps
4. ParaView will automatically load the grid and all available flow variables

**Opening Multiple Time Steps:**
Each XDMF file represents a single time step. To animate through time:
- Open the master time series XDMF file if generated
- Or, use the XDMF reader's time support if your ParaView version supports it

**Lagrangian Bubble Visualization:**
When simulations include Lagrangian bubbles (`lagrange_bubbles = .true.`), the XDMF file contains both:
- **Grid data:** Eulerian field variables on the computational mesh
- **Particle data:** Bubble positions and properties as point clouds

In ParaView, the particle data appears as a separate "Particles" grid that can be visualized using the Glyph filter to render spheres at bubble locations.

### Visualizing data in cylindrical coordinates

Visualizing data in cylindrical coordinates requires a coordinate transformation of the raw data in the database file.
Expand Down
Loading