VTK
VTK is the visualisation-output utility. It writes structured-grid (.vts) files (and parallel structured-grid .pvts files in MPI builds) that can be opened directly in ParaView. Individual modules (PhaseField, InterfaceProperties, DoubleObstacle, fluid-dynamics, …) call VTK::Write with a list of fields, and the module assembles the XML, base-64-encodes the binary payload, and in MPI builds stitches per-rank pieces into a single parallel file.
Key Classes and Concepts
VTK: a utility class exposing static helpers —Write,WriteHeader,WritePointData,WriteCoordinates,WriteEndPointData,CloseFile,encode_b64,compress_data.Field_t: the entry in thestd::vector<Field_t>that the caller hands toWrite. Each entry names one scalar, vector, or tensor field.
Component naming for tensor fields follows two fixed conventions, applied depending on whether the tensor is passed in Voigt or full matrix form:
- Voigt order:
xx,yy,zz,yz,xz,xy. - Full matrix order:
xx,xy,xz,yx,yy,yz,zx,zy,zz.
These labels appear as the component suffixes in the resulting ParaView array names.
Usage
Input
VTK has no dedicated .opi block. Two external inputs control it:
- The output cadence comes from
RunTimeControl: the call site guardsVTK::WritebehindRTC.WriteVTK(). - The output directory comes from
Settings:$VTKDirin the@Settingsblock.
Output
- Serial build: one
.vtsfile perWritecall, written into$VTKDir. - MPI build: one
.vtspiece per rank plus a root.pvtsassembler file.
Module-level wrappers such as Phi.WriteVTK(OPSettings, tStep) and IP.WriteVTK(OPSettings, tStep) construct the filename from the module name and the time step, then call VTK::Write internally.
Example
Direct use of VTK::Write is rare; users typically call the per-module wrapper.
if (RTC.WriteVTK())
{
Phi.WriteVTK(OPSettings, RTC.tStep); // phase-field fields
IP.WriteVTK(OPSettings, RTC.tStep); // interface energy / mobility
}Dependencies
- Settings — output directory and grid metadata.
- RunTimeControl — output cadence.
external/miniz.h— zlib-style compression of the binary payload.external/WinBase64/base64.h— base-64 encoding of the compressed payload.