Cad Mesh Mini Course Conf

49
MINICOURSE CAD Import and LiveLink for CAD - AutoCAD ® - Creo Parametric - Inventor ® - Pro/ENGINEER ® - SolidWorks ® - SpaceClaim ® TM

Transcript of Cad Mesh Mini Course Conf

Page 1: Cad Mesh Mini Course Conf

MINICOURSE

CAD Import and LiveLink

for CAD

- AutoCAD®

- Creo™ Parametric- Inventor® - Pro/ENGINEER® - SolidWorks®

- SpaceClaim®

TM

Page 2: Cad Mesh Mini Course Conf

2 | C H A P T E R :

Page 3: Cad Mesh Mini Course Conf

BeneluxCOMSOL BVRöntgenlaan 372719 DX ZoetermeerThe Netherlands +31 (0) 79 363 4230 +31 (0) 79 361 4212 [email protected] www.comsol.nl

DenmarkCOMSOL A/SDiplomvej 381 2800 Kgs. Lyngby +45 88 70 82 00 +45 88 70 82 88 [email protected] www.comsol.dk

FinlandCOMSOL OYArabiankatu 12 FIN-00560 Helsinki +358 9 2510 400 +358 9 2510 4010 [email protected] www.comsol.fi

FranceCOMSOL FranceWTC, 5 pl. Robert SchumanF-38000 Grenoble +33 (0)4 76 46 49 01 +33 (0)4 76 46 07 42 [email protected] www.comsol.fr

GermanyCOMSOL Multiphysics GmbHBerliner Str. 4D-37073 Göttingen +49-551-99721-0 +49-551-99721-29 [email protected] www.comsol.de

IndiaCOMSOL Multiphysics Pvt. Ltd.Esquire Centre, C-Block, 3rd FloorNo. 9, M. G. RoadBangalore 560001Karnataka +91-80-4092-3859 +91-80-4092-3856 [email protected] www.comsol.co.in

ItalyCOMSOL S.r.l.Via Vittorio Emanuele II, 2225122 Brescia +39-030-3793800 +39-030-3793899 [email protected] www.comsol.it

NorwayCOMSOL ASPostboks 5673 SluppenSøndre gate 7NO-7485 Trondheim +47 73 84 24 00 +47 73 84 24 01 [email protected] www.comsol.no

SwedenCOMSOL ABTegnérgatan 23SE-111 40 Stockholm +46 8 412 95 00 +46 8 412 95 10 [email protected] www.comsol.se

SwitzerlandCOMSOL Multiphysics GmbHTechnoparkstrasse 1CH-8005 Zürich +41 (0)44 445 2140 +41 (0)44 445 2141 [email protected] www.ch.comsol.com

United KingdomCOMSOL Ltd.Broers Building21 J J Thomson AvenueCambridge CB3 0FA +44-(0)-1223 451580 +44-(0)-1223 367361 [email protected] www.uk.comsol.com

United StatesCOMSOL, Inc.1 New England Executive ParkSuite 350Burlington, MA 01803 +1-781-273-3322 +1-781-273-6603

COMSOL, Inc.10850 Wilshire BoulevardSuite 800Los Angeles, CA 90024 +1-310-441-4800 +1-310-441-0868

COMSOL, Inc.744 Cowper StreetPalo Alto, CA 94301 +1-650-324-9935 +1-650-324-9936 [email protected] www.comsol.com

For a complete list of international representatives, visit www.comsol.com/contact

Home Page www.comsol.com

COMSOL User Forums www.comsol.com/

community/forums

CAD Import and Meshing Minicourse

2005–2011 COMSOL

Protected by U.S. Patents 7,519,518; 7,596,474; and 7,623,991. Patents pending.

This Documentation and the Programs described herein are furnished under the COMSOL Software License Agreement (www.comsol.com/sla) and may be used or copied only under the terms of the license agreement. Portions of this software are owned by Siemens Product Lifecycle Management Software Inc. © 1986–2011. All Rights Reserved. Portions of this software are owned by Spatial Corp. © 1989–2011. All Rights Reserved.

COMSOL, COMSOL Desktop, COMSOL Multiphysics, and LiveLink are registered trademarks or trade-marks of COMSOL AB. ACIS and SAT are registered trademarks of Spatial Corp.. Parasolid is a registered trademark of Siemens Product Lifecycle Management Software Inc.. Other product or brand names are trademarks or registered trademarks of their respective holders.

Version: October 2011 COMSOL 4.2a

Page 4: Cad Mesh Mini Course Conf

C O N T E N T S | 1

C o n t e n t s

Typographical Conventions . . . . . . . . . . . . . . . . . . . 3

Importing CAD Files 9

CAD Geometry for Finite Element Analysis (FEA) . . . . . . . . . . 9

3D CAD Geometry of a Wheel Rim - The Repair Operation . . . . . . 11

Virtual Geometry Operations 17

3D CAD Geometry of a Wheel Rim - Virtual Geometry Operations . . . 17

Modeling with Assemblies 29

Gaps in Assemblies . . . . . . . . . . . . . . . . . . . . . . 29

The Meshing Sequence 39

