MOTIOn

March 4, 2026 ยท View on GitHub

Modular HPC Optimized Toolkit for IO in Fortran

a pure Fortran 2003+ library providing a simple, agnostic API for parallel HDF5/XDMF I/O in MPI-based HPC applications.

CI Coverage GitHub tag License

๐Ÿ’พ HDF5+XDMF output
One call writes binary HDF5 data and XML metadata; MPI master/worker branching handled transparently
๐Ÿงฑ Three grid topologies
Cartesian uniform, Cartesian, and Curvilinear โ€” declare a block type and MOTIOn handles the geometry
๐Ÿ”„ Kind-generic field I/O
save_block_field/load_block_field overloaded for all Fortran kinds (R8Pโ€ฆI1P) and shapes (3-D field, vector, tensor, matrix)
โš™๏ธ Low-level control
Access hdf5_file_object and xdmf_file_object directly for custom dataspaces, attributes, and XML topologies
๐Ÿ—๏ธ Three-layer OOP
file_base_object โ†’ format objects โ†’ xh5f_file_object; extend any layer for custom formats
๐Ÿ–ฅ๏ธ MPI-parallel
Designed for distributed CFD solvers; each rank writes its own HDF5 file while the XDMF master collects metadata
๐Ÿ“ฆ Pre-built HDF5
GNU 14.2+ and nvfortran 25.3 HDF5 1.14.6 libraries included โ€” no separate HDF5 build required
๐Ÿ”ค Pure Fortran 2003+
Standard-compliant, no external dependencies beyond MPI and HDF5

Documentation

For full documentation (guide, API reference, examples, etc...) see the MOTIOn website.


Authors

Contributions are welcome โ€” see the Contributing page.

Copyrights

This project is distributed under a multi-licensing system:

Anyone interested in using, developing, or contributing to this project is welcome โ€” pick the license that best fits your needs.


Quick start

Write a parallel HDF5/XDMF output from a collection of Cartesian uniform blocks:

use motion
implicit none
type(xh5f_file_object) :: xh5f

call xh5f%open_file(filename_hdf5='out_rank'//trim(strz(myrank,2))//'.h5', &
                    filename_xdmf='out_procs'//trim(strz(nprocs,2))//'.xdmf')
call xh5f%open_grid(grid_name='blocks', grid_type=XDMF_PARAMETERS%XDMF_GRID_TYPE_COLLECTION_ASYNC)
do b = 1, nblocks
  call xh5f%open_block(block_type=XH5F_PARAMETERS%XH5F_BLOCK_CARTESIAN_UNIFORM, &
                       block_name='block_'//trim(strz(b,2)),                    &
                       nijk=nijk, emin=emin(:,b), dxyz=dxyz, time=time)
  call xh5f%save_block_field(xdmf_field_name='pressure',                              &
                             nijk=nijk,                                               &
                             field=pressure(1:nijk(1),1:nijk(2),1:nijk(3),b),         &
                             field_center=XDMF_PARAMETERS%XDMF_ATTR_CENTER_CELL,      &
                             field_format=XDMF_PARAMETERS%XDMF_DATAITEM_NUMBER_FORMAT_HDF)
  call xh5f%close_block
enddo
call xh5f%close_grid(grid_type=XDMF_PARAMETERS%XDMF_GRID_TYPE_COLLECTION_ASYNC)
call xh5f%close_file

See the full example in src/tests/motion_write_xdmf_file_test.F90.


Install

FoBiS

Standalone โ€” clone and fetch dependencies, then build:

git clone https://github.com/szaghi/MOTIOn && cd MOTIOn
FoBiS.py fetch
FoBiS.py build -mode tests-gnu && ./scripts/run_tests.sh --np 2

As a project dependency โ€” declare MOTIOn in your fobos and run fetch:

[dependencies]
deps_dir = src/third_party
MOTIOn = https://github.com/szaghi/MOTIOn
FoBiS.py fetch           # fetch and build
FoBiS.py fetch --update  # re-fetch and rebuild
ModeCommand
Shared libraryFoBiS.py build -mode shared-gnu
Static libraryFoBiS.py build -mode static-gnu
Tests (debug)FoBiS.py build -mode tests-gnu-debug
NVIDIA FortranFoBiS.py build -mode tests-nvf