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#
Write |
Module Contents#
- class physicsnemo_curator.domains.mesh.sinks.mesh_vtu.MeshVTUSink( )#
Bases:
physicsnemo_curator.core.base.Sink[physicsnemo.mesh.Mesh]Write
Meshobjects to VTU files.Each mesh is written to a separate
.vtufile. The sink stores:Points: Reference coordinates (t=0 positions)
Cells: Element connectivity with VTK cell types
Point arrays:
thicknessplusdisplacement_tNNNNfor 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:
- classmethod params() list[physicsnemo_curator.core.base.Param]#
Return parameter descriptors for the VTU sink.
- set_source(
- source: physicsnemo_curator.core.base.Source[physicsnemo.mesh.Mesh],
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.
- property output_dir: pathlib.Path#
Return the output directory path.