simulation in technology ug-interface for cad geometries ...€¦ · ug-interface for cad...

14
Interdisciplinary Center for Scientific Computing Simulation in Technology University of Heidelberg UG-Interface for CAD Geometries A. Hauser 1 and O. Sterz 2 Abstract Numerical simulation of real-world problems in computer aided engineering often requires the processing of complex CAD geometries. Powerful tools with fast algorithms must be supplied in order to cope with the huge amount of data. As the software package UG , combining parallelism and adaptivity with multigrid methods on unstructured grids, represents the ideal platform for solving large-scale problems, we describe the rather technical way of how CAD geometries might be preprocessed in order to incorporate their geometry and volume mesh into UG. The parametric geometry description is replaced by a surface triangulation that is very fine with respect to the volume mesh. Since we focus on solving discretised partial differential equations with geometric multigrid methods, we provide a volume mesh as coarse as possible. For the users of this method, a short manual, introducing the tools applied here, is appended. keywords: CAD geometries, UG, mesh generation, solid modelling 1 Introduction The group ’Simulation in Technology’ (SIT) is focused on developing fast algorithms for solving numerically partial differential equations in two and three dimensions. Practical relevant prob- lems are faced. For the numerical simulation of realistic problems the software package UG [1] has been developed, and is still expanding. Tackling real-world applications implies frequently processing CAD geometries, hence a robust CAD interface is essential. We are not interested in developing mesh generators or CAD kernels but in applying those tools for our purpose. We 1 IWR Simulation in Technology, University of Heidelberg, Im Neuenheimer Feld 368, D-69120 Heidelberg 2 IWR Simulation in Technology, University of Heidelberg, Im Neuenheimer Feld 368, D-69120 Heidelberg; Now at: CST GmbH, Bad Nauheimer Str. 19, D-64289 Darmstadt

Upload: others

Post on 12-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

Interdisciplinary Center forScientific Computing

Simulation in TechnologyUniversity of Heidelberg

UG-Interface for CAD Geometries

A. Hauser1 and O. Sterz2

Abstract

Numerical simulation of real-world problems in computer aided engineering often requires theprocessing of complex CAD geometries. Powerful tools with fast algorithms must be supplied inorder to cope with the huge amount of data. As the software package UG, combining parallelismand adaptivity with multigrid methods on unstructured grids, represents the ideal platformfor solving large-scale problems, we describe the rather technical way of how CAD geometriesmight be preprocessed in order to incorporate their geometry and volume mesh into UG. Theparametric geometry description is replaced by a surface triangulation that is very fine withrespect to the volume mesh. Since we focus on solving discretised partial differential equationswith geometric multigrid methods, we provide a volume mesh as coarse as possible.For the users of this method, a short manual, introducing the tools applied here, is appended.

keywords: CAD geometries, UG, mesh generation, solid modelling

1 Introduction

The group ’Simulation in Technology’ (SIT) is focused on developing fast algorithms for solvingnumerically partial differential equations in two and three dimensions. Practical relevant prob-lems are faced. For the numerical simulation of realistic problems the software package UG [1]has been developed, and is still expanding. Tackling real-world applications implies frequentlyprocessing CAD geometries, hence a robust CAD interface is essential. We are not interestedin developing mesh generators or CAD kernels but in applying those tools for our purpose. We

1IWR Simulation in Technology, University of Heidelberg, Im Neuenheimer Feld 368, D-69120 Heidelberg2IWR Simulation in Technology, University of Heidelberg, Im Neuenheimer Feld 368, D-69120 Heidelberg;

Now at: CST GmbH, Bad Nauheimer Str. 19, D-64289 Darmstadt

Page 2: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

apply ProEngineer3 as a modeller and ICEMCFD4 as the meshing tool. In this article, theconcept is described, how complex CAD geometries may be triangulated and incorporated intoUG.It should be mentioned, that the way chosen here was restricted by project deadlines. Therefore,the accent lies more on its fast implementation rather than on its best accomplishment.