Meshing with Default Settings . . . . . . . . . . . . . . . . . . 39

Adding Local Attribute Features . . . . . . . . . . . . . . . . . 41

The Swept Mesher . . . . . . . . . . . . . . . . . . . . . . 42

Page 5: Cad Mesh Mini Course Conf

2 | C O N T E N T S

Page 6: Cad Mesh Mini Course Conf

3

1

I n t r o d u c t i o n

Welcome to this minicourse in CAD import and meshing with COMSOL Multiphysics and the CAD Import Module.

The import and meshing of geometry is an essential part of modeling for which COMSOL Multiphysics provides several tools. To provide you a short introduction on working with these, we have included some exercises about CAD import of parts and assemblies, repair and defeaturing of imported geometry, the meshing environment, and virtual geometry operations.

We hope you enjoy this course!

The COMSOL Team

Typographical Conventions

All COMSOL user guides use a set of consistent typographical conventions that make it easier to follow the discussion, understand what you can expect to see on the Graphical User Interface (GUI), and know which data must be entered into various data-entry fields.

Page 7: Cad Mesh Mini Course Conf

4 | C H A P T E R 1 : I N T R O D U C T I O N

In particular, these conventions are used throughout the documentation:

• Click text highlighted in blue to go to other information in the PDF. When you are using the online help desk in COMSOL Multiphysics, these links also work to other Modules, model examples, and documentation sets.

• A boldface font indicates that the given word(s) appear exactly that way on the COMSOL Desktop (or, for toolbar buttons, in the corresponding tooltip). For example, the Model Builder window ( ) is often referred to and this is the window that contains the model tree. As another example, the instructions might say to click the Zoom Extents button ( ), and this means that when you hover over the button with your mouse, the same label displays on the COMSOL Desktop.

• The names of other items on the COMSOL Desktop that do not have direct labels contain a leading uppercase letter. For instance, the Main toolbar is often referred to— the horizontal bar containing several icons that are displayed on top of the user interface. However, nowhere on the COMSOL Desktop, nor the toolbar itself, includes the word “main.”

• The forward arrow symbol > are instructions to select a series of menu items in a specific order. For example, Options>Results is equivalent to: From the Options menu, select Results.

• A Code (monospace) font indicates you are to make a keyboard entry in the user interface. You might see an instruction such as “Enter (or type) 1.25 in the Current

density field.” The monospace font also is an indication of programming code. or a variable name. An italic Code (monospace) font indicates user inputs and parts of names that can vary or be defined by the user.

• An italic font indicates the introduction of important terminology. Expect to find an explanation in the same paragraph or in the Glossary. The names of other user guides in the COMSOL documentation set also have an italic font.

T H E D I F F E R E N C E B E T W E E N N O D E S , B U T T O N S , A N D I C O N S

Node: A node is located in the Model Builder and has an icon image to the left of it. Right-click a node to open a context menu and to perform actions.

Button: Click a button to perform an action. Usually located on a toolbar (the main toolbar or the Graphics toolbar, for example), or in the upper-right corner of a Settings window.

Page 8: Cad Mesh Mini Course Conf

| 5

Icon: An icon is an image that displays on a window (for example, the Model Wizard or Model Library) or displays in a context menu when a node is right-clicked. Sometimes selecting an item with an icon from a node’s context menu adds a node with the same image and name, sometimes it simply performs the action indicated (for example, Delete, Enable, or Disable).

K E Y T O T H E G R A P H I C S

Throughout the documentation, additional icons are used to help navigate the information. These categories are used to draw your attention to the information based on the level of importance, although it is always recommended that you read these text boxes.

CautionA Caution icon is used to indicate that the user should proceed carefully and consider the next steps. It might mean that an action is required, or if the instructions are not followed, that there will be problems with the model solution, for example:

ImportantAn Important icon is used to indicate that the information provided is key to the model building, design, or solution. The information is of higher importance than a note or tip, and the user should endeavor to follow the instructions, for example:

This may limit the type of boundary conditions that you can set on the eliminated species. The species selection must be carefully done.

Caution

Do not select any domains that do not conduct current, for example, the gas channels in a fuel cell.

Important

Page 9: Cad Mesh Mini Course Conf

6 | C H A P T E R 1 : I N T R O D U C T I O N

NoteA Note icon is used to indicate that the information may be of use to the user. It is recommended that the user read the text, for example:,

TipA Tip icon is used to provide information, reminders, short cuts, suggestions of how to improve model design, and other information that may or may not be useful to the user, for example:

See AlsoThe See Also icon indicates that other useful information is located in the named section. If you are working on line, click the hyperlink to go to the information directly. When the link is outside of the current document, the text indicates this, for example:

ModelThe Model icon is used in the documentation as well as in COMSOL Multiphysics from the View>Model Library menu. If you are working online, click the link to go to the PDF version of the step-by-step instructions. In some cases, a model is only available if you have a license for a specific Module. These examples occur in the

Undo is not possible for nodes that are built directly, such as geometry objects, solutions, meshes, and plots.

Note

It can be more accurate and efficient to use several simple models instead of a single, complex one.

Tip

