Comsol Alex Course Program Book

183
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

description

Comsol multiphysics Alex Course Program Book

Transcript of Comsol Alex Course Program Book

  • 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 - Fluid Structure Interaction

  • 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!

    Elnady Engineering & Agencies

  • 1

    Introductory Models

    Tutorials

    Parallel plate capacitor

    Thermal cube

    Stresses in a wrench

  • 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

    Adding Thermal Expansion

  • 3

    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

    Checkered flag to Finish

  • 5

    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

  • 7

    Set Boundary Cond Electric Potential

    Right-Click Electrostatics

    Choose Electric Potential

    Set to 100 Volts

    Choose Box Selection

    Select Top Electrode

    Mesh Free Triangular (Extra Fine)

  • 8

    Solve

    Pick Study 1

    Hit =

    Tutorial 2: Thermal cube

    More Practice with the User Interface

    Adding a 2nd Physics

    Adding Thermal Expansion

  • 9

    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

    Leave as 1 x 1 x 1 [m]

  • 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

  • 11

    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

    Choose the finish (checkered) flag

  • 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

  • 13

    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

    Then the checkered flag to Finish

  • 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

  • 15

    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

  • 17

    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 appendix

  • 19

    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

    Electric Potential 10mV Ground

  • 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 youre 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

    Go to it (!!!)

  • 21

    Capture the ConceptTM

    Questions

    & Answers

  • 6An Example: Electrical Heating in a Busbar

    An Example: Electrical Heating in a BusbarIn 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 simulationBy 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 1Titanium Bolt 2b

  • 7An 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 WizardStart 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 .

  • 8An 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 DefinitionsThe 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

    tbb

  • 9An 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.

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

    wbb=5cm wbb=10cm

  • 11

    An Example: Electrical Heating in a Busbar

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

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

  • 13

    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 menuthe boundary sectionselect Heat Transfer >Heat Flux.

    Boundary Section Domain Section

  • 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 menuthe boundary sectionselect 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.

  • 15

    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.

    MeshThe 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 mmthe value entered earlier as a global parameter.

    Click the Build All button to create the mesh.

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

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

    ResultsThe 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 directly creating an image, and another is to add an Image node to the Report

  • 17

    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.

  • 4 | C H A P T E R 2 : C A D I M P O R T

    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.

  • 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

  • 6 | C H A P T E R 2 : C A D I M P O R T

    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.

    The Mesh 1 node contains the operations that make up the mesh sequence.

  • 8 | C H A P T E R 2 : C A D I M P O R T

    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.

  • 10 | C H A P T E R 2 : C A D I M P O R T

    Impo r t o f I GE 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 Open.

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

    9 Right-click Geometry 1 then select Measurements.

  • 12 | C H A P T E R 2 : C A D I M P O R T

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

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

    12 From the Geometric entity level list select Boundary.

    13 In the Graphics window click one of the faces of the sphere to highlight it. Right-click anywhere to add it to the Selection list.

    14 From the Predefined list select Fine.

  • I M P O R T O F I G E S F I L E S | 13

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

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

    17 Select the sphere in the Graphics window, then enter 1e-4 in the Absolute repair tolerance edit field.

    18 To build the feature click the Build All button.

    To check if a solid was indeed created you can use the Measurements tool.

    19 Right-click the Geometry 1 node and select Measurements.

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

  • 14 | C H A P T E R 2 : C A D I M P O R T

    21 Click the Knit to Solid 1 node, then enter 1e-2 in the Absolute repair tolerance edit field.

    22 Click the Build all button to build the feature.

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

    24 Mesh the geometry by clicking the Mesh 1 node, then the Build all button.

    This time a properly connected volume mesh for the solid object was created.

  • M O D E L I N G W I T H A S S E M B L I E S | 15

    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.

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

  • 16 | C H A P T E R 2 : C A D I M P O R T

    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

    10 From the Type of geometry list select Finalized geometry.

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

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

    13 From the Geometric entity level list select Domain.

    14 Add the pin (domain 3) and the rod (domain 2) to the selection list by selecting them in the Graphics window.

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

    16 From the selection list select domain 2, then click the Remove from Selection button.

    17 From the Predefined list select Extremely fine.

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

    19 From the selection list select domain 3, then click the Remove from Selection button.

    20 From the Predefined list select Extremely coarse.

    21 Click Build All button.

  • 18 | C H A P T E R 2 : C A D I M P O R T

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

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

    10 In the Graphics window click the pin, then click the Hide Selected ( ) button.

    11 In the Settings window of Identity Pair 2 click Activate Selection ( ) next to the Destination Boundaries section.

    12 Add the boundary of the piston in contact with the pin (boundary 42) to the list of Destination Boundaries.

    13 Click the Identity Pair 1 node.

    14 Click Activate Selection ( ) next to the Destination Boundaries section.

  • 20 | C H A P T E R 2 : C A D I M P O R T

    15 Add the boundary of the rod in contact with the pin (boundary 53) to the list of Destination Boundaries.

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

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

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

    8 From the Predefined list select Extremely Fine.

  • 22 | C H A P T E R 2 : C A D I M P O R T

    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.

    4 In the Settings window click the Browse button.

  • 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

    plate 2

  • 24 | C H A P T E R 2 : C A D I M P O R T

    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

    Dense mesh regions

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

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

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

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

    narrow gaps

  • 26 | C H A P T E R 2 : C A D I M P O R T

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

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

    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.

    15 Click the Select Objects ( ) button.

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

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

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

  • M O D E L I N G W I T H A S S E M B L I E S | 27

    19 Add the faces highlighted in the figure below, boundaries 5-8, 9-12 on object imp1(2), to the list of Faces to delete.

    20 Select the Heal as through hole check box.

  • 28 | C H A P T E R 2 : C A D I M P O R T

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

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

    23 Repeat the previous step for the other three holes.

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

    25 Click 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

    26 Right-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

    Objects are not of the same width

  • 30 | C H A P T E R 2 : C A D I M P O R T

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

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

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

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

    31 Click the Form Union feature node.

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

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

  • 32 | C H A P T E R 3 : M E S H I N G TE C H N I Q U E S

    Th e Me s h i n g S equ 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

  • T H E M E S H I N G S E Q U E N C E | 33

    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 jointsCircuit board

  • 34 | C H A P T E R 3 : M E S H I N G TE C H N I Q U E S

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

    2 From the Geometric entity level list select Domain.

  • T H E M E S H I N G S E Q U E N C E | 35

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

    9 From the Predefined list select Coarser.

  • T H E M E S H I N G S E Q U E N C E | 37

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

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

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

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

    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.

  • 38 | C H A P T E R 3 : M E S H I N G TE C H N I Q U E S

    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.

  • T H E M E S H I N G S E Q U E N C E | 39

    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.

  • 40 | C H A P T E R 3 : M E S H I N G TE 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 | 41

    F r e e Me s h Pa r ame 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.

    8 Right-click the Free Tetrahedral 1 node, then select Size.

  • 42 | C H A P T E R 3 : M E S H I N G TE 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.

    10 To build the mesh click the Build All button.

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

  • F R E E M E S H P A R A M E T E R S | 43

    8 To build the mesh click the Build All ( ) button.

    9 Select the Resolution of curvature check box.

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

    11 To build the mesh click the Build All ( ) button.

    The selected fillet is resolved even finer with this mesh.

  • 44 | C H A P T E R 3 : M E S H I N G TE C H N I Q U E S

    Resolution of Narrow Regions

    Assume that you also want better resolution on narrow regions with no curvature such as chamfers.

    12 From the Graphics window add the boundary highlighted (boundary 44) in the figure below to the Selection list of the Size 1 feature node.

    13 Select the Resolution of narrow regions check box.

    14 In the Resolution of narrow regions edit field enter 2.1.

    The mesh Resolution of narrow regions mesh parameter approximately controls the number of layers of elements that are created in narrow regions (approximately). If the value of this parameter is less than one, the mesh generator might create elements that are anisotropic in size in narrow regions.

    15 To build the mesh click the Build All ( ) button.

  • F R E E M E S H P A R A M E T E R S | 45

    Element Growth Rate

    Assume that you are happy with the new parameter settings for curved and narrow regions. Now use these to mesh the entire geometry.

    1 Click the Zoom Extents ( ) button to see the entire geometry.

    2 From the geometric entity level list in the Size 1 feature node select Entire geometry.

    3 To build the mesh click the Build All ( ) button.

    The fine details of the geometry are resolved satisfactorily. However, the mesh consists of approximately 308,000 elements, which is too many. Assume that the inner part of the volume does not need such a high resolution. You can change it by specifying the rate of growth from the small elements on the surface towards the inner part of the geometry.

    4 Select the Maximum element growth rate check box.

    5 In the Maximum element growth rate edit field enter 2.3.

    The Maximum element growth rate determines the maximum rate at which the element size can grow from a region with small elements to a region with larger elements.

    6 To build the mesh click the Build All ( ) button.

    7 In the Messages window you can see that this mesh consists of approximately 112,000 elements.

  • 46 | C H A P T E R 3 : M E S H I N G TE C H N I Q U E S

    Mesh Quality

    Changing various mesh parameters can influence the quality of the mesh. In general, the default settings result in a mesh with rather good quality. However, this quality can decrease drastically when changing individual parameters.

    First take a look at the mesh statistics for the current mesh on the piston.

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

    The Statistics window appears, which contains details about the mesh, including the number and type of elements, and a histogram of element quality.

    The element quality is a number between 0 and 1, where 1 describes a perfectly isotropic element, and 0 describes a flat element. For 3D meshes in general a minimum quality of about 0.1 means a satisfactory mesh. However, this depends also on the type of geometry and physics application. Note that the quality number is calculated based on the linear elements.

  • F R E E M E S H P A R A M E T E R S | 47

    In the following, you learn how to visualize the elements with the worst mesh quality. Assume that you want to achieve the opposite goal as described in the previous exampleyou want much to resolve the narrow regions with less mesh.

    1 Click the Size 1 feature node.

    2 Select the Predefined radio button, then select the Custom radio button.

    This way the custom mesh parameters are reset to values corresponding to the Normal predefined mesh size.

    3 Select the Resolution of narrow regions check box.

    4 Change the value of Resolution of narrow regions to 0.1.

    5 To build the mesh click the Build All ( ) button.

    6 Right-click the Mesh 1 node and select Statistics.

    Now your mesh consists of only 28,000 elements. However, in the area of the narrow regions the quality becomes worse. The minimum element quality has decreased, and according to the histogram there is a relatively small number of elements that have the lowest quality.

    Visualize this situation with the following steps.

    7 Right-click the Mesh 1 node and select Plot.

    The Mesh 1 plot is added to the 3D Plot Group 1 under the Results section of the Model Builder. The mesh plot that appears in the Graphics window contains the volume elements colored according to quality.

    8 Expand the Element Filter section, and select Enable filter.

    9 From the Criterion list select Worst quality.

    10 In the Fraction edit field enter 0.005.

  • 48 | C H A P T E R 3 : M E S H I N G TE C H N I Q U E S

    11 Click the Plot button.

    You can now see those 0.5% of elements with the worst quality, where almost all of them are located around the narrow faces. As anticipated, decreasing the mesh resolution in narrow regions detrimentally influences the quality of the mesh.

  • M A P P E D A N D S W E P T M E S H I N G | 49

    Mapped and Swep t Me s h i n g

    COMSOL Multiphysics provides the ability to create structured meshes, specifically, mapped meshes on surfaces and swept meshes in subdomains. Each of these techniques can be used interactively and has its own set of parameters.

    This exercise demonstrates how to use the mapped and swept meshing techniques. It shows how to create these meshes interactively so as to achieve a desired distribution of elements.

    Swept Mesh with Default Settings

    First create a swept mesh with the default 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 thin_layer.mphbin, then click Open.

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

    7 To build the mesh click the Build All ( ) button.

  • 50 | C H A P T E R 3 : M E S H I N G TE C H N I Q U E S

    This procedure creates a very coarse mesh consisting of hexahedral elements. Assume that you want dense layers at the bottom because you expect high gradients in the simulation. In addition, you want a better resolution in the curved part of the geometry. The following section shows how to achieve these goals.

    Mapped Mesh Parameters

    In order to force a certain element distribution in a cross-section of the geometry, you must create a mesh on a source face. This mesh is later swept through the subdomains of the geometry.

    1 Click the Size node in the Model Builder.

    2 Click the Build Selected ( ) button.

    By building the Size feature, it becomes the current feature node in the mesh sequence after which the mapped mesh operation can be inserted.

    3 Right-click the Mesh 1 node and select More Operations>Mapped.

    4 Add boundary 1, which is highlighted in the figure below, to the Selection list.

    5 Right-click the Mapped 1 node and select Distribution.

    6 Add Edges 1 and 6 to the Selection list of the Distribution 1 feature node.

    7 From the Distribution properties list select Predefined distribution type.

    8 Type 8 in the Number of elements edit field.

  • M A P P E D A N D S W E P T M E S H I N G | 51

    9 In the Element ratio edit field type 5.

    This parameter controls the ratio in size between the last element and the first element along the edge.

    10 In the Distribution method list select Geometric sequence.

    11 Right-click the Mapped 1 node and select Distribution.

    12 Add Edges 2 and 4 to the Selection list of the Distribution 2 feature node.

    13 Type 2 in the Number of elements field.

    14 To build the mesh click the Build All ( ) button.

    15 Use the zoom and rotation features to magnify the modified mesh.

    You have achieved the desired element distribution in the cross section. The mesh looks to be adequate on the straight parts. However, the curved parts are not resolved satisfactorily.

    Swept Mesh Parameters

    Change the swept mesh parameters in order to achieve the desired element distribution along the subdomains.

  • 52 | C H A P T E R 3 : M E S H I N G TE C H N I Q U E S

    1 Right-click on the Swept 1 node and select Distribution.

    2 In the Selection list select domains 2, 3 and 4, then click the Remove from Selection ( ) button.

    3 From the Distribution properties list select Predefined distribution type.

    4 Type 5 in the Number of elements edit field.

    5 In the Element ratio edit field type 3.

    6 From the Distribution method list select Geometric sequence.

    7 Select the Reverse direction check box.

    This defines the distribution in the opposite direction for the selected subdomain.

    1 Right-click on the Swept 1 node and select Distribution.

    2 In the Selection list select domains 1, 3 and 4, then click the Remove from Selection ( ) button.

    3 From the Distribution properties list select Predefined distribution type.

    4 Type 5 in the Number of elements edit field.

    5 In the Element ratio edit field type 3.

    6 From the Distribution method list select Geometric sequence.

    The last step is to define the distribution for the curved parts.

    7 Right-click on the Swept 1 node and select Distribution.

    8 In the Selection list select domains 1 and 2, then click the Remove from Selection ( ) button.

    9 Type 10 in the Number of elements edit field.

    10 To build the mesh click the Build All ( ) button.

  • Solved with COMSOL Multiphysics 4.1Hea t S i n k

    Introduction

    This model is intended as a first introduction to simulations of fluid flow and conjugate heat transfer. It is also a very useful model for exploring the modeling procedure in COMSOL Multiphysics. More specifically, it demonstrates the use of three important concepts:

    The concept of sequencing. Each operation that you can use to set up a simulation is displayed as a node in the Model Tree. As you proceed with your model, the Model Tree forms a sequence of operations. You can make changes to any of the nodes in the tree and then re-run the sequence of operations to update your model according to the changes in the node settings.

    The selection of materials in the Materials node. In this node, you can specify and investigate materials and material properties for all the domains and for all physics interfaces in your model.

    The use of selections. In the Selections node, you can define selections of domains, boundaries, edges, and points, which you can later use in other steps in the modeling procedure.

    Model Definition

    The modeled system consists of an aluminum heat sink for cooling of components in electronic circuits mounted inside a channel of rectangular cross section; see Figure 1. Such a set-up is used in order to measure the cooling capacity of heat sinks. Air enters the channel at the inlet and exits the channel at the outlet. The base surface of the heat sink is kept at a constant temperature through an external heat source. All other external faces are thermally insulated.H E A T S I N K | 1

  • Solved with COMSOL Multiphysics 4.1

    2 | H E A T S I N Kinlet

    outlet base surface

    Figure 1: The model set-up including channel and heat sink.

    The cooling capacity of the heat sink can be determined by measuring the power required to keep the base surface of the heat sink at a constant temperature.

    The model solves a thermal balance for the heat sink and the air flowing in the rectangular channel. Thermal energy is transported through conduction in the aluminum heat sink and through conduction and convection in the cooling air. The temperature field is continuous across the internal surfaces between the heat sink and the air in the channel. The temperature is set at the inlet of the channel and at the base of the heat sink. Alternatively, you can also simulate the presence of a layer of adhesive material between the heat sink and the heating device used to keep a constant temperature. In such case, you have to define a heat transfer coefficient for the adhesive layer and then set the temperature at the heater side of the layer. The transport of thermal energy at the outlet is dominated by convection.

    The flow field is obtained by solving one momentum balance for each space coordinate (x, y, and z) and a mass balance. The inlet velocity is defined by a parabolic velocity profile for fully developed laminar flow. At the outlet, a constant pressure is combined the assumption that there are no viscous stresses in the direction perpendicular to the outlet. At all solid surfaces, the velocity is set to zero in all three spatial directions.

  • Solved with COMSOL Multiphysics 4.1The thermal conductivity of aluminum, the thermal conductivity of air, the heat capacity of air, and the air density are all temperature-dependent material properties.

    You can find all of the settings mentioned above in the physics interface for Conjugate Heat Transfer in COMSOL Multiphysics. You also find the material properties, including their temperature dependence, in the Material Browser

    Results

    In Figure 2, the hot wake behind the heat sink visible in the plot is a sign of the convective cooling effects.

    Figure 2: The surface plot visualizes the temperature field on the channel walls and the heat sink surface, while the arrow plot shows the flow velocity field around the heat sink.

    Model Library path: Heat_Transfer_Module/Tutorial_Models/heat_sinkH E A T S I N K | 3

  • Solved with COMSOL Multiphysics 4.1

    4 | H E A T S I N KModeling Instructions

    M O D E L W I Z A R D

    1 Go to the Model Wizard window.

    2 Click Next.

    3 In the Add Physics tree, select Heat Transfer>Conjugate Heat Transfer>Laminar Flow (nitf).

    4 Click Next.

    5 In the Studies tree, select Preset Studies>Stationary.

    6 Click Finish.

    G L O B A L D E F I N I T I O N S

    Parameters1 In the Model Builder window, right-click Global Definitions and choose Parameters.

    Define some parameters that you can use when specifying the channel dimensions.

    2 Go to the Settings window for Parameters.

    3 Locate the Parameters section. In the Parameters table, enter the following settings:

    G E O M E T R Y 1

    Import 11 In the Model Builder window, right-click Model 1>Geometry 1 and choose Import.

    2 Go to the Settings window for Import.

    3 Locate the Import section. Click the Browse button.

    4 Browse to the models Model Library folder and double-click the file heat_sink_n19.mphbin.

    5 Click the Build Selected button.

    6 In the Model Builder window, right-click Geometry 1 and choose Work Plane.

    NAME EXPRESSION DESCRIPTION

    L_channel 7[cm] Channel length

    W_channel 3[cm] Channel width

    H_channel 1.5[cm] Channel height

    U0 5[cm/s] Mean inlet velocity

  • Solved with COMSOL Multiphysics 4.1Rectangle 11 In the Model Builder window, right-click Geometry and choose Rectangle.

    2 Go to the Settings window for Rectangle.

    3 Locate the Size section. In the Width edit field, type L_channel.

    4 In the Height edit field, type W_channel.

    5 Locate the Position section. In the x edit field, type -4.5e-2.

    6 In the y edit field, type -W_channel/2.

    7 Click the Build Selected button.

    Extrude 11 In the Model Builder window, right-click Work Plane 1 and choose Extrude.

    2 Click the Go to Default 3D View button on the Graphics toolbar.

    3 Go to the Settings window for Extrude.

    4 Locate the Distances from Work Plane section. In the table, enter the following settings:

    5 Click the Build Selected button.

    M A T E R I A L S

    1 In the Model Builder window, right-click Model 1>Materials and choose Open Material Browser.

    2 Go to the Material Browser window.

    3 Locate the Materials section. In the Materials tree, select Built-In>Air.

    4 Right-click and choose Add Material to Model from the menu.

    AirBy default, the first material you add applies to all domains. Typically, you can leave this setting and add other materials that override the default material where applicable. In this example, specify aluminum for Domain 2:

    1 In the Model Builder window, right-click Materials and choose Open Material Browser.

    2 Go to the Material Browser window.

    3 Locate the Materials section. In the Materials tree, select Built-In>Aluminum 3003-H18.

    DISTANCES (M)

    H_channelH E A T S I N K | 5

  • Solved with COMSOL Multiphysics 4.1

    6 | H E A T S I N K4 Right-click and choose Add Material to Model from the menu.

    Aluminum 3003-H181 In the Model Builder window, click Aluminum 3003-H18.

    2 Select Domain 2 only.

    C O N J U G A T E H E A T TR A N S F E R

    Fluid 11 In the Model Builder window, right-click Model 1>Conjugate Heat Transfer and choose

    Fluid.

    2 Select Domain 1 only.

    Inlet 11 In the Model Builder window, right-click Conjugate Heat Transfer and choose the

    boundary condition Laminar Flow>Inlet.

    2 Select Boundary 115 only.

    3 Go to the Settings window for Inlet.

    4 Locate the Boundary Condition section. From the Boundary condition list, select Laminar inflow.

    5 In the Uav edit field, type U0.

    Outlet 11 In the Model Builder window, right-click Conjugate Heat Transfer and choose the

    boundary condition Laminar Flow>Outlet.

    2 Select Boundary 1 only.

    Temperature 11 In the Model Builder window, right-click Conjugate Heat Transfer and choose the

    boundary condition Heat Transfer>Temperature.

    2 Select Boundary 115 only.

    The default temperature, corresponding to 20 degrees Celsius or 68 degrees Fahrenheit, applies at the inlet.

    Temperature 21 In the Model Builder window, right-click Conjugate Heat Transfer and choose the

    boundary condition Heat Transfer>Temperature.

    2 Select Boundary 8 only.

    3 Go to the Settings window for Temperature.

  • Solved with COMSOL Multiphysics 4.14 Locate the Temperature section. In the T0 edit field, type 393.15[K].

    This value corresponds to 120 degrees Celsius or 248 degrees Fahrenheit.

    Outflow 11 In the Model Builder window, right-click Conjugate Heat Transfer and choose the

    boundary condition Heat Transfer>Outflow.

    2 Select Boundary 1 only.

    M E S H 1

    Free Tetrahedral 1In the Model Builder window, right-click Model 1>Mesh 1 and choose Free Tetrahedral.

    Size 11 In the Model Builder window, right-click Free Tetrahedral 1 and choose Size.

    2 Go to the Settings window for Size.

    3 Locate the Geometric Scope section. From the Geometric entity level list, select Domain.

    4 Select Domain 1 only.

    5 Locate the Element Size section. From the Predefined list, select Finer.

    6 Click the Build All button.

    D E F I N I T I O N S

    In the Model Builder window, right-click Study 1 and choose Compute.

    Selection 11 In the Model Builder window, right-click Model 1>Definitions and choose Selection.

    2 Go to the Settings window for Selection.

    3 Locate the Geometric Scope section. From the Geometric entity level list, select Boundary.

    4 Right-click Selection 1 and choose Rename.

    5 Go to the Rename Selection dialog box and type walls in the New name edit field.

    6 Click OK.

    7 Right-click Selection 1 and choose Select Box.

    8 Select Boundaries 3 and 5114 only.H E A T S I N K | 7

  • Solved with COMSOL Multiphysics 4.1

    8 | H E A T S I N K

    R E S U L T SData Sets1 In the Model Builder window, right-click Results>Data Sets>Solution 1 and choose

    Add Selection.

    2 Go to the Settings window for Selection.

    3 Locate the Geometric Scope section. From the Geometric entity level list, select Boundary.

    4 From the Selection list, select walls.

    3D Plot Group 11 In the Model Builder window, click Surface 1.

    2 Go to the Settings window for Surface.

    3 Locate the Coloring and Style section. From the Color table list, select Thermal.

    4 In the Model Builder window, right-click 3D Plot Group 1 and choose Arrow Volume.

    5 Go to the Settings window for Arrow Volume.

    6 In the upper-right corner of the Expression section, click Replace Expression.

    7 From the menu, choose Conjugate Heat Transfer (Laminar Flow)>Velocity field (u, v, w).

    8 Locate the Arrow Positioning section. Find the x grid points subsection. In the Points edit field, type 40.

    9 Find the y grid points subsection. In the Points edit field, type 20.

    10 Find the z grid points subsection. From the Entry method list, select Coordinates.

    11 In the Coordinates edit field, type 5e-3.

    12 Right-click Arrow Volume 1 and choose Color Expression.

    13 Go to the Settings window for Color Expression.

    14 In the upper-right corner of the Expression section, click Replace Expression.

    15 From the menu, choose Conjugate Heat Transfer (Laminar Flow)>Velocity magnitude (nitf.U).

    16 Click the Plot button.

  • Solved with COMSOL Multiphysics 4.2a

    2 0 1 1 C OV a r i o u s Ana l y s e s o f an E l b ow B r a c k e t

    Introduction

    The component depicted in Figure 1 is part of a support mechanism and is subjected to both mechanical loads and thermal loads. This tutorial model takes you through the steps to carry out a detailed analysis of the part using the Structural Mechanics Module.

    Figure 1: Geometry of the elbow bracket.

    In the various parts of the model you are introduced to using the available basic analysis types, together with numerous postprocessing possibilities. These analysis types are:

    Static analysis

    Eigenfrequency analysis

    Damped eigenfrequency analysis

    Transient analysis

    Modal based transient analysis

    Frequency response analysis

    Modal based frequency response analysis

    Parametric analysis

    Linear buckling analysis

    This tutorial model consists of a single model, with nine studies, corresponding to these analysis types, which are described in the section Available Study Types in the Structural Mechanics Module Users Guide. The chapter Structural Mechanics Modeling in the same manual provides further assistance.M S O L 1 | V A R I O U S A N A L Y S E S O F A N E L B O W B R A C K E T

  • Solved with COMSOL Multiphysics 4.2a

    2 | V A RNote: If you have already built the short model version described in Static and Eigenfrequency Analyses o