2 Concept

The crucial point in the concept followed here is the fact that the complex parametric geometrydescription, in the CAD context often implemented with NURBS, is abandoned. This is realisedby triangulating the surface of the geometry with triangles very accurately and work further ononly with this discrete surface triangulation as the new approximated geometry description.No CAD kernel is needed anymore, instead fast algorithms for processing the large number ofsurface elements must be provided.It should be noted here that CAD geometries are often handed over between different CADpackages in the neutral formats STEP or IGES. The interfaces for these complex formats areunfortunately prone to errors and it is not always clear where possible problems may stemfrom. But, triangulating the surface of a CAD geometry shows immediately whether the modelis consistent or not. Moreover, one may find specific deficient zones much faster and mighteliminate them. Having the surface triangulation as the new geometry description at hand, thevolume can be meshed.With fast PERL-Converters the volume mesh and surface triangulation are both processed tothe UG proprietary file formats ’lgm’ for the geometry and ’ng’ for the volume mesh (Figure 2).Here, ’lgm’ stands for ’linear geometrical model’. ’ng’ stems from the mesh generator NETGEN[3], of which an old version was embedded in UG, but which is not used anymore.It should be mentioned that adaptive mesh refinement requires a volume mesh and the cor-responding geometry. When adapting the volume mesh, newly created vertices of boundaryelements are projected onto the geometry. The finer the volume mesh, the better the geometryis resolved. In Figure 1 the coarse volume mesh is successively refined resembling more andmore the geometry of a sphere.

Figure 1: Adaptive refinement.

3Pro/ENGINEER marketed by ’Parametric Technology Corporation’ (PTC)4ICEM CFD Engineering marketed by ANSYS Inc.

2

Page 3: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

UG

CAD

Faceted Geometry

Coarse Grid

Meshgenerator

Figure 2: From CAD geometries to UG-grids: a principle sketch.

3

Page 4: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

3 Commercial Tools

Modelling and triangulation of complex CAD geometries can only be tackled with the help ofprofessional modelling and meshing tools. We favoured the commercial tools ProEngineer andICEMCFD.

3.1 Solid Modeller

As one of our cooperation partners uses ProEngineer as their main modelling tool, we adoptedProEngineer for modelling as well as for triangulating the geometry’s surface.

3.2 Mesh Generator

The variety of volume-meshing tools is impressing and it is not easy to find its pros and cons.Having compared several mesh generators, we finally chose ICEMCFD. It is a stand-alone soft-ware package using the octree-method as its main meshing approach. The typical algorithmconsists of three steps:

• Octants are split to resolve small features and to attain desired edge lengths.

• Octree vertices are warped so that they lie on the input geometry.

• Interior quadrants are meshed (Throw away exterior portions).

In general, octree-based meshing algorithms create too many elements and elements with poorquality near boundaries [4]. This leads, in particular, to a long meshing time and to manysmoothing iterations, until an adequate mesh is generated.Additionally, ICEMCFD produces sometimes inaccurate meshes, which do not resolve theboundaries sufficiently, leading to inconsistencies in UG . Although we circumvent this diffi-culty by treating complicated parts of the domain differently, this time consuming and tedioustask not always leads to one’s destination.On the other hand, ICEMCFD is robust and very flexible in operating differently on parts ofthe domain that require different meshing parameters.Finally, it is a reasonable priced meshing generator, with which quite complex geometries havebeen meshed (see examples below).

4 The Converters

Most of the work was invested in the design and implementation of the converters. They serveas interfaces between ProEngineer, ICEMCFD and UG. Hereby, the converters represent onthe one hand merely formatting tools or, on the other hand, tools that reconstruct geometricinformation.Because of its power in processing text and flexibility in treating many other aspects of program-ming, the programming language PERL was adopted. But, it should not be left unmentionedthat these positive features are bought with time-consuming and storage-intense algorithmsapplied by PERL.The following converters are to be considered:

