CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   How to write general constants data in a vtk file? (https://www.cfd-online.com/Forums/main/213588-how-write-general-constants-data-vtk-file.html)

bitbotboop January 2, 2019 06:57

How to write general constants data in a vtk file?
 
Hello all,

I am doing a rigid body simulation using particles. For some frequent steps I dump the data as a unstructures grid into vtk file. The file looks like

```
# vtk DataFile Version 4.1
Data
ASCII

DATASET UNSTRUCTURED_GRID
POINTS 8 float
0.5674292 -0.0773167 1 1.0674142 -0.073434755 1 0.56354725 0.42266828 1 1.0635322 0.4265502 1 0.5674292 -0.0773167 1.5 1.0674142 -0.073434755 1.5 0.56354725 0.42266828 1.5 1.0635322 0.4265502 1.5

CELLS 0 0


CELL_TYPES 0


CELL_DATA 0

POINT_DATA 8

VECTORS Forces float
0 -2452.5 0 0 -2452.5 0 0 -2452.5 0 0 -2452.5 0 0 -2452.5 0 0 -2452.5 0 0 -2452.5 0 0 -2452.5 0

VECTORS Velocity float
91.1642 35.48708 -0.00000000017143556 91.16366 35.55712 0.00000000015566408 91.094154 35.486534 -0.00000000015566408 91.09361 35.556576 0.00000000017143556 91.1642 35.48708 -0.00000000017143556 91.16366 35.55712 0.00000000015566408 91.094154 35.486534 -0.00000000015566408 91.09361 35.556576 0.00000000017143556

SCALARS h float 1
LOOKUP_TABLE default
0 0 0 0 0 0 0 0

SCALARS m float 1
LOOKUP_TABLE default
250 250 250 250 250 250 250 250
```

I want use these files to postprocess and generate the results such that it is reproducible.
For that reason I need to know the information about the time of each file. I have seen some examples but I haven't found a file which puts the information about the time in its legacy file. And also I have some other properties of the rigid body such as center of mass, total mass, moment of inertia, etc.

All I found is putting point data but I can't find information on saving such constants. Any help.

naffrancois January 7, 2019 15:33

Hello, I do it this way:

# vtk DataFile Version 2.0
Unstructured Grid 2D Dataset
ASCII

DATASET UNSTRUCTURED_GRID
FIELD FieldData 2
TIME 1 1 double
0.0000000000000000
MASS 1 1 double
1.0000000000000000
POINTS 2042 float
.................................................

This way TIME and MASS appear as a constant for each vtk file.

bitbotboop January 7, 2019 19:35

Thank you for the reply. How about a array constants, as center of mad, as these are three values. Or say a array of constants like

P=[2, 6, 77, 87,66, 997]


All times are GMT -4. The time now is 11:26.