• Theory for the Single-Phase Flow Interfaces

• The Laminar Flow Interface in the COMSOL Multiphysics User’s Guide See Also

Page 10: Cad Mesh Mini Course Conf

| 7

COMSOL Multiphysics User’s Guide. The Model Library path describes how to find the actual model in COMSOL Multiphysics.

Space Dimension IconsAnother set of icons are also used in the Model Builder—the model space dimension is indicated by 0D , 1D , 1D axial symmetry , 2D , 2D axial symmetry

, and 3D icons. These icons are also used in the documentation to clearly list the differences to an interface, feature node, or theory section, which are based on space dimension.

The following tables are examples of these space dimension icons.

• Acoustics of a Muffler: Model Library path COMSOL_Multiphysics>Acoustics>automotive_muffler

• If you have the RF Module, see Radar Cross Section: Model Library path RF_Module>Tutorial_Models>radar_cross_section.

Model

3D models often require more computer power, memory, and time to solve. The extra time spent on simplifying a model is time well spent when solving it.

Remember that modeling in 2D usually represents some 3D geometry under the assumption that nothing changes in the third dimension.

The Boltzmann Equation, Two-Term Approximation interface is available for 1D models and allows you to study the electron energy distribution function (EEDF) for some assumed discharge conditions.

3D

2D

1D

Page 11: Cad Mesh Mini Course Conf

8 | C H A P T E R 1 : I N T R O D U C T I O N

Page 12: Cad Mesh Mini Course Conf

| 9

Impo r t i n g CAD F i l e s

When importing a design into COMSOL Multiphysics from a CAD file, the CAD Import Module translates it into a format understood by COMSOL Multiphysics. After importing a CAD file you continue the modeling process with meshing and analysis in the usual fashion.

CAD Geometry for Finite Element Analysis (FEA)

A geometry created in a 3D CAD software might not automatically be suitable for FEA. One reason is that the geometry description requirements are rather stringent. For example, a 3D CAD geometry might contain very small gaps, edges, or surfaces that are difficult for the user of the CAD software to control. These can make meshing of the imported geometry impossible.

A common type of problem in CAD designs is the presence of sliver faces, which are very long and narrow faces. While the CAD Import Module provides tools to detect and remove such faces, in some cases the topology of the geometry is such that the sliver face can not be removed by such tools. Such an example is illustrated in the figure below.

Page 13: Cad Mesh Mini Course Conf

10 |

After meshing this geometry, a very dense mesh is unfortunately created to resolve the narrow strip of the face.

Alternatively the narrow strip can be easily avoided during the design of the geometry in the CAD software, through making sure that the neighboring fillets have large enough radii.

As the example above illustrates, meshing can be useful for diagnosing sliver faces and other small features in your geometry, and you can use it as a complement to the tools provided by the CAD Import Module. In COMSOL Multiphysics you can quickly create a surface or volume mesh of the part, then examine it for areas of dense mesh, which usually indicate small features. This process is made easier by the mesher which lists edges and faces which are too small to be meshed to a good quality.

Careful design in the CAD software is also important during the design of assemblies. Touching parts in a CAD assembly might not be accurately positioned or might contain slight mismatches between dimensions. Such unintentional errors also lead to the presence of small features and sliver faces in the decomposed geometry. For this reason it is recommended that parts of the CAD assembly are designed in the context of the assembly.

Even geometry features on a larger scale can make meshing of imported geometries difficult. Such features could be the subdivision of faces into smaller ones, or smaller holes, fillets and chamfers. You can usually control these features in the CAD software. Most modern CAD packages allow you to save different configurations of a part in the same file. It is often beneficial to save a configuration specially for FEA, where you

Page 14: Cad Mesh Mini Course Conf

| 11

suppress features not important for the analysis. This way you can reduce the number of mesh elements and thus the amount of memory needed to solve the problem.

3D CAD Geometry of a Wheel Rim - The Repair Operation

Importing 3D CAD files into the COMSOL Multiphysics modeling environment is straightforward. Since the settings of the import operation have been tuned to suit the most common cases, the majority of files import simply with the click of a button. During import the geometry is checked for errors and automatically repaired. The repair operation also removes features that fall within the import tolerance.

In this example, the Parasolid file of a wheel rim contains a few small faces and slivers, which are not removed during import, since they fall outside the default repair tolerance. The step-by-step instructions below demonstrate one possibility of locating and removing these features. You can follow this general workflow:

• Import the file

• Create a mesh for quick examination of the geometry

• Obtain the size of the features you would like to remove

• Repair the object

• Create a new mesh for comparison.

Model Wizard1 Double-click the COMSOL Multiphysics icon on the desktop.

In this example you are only interested in preparing a geometry and can skip the steps of selecting a physics interface and study type.

2 In the Model Wizard window, click the 3D button and click Finish .

Importing the Geometry1 Under the Model 1 node, right-click Geometry 1 and select Import .

2 In the Settings window click the Browse button.

3 In your COMSOL installation directory navigate to the folder models/CAD_Import_Module/Tutorial_Models and double click the file repair_demo_1.x_b.

Page 15: Cad Mesh Mini Course Conf

12 |