4

Page 5: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

• fnf2lgmThe ’fnf’-file is a ProEngineer proprietary file and describes the surface triangulation car-ried out in ProEngineer. The converter ’fnf2lgm’ simply maps the ’fnf’-format onto theUG-format ’lgm’ for the geometry description.

• lgm2gnuThis tool checks the consistency of the new generated ’lgm’-file.

• lgm2tetin’lgm2tetin’ converts the ’lgm’-file into the ICEMCFD proprietary ’tin’-file describing thegeometry.

• projectPtsAs already mentioned above, ICEMCFD resolves the geometry only within a relativelylarge tolerance. Because the tolerances in UG are smaller, the vertices of the volume meshlying at the boundary must be projected exactly (with computational accuracy) onto thegeometry, i.e. the surface triangulation.

• lgm+star2ngThis last converter finally generates the grid-file ’ng’ as it reads the geometry file ’lgm’and the volume mesh file in the ’star’-format exported by ICEMCFD.

5 Fast Algorithms

Mesh adaptation and reconstructing the volume mesh from the ’star’-file and ’lgm’-file requiresthe mapping from vertices of the volume mesh to the surface triangle next to it. For a reasonablemesh and surface triangulation we may assume m ∼ n, with m the number of volume elementsand n the number of surface triangles. Simple aproaches for projecting every boundary vertexof a volume element onto the nearest surface triangle lead to an algorithm of complexity O(n2).As the number of n and m respectively may count several millions, the task won’t be managedwithin a tolerable time frame. Hence, fast algorithms are indespensible. Here, binary searchtrees are applied to accelerate the mapping algorithm. They are realised in the PERL-module’tree.pm’ and c-file ’bbtree.c’ in UG. Using these data structures, the complexity adds up toO(n log n).Additionally, in order to generate the volume mesh file ’ng’ from the star-file, the informationwhich surface of an tetrahedron lies at the boundary of the geometry is reconstructed. Thecomplexity of this algorithm is O(n) and is implemented in ’lgm+star2ng’.

6 Examples

After having described the methods for incorporating CAD geometries into UG, this sectionshould give an overview of the geometries that have already been computed on.In numerical simulations also the environment may be considered, e.g. in computational electro-magnetics or heat transfer. Therefore, often a box is wrapped around the geometries increasingthe number of elements considerably. For the sake of better visualisation, in the following, allgeometries and volume meshes are plotted without the environment.

5

Page 6: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

First, simple geometries modelled by the authors are presented. They only serve for the eval-uation of the tools explained above. Figure 3 shows a triangulated cube and sphere. Figure 4gives an impression of the flexibility of modelling.

Figure 3: Unitcube (1500 tets), sphere (1888 tets)

Figure 4: Flower: CAD model and volume mesh (2052 tets)

Now we arrive at geometries, where only powerful tools will tackle the task within a tolerabletime frame and with a good mesh quality. Figure 5 shows the team7-benchmark geometry forthe evaluation of electromagnetic codes [5]. Figure 6 shows a hollow conductor (pol) installedin gas-insulated switch gears. In Figure 7 a rather complex geometry is given. It distinguishesitself in having small and large surfaces leading to locally very different meshing parameters.This makes the triangulation process difficult. Figure 8 displays a mixing device, where thecomponent shown on the left is subtracted from a cylinder leading to the actual geometry to

6

Page 7: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

be triangulated. Figure 9 shows the most complex geometry with a cylindrical case and threecomplicated shaped conductors. On this geometry with a coarse grid of 66557 tetrahedra, thenumerical simulation of the magnetic and current field [5] as well as the induced temperaturefield [6],[2] has been carried out.

Figure 5: Team7: CAD model and volume mesh (5663 tets)

Figure 6: Pol: CAD model and volume mesh (9199 tets)

7

