I have been a fan of OpenDX since long time ago. (See some videos in PETScFEMResults page.) However it seems that OpenDX is no more being actively developed so I started playing with VTK. My feeling is that VTK is great, and also that is very programmable. I started using ParaView which is also great, but for creating good videos I think that one has to do it with programming. I started coding in C++ but I found that many examples are in Python so that I started to code in Python.
A first example: Walking worm
This example is interesting because it has some features I'm interested in: deformable meshes, flying cameras. The files needed for running the scripts can be found in the attachment below (worm-data.tgz). The script is largely commented and self explained.
FEM simulation of elastic tube with large displacement formulation
This video shows a Finite Element simulation of the deformation of a hollow tube of a soft material with a large displacement formulation. The VTK Python script is available here. Details of the physical and numerical problem are available in PETScFEMElastLDResults.
From the point of view of VTK the example features are:
Moving mesh of an elastic structure
Visualization in colormap of the deformation on the skin with colormap
Rotating camera
Particle trail at the upper tube end for visualization of the trajectory.
Finite element mesh movement (relocation of nodes) for subsequent fluid structure interaction
We show here the relocation of nodes for a CFD computation with PETSc-FEM. The geometry is the well known Ahmed body for a subsequent fluid-structure computation. We show the intersection of the FEM tetra mesh with horizontal planes at the center of the body and also at mid distance between the base of the body and the floor (the spacing between the base of the body and the floor is 5cm). The relocation is shown for a yaw movement of 30 degrees and a shift in the transverse direction of +/-0.6 (the length of the body is 1.044). The mesh movement is done with the technique described here.
The VTK Python script is available here. The From the point of view of VTK the example features are:
A cut of a moving mesh
The surface of the body is shown in transparency
A rotating camera with varying shot distance
The Tower of Hanoi Problem
The Towers of Hanoi problems consists in moving n discs from peg A to peg B using peg C as auxiliary, according to the following rules
Pancake sorting is a variation of the sorting problem in which the only allowed operation is to reverse the elements of some prefix of the sequence. Unlike a traditional sorting algorithm, which attempts to sort with the least comparisons possible, the goal is to sort the sequence in as few reversals as possible. This operation can be visualized by thinking of a stack of pancakes in which one is allowed to take the top k pancakes and flip them.
Here we perform the visualization of a simple pancake sorting algorithm with VTK. The algorithm starts by flipping the top pancakes from the largest one to the top, so that the largest pancake goes to the top. Then, sorting the whole pancake stack we bring the largest pancake to the bottom. The subsequent move brings the second largest to the second position, and so on, recursively.
The VTK Python script is available here: pancake.py
Comparison of bubble sort (up) and quicksort algorithms (down) for sorting 30 items. The color represents the value of the item, so that once they are ordered they should be ranging from blue to red. Both algorithms are studied in basic computer science courses, here they are presented rather as an example of programming with Python-VTK. The python script is available here