action functions
|
Please note that the library has not been "officially" released. While we continue to work on the documentation, these web pages are likely to contain broken links and documents in draft form. Please send an email to if you wish to be informed of the library's "official" release. |
All of oomph-lib's existing elements implement the GeneralisedElement::output(...) functions, allowing the computed solution to be documented via a simple call to the Mesh::output(...) function, e.g.
// Open output file ofstream output_file("output.dat") // Call the mesh's output function which loops over the // element and calls theirs... Problem::mesh_pt()->output(output_file);
By default, the output is written in a format that is suitable for displaying the data with tecplot, a powerful and easy-to-use commercial plotting package -- possibly a somewhat odd choice for a an open-source library.
The FAQ contain an entry that discusses how to display oomph-lib's output with gnuplot and how to adjust oomph-lib's output functions to different formats.
Angelo Simone has written a python script that converts oomph-lib's output to the vtu format that can be read by paraview, an open-source 3D plotting package. The conversion script can currently deal with output from meshes that are composed of 2D quad elements -- the extension to 3D is work in progress.
The oomph-lib distribution contains three scripts:
bin/oomph-convert.py : The python conversion script itself. bin/oomph-convert : A shell script wrapper that allows the processing of multiple files. bin/makePvd: A shell script the creates the * .pvd files required by paraview to produce animations.
oomph-lib's bin directory to your path (in the example shown here, oomph-lib is installed in the directory /home/mheil/version185/oomph): biowulf: 10:31:50$ PATH=$PATH:/home/mheil/version185/oomph/bin
soln0.dat is the oomph-lib output produced by the adaptive solution of a Poisson equation in a fish-shaped domain. biowulf: 11:05:10$ ll total 824 -rw-r--r-- 1 mheil users 2292 May 21 09:19 soln0.dat
oomph-convert.py biowulf: 11:16:18$ oomph-convert soln0.dat
-- Processing soln0.dat
oomph-convert.py, ver. 20080514
Convert from oomph-lib Tecplot format to VTK XML format.
Dimension of the problem: 2
Plot cells defined
Field variables = 1
Conversion started
Coordinate defined
Connectivities defined
Offset defined
Element types defined
Field data defined
Conversion done
Output file name: soln0.vtu
* .vtu file biowulf: 11:32:08$ ll total 1024 -rw-r--r-- 1 mheil users 329874 May 21 09:19 soln0.dat -rw-r--r-- 1 mheil users 705294 May 21 11:16 soln0.vtu
biowulf: 11:34:08$ paraview --data=soln0.vtu
Select the "Display" tab...
...and make the data visible:
Now choose to colour the plot by the first (and, in the present example, only) variable to obtain a contour plot of the solution.
Switching to a wireframe representation shows the underlying mesh (each element is represented as a 5x5 sub-grid).
oomph-convert and makePvd scripts in action
oomph-lib's bin directory to your path (in the example shown here, oomph-lib is installed in the directory /home/mheil/version185/oomph): biowulf: 10:31:50$ PATH=$PATH:/home/mheil/version185/oomph/bin
soln?. dat are the oomph-lib output files that illustrate the progress of the mesh adaptation during the adaptive solution of a Poisson equation in a fish-shaped domain. biowulf: 11:05:10$ ll total 824 -rw-r--r-- 1 mheil users 2292 May 21 09:19 soln0.dat -rw-r--r-- 1 mheil users 176776 May 21 09:19 soln1.dat -rw-r--r-- 1 mheil users 278117 May 21 09:19 soln2.dat -rw-r--r-- 1 mheil users 367408 May 21 09:19 soln3.dat
oomph-convert on all files (the -z option adds zeroes to the numbers -- this is only required if the files are to combined into an animation by paraview) biowulf: 11:16:13$ oomph-convert -z soln*.dat -- Processing soln0.dat oomph-convert.py, ver. 20080514 Convert from oomph-lib Tecplot format to VTK XML format. Dimension of the problem: 2 Plot cells defined Field variables = 1 Conversion started Coordinate defined Connectivities defined Offset defined Element types defined Field data defined Conversion done Output file name: soln00000.vtu -- Processing soln1.dat oomph-convert.py, ver. 20080514 Convert from oomph-lib Tecplot format to VTK XML format. Dimension of the problem: 2 Plot cells defined Field variables = 1 Conversion started Coordinate defined Connectivities defined Offset defined Element types defined Field data defined Conversion done Output file name: soln00001.vtu [further output suppressed]
* .vtu files biowulf: 12:37:05$ ll total 2568 -rw-r--r-- 1 mheil users 5979 May 21 12:37 soln00000.vtu -rw-r--r-- 1 mheil users 377490 May 21 12:37 soln00001.vtu -rw-r--r-- 1 mheil users 592990 May 21 12:37 soln00002.vtu -rw-r--r-- 1 mheil users 789325 May 21 12:37 soln00003.vtu -rw-r--r-- 1 mheil users 2292 May 21 09:19 soln0.dat -rw-r--r-- 1 mheil users 176776 May 21 09:19 soln1.dat -rw-r--r-- 1 mheil users 278117 May 21 09:19 soln2.dat -rw-r--r-- 1 mheil users 367408 May 21 09:19 soln3.dat
* .vtu files can be displayed individually as discussed above. * .pvd file using makePvd biowulf: 12:40:56$ makePvd soln mysoln.pvd --> File mysoln.pvd created
biowulf: 12:42:08$ paraview --data=mysoln.pvd
* .pvd file is loaded you can customise the plot style as discussed in the previous example, and then use the "play/stop/..." buttons to animate the progress of the mesh adaptation.
Paraview allows you to save the animation in an avi file. However, note that the file cannot be displayed with xanim. mplayer seems to do the trick, though. Try it by downloading this animation.
1.4.7