Table of Contents

Home vtu2bin inigenerator

vtu2bin

FlowVC requires the velocity data be converted into binary files prior to exectution. These binary files contain the velocity data as well as the coordinate and connectivity information of your dataset and can be created using the vtu2bin command.

If you are using the recomended layout the best way to use this is from the project_root direcory running the following command with the –batch flag enabled.

python -m flowvcutils vtu2bin START STOP --batch

Where START and STOP is the starting and stopping timestep for your data set. This will generate the binary files for all of the simulation cases that you have with a single command.

Options

–root Text

In batch mode this is the root to the project directory. Ensure the .vtu files are located in the path root/case_/input_vtu/case_xxxxxx.vtu

If batch mode is not used, this is the directory where the .vtu files are located, with the default being the current dirctory.

–output TEXT

Output directory target to store bin files.

Batch Mode: This will be set to root/case_input_bin/ Non Batch Mode: Default = current working directory

–file_name TEXT

The base file name, used to locate the velocity files. (e.g., case1_ if the ".vtu" files are named case1_00000.vtu).

Batch Mode: This will be set to the subdirectory name. Non Batch Mode: default = current directory name

–batch

Flag to set the operating mode into Batch Mode to process all subdirectorys in the project. Otherwise it will process a single folder.

–extension TEXT

File extension of the data files. The default is '.vtu'. File formats ".vtp", ".vtk" and ".pvtu" file formats might work, but they have not been tested.

–increment INTEGER

The increment between each vtu file (default: 50).

–num_digits INTEGER

The number of digits in file name, (e.g., 5 for case1_00100.vtu) with the default being 5

–field_name TEXT

Field name for velocity data within the .vtu files. The default is 'velocity' and this is the only field name that was tested.

-h, –help

Show the help message with a description of all the options.

Binary File Data Format

FlowVC requires velocity files, and for an unstructured mesh requires a cordinates file, connectivity file, and an adjacency file to define the mesh. These files all share a common prefix, which can be any name you choose and is refered to here as InFilePrefix.

Velocity

If the velocity is defined discretely in time, each time instant should have its own separate file. The velocity data must be equally spaced in time. File names should follow the format InFilePrefix_vel.#.bin, where # is a unique index for each time instant. The difference between successive file time points must be consistent

Each file's content should begin with a time stamp, followed by the velocity vectors at each node.

\begin{equation} t_s \; \underbrace{u_0\; v_0\; w_0}_{\text{node 0}} \underbrace{u_1\; v_1 \; w_1}_{\text{node 1}} ....\; \underbrace{u_{n-1} \; v_{n-1}\; w_{n-1}}_{\text{node n-1}} \end{equation}
  • Cartesian Data: the order should loop over the x-direction in the innermost loop, followed by y, and then z in the outer loop.
  • Unstructured Data: The ordering must align with the nodes specified in the InFilePrefix coordinates.#.bin file.
  • 2D Data: you must still specify a third velocity component, \(w_i\), which can be set to 0.0.
Value Data Type
t double
u,v,w double

Unstructured Mesh

The unstructured mesh is defined by three files:

  • Coordinates File : InFilePrefix_coordinates.bin
  • Connectivity File: InFilePrefix_connectivity.bin
  • Adjacency File: InFilePrefix_adjacency.bin

Cordinates File

\begin{equation} n \; \underbrace{x_0\; y_0\; z_0}_{\text{node 0}} \underbrace{x_1\; y_1 \; z_1}_{\text{node 1}} ....\; \underbrace{x_{n-1} \; y_{n-1}\; z_{n-1}}_{\text{node n-1}} \end{equation}
  • n: The the number of points in the data set
  • \(x_i \; y_i \; z_i\): The cordinates of each node
Value Data Type
n int
\(x_i \; y_i \; z_i\) double

Connectivity

The connectivity specifies the indices of the 4 nodes that make up each element. The index of each node is based on coordinates file ordering counting from 0.

\begin{equation} e\; \underbrace{i_0^0\; i_0^1\; i_0^2\; i_0^3}_{\text{element 0}} \underbrace{i_1^0\; i_1^1\; i_1^2\; i_1^3}_{\text{element 1}} ... \underbrace{i_{e-1}^0\; i_{e-1}^1\; i_{e-1}^2\; i_{e-1}^3}_{\text{element e-1}} \end{equation}
  • e: The number of elements in the data set
  • \(i_i^j\): The index of the j'th node making i'th element in the dataset
Value Data Type
e int
\(i_i^j\) int

Adjacency

The adjacency file contains the indices of the adacent elements that share a face with the current element. The index of each element is based on the order of the connectivity file.

\begin{equation} e\; \underbrace{e_0^0\; e_0^1\; e_0^2\; e_0^3}_{\text{element 0}} \underbrace{e_1^0\; e_1^1\; e_1^2\; e_1^3}_{\text{element 1}} ... \underbrace{e_{e-1}^0\; e_{e-1}^1\; e_{e-1}^2\; e_{e-1}^3}_{\text{element e-1}} \end{equation}
  • Boundary Elements: For faces not shared with other elements set \(e=-1\)
  • Data Type

    e(int): The number of elements in the data set \(e_i^j\) (int): The index of the element that shares the j'th face for the ith element in the dataset. Note if the element face is not shared with another element (i.e. on the edge this is a -1)

Emacs 29.3 (Org mode 9.6.15)