foamgen.vtk_tools

VTK support module

synopsis

Geometry and mesh manipulation using VTK.

Functions

stl_to_periodic_box(fin, fout, mins, sizes, …)

Move periodic STL into periodic box.

vtk_bin_to_ascii(fin, fout, origin, spacing)

Convert VTK file to ascii format.

foamgen.vtk_tools.stl_to_periodic_box(fin, fout, mins, sizes, render)[source]

Move periodic STL into periodic box.

Uses VTK to create foam in box with periodic boundary conditions. Divides the foam to 27 parts and reflects them over boundaries.

Parameters
  • fin (str) – filename of foam with all closed cells

  • fout (str) – filename of foam fully inside the box

  • mins (list) – origin coordinates

  • sizes (list) – box sizes

  • render (bool) – render scene if True

foamgen.vtk_tools.vtk_bin_to_ascii(fin, fout, origin, spacing)[source]

Convert VTK file to ascii format.

Intended for VTK files with 3D voxel data. Also adjusts origin and spacing.

Parameters
  • fin (str) – input filename

  • fout (str) – output filename

  • origin (list) – origin of coordinate system

  • spacing (list) – distance between the nodes in structured mesh