Slinky is a package built to solve an initial value problem concerning an elastic rod whose initial configuration is a straight rod. The model is derived from the theory of unshearable and inextensible rods. The code was formerly written in C++/OpenGL. Some customizations were possible by changing the values of certain parameters of the computation in a text file.
For visualization tasks, the LCVM laboratory has developed DataViewer, a software that allows to use OpenGL in an easier and more powerful manner. Its philosophy is to provide classes in C++ that allow to start from more complex primitives without having to write the code using simple OpenGL primitives each time.
As we said above, DataViewer provides classes, i.e objects, that we may use to construct the geometrical objects we need. The most useful classes are
For example, we understand in seeing
the core code of DataViewer that DVlines inherits from DVpoints. Generally, the power of an
object oriented programming language is in the reusability of code. Moreover,
it is very pleasant to derive a complex primitive from another that is
simpler.
Slinky was initially composed of a file named "slinky.cc" containing all the code needed to represent the solution of the problem, combining C++ code and OpenGL functions with glu interface. The numerics is done by a file called "ivp.E.f" written in Fortran. The latter contains two function definitions that are "dna_data_compute.f" and "ode.f", which is the real solver. This function computes a system of N differential equations of first order in N variables, that can explicitly depend on the time or not. For our problem the time represents the arclength of the rod. The number N is in our case equal to fourteen.
The easiest way to construct a new base for Slinky is to rewrite all the code in order to translate it from a C++/OpenGL program to a DataViewer one so that we may integrate it in other computational programs of of the lab without difficulty. Moreover, it will be interesting to construct a more efficient interface for the Slinky package that we will write in the Python language that is the interfacing standard for DataViewer and the other packages developped in the lab. Schematically, the code of DataViewer receives input from the Ivp solver and from the interface. The output of the solver is the computed solution containing all the points of the curve. The interface provides the values of some geometrical parameters and allows to choose between a certain number of visualization options for the curve. The interface also communicates the physical parameters of the computation to the Ivp solver.
First of all, Slinky needs . After downloading it, follow the installation instructions. Don't forget to verify that you also have the libraries needed by DataViewer. Some frequent errors are to forget to initialize some environment variables. If you use the bash shell with a Linux box, you may need to do:
where foo is the absolute path to the DataViewer directory. People who use other platforms (Sun,SGI,...) have to look at the installation documentation for DataViewer very carefully.
Installing Slinky is very easy once you have DataViewer working. The file you download is a compressed one in tar format. or and copy it in the "applications" directory of DataViewer. After that, uncompress it with a tar instruction. You should have now a directory named Slinky. I sum up the steps
After that, you have to compile the package
Normally, it should work!
Slinky has several components built to study Initial Value Problem IVP. From a numerical point of view, Slinky uses a solver called Vode in double precision that may treat stiff and non stiff problems. You will see the amazing shapes that a straight rod may have under the different initial conditions you choose. The goal of Slinky is to link a powerful solver and a strong tool for visualizing the computed solution. Numbers by themselves say nothing, but binding them into DataViewer brings transparency!
Generally, solving the IVP is easy. You have to launch slinky. To sum up, you have to type
You should see two windows as shown below
Once you get that, you may begin to introduce your parameters in the different areas of the control panel.
You have four buttons that let you customize the problem. "IVP" is associated to the initial parameters and variables. "Geometry" to the geometrical parameters. "Material" and "Frenet" to the frames that you may want to represent or not. Quit may be pressed, once you have finished all your computations.
Inspect a little the IVP feature. You see that you have several variables and parameters that you may modify. Always be careful to write numbers in the entries, because you will get an error if you introduce something else when the computation will begin.
When you have finished with this panel, click on OK to modify other things. Look at the Geometry panel !
With this panel, you may customize the graphical features of the objects appearing in the window, representing the rod.
It is also possible to attach a frame along the rod. We have provided two types of frames : the first is the material frame of the rod that is derived directly from the computation. The second is the Frenet frame that is computed by considering only the position vector and its derivatives.
The panel for the Frenet frame is designed in the same manner.
After having customized your problem, you may launch the computation. Click on the File button. In the menu that appears, click on User and a little window will be generated containing a button labeled Draw. Finally, click on it and you should see a a result like the following
Here is an example of a material frame !
You may zoom, displace and rotate the figure as you want with the mouse or the cursors.
An interesting feature of DataViewer is to provide animations. Slinky gains very much of it.
A homotopy of the rod was developed in collaboration with Joel Langer. Slinky allows to observe the deformation dynamically. You launch the homotopy application in typing ./homotopy. You should see the two following windows
You have to click on the homotopy button to modify the parameters of this transformation
The other 4 parameters have the same meaning as for the Centerline section in the Geometrical Values panel seen before.
Let have a look now to an important feature of the package that allows us to see the impact of a variation on one or several external variables, i.e. the three components of the couple m and the net force n.
This Slinky feature allows you to recompute by modifying the IVP parameters and visualize the variation of the rod as an animation. Launch the variation part by typing ./variate. You will obtain these windows:
Most of the buttons are known, see more precisely to the Variation one.
When you have finished with the modifications, click on File and User. You will obtain the Draw button. Click on it ! After a little time, a shape will appear in the rendering window. As for the homotopy, click on the Animate button. Enjoy !
The following images contain samples of an animation sequence:
The last feature of Slinky provides an animation of the motion of the Frenet frame.
Type ./frenet to get this feature. As the other possibilities of the package, you obtain the windows
You have standard buttons. All the controls of this part of Slinky are identical to those previously described. Customize, then click File, User and Draw. Wait until a shape appears in the main window. Click Animate and so on.The following images contain some samples of the animation:
You can look at more samples by clicking on the first image on the top
of this document.
You may ask me any about Slinky, or contact the
laboratory.