46
ElmerGUI A new pre-processor for Elmer Mikko Lyly CSC, Finnish IT Center for Science Elmer User meeting, 29th May 2008, CSC, Espoo

ElmerGUI A new pre-processor for Elmer

  • Upload
    nerina

  • View
    22

  • Download
    0

Embed Size (px)

DESCRIPTION

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: - PowerPoint PPT Presentation

Citation preview

Page 1: ElmerGUI A new pre-processor for Elmer

ElmerGUI A new pre-processor for Elmer

Mikko Lyly

CSC, Finnish IT Center for Science

Elmer User meeting, 29th May 2008, CSC, Espoo

Page 2: ElmerGUI A new pre-processor for Elmer

Outline

Backgound Workflow Practical example On input file formats Excercise Custom menus

Page 3: ElmerGUI A new pre-processor for Elmer

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

Page 4: ElmerGUI A new pre-processor for Elmer

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

Page 5: ElmerGUI A new pre-processor for Elmer

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

Page 6: ElmerGUI A new pre-processor for Elmer

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

Page 7: ElmerGUI A new pre-processor for 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

Page 8: ElmerGUI A new pre-processor for Elmer

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

Page 9: ElmerGUI A new pre-processor for Elmer

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

Page 10: ElmerGUI A new pre-processor for Elmer

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

Page 11: ElmerGUI A new pre-processor for Elmer

ElmerGUI + ElmerSolver + ElmerPost

Workflow

ElmerGrid

Page 12: ElmerGUI A new pre-processor for Elmer

Workflow

Open your input file (example: samples/grd/angle3d.grd):

Page 13: ElmerGUI A new pre-processor for Elmer

Workflow

Optionally configure mesh generator and remesh:

Page 14: ElmerGUI A new pre-processor for Elmer

Workflow

The values in the config dialog are inherited from cmd line tools:

Page 15: ElmerGUI A new pre-processor for Elmer

Workflow

Remeshing is perfomed in a separate thread:

Page 16: ElmerGUI A new pre-processor for Elmer

Workflow Manipulate boundaries: Select a boundary by double clicking and

choose ”divide surface” to split it by ”sharp edges”:

Page 17: ElmerGUI A new pre-processor for Elmer

Workflow Manipulate boundaries: Select boundaries by holding down the

CTRL-key while double clicking. Choose ”unify surface” to join:

Page 18: ElmerGUI A new pre-processor for Elmer

Workflow Turn on/off boundary index numbering for verification:

Page 19: ElmerGUI A new pre-processor for Elmer

Workflow Define an equation (PDE-system) to solve:

Page 20: ElmerGUI A new pre-processor for Elmer

Workflow Let us define the ”heat equation” as an example:

Page 21: ElmerGUI A new pre-processor for Elmer

Workflow The equation can later be activated for modification from menu:

Page 22: ElmerGUI A new pre-processor for Elmer

Workflow Similarly, we can next define material properties and parameters:

Page 23: ElmerGUI A new pre-processor for Elmer

Workflow Data is given in the ”General” and ”Heat equation” tabs:

Page 24: ElmerGUI A new pre-processor for Elmer

Workflow Add body force:

Page 25: ElmerGUI A new pre-processor for Elmer

Workflow Add boundary conditions:

Page 26: ElmerGUI A new pre-processor for Elmer

Workflow Generate solver input file (sif):

Page 27: ElmerGUI A new pre-processor for Elmer

Workflow Edit the solver input file (if needed):

Page 28: ElmerGUI A new pre-processor for Elmer

Workflow Save the model:

Page 29: ElmerGUI A new pre-processor for Elmer

Workflow

Run solver:

Page 30: ElmerGUI A new pre-processor for Elmer

Workflow Convergence monitor reveals possible problems:

Page 31: ElmerGUI A new pre-processor for Elmer

Workflow Invoke post processor:

Page 32: ElmerGUI A new pre-processor for Elmer

Workflow Visualize the results by Elmerpost:

Page 33: ElmerGUI A new pre-processor for Elmer

Workflow You can alternatively define/edit body properties by holding down

the SHIFT-key and by double clicking any surface of the body:

Page 34: ElmerGUI A new pre-processor for Elmer

Workflow Similarly, boundary conditions may be (re)defined by holding

down the ALT-key while double clicking a boundary:

Page 35: ElmerGUI A new pre-processor for Elmer

Workflow The SHIFT / ALT –functionality may also be activated from menu:

Page 36: ElmerGUI A new pre-processor for Elmer

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)

Page 37: ElmerGUI A new pre-processor for Elmer

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>...

Page 38: ElmerGUI A new pre-processor for Elmer

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

Page 39: ElmerGUI A new pre-processor for Elmer

Input file formats The previous smesh-file should produce the following output:

Page 40: ElmerGUI A new pre-processor for Elmer

Input file formats Mesh density control by volume constaints (see tetgen’s manuals

for more details about command relevant line arguments):

Page 41: ElmerGUI A new pre-processor for Elmer

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

Page 42: ElmerGUI A new pre-processor for Elmer

Input file formats

Activate local mesh density control by introducing argument ”m”:

Page 43: ElmerGUI A new pre-processor for Elmer

Input file formats

Page 44: ElmerGUI A new pre-processor for Elmer

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

Page 45: ElmerGUI A new pre-processor for Elmer

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

Page 46: ElmerGUI A new pre-processor for Elmer

Finally…

ElmerGUI will be evolving in the near future Tutoirials available from Elmer’s web site User feedback is more than welcome