As soon as the import is done the geometry appears in the Graphics window.

Creating a Surface MeshCreating a surface mesh for an imported solid is often the fastest way to assess the quality of the geometry and to identify regions needing repair or defeaturing.

1 In the Model Builder right-click the Mesh 1 node and select More Operations>Free

Triangular .

2 Go to the Settings window and from the Selection list box select All boundaries.

3 Click the Build All button to create the mesh.

As soon as the mesh is ready the Messages window displays the number of mesh elements, which is about 18,000. In addition, two warnings appear in the Messages window. These warning indicate that the geometry contains edges that are much shorter than the minimum element size, and that there are faces which are smaller than the minimum element size.

The warnings also appear under the Free Triangular 1 feature node in the mesh sequence. You can click on these nodes to get a list of short edges and small faces.Note

Page 16: Cad Mesh Mini Course Conf

| 13

Next, examine the mesh and look for areas of denser mesh. Denser mesh usually indicates faces or edges significantly smaller in comparison to the size of the geometry.

4 To examine the mesh without the edges or faces from the warning nodes being highlighted click the Mesh 1 node, then press Ctrl+D on your keyboard. This way you can deselect the last selection, which COMSOL Multiphysics always retains.

5 Zoom in on the area around the bolt holes, shown below.

The areas of dense mesh, indicated by the arrows in the figure, are due to slivers and small faces. Zooming in even closer reveals a small triangular face sitting adjacent to a sliver face. Two of these can be found around each bolt hole location.

To get a representative size for these faces measure the length of one of the edges.

6 On the toolbar above the Graphics window click Select Edges .

Page 17: Cad Mesh Mini Course Conf

14 |

7 Click on the edge highlighted in the figure below, then click Measure on the main toolbar.

The Messages window displays the length of the edge, which is 2.556e-4 m.

8 Now pan, rotate, and zoom the object to take a better look at the area where two adjacent spokes connect to the rim.

Each spoke contains a dense mesh area just like the ones indicated by the arrows in the figure.

On closer examination you can see that the cause of the dense mesh here is a sliver face, which you can find at the same location on each spoke.

Page 18: Cad Mesh Mini Course Conf

| 15

9 To get the width of the sliver face, click the edge shown in the figure, then click Measure on the main toolbar.

The length for edge 958 is 3.126e-4 m (0.3126 mm).

Repairing the GeometryNow that you know the size of the faces to be removed you can repair the geometry.

1 Right-click the Geometry 1 node and select CAD Repair>Repair .

2 In the graphics area select the wheel rim to add it to the Input objects list.

3 In the Absolute repair tolerance edit field enter 3.2e-4.

By keeping the repair tolerance close to the size of the features to be removed you can avoid removing anything else and breaking the geometry.

4 Click Build All to perform the operation.

5 Examine the geometry. Pan and zoom to take a look at the areas

Page 19: Cad Mesh Mini Course Conf

16 |

that contained the slivers and small faces, which are now no longer present in the geometry.

Updating the Mesh1 Right-click the Mesh 1 node and select Build All .

As soon as the mesh is created you can see that it now contains about 2000 less surface elements than before the repair.

Page 20: Cad Mesh Mini Course Conf

| 17

V i r t u a l Geome t r y Ope r a t i o n s

The repair and defeaturing tools that find and delete small geometry features can operate only within the limits of what is allowed by the topology of the geometry. To handle more complex cases, where defeaturing fails, you can use virtual geometry operations. With these tools you can set geometric entities, such as vertices, edges, or faces, to be ignored by the mesher. Since selected elements are “hidden” from the mesher, meshing takes place on a virtual geometry, hence the name virtual operations.

Other benefits of using virtual operations is that they work on the finalized geometry, and that they keep the curvature of the geometry. The latter is especially important when removing larger faces, or for certain physics applications when altering the curvature of the geometry can for example give rise to stress concentrations.

3D CAD Geometry of a Wheel Rim - Virtual Geometry Operations

The wheel rim geometry of the previous exercise contains a few small faces and slivers, which are not removed during import, since they fall outside the default repair tolerance. The step-by-step instructions below demonstrate one possibility of locating and removing these features. You can follow this general workflow:

• Import the file

• Create a mesh for a quick examination of the geometry

• Apply virtual geometry operations

• Create a new mesh for comparison.

M O D E L W I Z A R D

1 Double-click the COMSOL Multiphysics icon on the desktop.

In this example you are only interested in preparing a geometry and can skip the steps of selecting a physics interface and study type.

2 In the Model Wizard window, click the 3D button and click Finish .

I M P O R T I N G T H E G E O M E T R Y

1 Under the Model 1 node, right-click Geometry 1 and select Import .

2 In the Settings window click the Browse button.

Page 21: Cad Mesh Mini Course Conf

18 |

3 In your COMSOL installation directory navigate to the folder models/CAD_Import_Module/Tutorial_Models and double click the file repair_demo_1.x_b.

4 Click the Import button.

As soon as the import is done the geometry appears in the Graphics window.

C R E A T I N G A S U R F A C E M E S H

