mesh_vtu#

VTU writer sink for PhysicsNeMo Mesh objects.

Writes physicsnemo.mesh.Mesh objects to VTU (VTK UnstructuredGrid) files, producing output compatible with the PhysicsNeMo drop_test recipe and other VTK-based workflows.

The sink stores per-timestep displacement fields as point arrays (displacement_tNNNN), with mesh points set to reference coordinates (t=0). This format enables efficient storage and downstream reconstruction of position trajectories.

Classes#

MeshVTUSink

Write Mesh objects to VTU files.

Module Contents#

class physicsnemo_curator.domains.mesh.sinks.mesh_vtu.MeshVTUSink(
output_dir: str,
naming_template: str | None = None,
flip_triangle_normals: bool = True,
)#

Bases: physicsnemo_curator.core.base.Sink[physicsnemo.mesh.Mesh]

Write Mesh objects to VTU files.

Each mesh is written to a separate .vtu file. The sink stores:

  • Points: Reference coordinates (t=0 positions)

  • Cells: Element connectivity with VTK cell types

  • Point arrays: thickness plus displacement_tNNNN for each timestep, and optional stress fields (Von_Mises_tNNNN)

  • Cell arrays: Optional per-element fields

This format matches the output expected by the PhysicsNeMo drop_test recipe for physics-informed machine learning.

Parameters:
  • output_dir (str) – Directory where VTU files will be written.

  • naming_template (str | None) – Format string for output names. Placeholders: {index}, {seq}, {run_id}. Default: mesh_{index:04d}.

  • flip_triangle_normals (bool) – Whether to reverse triangle vertex order for VTK normal convention. Default is True.

Examples

>>> sink = MeshVTUSink(output_dir="./output/")
>>> paths = sink(mesh_generator, index=0)
>>> paths
['./output/mesh_0000.vtu']

Initialize the VTU sink.

Parameters:
  • output_dir (str) – Directory where VTU files will be written.

  • naming_template (str | None) – Format string for output names.

  • flip_triangle_normals (bool) – Whether to reverse triangle vertex order.

classmethod params() list[physicsnemo_curator.core.base.Param]#

Return parameter descriptors for the VTU sink.

Returns:

Descriptors for configuration parameters.

Return type:

list[Param]

set_source(
source: physicsnemo_curator.core.base.Source[physicsnemo.mesh.Mesh],
) None#

Set the source for resolving naming placeholders.

Parameters:

source (Source[Mesh]) – The pipeline source.

description: ClassVar[str] = 'Write Mesh objects to VTK UnstructuredGrid files'#

Short description shown in the interactive CLI.

name: ClassVar[str] = 'Mesh VTU Writer'#

Human-readable display name for the interactive CLI.

property output_dir: pathlib.Path#

Return the output directory path.