coconut_tools.group_vtu_files

Utility to merge .vtu files from multiple processors into a single file for ParaView visualization.

When COCONUT (or other MPI-based MHD solvers) produces separate .vtu files per processor, this tool collects them into a unified .pvtu file readable by ParaView.

Features: - Supports distributed output folder structures (e.g. one folder per timestep), - Automatically generates .pvtu headers referencing each processor’s .vtu file, - Can be integrated in batch visualization workflows.

Intended for post-processing and visualization of 3D MHD simulation results.

Functions

initialize(index, input_dir, output_dir, ...)

Merge distributed VTU files from Coolfluid into a single VTU file per time step.

merge_all_snapshots(input_dir, output_dir, ...)

Launch merging of distributed VTU snapshots, optionally using multiprocessing.

coconut_tools.group_vtu_files.initialize(index, input_dir, output_dir, timestep, start_time, nb_proc=900, stat=False, input_str='corona-flow0', remove=True)[source]

Merge distributed VTU files from Coolfluid into a single VTU file per time step.

Parameters:
  • index (int) – Snapshot index.

  • input_dir (str) – Path to the input directory containing distributed VTU files.

  • output_dir (str) – Path to the output directory to save merged VTU files.

  • timestep (int) – Time increment between snapshots.

  • start_time (int) – Starting snapshot index.

  • nb_proc (int, optional) – Number of processors used. Defaults to 900.

  • stat (bool, default False) – consider as stationary run if True

  • input_str (str, 'corona-flow0') – expected input name for vtu files

  • remove (bool, True) – remove splitted vtu if True

Return type:

None

Returns:

None

coconut_tools.group_vtu_files.merge_all_snapshots(input_dir, output_dir, start_time, timestep, nbmax, num_processes=5, nb_proc=900, use_pool=True, stat=False, input_str='corona-flow0', remove=True)[source]

Launch merging of distributed VTU snapshots, optionally using multiprocessing.

Parameters:
  • input_dir (str) – Path to the input VTU directory.

  • output_dir (str) – Path to the output VTU directory.

  • start_time (int) – Starting snapshot index.

  • timestep (int) – Time increment between snapshots.

  • nbmax (int) – Total number of snapshots to process.

  • num_processes (int, optional) – Number of parallel processes. Defaults to 5.

  • nb_proc (int, optional) – Number of distributed files per snapshot. Defaults to 900.

  • use_pool (bool, optional) – If True, use multiprocessing. If False, run sequentially. Defaults to True.

  • stat (bool, default False) – consider as stationary run if True

  • input_str (str, 'corona-flow0') – expected input name for vtu files

  • remove (bool, True) – remove splitted vtu if True

Return type:

None

Returns:

None