Creating a surface mesh for an imported solid is often the fastest way to assess the quality of the geometry and to identify regions needing repair or defeaturing.

1 In the Model Builder right-click the Mesh 1 node and select More Operations>Free

Triangular .

2 Go to the Settings window and from the Selection list box select All boundaries.

3 Click the Build All button to create the mesh.

As soon as the mesh is ready the Messages window displays the number of mesh elements, which is about 18,000. In addition, two warnings appear in the Messages window. These warning indicate that the geometry contains edges that are much

Page 22: Cad Mesh Mini Course Conf

| 19

shorter than the minimum element size, and that there are faces which are smaller than the minimum element size.

Next, examine the mesh and look for the areas where the mesher indicates small edges or faces. These regions usually correspond to a denser mesh, some of which are highlighted in the figure below.

The warnings also appear under the Free Triangular 1 feature node in the mesh sequence. You can click on these nodes to get a list of short edges and small faces.Note

Page 23: Cad Mesh Mini Course Conf

20 |

4 Using the Zoom Box button, zoom to the area shown below, where a spoke connects to the rim.

Each spoke contains a dense mesh area due to the small features indicated by the arrows in the figure.

On closer examination you can see that several edges in this area are highlighted as being to short to be meshed with the current mesh settings.

V I R T U A L G E O M E T R Y O P E R A T I O N S

Instead of repairing or defeaturing the geometry, this time you can use the virtual geometry operations to “hide” small geometry features from the mesher while keeping the curvature of the geometry unmodified.

1 Right-click the Geometry 1 node and select Virtual Operations>Ignore Edges.

Page 24: Cad Mesh Mini Course Conf

| 21

2 In the graphics area select the edges 217, 219, and 222, highlighted in the figure, to add them to the Edges to ignore list.

3 Click the Build Selected button.

The visualization of the rim in the Graphics window is updated to reflect that the selected edges, and, where applicable, adjacent vertices are no longer part of the geometry which is going to be meshed.

As an alternative to the Ignore Edges operation you can also use the Form Composite Faces operation.

4 Right-click the Geometry 1 node and select Virtual Operations>Form Composite

Faces.

Page 25: Cad Mesh Mini Course Conf

22 |

5 Select faces 112, 118, 122, and 126, highlighted in the figure below.

6 Click the Build Selected button. The geometry in the Graphics window is updated with the new composite formed faces.

Page 26: Cad Mesh Mini Course Conf

| 23

7 To view the new mesh over this region click the Mesh 1 node, then click the Build All button.

This time the mesh has fewer elements and there are no warnings, as the mesher no longer sees the short edges.

Page 27: Cad Mesh Mini Course Conf

24 |

8 Click the Zoom Extents button to view the entire rim geometry again. Then zoom to the region shown below using the Zoom Box button.

The short edges in this region form a small face which you remove using the Collapse Edges operation. The long edges of the sliver face can be removed by adding them to the existing Ignore Edges 1 operation in the geometry sequence.

9 Click the Ignore Edges 1 node, then click the Build Preceding State button.

10 Select the edges 197 and 198, shown in the figure to the right. After this latest addition the list should now include edges 197, 198, 217, 219, 222.

11 Click the Build Selected button.

Page 28: Cad Mesh Mini Course Conf

| 25

Now continue by removing the small triangular face. Before adding the operation to the sequence take a look in the Model Builder window.

A green rectangle is displayed around the Ignore Edges 1 node telling you that this is the current node. Any operations that you add to the sequence will be placed directly after the current node. The Form Composite Faces 1 node is marked by a small yellow triangle, which signals that the node needs rebuilding.

12 Make sure that the next operation will be the last one in the sequence by right-clicking the Form Composite Faces 1 node and selecting Build Selected.

13 Right-click the Geometry 1 node and select Virtual Operations>Collapse Edges.

14 Select edges 205-207 highlighted in the figure. Use the Select Box button to select all three edges at once.

15 Click the Build Selected button.

Page 29: Cad Mesh Mini Course Conf

26 |

16 To build the mesh click first the Mesh 1 node, then the Build All button.

The new mesh contains fewer elements since the sliver and small face are no longer visible to the mesher.

The last virtual geometry operation you will try in this exercise is the Ignore Vertices operation to remove a short edge from a segmented edge. In this context the operation is equivalent to the Form Composite Edges operation.

Page 30: Cad Mesh Mini Course Conf

| 27

17 Click the Zoom Extents button to view the entire rim geometry. Then zoom in on the region shown below using the Zoom Box button.

18 Right-click the Geometry 1 node and select Virtual Operations>Form Composite Edges.

19 Add the vertex highlighted in the figure to the list of Vertices to ignore, then click the Build Selected button.

Page 31: Cad Mesh Mini Course Conf

28 |

20 To mesh the geometry once more right-click the Mesh 1 node and select Build All.

The mesher now sees the two edges as one unit, which is reflected in the way the elements are laid out in this new mesh.

Page 32: Cad Mesh Mini Course Conf

| 29

Mode l i n g w i t h A s s emb l i e s

A CAD file which contains an assembly or a multi-body part is a collection of solid bodies. When importing such a design, each body becomes a geometry object in COMSOL Multiphysics. In addition you can have additional geometry objects created by various other features of the geometry sequence.