Page 8: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

Figure 7: Skinproblem: CAD model and volume mesh (69903 tets)

Figure 8: Mixing device: CAD model and volume mesh (6632 tets)

8

Page 9: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

Figure 9: GIS: CAD model, mesh of the case and interior conductors respectively (66557 tets)

References

[1] P. Bastian, K. Birken, K. Johannsen, S. Lang, K. Eckstein, N. Neuss, H. Rentz-

Reichert, and C. Wieners, UG - a flexible software toolbox for solving partial differentialequations, Computing and Visualization in Science, 1 (1997), pp. 27–40.

[2] A. Hauser and O. Sterz, Complex modelling of heat distribution in a switch gear causedby eddy current losses. In preparation, 2005.

9

Page 10: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

[3] J. Schoberl, NETGEN - an advancing front 2D/3D-mesh generator based on abstract rules,Comput. Visualiz. Sci, 1 (1997), pp. 41–52.

[4] J. Shewchuk, Quadtree- and octree-based algorithms for mesh generation, 1999. Lecture12.

[5] O. Sterz, Modellierung und Numerik zeitharmonischer Wirbelstromprobleme in 3D, PhDthesis, IWR-Simulation in Technology, University of Heidelberg, 2004.

[6] O. Sterz, A. Hauser, and G. Wittum, Adaptive local multigrid methods for the solutionof eddy current problems, In preperation, (2004).

10

Page 11: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

A Manual

A.1 Introduction

Opposing the description given above about the general principle, this section should illuminatethe practical way, how a CAD geometry might be brought into UG.Principally, this newly developed way is based on the domain interface ’lgm’.All PERL converters can be found in ’UG/ug/pm’.

A.2 Course of Action

A.2.1 ProE

In order to map the different components onto the subdomains in UG , the components areencoded with pressure values. Every component must have one pressure load. The valuescorrespond to the sequence the components are listed in the model tree on the left hand side.If a model consists of e.g. one component containing another component (e.g. a sphere in acube), one of two methods for treating such models must be chosen:

1. Cut OutThe inner component is cut out from the outer component by boolean operations.

2. Setting Pressure in a Special WayThe pressure values consist of a number with one decimal. The first value corresponds tothe subdomain the component should posses in UG, the second value indicates with whichother component it stays in contact.

For trivial geometries it is easier to just cut out the inner components. If the inner componentsare very complex, the cutting-out process may fail, why there exists the second way.In ProEngineer (ProE) the model is a ’part’ or an ’assembly’. A ’part’ is just one componentwith one material. An assembly consists of several components.’Mechanica’ is a module in ProE. In this module the actual surface triangulation as the newgeometry description is carried out. The modelling module is called ’Standard’.In order to be able to write a mesh into a file, the following settings must be carried out:

• ’Standard’: switch on ’Struc Simulation SET’ in the menu ’utilities→floating modules’

• ’Mechanica’: set the FEM-mode in the ’Menu Manager’ menu

Now, one can proceed in the following way:

1. Modelling or ImportThe CAD geometry is either modelled or imported via the neutral formats STEP or IGES.Because ProE is a solid modeller, one has to ensure that the model consists not just ofseveral surfaces, but really represents a solid.

2. Components Contained in ComponentIf the ’Cut out’-way is preferred, do the following: In the ’assembly’ mode, the innercomponents are cut out from the outer:Manager Menu, ’Standard’: Component→Adv Utils→Cut Out

11

Page 12: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

3. Setting the Pressure ValuesIn Mechanica, set for every part the pressure:Manager Menu: Structure→Loads→New→pressure

4. Create AnalysisBecause ProE is also a simulation tool, a formal analysis with a name, completely irrelevantfor us, must be created:Manager Menu, ’Mechanica’: Structure→Analyses→New

5. Creating a Surface MeshThe surface mesh can be created now:Manager Menu, ’Mechanica’: Structure→Mesh→Create→ Boundary→Triangles→Start

