460 likes | 643 Views
Mikko Lyly CSC, Finnish IT Center for Science Elmer User meeting, 29th May 2008, CSC, Espoo. ElmerGUI A new pre-processor for Elmer. Outline. Backgound Workflow Practical example On input file formats Excercise Custom menus. Background. Intended to replace ElmerFront:
E N D
Mikko Lyly CSC, Finnish IT Center for Science Elmer User meeting, 29th May 2008, CSC, Espoo ElmerGUIA new pre-processor for Elmer
Outline • Backgound • Workflow • Practical example • On input file formats • Excercise • Custom menus
Background • Intended to replace ElmerFront: • Enhanced mesh generation and mesh manipulation tools • Enhanced visualization routines (based on OpenGL and extensions) • Better compatibility with latest Solver • Programmable/customizable GUI • Less dependencies on external libraries • Portability (Linux, Windows, Mac) • ElmerGUI is not: • A CAD program – complicated 3D-geometries should be modelled by separate tools and imported into ElmerGUI in an appropriate format • A stand-alone-program – it needs ElmerSolver and ElmerPost (the “elmer-suite”) in path to solve the problem and visualize the results
Prequisites • Libraries: • Qt Cross-Platform Application Framework (version 4.2 or higher) • Qwt - Qt Widgets for Technical Applications (version 5 or higher) • Qt4: http://trolltech.com/products/qt/ • Qwt5: http://qwt.sourceforge.net/ • Licence: GPL • Qt4 is pre-installed on most Linux distributions • Binary installation packages available for Windows and Mac
Compilation • Getting the sources: $ svn co https://elmerfem.svn.sourceforge.net/svnroot/elmerfem elmefem • ElmerGUI is located in ”elmerfem/trunk/misc/Mesh3D”: $ cd elmerfem/trunk/misc/Mesh3D $ less LICENCES.txt • Follow the compilation instruction in README.txt: $ qmake –project $ qmake $ make
Mesh generation • Possibility to use the following mesh generators: • Tetgen (libtet compiled as a shared library) • Netgen (libng compiled as a shared library) • ElmerGrid (built-in) • No hard-coded dependencies on external generators • For more information and documentation, see: http://tetgen.berlios.de/ http://www.hpfem.jku.at/netgen/ http://www.csc.fi/elmer
Mesh generation • Tetgen (libtet) • Developed by Hang Si et al. at the Weierstrass Institute for Applied Analysis and Stochastics • Fast and efficient unstructured tetrahedral mesh generator • Licenced under the MIT-licence • Not free, but for private, research, and educational purposes it can be used at no cost and without further arrangements • Due to the commercial restrictions, libtet is not included in the binary distribution packages of Elmer. • The user has to make sure that he has a valid licence, or right to use the genarator otherwise, and download /compile the shared library from source: $ cd elmerfem/trunk/misc/tetgen_patches $ patch < patch_tetgen.h $ g++ -fPIC -c predicates.cxx $ g++ -fPIC -O -DTETLIBRARY -c tetgen.cxx $ g++ -fPIC -c ElmerAPI.cpp $ g++ -shared predicates.o tetgen.o ElmerAPI.o -o libtet.so
Mesh generation • Netgen (libng) • NETGEN was developed mainly by Joachim Schöberl within project grants from the Austrian Science Fund FWF ( Special Research Project "Numerical and Symbolic Scientific Computing", Start Project "hp-FEM) at the Johannes Kepler University Linz. Significant contributions were made by Johannes Gerstmayr (STL geometry) Robert Gaisbauer (OpenCascade interface). • Powerful triangular and tetrahedral mesh generator • Licenced under LGPL – included in the binary distribution packages of Elmer • Instructions for compiling libng from source can be found from $ cd elmerfem/trunk/misc/netgen_patches $ less README
Mesh generation • ElmerGrid • Built-in mesh generator and mesh manipulation tool • Very fast structured 1D/2D/3D-mesh generation • Able to import mesh files in several external formats
Mesh generation • Mesh generator chosen automatically by input-file-format: • STL (stereolitography format) – libtet or libng • SMESH (piecewise linear complex) – libtet • POLY (like SMESH but less restrictions) - libtet • OFF (Geomview's polyhedral file format) - libtet • PLY (polyhedral file format) - libtet • MESH (Medit's surface mesh file format) - libtet • GRD (elmergrid's native input file) - ElmerGrid • FDNET (Fidap's mesh file format) - ElmerGrid • MSH (Gmesh's file format) - ElmerGrid • MPHTXT (Comsol Multiphysic's mesh file format) - ElmerGrid • UNV (Ideas' universal file format) – ElmerGrid • Elmer's native mesh file format
Workflow ElmerGUI + ElmerSolver + ElmerPost ElmerGrid
Workflow • Open your input file (example: samples/grd/angle3d.grd):
Workflow • Optionally configure mesh generator and remesh:
Workflow • The values in the config dialog are inherited from cmd line tools:
Workflow • Remeshing is perfomed in a separate thread:
Workflow • Manipulate boundaries: Select a boundary by double clicking and choose ”divide surface” to split it by ”sharp edges”:
Workflow • Manipulate boundaries: Select boundaries by holding down the CTRL-key while double clicking. Choose ”unify surface” to join:
Workflow • Turn on/off boundary index numbering for verification:
Workflow • Define an equation (PDE-system) to solve:
Workflow • Let us define the ”heat equation” as an example:
Workflow • The equation can later be activated for modification from menu:
Workflow • Similarly, we can next define material properties and parameters:
Workflow • Data is given in the ”General” and ”Heat equation” tabs:
Workflow • Add body force:
Workflow • Add boundary conditions:
Workflow • Generate solver input file (sif):
Workflow • Edit the solver input file (if needed):
Workflow • Save the model:
Workflow • Run solver:
Workflow • Convergence monitor reveals possible problems:
Workflow • Invoke post processor:
Workflow • Visualize the results by Elmerpost:
Workflow • You can alternatively define/edit body properties by holding down the SHIFT-key and by double clicking any surface of the body:
Workflow • Similarly, boundary conditions may be (re)defined by holding down the ALT-key while double clicking a boundary:
Workflow • The SHIFT / ALT –functionality may also be activated from menu:
Workflow • There are some useful functions available from menu: • View -> Surface mesh (toggles the visibility of surface mesh) • View -> Sharp edges (show the ”sharp edges” separating boundaries) • View -> Compass (show coordinates) • View -> Hide/show selected (toggle the visibility of current selection) • View -> Numbering (useful for debugging and verification of the model) • View -> Reset model view (clear view) • Model -> Summary (get an overview of the model) • File -> Save picture as… (save the image in several formats) • Mesh -> Terminate (kills the meshing thread, if blocked) • Run -> Show convergence (toggles the visibility of convergece monitor) • Run -> Kill solver (kills the solver process, if necessary) • Run -> Kill postprocessor (kills ElmerPost, if necessary)
Input file formats • SMESH • Part 1 - node list • First line: <# of points> <dimension (must be 3)> <# of attributes> <# of boundary markers (0 or 1)> • Remaining lines list # of points:<point #> <x> <y> <z>[attributes] [boundary marker]... • Part 2 - facet list • One line: <# of facets> <boundary markers (0 or 1)> • Following lines list # of facets: <# of corners> <corner 1> <corner 2> ... <corner #> [boundary marker]... • Part 3 - hole list • One line: <# of holes> • Following lines list # of holes:<hole #> <x> <y> <z>... • Part 4 - region attributes list • One line: <# of region> • Following lines list # of region attributes:<region #> <x> <y> <z><region number><region attribute>...
Input file formats • Example (”L.smesh”): • 12 3 0 1 • 1 0 0 0 1 • 2 4 0 0 1 • 3 4 2 0 1 • 4 2 2 0 1 • 5 2 6 0 1 • 6 0 6 0 1 • 7 0 0 2 1 • 8 4 0 2 1 • 9 4 2 2 1 • 10 2 2 2 1 • 11 2 6 2 1 • 12 0 6 2 1 • 8 1 • 6 1 2 3 4 5 6 1 • 6 7 8 9 10 11 12 1 • 4 1 2 8 7 1 • 4 2 3 9 8 2 • 4 3 4 10 9 1 • 4 4 5 11 10 1 • 4 5 6 12 11 3 • 4 6 1 7 12 1 • 0 • 0
Input file formats • The previous smesh-file should produce the following output:
Input file formats • Mesh density control by volume constaints (see tetgen’s manuals for more details about command relevant line arguments):
Input file formats • It is possible to control the density locally by ”mtr-files” • Example (”L.mtr”): • 12 1 • 0.25 • 0.25 • 0.25 • 0.025 • 0.25 • 0.25 • 0.25 • 0.25 • 0.25 • 0.025 • 0.25 • 0.25
Input file formats • Activate local mesh density control by introducing argument ”m”:
Input file formats • Examples can be found from • Tetgen’s site at http://tetgen.berlios.de/ • INRIA’s mesh database at http://www-c.inria.fr/gamma/download/disclaimer.php
Customizing the GUI • The menus of ElmerGUI are constructed dynamically when the process is initiated • Menus are described by ”edf-files” (elmer-definition-file) which are written in XML containing problem specific information about dialog styles and dependencies on model data • The files are located in directory ”edf” (with respect to ElmerGUI) • An example of customizing the menus can be found from the course material and from Elmer’s web site
Finally… • ElmerGUI will be evolving in the near future • Tutoirials available from Elmer’s web site • User feedback is more than welcome