The collection of geometry objects resulting from the operations in the geometry sequence needs to be prepared for physics modeling. This is done by the last feature node of the geometry sequence, called the Finalize ( ) feature. The Finalize feature cannot be deleted from the sequence, and its label in the Model Builder changes according to the finalization method. There are two methods for finalization of geometry:

• forming a union of all objects, which becomes the modeling domain

- The modeling domain, created by the union operation, consists of domains separated by interior boundaries. COMSOL ensures continuity in the field variables across interior boundaries.

• forming an assembly object for modeling

- The geometry objects become separate domains for modeling. Identity pairs (or contact pairs) need to be defined to ensure continuity.

- Imprints can optionally be created on touching boundaries.

Each of these methods influences the type of mesh you can create. Forming a union imposes the largest constraints on the meshing procedure, while an assembly object without imprints leaves you with maximum freedom for mesh generation.

Working with imported CAD assemblies can be more difficult than single components, since gaps and dimensional mismatches can influence the final mesh.

Gaps in Assemblies

The CAD model in this exercise contains some gaps on the assembly level, which can prevent the creation of a good mesh. One of the parts also contains holes we would like to remove.

You can start by importing the CAD file.

1 Click the New ( ) button on the main toolbar.

Page 33: Cad Mesh Mini Course Conf

30 |

2 In the Model Wizard make sure that the space dimension is 3D, then click the Finish button.

3 To add an import feature to the geometry sequence right-click Geometry 1 and select Import.

4 In the Settings window click the Browse button.

5 Locate the course CD on the hard disk and select the file assembly_gaps.x_b, then click Open.

1 Click Import in the Settings window.

The assembly consists of two parts, plate 1 and plate 2. Plate 2 has four screw holes, and two feet that fit into corresponding holes on plate 1. Besides the imported parts, the surrounding air volume is also important for the analysis. Therefore, you can continue by creating a block around the objects.

2 Right-click the Geometry 1 node and select Block.

3 Use data from the following table to draw a block:

POSITION: BASE: CORNER SIZE

x -0.01 Width 0.06

y -0.03 Depth 0.06

z -0.06 Height 0.12

plate 1

plate 2

Page 34: Cad Mesh Mini Course Conf

| 31

4 Click the Build All ( ) button.

5 Right-click the Mesh 1 node and select Free Tetrahedral.

The finalize operation is performed automatically as you click the Mesh 1 node. During the finalize operation, COMSOL Multiphysics determines the geometric difference of the objects and creates one object with three subdomains delimited by single surfaces.

6 Click the Build All ( ) button.

After the meshing is completed, note that there are about 127,000 tetrahedral elements in this seemingly simple geometry.

7 Click the Transparency ( ) button to visualize the inner domains.

You can see that there is a very fine mesh in several boundary regions between the two parts of the assembly. Usually this occurs if small, dimensional discrepancies exist between parts. They might be present in the design to provide important clearance for assembling the final product. In this case the clearance between the feet

Dense mesh regions

Page 35: Cad Mesh Mini Course Conf

32 |

of plate 1 and the corresponding slots on plate 2 causes a very thin air gap. However, such fine details do not affect the overall physics phenomena.

You cannot change the dimension of imported objects with the CAD Import Module. Yet, you can, easily remove both the feet and the slots. To this you need to use the defeaturing tools.

D E L E T I N G F A C E S

1 Right-click the Geometry 1 node, then select CAD Defeaturing>Delete Faces.

In the Tools window that appears you can select faces of the geometry to be removed. When a delete operation is completed a feature node will be added to the geometry sequence.

To make the selection of faces easier first hide the block and plate 1.

2 Click the Select Objects ( ) button.

3 In the Graphics window click the block, then click the Hide Selected ( ) button.

4 In the Graphics window click plate 1, then click the Hide Selected ( ) button.

5 Click the Select Boundaries ( ) button to switch back to boundary selection.

narrow gaps

Page 36: Cad Mesh Mini Course Conf

| 33

6 Add the faces highlighted in the figure below, boundaries 1, 2, 5, 6, 7, 8 on object imp1.separator, to the list of Faces to delete.

The selected faces delimit the features to be removed.

7 Click the Delete Selected button to delete the feet.

The default heal method, Patch, heals the wound that results from removing the faces, by shrinking and growing neighboring faces to cover the hole.

When the operation completes a Delete Faces 1 feature node is added to the Model

Builder, right after the current feature in the geometry sequence, which was the Block 1 feature.

D E L E T I N G H O L E S

With the feet removed you can continue with removing the corresponding slots on plate 1.

Hide some objects again to make face selection easier, this time the block and plate 2.

1 To show all domains again click the Reset Hiding ( ) button.

2 Click the Select Objects ( ) button.

3 In the Graphics window click the block, then click the Hide Selected ( ) button.

4 In the Graphics window click plate 2, then click the Hide Selected ( ) button.

5 Click the Select Boundaries ( ) button to switch back to boundary selection.

Page 37: Cad Mesh Mini Course Conf

34 |