6. Control MeshsizeIn order to control the mesh size, mesh controls can be set on entities (surface, whole partetc.) of the model:Manager Menu, ’Mechanica’: Structure→Mesh→ Controls

7. Write into File (Run analysis)Manager Menu, ’Mechanica’:Structure→Run’Run FEM Analysis’ window: Solver: FEM neutral

A.2.2 fnf2lgm, lgm2gnu, lgm2tetin

1. fnf2lgmConvert the fnf-file into the corresponding lgm-file.

2. lgm2gnuCheck, whether lgm-file is O.K.

3. lgm2tetinConvert lgm-file into the ICEMCFD tin-file

A.2.3 ICEMCFD

The tin-file can now be read and visualised by the mesh generator ICEMCFD. All parameters,that may be set in ICEMCFD, are stored in the tin-file. The original tin-file will be overwritten.In ICEMCFD every change of parameters must be saved to take effect.In order to generate a volume mesh two strategies can be followed:

1. The volume mesh will be generated directly. But, because of ICEMCFD’s octree approach,it might happen that some entities are not resolved leading to a non-consistent mesh inUG.

2. Firstly, a surface mesh is generated. This represents, an additional constraint for thevolume mesh.

The surface is triangulated with an ’advancing-front’ meshing algorithm, all entities arebetter resolved. But, one has to pay attention that the parameters (e.g. mesh size) on thesurface are not too different from those set on the volume, because ICEMCFD might beunable to generate the volume mesh with too restrictive constraints.

12

Page 13: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

At the end of the day, it is recommended that the first volume mesh should be quite smoothwith many more elements than the target coarse grid in UG. This is than stored and graduallycoarsened until no more elements can be eliminated with a given element quality.Eventually, the created volume mesh can be exported into the star-file format. The star-formatoriginates from the simulation tool STAR-CD and has been chosen, because all relevant infor-mation of the volume mesh is presented concisely.The read geometry can now be meshed in ICEMCFD in the following way:

1. Open tin-file in the file-menu.

2. Optional: Rename surfaces, lines and points in order to set different mesh parameters.geometry: surfaces→rename (the same for points and lines)

3. Global meshsize.geometry: mesh params→model

4. Optional: Set parameters for corresponding entities. The parameters set on lines arerelevant for the surface mesh, those set on surfaces are relevant for the volume mesh.Geometry: mesh params→selected family

5. Check, whether geometry is consistent.Geometry→Repair→Create Topology

6. For the surface mesh: each surface must correspond to a ’loop’.Loop: Create→from each surface

7. For the surface mesh: Meshing.Surface Mesh→patch based mesh. Select tri, number of smoothing steps 0, surface pro-jection on mesh (surface mesh is idiotically saved as ’quad.uns’)

8. Generate volume mesh.Mesh: Tetra→From CAD/Surface MeshSmoother iterations 0, Use existing surface mesh (in case one exists)Mesh

9. A copy of the generated volume mesh should be saved, because mistakes in the followingcoarsening process may occur.

10. Coarse Mesh.Edit mesh: CoarseIf some entities should not be coarsened they simply can set to ’frozen’. The coarseningprocess should be terminated, when almost no element with the preset mesh quality canbe eliminated anymore. Principally, the mesh quality can be reduced and thus the numberof elements, but it turned out, that than some entities are not resolved anymore.

11. Output: Select solver → STAR-DC

12. Output: Star-CD inputSelect the best mesh and name it the same name as your fnf-, lgm- and tin-file with theprefix ’star ’.

13

Page 14: Simulation in Technology UG-Interface for CAD Geometries ...€¦ · UG-Interface for CAD Geometries A. Hauser1 and O. Sterz2 Abstract Numerical simulation of real-world problems

A.2.4 lgm+star2ng

Eventually, the mesh file ’ng’ can be constructed with the converter lgm+star2ng.

14