Elnady Engineering and Agencies
2 Elgabal Elakhdar Buildings, Nasr City, 11471 Cairo, Egypt.
Tel: +20 2 23425763
Fax: +20 2 23421793
www.elnadycompany.com
Finite Element
Modeling Using
COMSOL Multiphysics
Alexandria
25-27 September, 2012
PROGRAM
Finite Element Modeling Using COMSOL Multiphysics
Day1 Agenda
09:00 – 11:00 Introduction to COMSOL Multiphysics
11:00 – 12:30 COMSOL Demonstraion
Installation on attendees’ laptop
12:30 – 1:00
Coffee Break
01:00 – 03:00
Tutorial session: Getting started with COMSOL
- Parallel plate capacitor
- Thermal cube
- Stresses on a wrench
- Electrical heating and thermal stresses in a busbar
Day2 Agenda
09:00 – 12:00
- Background on Finite Element Analysis
- Advanced Meshing Techniques
-
12:00– 12:30
Coffee Break
12:30 – 02:00
Solver Sequence and settings
Model of Day: Heat Sink
Day3 Agenda
09:00 – 10:30
Results and Post Processing
10:30 – 12:00
Advanced Structural Mechanics examples
- Elbow Bracket, different Force Analysis
- Elbow Bracket, Elasto-plastic Analysis
- Tube Connector
Welcome Letter & Trial License Details
Dear Colleague,
It is our pleasure to welcome you to the Multiphysics High Performance Computing Workshop. During
your registration, you should receive the following items:
• The Program book including step-by-step tutorials for the minicourse
• DVD with the latest COMSOL Multiphysics version 4.3. For installation, see the information about
the trial license below
Your Trial License
• You will find an installation DVD of COMSOL Multiphysics 4.3.
• The installation Code is
9FFFBFFF0-TYSW-121009-17073896-324157832• This is a full functional trial license with all modules enabled.
• Expiry date: 2012-10-09
• You are entitled for technical Support. Send an email to [email protected]
• For pricing and ordering information, please contact [email protected]
We wish you an informative and great Workshop!
Introductory Models
Tutorials
• Parallel plate capacitor • Thermal cube
2
Tutorial 1: Parallel Plate Capacitor
What you will learn
• More experience with the interface • Sketching geometries in COMSOL
• How to have a domain “not active” in the analysis
Tutorial 2: Thermal cube
• More Practice with the User Interface • Adding a 2nd Physics
Tutorial 3: Stresses in a Wrench
What you will learn
• Hands on with the interface
• The basic steps in all COMSOL models • How to show deformed plots
Tutorial 4: Electrical Heating and
Thermal Stresses in a Busbar
4
Tutorial 1: Parallel Plate Capacitor
What you will learn
• More experience with the interface • Sketching geometries in COMSOL
• How to have a domain “not active” in the analysis
• Select “2D”
• AC / DC > Solid Mechanics • Stationary
Create Geometry
• Open Model 1 • Pick “Geometry 1”
• Change Length Unit to “cm” • Draw Three Rectangles
Set Materials
• Right Click on “Materials” • Choose “Open Model Library” • Pick “Built-In” Material Library • Select “Air”
• Right Click on it, “Add to Model” (This will assign it to all subdomains
but we will only use it in the air domain: Electrodes will not be included in the analysis)
6
Electrostatics
– Active only in Air Domain
• Pick “Electrostatics” in Model Builder • Clear all Selections (hit “ X “ ) • Only Select Air Domain • Right-click to confirm
Set Boundary Condition – Ground
• Right-Click “Electrostatics” • Choose “Ground”
• Choose “Box Selection” • Select Bottom Electrode • Confirm
Set Boundary Cond – Electric Potential
• Right-Click “Electrostatics” • Choose “Electric Potential” • Set to 100 Volts
• Choose “Box Selection” • Select Top Electrode
8
Solve
• Pick “Study 1” • Hit “ = “
Tutorial 2: Thermal cube
• More Practice with the User Interface • Adding a 2nd Physics
Choose Physics and Study
• Choose File > New • Select “3D”
• Select “Heat Transfer in Solids” in “Physics” • Choose “Stationary” under “Study”
Draw Geometry
• Right click on “Geometry” • Choose “Block”
10
Set Materials
• Right click on “Materials” • Choose “Open Material Library” • Go to “Built-in” Section
• Right Click on “Aluminum 6063” • Choose “Add to Model”
• Assign it to the block
Set Boundary Conditions
• Right Click on “Heat Transfer” • Select “Convective Cooling” • Choose “All Boundaries” • h = 1000 Text = 500
• Right Click on “Heat Transfer” • Select “Temperature”
• Choose bottom surface • Right click to confirm • Set Temperature as “300”
Mesh and Solve
• Right Click on “Mesh” • Select “Free Tetrahedral” • Select “Size”
• Choose “Coarser” mesh size • Right Click on “Study” • Select “Compute”
Add Structural Equations
• Right Click on “model 1” node • Choose “Add Physics” • Open “Structural Mechanics” • Pick “Solid Mechanics”
12
Add Thermal Expansion
• Open “Structural Mechanics” in Model Tree • Right Click on “Linear Elastic Material Model” • Choose “Thermal Expansion”
• Change “Temperature” from “user defined” to “Temperature (ht/solid1)”
• Leave Ref Temperature as 293 K
Constrain Bottom Surface + Solve
• Right Click on “Solid Mechanics” • Choose “Fixed Constraint” • Select & Confirm bottom surface • Right Click on “Study”
• Pick “Compute”
• Open “3D Plot group 1” • Right Click on “Surface” • Add “Deformation”
Tutorial 3: Stresses in a Wrench
What you will learn
• Hands on with the interface
• The basic steps in all COMSOL models • How to show deformed plots
1) Set Dimensions, Physics & Study-Type
• Select “3D”
• Structural Mechanics > Solid Mechanics • Stationary
14
2) Import Geometry
• Right click on “Geometry” • Choose “Import” Then “Browse”
• C:\COMSOL41\models\COMSOL_Multiphysics\Structural_Mechanics • Choose “Wrench.mphbin”
• “Import”
3) Set Materials
In Model Builder:
• Right Click on “Materials” • “Open Model Library” • Pick “Built-In”
• Select “High Strength Alloy Steel” • Right Click, “Add to Model” • Select “Steel AISI 4340” • Right Click, “Add to Model” • Pick Bolt, right-click to add
4 a) Constrain Bolt
In Model Builder:
• Right Click on Solid Mechanics • Choose “Fixed Constraint” In Graphics Window:
• Pick the Bolt Cut End • Right Click to confirm
4 b) Add Load
In Model Builder:
• Right click on Solid Mechanics • Choose “Face Load”
• Pick end of the wrench • Enter ”F” for Fz
16
5) Mesh
In Model Tree:
• Right Click on “Mesh 1” • Choose “Add Tetrahedral” • Pick “Size
• Change to “Coarser” • Right click “Mesh 1” • Pick “Build All”
6) Solve
In Model Builder: • Pick “Study 1” • Choose “Compute”
Display Stress on Deformed Geometry
• Open “Results” > “3D Plot Group 1” • Pick “Surface 1” > Replace Expression
– Plot Von Mises Stress
• Right click on “Surface 1” • Add “Deformation”
Tutorial 7: Electrical Heating
and Thermal Stresses in a Busbar
18
Your first model
Exercises:
Electrical Heating in a Busbar
• Bus bar made of copper. • Bolts made of titanium. • Direct current 10 mV from a
transformer to an electric device. • Heat is produced due to the resistive
losses--joule heating.
• Calculate the thermal expansion. • Work though exercises, but not the
Your first training model: A Copper Busbar
• A busbar is an electric
current conductor –
typically found in high-
power applications.
• You will investigate:
– Joule Heating – Thermal Expansion – Flow with Cooling
for a certain busbar geometry
Boundary Conditions: Electric Currents
20
Boundary Conditions: Heat Transfer
Cooling with a heat transfer coefficient of 5 W/m^2/K and surrounding air temperature at 293.15 K
Now you’re ready for your own simulations!
The only difference between the hands-on and your problem is… • Perhaps a few more physics
• A bit more geometry • Some more loads & b.c.’s
Capture the Concept
TMQuestions
& Answers
6
An Example: Electrical Heating in a Busbar
An Example: Electrical Heating in a Busbar
In order to get acquainted with COMSOL Multiphysics, it is best to work through a basic example step by step. This section will cover the model building procedure, highlighting several features and demonstrating common simulation tasks. The example shows how to:
• Set up a multiphysics simulation
• Run a geometric parametric sweep
• Expand a model, taking more phenomena into account, after successfully running a first simulation
By following the directions in this section, you will create a model that analyzes a busbar designed to conduct a direct current from a transformer to an electric device (see below). The current conducted in the busbar, from bolt 1 to bolts 2a and 2b, produces heat due to the resistive losses, a phenomenon referred to as Joule heating.
This presents a classic example of multiphysics, since the electric conductivity of the conductor is temperature dependent while the heat source in the heat transfer problem depends on the electric current density. In fact, the phenomena are strongly coupled, meaning one affects the other and vice versa.
Titanium Bolt 2a
Titanium Bolt 1 Titanium Bolt 2b
An Example: Electrical Heating in a Busbar
Once you have captured the basic multiphysics phenomena, you will also have the chance to investigate thermal expansion yielding structural stresses and strains in the busbar and the effects of cooling by an air stream. The Joule heating effect is described by conservation laws for electric current and energy. Once solved for, the two conservation laws give the temperature and electric field, respectively. All surfaces, except the bolt contact surfaces, are cooled by natural convection in the air surrounding the busbar. You can assume that the electric potential at the upper-right vertical bolt surface is 10 mV and that the potential at the two lower horizontal surfaces of the lower bolts is 0 V.
The Model Wizard
Start COMSOL by double-clicking its icon on the desktop.
When the Model Wizard opens, select
a space dimension; the default is 3D.
Click the Next button to continue
to the physics page.
In the Add Physics step, click the Heat Transfer folder, right-click Joule Heating and Add Selected. Click the Next button .
8
An Example: Electrical Heating in a Busbar
The last Model Wizard step is to select
the Study Type. Preset Studies contains
studies that have solver and equation settings adapted to the Selected physics, in this example, Joule Heating.
Select the Stationary study type and
click the Finish button . Any
selection from the Custom Studies list
needs manual fine-tuning.
Global Definitions
The Global Definitions in the Model Builder stores Parameters, Variables,
and Functions with a global scope. You
can use these operations in several
Models. In this case, there is only one Model 1 node where the parameters are
used.
Since you will run a geometric parameter study later in the example, define the geometry using parameters from the start. Do this by entering parameters for the length for the lower part of the busbar, L, the radius of the titanium bolts, rad_1, the thickness of the busbar, tbb, and the width of the device, wbb.
Also add the parameters that will control the mesh, mh, a heat transfer coefficient for cooling by natural convection, htc, and a value for the voltage across the busbar, Vtot.
L 2xrad_1
wbb
An Example: Electrical Heating in a Busbar
Right-click Global Definitions and
select Parameters to create a list of
parameters containing L, rad_1, tbb, wbb, mh, htc, and Vtot. In the Parameters table, click the first row under Name and enter L. Click the first row under Expression and enter the
value of L, 9[cm]. Note that you can enter any unit inside the square brackets. Continue adding the other parameters according to the
Parameters list. It is a good idea to
type in descriptions for variables, in case you forget or share the model with others.
Geometry
Here you can take a shortcut by loading the model geometry from the
Model Library, which you open by choosing Open Model Library from the File menu. In the Model Library, select
COMSOL Multiphysics>Multiphysics>busbar_geom and then click Open.
Alternatively, you can construct the busbar geometry using the parameters entered above with the COMSOL geometry tools. If you would like to see this now, have a look at “Appendix: Creating Geometry Sequences” on page 42.
Once you have created or imported the geometry, experimenting with different dimensions is easy: update the values of L, tbb, or wbb, and rerun the geometry sequence.
Under Global Definitions click Parameters. In the Settings window, select the
wbb parameter’s Expression column and enter 10[cm] to change the value of the width wbb. In the Model Builder, click the Form Union node and then
10
An Example: Electrical Heating in a Busbar
the Build All button to rerun the geometry sequence. You should get a
wider busbar.
Return to the Parameters table and change the value of wbb back to 5[cm]. Rerun the geometry sequence.
Experienced users of other CAD programs are already familiar with this approach since all major CAD platforms include parameterized geometries. To support this class of users and avoid redundancy, COMSOL offers the
LiveLink family of products. These products connect COMSOL
Multiphysics directly with a separate CAD program, so that all parameters specified in CAD can be interactively linked with your simulation geometry. The current product line includes LiveLink™ for SolidWorks®, LiveLink™ for
Inventor®, and LiveLink™ for Pro/ENGINEER®.
It is also worth noting that LiveLink™ for Matlab® is available for those who want to incorporate a COMSOL Multiphysics model into an extended programming environment.
Having completed the geometry for your model, it is time to define the materials.
An Example: Electrical Heating in a Busbar Materials
The Materials node administrates
the material properties for all physics and all domains in a
Model node. The busbar is made
of copper, and the bolts are made of titanium. Both these materials are available from the Built-In
material database.
In the Model Builder, right-click Materials and select Open Material Browser. In the Material Browser, expand the Built-In
materials folder, right-click
Copper and select Add Material to Model.
Click the Material Browser window tab and repeat the above procedure for Titanium beta-21S.
In the Model Builder, collapse the Geometry 1 node to get a better overview
of the model. Under the Materials node, click Copper. In the Settings
window, locate the Material Contents section.
The Material Contents section
provides useful feedback on the model’s material property usage. Properties that are both required by the physics and available from the material are marked with a green check mark . Properties required by
the physics but missing in the material will result in an error and are therefore marked with a stop sign . A property that is not used in the model is unmarked. You may note that the Thermal expansion coefficient at the
bottom of the list is not used, but you will need it later for expanding your model with heat induced stresses and strains.
12
An Example: Electrical Heating in a Busbar
In the Settings window, click the Clear Selection button to clear the
selection list.
Click in the Graphics window to
highlight the copper domain. Right-click anywhere in the Graphics
window to add the highlighted domain to the copper Selection list in the
Settings window. Domain number 1
should now display in the list.
In the Model Builder, click the Titanium beta-21S node. Click the
upper titanium bolt to highlight it and then right-click to add it to the titanium Selection list. Repeat this
procedure for the two remaining bolts. These should correspond to the domains 2, 3, and 4.
Be sure to investigate the Material Contents section in the Settings
window. All the properties used by the physics interfaces should have a green check mark . Close the Material Browser.
Physics
The domain settings for the Joule Heating physics interface are complete
now that you have set the material properties for the different domains. Next you will set the proper boundary conditions for the heat transfer problem and the conduction of electric current.
An Example: Electrical Heating in a Busbar
In the Model Builder, expand the Joule Heating node to examine the default
physics interface nodes. Joule Heating Model 1 contains the settings for heat
conduction and current conduction. The heating effect for Joule heating is set in Electromagnetic Heat Source 1.
Thermal Insulation 1 contains the default boundary condition for the heat
transfer problem and Electric Insulation 1 corresponds to the conservation
of electric current. Initial Values 1 contains initial guesses for the nonlinear
solver for stationary problems and initial conditions for time-dependent problems.
Right-click the Joule Heating node. In the second section of the context
menu—the boundary section—select Heat Transfer >Heat Flux.
14
An Example: Electrical Heating in a Busbar
In the Settings window, select All boundaries in the Selection list.
Rotate the busbar to inspect the back. Click one of the titanium bolts to highlight it in green. Right-click anywhere in the
Graphics window to remove this
boundary from the Selection list.
Repeat this for the other two bolts. This removes boundaries 8, 12, and 28 from the Selection list.
Inspect the list to make sure only these boundaries are removed. In the Settings window, click the
Inward heat flux radio button.
Enter htc in the Heat transfer coefficient field, h. Continue by
setting the boundary conditions for the electric current.
In the Model Builder, right-click
the Joule Heating node. In the
second section of the context menu—the boundary section— select Electric Currents>Electric Potential. Click the circular face of
the upper titanium bolt to highlight it and right-click anywhere to add it to the Selection
list. The boundary face is numbered 28.
An Example: Electrical Heating in a Busbar
In the Settings window, enter Vtot in the Voltage field. The last step in
the physics settings is to set the two remaining bolt surfaces to ground.
In the Model Builder, right-click
the Joule Heating node. In the
boundary section of the context menu, select Electric
Currents>Ground.
In the Graphics window, click one
of the remaining bolts to highlight it. Right-click anywhere to add it to the Selection list. Repeat this
procedure for the last bolt.
Click the Go to Default 3D View button on the Graphics toolbar.
Mesh
The simplest way to mesh is to create an unstructured tetrahedral mesh. This will do nicely for the busbar.
In the Model Builder, right-click
the Mesh 1 node and select Free Tetrahedral. Click the Size
node .
In the Settings window, select the Custom button under Element Size. Enter mh in the Maximum element size field to set the
maximum element size to 6 mm— the value entered earlier as a global parameter.
16
An Example: Electrical Heating in a Busbar
Later, in Studying Mesh Dependence and Convergence on page 29, you will create meshes for running mesh convergence studies and to investigate the magnitude of the change in a solution parameter after refining the mesh.
Study
To run a simulation, in the Model Builder, right-click Study 1 and select Compute . The Study node automatically defines a solution sequence for
the simulation based on the selected physics and the study type. The simulation only takes a few seconds to solve.
Results
The default plot displays the temperature in the busbar. The temperature difference in the device is quite small, less than 1 K, due to the high thermal conductivity of copper and titanium. The temperature is
substantially higher than the ambient temperature 293 K.
With this solution in hand, you can create an image that will be displayed by COMSOL when browsing for model files. Go to the File menu and select Save Model Image. There are two other ways to create images from this plot.
One way is to use the Image Snapshot button in the Graphics toolbar for
An Example: Electrical Heating in a Busbar
by right-clicking the Plot Group of interest. The second option lets you reuse
the Image Settings if you update the model.
The temperature distribution is symmetric with a vertical mirror plane running between the two lower titanium bolts and running across the middle of the upper bolt. In this case, the model does not require much computing power and you can model the whole geometry. For more complex models, you should consider using symmetries in order to reduce the size of the model.
Another plot of interest shows the current density in the device. In the Model Builder, right-click Results and select 3D Plot Group. Right-click 3D Plot Group 3 and select Surface. In the Settings window, in the Expression section,
click the Replace Expression button . Select Electric Currents> Current density norm. This is the variable for the magnitude, or absolute
value, of the current density vector.
Click the Plot button . The resulting
plot is almost uniform due to the high current density at the contact edges with the bolts. You can change the
Range of the color table to visualize the
current density distribution in the
Settings window. Under Range, select
the Manual color range check box.
Enter 0.6e7 in the Maximum field.
Click the Plot button . Save the
model as busbar.mph.
This plot shows how the current takes the shortest path in the 90-degree bend in the busbar. Moreover, the edges of the busbar outside of the bolts are hardly utilized for current conduction.
18
An Example: Electrical Heating in a Busbar
Rotate the device to show the back of the busbar where you will see the high current density around the contact surfaces of the bolts. Continue the exercise by adding your own plots and investigating ways of generating cross section plots and cross section line plots.
Now you have completed a basic multiphysics simulation. The following
sections are designed to increase your understanding of the steps you implemented up to this point as well as to extend your simulation to include other relevant effects, like thermal expansion and fluid flow.
I m p o r t i n g C A D 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.
I M P O R T I N G C A D F I L E S | 5
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.
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
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.
3 D C A D G E O M E T R Y O F A N E N G I N E P I S T O N
In this example you import and mesh two versions of a 3D geometry of a diesel-engine piston. The first version of the geometry is intended for FEA and has many features suppressed. With the use of two symmetry planes you only need to analyze a quarter of the original geometry. The second version is the complete 3D geometry.
1 Start COMSOL by double-clicking its icon on the desktop.
2 In the Model Wizard ( ) the default space dimension is 3D. Since you do not need any physics modeling, you can click the Finish ( )button.
The Geometry 1 ( )node is added to the Model Builder. The Geometry 1 node contains the geometry sequence, where the geometry operations are stored. In the
Settings window to the right of the Model Builder you are able to change various geometry settings.
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 piston_for_fem.x_b, then click Open.
I M P O R T I N G C A D F I L E S | 7
6 Click Import in the Settings window.
As soon as the import is finished the geometry appears in the Graphics window.
Continue by creating a simple unstructured tetrahedral mesh.
7 Right-click the Mesh 1 node and select Free tetrahedral.
8 To build the mesh click the Build All ( ) button.
The Messages window indicates that there are roughly 34,000 tetrahedral elements in this geometry.
For the sake of comparison, import and mesh the complete 3D CAD geometry.
1 In the Model Builder select the Import 1 node.
2 In the Settings window click the Browse button.
3 Locate the course CD and select the file piston_design.x_b, then click Open.
4 Click the Mesh 1 node.
Since you have changed a setting, the Import 1 node is automatically rebuilt as you leave the geometry sequence. This means that the newly specified file is imported instead.
I M P O R T I N G C A D F I L E S | 9
5 Click the Build All button to mesh the geometry.
According to the Messages window, this part consists of approximately 201,000 tetrahedral elements.
Observe the differences between the two geometries and how this effects the mesh. The regions around small features such as fillets contain many small elements, which contribute significantly to the total number of elements.
I m p o r t o f I G E S F i l e s
The Initial Graphics Exchange Specification, or IGES, data format was first published in 1980, and supports data exchange for a wide range of formats including 3D solid modeling representations. Although it is not as suitable for CAD data transfer as modern file formats, the neutral IGES data format is still wide-spread for exchange of geometry data.
In the IGES format, 3D data is handled by a trimmed surface representation, which, in its basic form, does not include information about how the surfaces are connected. Thus, the faces that make up a solid geometry have to be stitched together during the import of the geometry, making the IGES format very sensitive to tolerances. The latest update of the IGES format, version 5.3, addresses this issue by including support for objects called Manifold Solid B-rep Objects (entity type 186), which can contain surface connectivity information. Provided it is supported by your CAD software, it is recommended that you use this option for IGES file export.
Knitting Faces after Import
In the majority of cases, IGES files do not contain any connectivity information and the process of knitting the faces together into a solid object is sensitive to tolerances. In this example, you can test how the knit tool included with the CAD Import Module can help you with creating a solid object, even though there are gaps between faces due to either design flaws or tolerance issues.
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 sphere.igs, then click
I M P O R T O F I G E S F I L E S | 11
6 Click Import in the Settings window.
The geometry looks like a solid sphere, whose outer surface is split into two halves.
Continue by creating a simple unstructured tetrahedral mesh.
7 Right-click the Mesh 1 node and select Free tetrahedral.
8 To build the mesh click the Build All button.
The mesh appears in the Graphics window, but a warning is displayed in the Settings
window that tetrahedral elements were not created since the geometry contains no domains.
Add a Measurements node to the geometry sequence to examine the imported geometry.
10Click the sphere object in the Graphics window to highlight it. Right-click anywhere to add it to the Selection list.
The following information is displayed in the Measurements window:
The information indicates that the geometry is not a solid object since it does not contain any domains.
By default, during import the CAD Import Module tries to knit faces and form solids. If a solid is not created, it usually means that there were gaps, larger than the default import tolerance of 10-5 in the geometry units, between geometry faces. In these next steps you will create a surface mesh of the sphere to visualize the gap between the two halves.
11Right-click the Free Tetrahedral 1 node and select Size.
12From the Geometric entity level list select Boundary.
13In the Graphics window click one of the faces of the sphere to highlight it. Right-click anywhere to add it to the Selection list.
I M P O R T O F I G E S F I L E S | 13
15Click the Build All button.
Examine the meshed surfaces, note that the mesh only connects on a portion of the common edge. On the portion where the mesh does not connect there is a narrow gap between the faces.
Even when the geometry includes such a gap you can create a solid by using the knit tool.
16Right-click the Geometry 1 node and select CAD Repair, then Knit to Solid.
The Knit to Solid 1 node is inserted into the geometry sequence after the Import 1
node.
17Select the sphere in the Graphics window, then enter 1e-4 in the Absolute repair tolerance edit field.
18To build the feature click the Build All button.
To check if a solid was indeed created you can use the Measurements tool.
19Right-click the Geometry 1 node and select Measurements.
20Add the sphere to the selection list, by selecting it in the Graphics window. The displayed information still indicates that there are no domains in the sphere. This means that the gap was larger than 10-4 m and the tool could not create a solid.
21Click the Knit to Solid 1 node, then enter 1e-2 in the Absolute repair tolerance edit field.
22Click the Build all button to build the feature.
23Right-click the Geometry 1 node and select Measurements, then select the sphere. This time the object contains a domain, which indicates that a solid object was created by the knit to solid tool.
24Mesh the geometry by clicking the Mesh 1 node, then the Build all button.
M O D E L I N G W I T H A S S E M B L I E S | 15
M o d e l i n g w i t h A s s e m b 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.
In the following exercise, you import a 3D CAD assembly and test each of the above methods for handling several geometry objects. You will also be able to test how to prepare the same assembly for contact modeling by setting up contact pairs.
The last exercise of this section will demonstrate how gaps and dimensional mismatches can influence the final mesh of an imported geometry.
Form a union
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
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 piston_assembly.x_b, then click Open.
6 Click Import in the Settings window.
When the import is completed, examine the geometry. Notice that there are three geometry objects: the piston, the pin, and the rod. The pin is connected to the rod and the piston.
7 Click the Form Union button in the Model Builder, then click the Build Selected( ) button.
The default finalization method is Form a union. After the operation is completed, examine the resulting geometry. Note that COMSOL Multiphysics has combined the three geometry objects into just one with three subdomains corresponding to the piston, pin, and rod, respectively. These subdomains are delimited by inner surfaces.
8 Right-click the Geometry 1 node and select Measurements.
9 Select all three geometry objects in the Graphics window. Note that each of the 3 objects contains one domain.
rod
piston pin
M O D E L I N G W I T H A S S E M B L I E S | 17
10From the Type of geometry list select Finalized geometry.
11From the Geometric entity level list select Entire geometry.
Note that the finalized geometry is a single object containing three domains. The total number of faces, edges, and points does not correspond to the number of entities before union.
Mesh two of the subdomains with different sized meshes.
12Right-click the Mesh 1 node and select Free Tetrahedral. 13From the Geometric entity level list select Domain.
14Add the pin (domain 3) and the rod (domain 2) to the selection list by selecting them in the Graphics window.
15Right-click the Free Tetrahedral 1 node and select Size.
16From the selection list select domain 2, then click the Remove from Selection button.
17From the Predefined list select Extremely fine.
18Right-click the Free Tetrahedral 1 node and select Size.
19From the selection list select domain 3, then click the Remove from Selection button.
20From the Predefined list select Extremely coarse.
Examine the mesh. The Wireframe Rendering( ) or Transparency ( ) buttons are useful when details of a geometry are hidden behind other parts. Notice that the elements are connected at the surface between the subdomains.
Form an Assembly and Create Imprints
Now change the finalization method to form an assembly and create imprints.
1 Click the Form Union node in the Model Builder.
2 From the Finalization method list select Form an assembly.
3 Select the Create imprints check box.
4 Click the Build Selected button.
The operation creates imprints on the pin surface that is in contact with the piston and the rod.
I D E N T I T Y P A I R S
To ensure continuity between the domains you can create identity pairs between the boundaries of the domains.
1 Right-click the Definitions node and select Identity Pair ( ). This adds an identity pair feature to the Model Builder.
To make the selection of surfaces easier first hide the rod and the piston.
2 Click the Select Domain ( ) button.
3 In the Graphics window click the rod, then click the Hide Selected ( ) button.
4 In the Graphics window click the piston, then click the Hide Selected ( ) button.
5 Click the Select Boundaries ( ) button to switch back to boundary selection.
6 Add the boundary of the pin in contact with the rod (boundary 105) to the list of
M O D E L I N G W I T H A S S E M B L I E S | 19
7 To add a second identity pair, between the pin and the piston, right-click the
Definitions node and select Identity Pair.
8 Add the boundary of the pin in contact with the piston (boundary 104) to the list of Source Boundaries.
Before selecting the destination boundaries, you can make the rod and the piston visible again and hide the pin instead.
9 Click first the Reset Hiding ( ) button, then click the Select Domain ( ) button.
10In the Graphics window click the pin, then click the Hide Selected ( ) button.
11In the Settings window of Identity Pair 2 click Activate Selection ( ) next to the
Destination Boundaries section.
12Add the boundary of the piston in contact with the pin (boundary 42) to the list of
Destination Boundaries.
13Click the Identity Pair 1 node.
15Add the boundary of the rod in contact with the pin (boundary 53) to the list of
Destination Boundaries.
16To show all domains again click the Reset Hiding ( ) button.
M E S H I N G
The three domains of the assembly object all have their own boundary surfaces. This option gives you greater freedom in meshing the different parts than the union method.
M O D E L I N G W I T H A S S E M B L I E S | 21
As you can see, you can now freely mesh the two objects with different sized meshes. Note that this mesh is for illustrative purposes and is not appropriate for FEA, due to the quality of the mesh.
Form an Assembly
Now test the third, and last, method of finalizing the geometry by creating an assembly object without any modification of the geometry.
1 Click the Form Assembly node in the Model Builder.
2 De-select the Create imprints check box.
3 Click the Build Selected button.
The operation forms an assembly object for modeling, but the geometry objects are not modified.
M E S H I N G
This procedure gives you even greater freedom in meshing the objects. Because there are no imprints on the boundary surfaces, you can create a swept mesh of the pin.
1 Click the Free Tetrahedral 1 node.
2 In the Selection list select domain 3 and click the Remove from Selection ( ) button.
3 Right-click the Size 1 node and select Delete.
4 Right-click Mesh 1 and select Swept.
5 From the Geometric entity level list select Domain.
6 Select the pin (domain 3).
7 Right-click the Swept 1 node and select Size.
9 Click the Build All ( ) button.
In this example you can see that after importing CAD assemblies, the method that gives you the greatest freedom in meshing is to form an assembly object without creating imprints. This method is also suitable for complex CAD geometries where a geometry analysis by the other two methods fails.
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.
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.
M O D E L I N G W I T H A S S E M B L I E S | 23
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:
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
POSITION: BASE: CORNER SIZE
x -0.01 Width 0.06
y -0.03 Depth 0.06
z -0.06 Height 0.12
plate 1
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 to 130,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
M O D E L I N G W I T H A S S E M B L I E S | 25
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.
8 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.
9 Click the Select Objects ( ) button.
10In the Graphics window click the block, then click the Hide Selected ( ) button.
11In the Graphics window click plate 1, then click the Hide Selected ( ) button.
12Click the Select Boundaries ( ) button to switch back to boundary selection.
13Add the faces highlighted in the figure below, boundaries 1, 2, 5, 6, 7, 8 on object imp1(1), to the list of Faces to delete.
The selected faces delimit the features to be removed.
14Click 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.
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.
15Click the Select Objects ( ) button.
16In the Graphics window click the block, then click the Hide Selected ( ) button.
17In the Graphics window click plate 2, then click the Hide Selected ( ) button.
M O D E L I N G W I T H A S S E M B L I E S | 27
19Add the faces highlighted in the figure below, boundaries 5-8, 9-12 on object imp1(2), to the list of Faces to delete.
21Click 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.
22Click 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.
23Repeat the previous step for the other three holes.
24The Faces to delete list should now contain faces 7-14 and 17-24 of object dfa1.
25Click the Delete Selected button to delete the holes. The last step is to create a new mesh of the geometry.
M O D E L I N G W I T H A S S E M B L I E S | 29
26Right-click the Mesh 1 node in the Model Builder, then select Build All.
The mesh now consists of about 31,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
27Right-click the Geometry 1 node and select Export to File.
28The Input list shows all three objects selected (dfa2, blk1, and dfa3). To accept and export the objects click Export.
29From the Save as type list select either Parasolid binary file or Parasolid text file.
30Select a directory, enter a file name, then click Save.
The resulting Parasolid file can be imported into most CAD software.
You can also use the CAD Import Module to fix the dimensional discrepancy, by for example using the repair functionality of the Finalize feature.
31Click the Form Union feature node.
32In the Relative repair tolerance edit field enter 1e-3.
33Right-click the Mesh 1 node in the Model Builder, then select Build All.
32 | C H A P T E R 3 : M E S H I N G T E C H N I Q U E S
T h e M e s h i n g S e q u e n 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-5m, 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
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.
8 Click the small plus sign (or triangle) in front of the Mesh 1 node to expand the meshing sequence.
Initially the meshing sequence contains only the Size feature node. This feature 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 Right-click the Mesh 1 node and select Free tetrahedral.
The Free Tetrahedral 1 feature node is added after the Size 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 Tetrahedral 1 node becomes the current feature.
Electronic component
Solder joints Circuit board
34 | C H A P T E R 3 : M E S H I N G T E C H N I Q U E S
10To 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.
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 face. For straight and circular sweep paths, you can use several connected faces as source
36 | C H A P T E R 3 : M E S H I N G T E C H N I Q U E S
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.
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.
8 Right-click the Free Triangular 1 node and select Size.
10Click the Build All ( ) button to build the mesh.
The mesh is built, but a Problems node appears under the Free Triangular 1 feature node.
11Expand the Problems 1 node, then 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 then 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.
12Click the Size node, then select Coarser from the Predefined list.
13Right-click the Free Tetrahedral 1 node, and select Size.
14From the Predefined list select Normal.
Since the global setting is Coarser, the size attribute to the Free Triangular 1 node is no longer necessary.
38 | C H A P T E R 3 : M E S H I N G T E C H N I Q U E S
16Right-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.
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.
40 | C H A P T E R 3 : M E S H I N G T E C H N I Q U E S
This latest mesh consists of approximately 18,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.
F r e e M e s h P a r a m e t e r s
The free meshing algorithm using tetrahedral elements is the most general meshing technique, and does not pose any constraints on the structure of the geometry. Hence it can be used to mesh any arbitrary object.
This exercise shows how to use the various parameters of the free mesh algorithm. There are a number of predefined parameter sets, and each parameter can be tuned individually.
Predefined Parameter Settings
There are nine predefined parameter sets ranging from “extremely fine” to “extremely coarse.” These settings result in a good mesh for most geometries and simulation problems.
Follow the next steps to import a 3D CAD model and to test two of these settings.
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 piston_for_fem.x_b, then click Open.
6 Right-click the Mesh 1 node and select Free tetrahedral.
7 To build the mesh click the Build All ( ) button.
The Messages window indicates that there are roughly 34,000 tetrahedral elements in this geometry.
Use the mouse to rotate the object and look at the geometry more closely. You can see that it contains some small details such as fillets and chamfers. Assume that the existing mesh does not resolve these details sufficiently for your simulation needs and so a finer parameter setting is required.
42 | C H A P T E R 3 : M E S H I N G T E C H N I Q U E S
9 From the Predefined list select Fine.
This changes the predefined parameter set from “Normal” to “Fine”.
10To build the mesh click the Build All button.
11In the Messages window, note that this mesh consists of approximately 91,000 elements.
If you examine the mesh you can see that, even with the Fine settings, some narrow areas are not resolved sufficiently. You could decrease the mesh size once more but, to achieve a fine mesh only on certain types of boundaries, you also have the possibility to tune individual mesh parameters. This is demonstrated in the following sections.
Mesh Curvature
Assume that you want a better resolution on regions with a high curvature, such as fillets. To find the right setting you can test it first on just one of the fillets in the geometry.
1 Click the Size 1 node.
2 From the Predefined list select Normal.
3 From the Geometric entity level list select Boundary.
4 From the Graphics window select the boundary highlighted (boundary 12) in the figure below.
5 In the Element Size section click the Custom radio button.
6 Select the Minimum element size check box.
7 Change the value of Minimum element size to 5e-4.
With the Minimum element size parameter, you can prevent the generation of a fine mesh around small curved regions of the geometry. When the radius of curvature is smaller than this value, the mesh generator considers the radius of curvature as being this value.
8 To build the mesh click the Build All ( ) button.
9 Select the Resolution of curvature check box.
10In the Resolution of curvature enter 0.5.
The Resolution of curvature parameter determines the size of boundary elements compared to the curvature of the geometric boundary. The curvature radius multiplied by the resolution of curvature gives the maximum allowed element size along the boundary. A lower value gives a finer mesh along curved boundaries.
11To build the mesh click the Build All ( ) button.