6 Add the faces highlighted in the figure below, boundaries 5-8, 9-12 on object imp1.backside, to the list of Faces to delete.

7 Select the Heal as through hole check box.

Page 38: Cad Mesh Mini Course Conf

| 35

8 Click the Delete Selected button to delete the holes.

Before continuing with meshing, you can also delete the four mounting holes, shown in the figure below, since they are assumed to not influence the analysis.

You can easily select the faces delimiting the holes by using the Select Box tool.

9 To show all domains again click the Reset Hiding ( ) button.

10 Click the Select Box ( ) button, then in the Graphics window draw a rectangle around the faces delimiting one of the holes. Confirm the selection by right-clicking.

11 Repeat the previous step for the other three holes.

12 The Faces to delete list should now contain faces 7-14 and 17-24 of object dfa1.

13 Click the Delete Selected button to delete the holes.

The last step is to create a new mesh of the geometry.

Page 39: Cad Mesh Mini Course Conf

36 |

14 Right-click the Mesh 1 node in the Model Builder, then select Build All.

The mesh now consists of about 32,000 tetrahedral elements. As you can see in the figure, there are still two regions of high mesh density left. The reason for this is a slight difference in width between the two objects.

If this dimensional mismatch is unintentional and assumed to not be important for the analysis, it can easily fixed in a CAD software. With the CAD Import Module, you can export defeatured parts to a Parasolid file, which you can open and edit with a CAD program.

Dense mesh regions

Objects are not of the same width

Page 40: Cad Mesh Mini Course Conf

| 37

E X P O R T I N G T O P A R A S O L I D F O R M A T

1 Right-click the Geometry 1 node and select Export to File.

2 The Input list shows all three objects selected (dfa2, blk1, and dfa3). To accept and export the objects click Export.

3 From the Save as type list select either Parasolid binary file or Parasolid text file.

4 Select a directory, enter a file name, then click Save.

The resulting Parasolid file can be imported into most CAD software.

A D J U S T I N G T H E R E P A I R TO L E R A N C E

You can also use the CAD Import Module to fix the dimensional discrepancy, by for example using the repair functionality of the Finalize feature.

5 Click the Form Union feature node.

6 In the Relative repair tolerance edit field enter 1e-3.

7 Right-click the Mesh 1 node in the Model Builder, then select Build All.

As you can see the resulting mesh contains only about 5000 elements.

Page 41: Cad Mesh Mini Course Conf

38 |

Page 42: Cad Mesh Mini Course Conf

| 39

Th e Me s h i n g S e qu en c e

COMSOL Multiphysics provides an interactive meshing environment where, with a few mouse clicks, you can easily mesh individual faces or domains. Each meshing operation is added to the meshing sequence. The final mesh is the result of building all the operations in the meshing sequence.

This example demonstrates how to use the meshing sequence. On a realistic geometry you create a mesh consisting of different element types. You learn how to mesh certain parts of a geometry, modify this mesh, change the parameters to your liking, and rebuild the mesh.

Meshing with Default Settings

To start, import a 3D CAD geometry and mesh it with the default settings using the free mesher to generate a mesh with tetrahedral elements.

1 Click the New ( ) button on the main toolbar.

2 In the Model Wizard make sure that the space dimension is 3D, then click the Finish button.

3 To add an import feature to the geometry sequence right-click Geometry 1 and select Import.

4 In the Settings window click the Browse button.

5 Locate the course CD on the hard disk and select the file solder_joints.x_b, then click Open.

6 Click Import in the Settings window.

Note that for many of the imported objects a warning is displayed that the default import tolerance, 10-5 m, might be too large for the geometry, which includes parts on the order of a tenth of a millimeter in size. Features smaller than the import tolerance are automatically removed during import. Therefore, if you know that your geometry contains small features you can change the import tolerance in the

Page 43: Cad Mesh Mini Course Conf

40 |

Settings window of the Import feature. There you also have the option of turning off the repair feature during import. In this particular case, this is not necessary.

The geometry represents a small part of a circuit board with an electronic component mounted by means of several solder ball joints.

Continue by creating a simple unstructured tetrahedral mesh.

7 Click the Mesh 1 node.

As you click the Mesh 1 node the Finalize feature is automatically built, which means that the various objects are combined into the one object with inner boundaries and subdomains.

With the default Physics-controlled mesh, in the Sequence type list in the Settings window of the mesh node, COMSOL automatically creates a mesh adapted for the physics settings in the model. A set of nine predefined element sizes, ranging from Extremely fine to Extremely coarse and the default Normal size, give you control of how well you would like to resolve the geometry. With the default physics-controlled option the mesh sequence is always hidden.

In this case you will manually work with the mesh sequence.

Electronic component

Solder jointsCircuit board

Page 44: Cad Mesh Mini Course Conf

| 41

8 From the Sequence type list select User-controlled mesh.

A default mesh sequence consisting of the Size and Free Tetrahedral 1 nodes appears under the Mesh 1 node.

Note that you could have also right-clicked the Mesh 1 node and selected Free tetrahedral to add an unstructured mesh to the sequence, and to change the sequence type from physics-controlled to user-controlled.

The first Size feature node is called a global attribute feature, since it influences all subsequent operation features in the meshing sequence. This first Size feature node cannot be deleted from the meshing sequence. You can also add attribute features under an operation feature node, in which case it is called a local attribute feature.

9 To build the mesh click the Build All button.

According to information displayed in the Messages window this mesh consists of approximately 35,000 elements. While the geometry is resolved quite well by this mesh, you may want to reduce the number of elements to reduce the memory required for solving the problem.

Adding Local Attribute Features

Assume that you are investigating the solder joints and would therefore like to keep the detailed mesh in the spherical subdomains, but create a mesh with fewer elements in the remaining objects.

1 Right-click the Free Tetrahedral 1 feature node and select Size.

Page 45: Cad Mesh Mini Course Conf

42 |

2 From the Geometric entity level list select Domain.

3 Use the Graphics window to select the domains 1-3, which represent the circuit board and the electronic component.

4 From the Predefined list select Coarser.

5 Click the Build All button to build the new mesh.

According to the Messages window the mesh now consists of approximately 24,000 elements.

The Swept Mesher

For even fewer elements in the circuit board and electronic component, you can create a swept mesh. This technique sweeps a boundary mesh through the domains to create a structured mesh in the sweep direction.

The swept mesher operates on a 3D subdomain by first meshing a source face, and then sweeping the resulting face mesh through the subdomain to an opposite target

Page 46: Cad Mesh Mini Course Conf

| 43

face. For straight and circular sweep paths, you can use several connected faces as source faces. All faces that encompass a domain are classified as either source faces, a target face, or boundary faces. The boundary faces are the faces connecting the source and target faces.

M E S H I N G A S E T O F B O U N D A R I E S

First you can modify the free tetrahedral mesh operation to operate only on the solder joints.

1 Click the Free Tetrahedral 1 feature node.

2 From the Geometric entity level list select Domain.

3 From the Selection list select domains 1,2, and 3, then click the Remove from

Selection ( ) button.

You can also remove the Size 1 feature node.

4 Right-click the Size 1 node, then select Delete.

You can now create a coarse mesh on the source boundaries for the sweep mesh operation. Build the mesh before continuing.

5 Click the Build All ( ) button.

6 Right-click the Mesh 1 node then select More Operations then Free Triangular.

The Free Triangular 1 feature node is added after the Free Tetrahedral 1 feature node. COMSOL Multiphysics always inserts new nodes in the meshing sequence after the current feature node. To indicate the current feature node, it appears with a quadratic frame around its icon. As soon as it is inserted, the Free Triangular 1 node becomes the current feature.

7 From the Graphics window select the two faces (boundaries 2 and 14) highlighted in the figure below.

To make selection easier click the Wireframe Rendering ( ) button. Click it again to turn of wireframe rendering.

Page 47: Cad Mesh Mini Course Conf

44 |

8 Right-click the Free Triangular 1 node and select Size.

9 From the Predefined list select Coarser.

10 Click the Build All ( ) button to build the mesh.

The mesh is built, but a Warning 1node appears under the Free Triangular 1 feature node.

11 Click the Warning 1 node to read the message.

COMSOL Multiphysics generates the warning because the Coarser predefined mesh size you have applied to the two surfaces has been overridden by the relatively finer Normal mesh settings specified in the first Size feature node of the meshing sequence. The reason is to avoid bad quality meshes, that may result if the boundary of a domain is meshed with a coarser mesh size than the volume.

To avoid this situation a good practice is to set the first global Size setting to the coarsest mesh that you plan to have in the geometry, then specify local size feature nodes for the mesh operations that need finer mesh.

12 Click the Size node, then from the Predefined list select Coarser.

13 Right-click the Free Tetrahedral 1 node, and select Size.

14 From the Predefined list select Normal.

Since the global setting is Coarser, the size attribute to the Free Triangular 1 node is no longer necessary.

15 Right-click the Size 1 node under the Free Triangular 1 node, then select Delete.

Page 48: Cad Mesh Mini Course Conf

| 45

16 Right-click the Mesh 1 node then select Build All ( ) to build the mesh.

Notice that the triangular mesh is coarser this time.

C R E A T I N G A S W E P T M E S H

Now that the source faces are meshed, you can sweep this mesh through the subdomains.

1 Right-click the Mesh 1 node and select Swept.

The Geometric entity level list is set to Remaining by default for new mesh operations. In this case the remaining domains correspond to the domains we would like to sweep mesh.

Page 49: Cad Mesh Mini Course Conf

46 |

2 Click the Build All ( ) button to build the mesh.

The mesh now consists of approximately 15,000 elements. The swept mesher used the Coarser predefined mesh size to determine the number of elements along the sweep direction. By specifying a distribution for the swept mesher you have the possibility to manually control the number and distribution of elements along the sweep direction.

3 Right-click the Swept 1 feature node and select Distribution.

4 In the Number of elements edit field enter 2.

5 Click the Build All button to build the mesh.

This latest mesh consists of approximately 19,000 elements, keeping the higher resolution for the subdomains which are important for the analysis, while providing a less dense structured mesh for the remaining subdomains.