comsol postprosessing and visualization handbook part-1 · essentials of postprocessing and...

36
Essentials of Postprocessing and Visualization in COMSOL Multiphysics ® COMSOL HANDBOOK SERIES

Upload: ngodien

Post on 04-Jun-2018

339 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

2ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

CUT POINTS AND EVALUATIONS

Essentials of Postprocessing and Visualization in COMSOL Multiphysics®

COMSOL HANDBOOK SERIES

Page 2: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

Essentials of Postprocessing and Visualization in COMSOL MultiphysicsCOMSOL, COMSOL Multiphysics, Capture the Concept, COMSOL Desktop, and LiveLink are either registered trademarks or trademarks of COMSOL AB. All other trademarks are the property of their respective owners, and COMSOL AB and its subsidiaries and products are not affiliated with, endorsed by, sponsored by, or supported by those trademark owners. ©2014-2015 COMSOL.

Contact InformationVisit the Contact COMSOL page at www.comsol.com/contact to submit general inquiries, contact Technical Support, or search for an address and phone number. You can also visit the Worldwide Sales Offices page at www.comsol.com/contact/offices for address and contact information.

If you need to contact Support, an online request form is located at the COMSOL Access page atwww.comsol.com/support/case.

Further ResourcesFurther writing and tutorials on postprocessing in COMSOL are available here:

VIDEOS www.comsol.com/search/?s=postprocessing&subset=video

BLOG ARTICLES www.comsol.com/search/?s=postprocessing&subset=blog

DISCUSSION FORUM www.comsol.com/community/forums/results-and-visualization/

SUPPORT KNOWLEDGE BASE www.comsol.com/support/knowledgebase/

ii

Page 3: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

TABLE OF CONTENTS

INTRODUCTION 1

DATA SETS, DERIVED VALUES, AND TABLES ▪ Solutions 2

▪ Cut Points and Evaluations 3 ▪ Tables 6

PLOT TYPES ▪ Choosing a Plot Type 8

▪ 3D Plots 8 ▪ 2D Plots 15▪ 1D Plots 21

USING POSTPROCESSING FOR RESULTS INTERPRETATION 24

EXPORTING RESULTS ▪ Data, Tables, and Mesh 25

▪ Reports 27

TIPS & TRICKS ▪ Shortcuts 28

▪ Rearranging the COMSOL Desktop 28▪ Showing Meshes on Surface Plots 29▪ Sliding and Interactive Positioning 30

CONCLUDING REMARKS 31

iii

Page 4: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

iv

Page 5: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

1ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

INTRODUCTION

The orientation, coloring, and arrangement of an object created using computer modeling can offer perspective on the geometry, function, and success of a product. Visualization is an incredibly important part of the engineering process. Visually displaying the physics in a simulation gives an explanation of what’s really happening inside a device or design: heat transfer takes on colors that help us understand its distribution, points of structural failure become visible and obvious, and the paths fluids travel are suddenly traceable.

The postprocessing and visualization tools in the COMSOL Multiphysics® software are a great asset for helping you understand your results, see what’s happening in your product, and explain your work to colleagues, collaborators, and customers. The demonstrations in this guide will allow you to more easily identify physics phenomena, opening up a visual avenue for you to share your findings, communicate your design ideas, and demonstrate limits and challenges. As simulation is especially helpful for verifying a design prior to prototyping, these techniques also offer a way to quickly see how changes to the dimensions, materials, or other parameters will affect the quality of your device.

We have put together this material based on requests from COMSOL® software users, many of whom wish to use the postprocessing and graphics tools in COMSOL more effectively. Our goal is to offer techniques that will meet your needs, enable and inspire you to discover new ways of demonstrating your product’s capabilities, and aid you in exploring the incredible world of physics happening on, or under, the surface of your work.

INTRODUCTION

HELMHOLTZ COILSimulation of a parallel pair of identical circular coils spaced one radius apart and wound so that the current flows through both coils in the same direction. Results show the uniform magnetic field between the coils with the primary component parallel to the axes of the two coils.

Page 6: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

2

SOLUTIONS

COMSOL HANDBOOK SERIES

Paradoxically, although we will explore in detail the techniques used to create visual results in the COMSOL® software, we must start with the numbers—the data needed to do so. This chapter will outline the data sets, derived values, and tables that results plots draw from.

SOLUTIONS

Solution data sets correspond to data stored by the solvers. They rely on information such as which solver is selected and which component the solution applies to (for models with multiple components). Every solved model contains at least one solution data set.

To demonstrate the use of data sets, derived values, and tables, let’s take a look at a model that shows the stress distribution in a driving pulley:

The solution to this model is found using a kinetostatic analysis, where the pulley is “frozen” at a moment in time and the center is assumed fixed. We can examine the stress distribution and deformation for different rotational speeds (the variable n represents the rpm).

Open the COMSOL Multiphysics® software, go to the Application Libraries, and open the stresses in pulley model from File > Application Libraries > COMSOL Multiphysics > Structural Mechanics.

The Results node for the solved model is shown in Figure 3.

Two solutions have already been created. They are different result sets from the same study; Study 1/Adaptive Mesh Refinement 1 includes a step in the study that refines the mesh in certain areas of the model where greater accuracy is needed. If we examine the existing plot groups in the Results node, we will see that they draw on data from Study 1/Solution 1 or Study 1/Adaptive Mesh Refinement 1.

Each of the 2D plots shows the stress in the pulley for a specific rpm, which is set in the Parameter value (n) field. You can also change the data set to Study 1/Solution 1 or Study 1/Adaptive Mesh Refinement 1, and click Plot to see how the mesh refinement affects the results.

DATA SETS, DERIVED VALUES, AND TABLES

HINT

As we’ll see later, duplicating solutions is a very useful way to easily switch between views in a plot, for example, to show results at different times or in different locations. (This duplicates only a view of the solution and not the underlying data in the numerical solvers, and so does not increase memory usage.)

Page 7: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

3ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

CUT POINTS AND EVALUATIONS

Let’s take a look at some of the other data sets in this model.

CUT POINTS AND EVALUATIONS

CUT POINTSCut points are points created in a solution that do not affect the geometry of a model. They create data sets that can be used for evaluating variables at the exact location of the cut point. In this model, we can plot the stress at a point for different rotational speeds (rpm), for example, to see how the rpm affects the stress.

A cut point may be placed anywhere in a model geometry. The coordinates of the cut point can be adjusted in the settings section. In this model, the point (0,0) is at the center of the pulley.

Go to the Cut Point 2D 1 node and click Plot after entering the coordinates shown in the screenshot. The cut point will appear in the Graphics window at the top right corner of the pulley cross-section, along the edge of one of the openings (only one quadrant is shown):

We’ll use this point later to create some new plots. For now, take a look at the 1D plot group called von Mises vs. Rotational speed in the Results node.

The selected data set is Cut Point 2D 1, and the results show how the stress changes with the rpm at coordinates (19, 54), in millimeters:

NOTES

All the models used in this guide are available in the Application Libraries for COMSOL® software users. If you are not currently using COMSOL, contact us at www.comsol.com/contact. You can find more information about the physics capabilities of COMSOL at www.comsol.com/products.

This guide assumes that you have updated the COMSOL Application Libraries. This can be done from File > Help > Update COMSOL Application Library. Then click Find Applications and, if you’re looking for a specific model, click Uncheck all on the next screen. Navigate to the model that you’re looking for (in this case, it would be COMSOL Multiphysics > Structural Mechanics > Stresses in Pulley) and click Download.

HINT

One useful capability of cut points is the “Snap to closest boundary” feature—selecting this check box will move the cut point to the boundary closest to your selected coordinates, which is very helpful if you want to create a cut point right on the edge of the geometry.

CUT LINES & CUT PLANES

Cut points are used for evaluating variables at a specific location; likewise, cut lines can be used to evaluate variables and visualize results along a designated line. Cut planes can be created to visualize cross-sectional surface plots in three dimensions.

Page 8: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

4

CUT POINTS AND EVALUATIONS

COMSOL HANDBOOK SERIES

DERIVED VALUESWe’ve taken a look at all of the data sets that currently exist in the model. In this section, we will discuss maxima and minima, integrals, and point and global evaluations. These calculations can be used to manipulate data for results plots.

Right-click Derived Values under the Results node to see a list of values that can be calculated. Let’s find the maximum stress on the surface of the cross section; choose Maximum > Surface Maximum.

This allows us to evaluate the maximum of a chosen variable over a surface domain. In the Surface Maximum settings window, we’ll choose Study 1/Adaptive Mesh Refinement 1 for the data set. Set the selection to Domain 1 by clicking on the cross-section of the pulley in the Graphics window.

In the Expression section, check that the default expression is solid.disp (displacement) and the unit is m (meters). Click Evaluate at the top of the settings window. This will create a table

with two columns, showing the maximum total displacement for each rpm value.

We can also add multiple variables to this table. Change the expression to solid.mises (von Mises stress) by typing it in or clicking Replace Expression and choosing Model > Component 1 > Solid Mechanics > Stress >solid.mises - von Mises stress. Change the units to MPa and click Evaluate again.

Table 1 will now show different values for the maximum displacement and stress at each rpm:

Voilà! We’ve got our data.

POINT EVALUATIONSNow let’s create a Point Evaluation. Point evaluations are used to evaluate a variable or expression at a specific chosen point (in contrast to the maximum we just found, which was over a whole domain). They can also be evaluated over multiple points, for example, to explore the deformation (or other effect) at several locations in a model.

MORE DERIVED VALUES

Other maxima and minima can be evaluated for a chosen variable along a line or over a volume. Averages and integrals can be evaluated similarly, available in the selection list that appears when you right-click the Derived Values node.

Page 9: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

5ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

CUT POINTS AND EVALUATIONS

Right-click Derived Values and choose Point Evaluation.

In the geometry shown in the Graphics window, a set of points will appear on the pulley cross-section. These are points that are drawn in the model geometry. One or more of them must be selected for the point evaluation (we can’t choose a point just anywhere, as in the case of a cut point).

Choose the points you want to select by clicking on them in the Graphics window. Let’s choose the two points on either side of the central hole, left and right of (0,0).

Their names are added to the selection list when you click on them (36 and 55). Change the expression to solid.mises and the units to MPa. Click Evaluate.

We have now created Table 2, which shows the stress at both points for each rpm.

GLOBAL EVALUATIONSBecause the pulley will warp and deform slightly as it spins, the diameter is not actually constant. What if want to measure the diameter as it changes with rotational speed?

We’ll create a variable that describes the deformation of the cross-section by measuring the change in distance between two points at different rpms. For this, we’ll use a global evaluation.

First, create two integration nodes. We’re going to evaluate an integral over a point, which gives the value of a function (which we’ll define) at that point.

Expand Component 1 and the Definitions node. Right-click Definitions and choose Component Couplings > Integration. Do this twice.

Page 10: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

6

TABLES

COMSOL HANDBOOK SERIES

Click on the Integration 1 node. Under Geometric entity level, select Point. The Graphics window now shows all points in the pulley geometry, as it did when we created a Point Evaluation earlier. For this evaluation, we’ll again choose the points farthest from the center to the left and right.

Click on the far-right point (point 90) to select it.

Go to the Integration 2 node, again set the geometric entity level to Point, and this time select the far-left point (point 1).

Now we need to create the variable that we want to measure. Right-click the Definitions node again and choose Variables. In the Variables table, enter diam for the name and intop1(R+u)-intop2(-R+u) for the expression.

The variable we just created measures the diameter at a given rpm. The names intop1 and intop2 correspond to the integral operators. Note that we’ve used R and -R to account for both directions (left and right of zero).

Now right-click Study 1, above the Results node, and choose Update Solution. Because this model has already been solved, we need to update the results. But rather than needing to compute the study all over again, COMSOL lets you add this component coupling, then adjust the existing solution to account for it. (This especially comes in handy if you’ve forgotten to create variables and couplings until after you have already solved the simulation.)

Now let’s go back to the Results node. Right-click Derived Values and choose Global Evaluation. In the Expression field, enter diam-2*R. This represents the difference between the original diameter (2*R) and the new variable we just created, giving us the deformation

in meters.Click Evaluate. Table 3 will appear, showing the deformation. The first few entries (for n less than 2500) will be negative, indicating that the diameter has decreased. At n=2500, the results will become positive and grow increasingly large as the rpm increases.

We’ve completed our global evaluation.

TABLES

Almost done! We’ve seen how to gather and organize data from the solvers in several different ways. Let’s wrap up with a few comments on using tables effectively.

You’ve probably noticed by now that the evaluations we performed automatically generated tables. Tables store information from data sets and derived values. Here’s a summary of the tables we created in the pulley model:

• The results from Cut Point 2D 1, where we plotted the stress at (19, 54) over different rpms

• The maximum stress and displacement in the cross section for different speeds

• The table showing the change in distance between two points, created using the global evaluation

Let’s take a quick look at the shortcuts that are available for tables.

At the top of any table window underneath the title, you’ll see the following display of icons:

VARIABLES

It’s not necessary to keep the variable R in the function, but in this case we did so in order to describe the diameter. The variable expression intop1(u) – intop2(u) would also work, but would give us the change between any two points.

Page 11: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

7ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

TABLES

Several of these buttons are self-explanatory. Here’s a rundown of the others:

• Settings: opens the table settings window in the center column.

• Full Precision: displays the complete values in the table (to all decimal places).

• Automatic Notation: displays integers in normal notation and decimals in scientific notation.

• Scientific Notation: displays all values in scientific notation.

• Decimal notation: displays all values in decimal notation.

• Table Graph: creates a graph plot using the data from the table (read more about this below). Similarly, the Table Surface button creates a surface plot using data from the table.

• Export: exports the table data to a text file (.txt).

• Display: displays the next table under the Tables node. Clicking the arrow will show a list of all the tables created so far, allowing you to switch between them.

A final note: tables are very useful for checking the results at a certain time or parameter value, for instance to see how a solution changes from its initial value to its final. We can also use data from a table in a results plot. As an example, we’ll use the global evaluation we created at the end of the last section.

Right-click Results and choose 1D Plot Group. Right-click the new node, 1D Plot Group 5, and choose Table Graph. (You can also do this by clicking the Table Graph icon from the table window.) From the Table selection list, choose Table 3 and click Plot.

Results show the table and graph indicating how the deformation increases with higher rpms.

HINT

You can also import tables from data files by right-clicking the Tables node under Results, choosing Table, and then using the import function available in the settings window to upload a text or data file. This is particularly useful for comparing results from a simulation with experimental data.

Page 12: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

8

CHOOSING A PLOT TYPE

COMSOL HANDBOOK SERIES

So we have data, and we have learned a few ways to use and manipulate it. Now let’s move on to the fun part: visualizing results.

CHOOSING A PLOT TYPE

The COMSOL® software is so flexible that you can, for instance, create a 3D plot from a 2D model. Such extrusions are a very powerful tool for getting a closer look at the physics in your device. But when would you do this? For what applications would you want to? Sometimes the best plot type for visualizing your results will be counterintuitive. Before we shed some light on this, we’ll cover the basics of creating plots; later, we’ll move on to the fancier stuff.

We’ll start with the most realistic plot type, since this is how you would visualize an object in real life: 3D. Since reducing the dimension is intuitive—2D and 1D plots are often created by slicing cross-sections of 3D plots—we’ll examine most plot techniques using a 3D model.

3D PLOTS

Let’s take the example of an aluminum heat sink used for cooling components in electrical circuits. If you have the Heat Transfer Module or the CFD Module, this model can be found in the Application Libraries under File > Application Libraries > Heat Transfer Module > Tutorial Models, Forced and Natural Convection or under File > Application Libraries > CFD Module > Non-Isothermal Flow. The model documentation, including steps to build the simulation, is also available there.

One reason this model is a good example is that there’s plenty of physics going on here! This model studies fluid flow and heat transfer. The heat sink, made of aluminum with a cluster of pillars for cooling, is mounted on a plate of silica glass. It sits inside a rectangular channel with an inlet and an outlet for air flow. Initially, the base of the heat sink experiences 1 watt of heat flux, generated by an external heat source.

The model analyzes thermal conduction, convection, and the temperature field across the surfaces.

You can find the temperature plot by expanding the Results node and clicking on the Temperature (ht) plot group. But since we’re going to recreate it, go ahead and delete it (right-click and choose Delete). Let’s also delete the Velocity (spf) plot group, since we’ll recreate it later.

Another piece of the puzzle that we’ll delete and re-create is the view. The final results show a limited geometry—part of the rectangular channel is hidden. Hiding entities like this is a very helpful trick for visualizing physics inside of a model, as we will see.

For now, let’s restore the view to show the whole geometry so that we can explore hiding components. Expand Component 1 > Definitions > View 1 and delete the Hide Geometric Entities 1 node.

SURFACE PLOTSThe first plot we’ll create on the heat sink geometry is a surface plot to show the temperature changing in the channel. Right-click the Results node and choose 3D Plot Group. Right-click the new node and choose Surface.

The expression we want (temperature) is already in the field. If we needed to add it, however, we could find it by clicking Replace Expression and choosing Model > Component 1 > Heat Transfer > T - Temperature.

PLOT TYPES

Page 13: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

9ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

3D PLOTS

If you don’t remember the location of the expression you need, search for it by typing a keyword into the field at the top of the expression window:

Click Plot. We now have a surface that, quite frankly, looks nothing like the final results that we’re aiming for! But we’ll adjust our view and plot settings until we’ve reached a look we like. One reason the air box looks so different from the results shown earlier is that the default color scheme is set to Rainbow.

In the Surface settings window, we can change this under the Coloring and Style tab. Using the drop-down list, change the color table from Rainbow to ThermalLight.

That looks a little better! However, we still can’t see what’s going on inside the channel. Remember when we deleted the Hide Geometric Entities node from View 1? Let’s go back there for a minute.

INVISIBILITY CLOAKS: HIDING ENTITIESIn some cases, it’s very helpful to be able to hide certain parts of a geometry to get a good look at what’s going on inside—especially with a complex model geometry that has an air domain around it, like the heat sink. Much of the time, you won’t want to see the air box when you set up your results. At other times, you may want a view that exposes the inside of a device, hidden underneath several other geometric components. The trick we’re about to use frequently comes in handy in postprocessing.

Back in the View 1 node, click the node called Hide Geometric Entities. In the settings window under Geometric entity level, Boundary is selected. (You can also hide points, edges, and domains.)

Now select the three faces of the channel that block the view of the heat sink (boundaries 1, 2, and 4). They turn red when the mouse hovers over them, and purple when selected (click to select).

HINT

Another way to reach the view node that applies to a particular plot group is to select the plot group (such as 3D Plot Group 1) and check the Plot Settings tab. In the View field, you can change which view applies to the plot group, or navigate directly to the view by clicking the button next to the drop-down list.

ENTITIES VS. OBJECTS

There is also an option to Hide Geometric Objects, which hides objects created by a geometry feature. Hiding geometry objects only applies in certain nodes, such as the View and Definitions nodes. Actions that hide geometric objects are not reflected in the Materials, Physics, Mesh, and Results nodes, so Hide Geometric Entities is a better option when you are not working in the Geometry branch of the model tree.

Page 14: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

10

3D PLOTS

COMSOL HANDBOOK SERIES

Now add boundary 121, the channel inlet, to the selection. This can be done by rotating the heat sink until the face is visible, or by holding the mouse over the area and scrolling until you see the edges of the face turn red. Then click to select it.

For a simple geometry like this, it is easy enough to rotate the model and select the face on the other side. But for complicated geometries, or faces that are covered by other faces and not accessible from the outside of the model, the scroll wheel (or the arrow keys, if your mouse doesn’t have a scroll wheel) provides a much easier way to cycle through the entities. This is also very useful if you have carefully arranged a view and you don’t want to reposition your model.

For models where you will select the same set of features several times, or where you need to carefully select many entities, use the Create Selection button next to the selection list.

Here, you can define and name your selection. It will appear as a new node in the Definitions:

Under the Results node, the new group will appear as an option when creating selections of the same entity type, so that you don’t need to re-select the entities.

Go back to 3D Plot Group 5. You can see the inside of the channel now. Let’s get rid of some of those lines, though. Under the Plot Settings tab, uncheck the Plot data set edges box and click Plot. Now we see just the surface and the geometry, without the lines.

Page 15: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

11ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

3D PLOTS

LINE PLOTSAlthough we just unplotted the data set edges in the heat sink, one plot type that we can add to show results is a line plot. Line plots are used to display quantities on edges; the following line plot shows the temperature on the edges of the heat sink domain:

Line plots can also be used to show results at multiple locations in a model. Under the Coloring and Style tab in the settings for a line plot, the style can be set to lines or to tubes, with a manually-adjustable radius.

The results below show a plot running along the center of the heat sink channel, depicting the air flow velocity between the inlet and the outlet:

These results were created using a Cut Line 3D solution.

ARROW PLOTSThe next plot that we’ll add is an arrow plot. Right-click 3D Plot Group 5 and choose Arrow Volume. This creates a plot of arrows that show the velocity vector field of the airflow through the channel and around the heat sink. The length of the arrows will indicate how fast the

air is moving—it flows fastest above the heat sink and high up in the air domain, and slower around the floor and the base of the heat sink.Your initial arrow plot won’t look like the one above, though; to create the above image, you would need to add more arrows, and would have to scale them down so that the geometry underneath is visible.

Take a look at the Arrow Positioning tab. There are listings for x-grid points, y-grid points, and z-grid points. This means that we can change how many arrow entries are shown along the x-axis, along the y-axis, and along the z-axis.

The ideal number of arrows will normally depend on the application, but for now, change the x-grid points to 8, the y-grid to 4, and the z-grid to 4. (For a real graphic you would of course want more arrows so that you can see the flow field, but for learning purposes it will be helpful to make everything large.)

DEFORMATIONS

The line plot shown below includes a deformation and a radius expression. For an example of using deformations, turn to page 18.

Page 16: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

12

3D PLOTS

COMSOL HANDBOOK SERIES

We can change the arrow size by changing the scale factor under the Coloring and Style tab. Check the Scale factor box and increase the scale factor to 0.05 (again, this is much larger than you would use if you were trying to really visualize the physics).

Now our plot is looking pretty good. Let’s add a color range to the arrow plot so that what’s happening to the velocity is a little clearer.

Right-click Arrow Volume 1 and choose Color Expression. Click Replace Expression, choose Model > Component 1 > Laminar Flow > spf.U - Velocity magnitude, and then click Plot.

Now our arrow plot shows the changing velocity of the air flow as it enters and exits the channel. Check the Color legend box under the Coloring and Style tab to see a reference for the fastest and slowest flow regions (with red being the fastest, blue the slowest).

This example showed an arrow volume plot. In a similar fashion, arrow surface and arrow line plots can be used to visualize vector quantities

as arrows on planar surfaces or arrows on lines, respectively. The figure below shows arrow lines (along with a regular line plot, deformed) plotted on a cut line solution.

CONTOUR PLOTSLet’s add a contour plot on the back wall of the channel. Contour plots are helpful for telling immediately if a device is approaching its limits or is in danger of failure (for instance, showing the exact temperature during a phase transition or indicating that a mechanical structure is approaching its yield stress level).

If you remember, we mentioned duplicating solutions earlier. To create a contour plot, we’ll need to add a new solution so that the contours don’t appear everywhere in the model.

Expand the Data Sets node, right-clickStudy 1/Solution 1, and choose Duplicate. A new solution called Study 1/Solution 1 (2) will appear in the Data Sets list. Right-click the new solution and choose Selection.

This feature is similar to hiding geometric entities, which we did in the View node earlier so that we could see inside the model. Selections in a solution allow you to choose which areas of the model you want to see, meaning that anything unselected will not be used for plotting results when the solution is used as the data set.

Set the geometric entity level to Boundary, and select only the back wall of the channel.

HINT

In a case where we only want to see one layer of arrows in the z-direction, it’s sometimes more helpful to change the entry method. Instead of Number of points, change this to Coordinates. This allows you to limit the points used in the z-direction to only one point and specify its location on the z-axis. For example, try entering 5[mm] in the coordinates field and see what happens.

HINT

In a contour plot, click on the results to see a table with values showing the temperature data at the positions clicked. Alternatively, use the Level labels check box in the contour plot settings under the Coloring and Style tab to see data for each contour level.

Page 17: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

13ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

3D PLOTS

Now right-click 3D Plot Group 5 and choose Contour. This will add a contour plot. Make sure to choose Study 1/Solution 1 (2) for the data set in the plot settings.

Change the expression to T if it isn't already (type it into the field). Click Plot. Now we have a contour plot showing the wall temperature changing over the distance of the channel.

Instead of lines, we can also blend the contours so that the space between each level is filled in. Check out the options available in the Levels tab and the Coloring and Style tab in the Contour settings window:

Change the contour type from Lines to Filled, as shown, and disable the arrow plot by right-clicking its node and choosing Disable. Here’s what we get:

The Tubes setting for contour plots allows you to control the radius of a three-dimensional tube showing the contour paths, rather than standard lines.

Keep in mind that for this plot, we have two plots overlapping (the original surface and the contours). In this case, they don’t interfere with each other because they have the same color scheme; however, in other cases this can be a problem. See if you can manipulate your results so that the surface plot no longer contains the back wall.

It’s a little easier to see what’s going on now; the contour layers show the evolution of the temperature gradient on the back wall, which is at its hottest right next to the heat sink. The contours are very smooth already (try refining your mesh to get the smoothest results), but let’s add the lines back in so that we can get a really clear idea of the temperature gradient.

Duplicate the contour plot you just created, and set it to display lines instead of filled levels. Play around with the colors and settings to create an image similar to the following:

See if you can create this plot using your new knowledge of hidden entities and using multiple surfaces:

A NOTE ABOUT DIFFERING VISUALS

Your results may not look exactly like the images shown here, since we obtained these results using a refined mesh and a high-power computer. We’ve also added a line plot to show some of the data set edges.

Page 18: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

14

3D PLOTS

COMSOL HANDBOOK SERIES

SLICE PLOTSWe’ve added surface, arrow, and contour plots. Now it’s time for something a little different.

The velocity plot that we deleted earlier contained what is called a slice plot. Slice plots show cross-sectional surfaces used for visualizing the change in a variable over a distance. For instance, for this model we might add a slice plot to show the temperature changing as the slices move farther and farther from the heat sink, or the velocity of the air as it flows through the channel.

Let’s create a velocity slice plot. Rather than adding this into the plots we just finished, we’ll start a new plot group to avoid crowding up the visual. Right-click the Results node and add a new 3D plot group. Right-click the new node and choose Slice.

Temperature is automatically chosen for the plot expression. If we plot it, we’ll see a series of slice plots showing the initial temperature at the inlet as comparatively low, increasing near the heat sink, and decreasing again near the outlet.

Let’s plot the velocity magnitude instead, as we did with the arrow plots. The expression we want is Model > Component 1 > Laminar Flow > spf.U - Velocity magnitude.

Now we have a slice plot showing the fluid velocity for different cross sections of the air inside the channel.

STREAMLINESStreamline plots depict vector quantities by showing curves that flow tangent to an instantaneous vector field. They are often used to show fluid movement. For the heat sink model, for instance, we might add streamlines to visualize the air flow through the channel.

Reset your temperature plot so that it contains only the surface showing the overall temperature with the heat sink and channel in the same plot, without the contours. Now right-click the plot's node and choose Streamline. For the expression, choose Replace Expression > Model > Component 1 > Laminar Flow > u, v, w - Velocity field.

Under the Streamline Positioning tab, change the positioning to Magnitude controlled. Under the Coloring and Style tab, change the line type to Ribbon. Click Plot, and you’ll see a series of lines showing the velocity vector field of the air flowing past the heat sink. Go ahead and change the ribbon width and positioning distances until you’re happy with the streamline arrangement.

Our first attempt is a little hard on the eyes—everything is red. Right-click the Streamline 1 node and add a color expression. In addition to making the plot more visually appealing, the color will now represent the velocity magnitude. Navigate to Replace Expression > Model > Component 1 > Laminar Flow and choosespf.U - Velocity magnitude. Click Plot.

ISOSURFACESIsosurface plots show results quantities as a set of colored surfaces on which the result is constant. They might be used to show scalar fields such as temperature, chemical species concentration, electric potential, or pressure. Let’s take a look at an example where we want to know the acoustic pressure levels inside a speaker.

If you have the Acoustics Module installed, open the COMSOL Application Libraries and navigate to Acoustics Module > Electroacoustic Transducers > vented loudspeaker enclosure to follow along.

SLICE POSITIONING

The slice plots shown here use yz-planes that shift in the x-direction. However, you can change these by changing the settings under the Plane Data tab. Try creating this plot using the plane positioning tools:

For more tips about positioning slice plots, turn to page 28 in the Tips and Tricks section.

Page 19: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

15ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

2D PLOTS

This model studies how the sensitivity of a loudspeaker driver is affected by its enclosure. The speaker driver is set in a vented enclosure and contains a magnet, voice coil, cone, and other hardware components. The simulated air domain is surrounded by a spherical perfectly matched layer (PML) that absorbs outgoing waves, minimizing reflections in order to model an infinite domain. The model solves for the sound pressure distributions at different frequencies, local stresses and strains in moving parts, and deformations in the structures.

Under the Results node, click on the plot group named Acoustic Pressure. It contains, among other plots, an isosurface node.

Your isosurface plot may look slightly different than the one shown here, since the color range has been modified.

These isosurfaces show constant pressure surfaces inside the enclosure and outside of the speaker cone. We can see the sound waves moving outward from the speaker.

2D PLOTS

Now, for a change of pace, let’s explore a few plot types in 2D. All of the plot types we showed on the 3D heat sink model can be used in 2D, and the plots we’ll show here can also be used in 3D.

The model we’ll use for this demonstration is a pyramidal absorber used for microwave absorption in an anechoic chamber. If you have the RF Module installed, this model is under File > Application Libraries > RF Module > Passive Devices.

The pyramidal absorber is actually a 3D model, but we’ll create some useful 2D plots for visualization purposes. The geometry includes one pyramidal unit cell surrounded by:

• A rectangular air domain

• Perfectly matched layers (PML) at the top of the air domain, which create a boundary that avoids internal reflections back into the simulation domain

• A perfect electric conductor (PEC) layer below the pyramid block, representing a conductive coating on the wall of the chamber

ANECHOIC CHAMBERS

An anechoic chamber is designed to absorb noise or electromagnetic waves and is insulated from external sources of such waves. The walls are lined with an absorbent material that is arranged and shaped to absorb as much radiation (in this case) from as many directions as possible. Anechoic chambers are often used for testing radar devices, antennas, or electromagnetic interference.

Page 20: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

16

2D PLOTS

COMSOL HANDBOOK SERIES

CUT PLANESCreating surface, arrow, and contour plots in 2D works the same way as in 3D. However, if we start with a 3D geometry and want to create a 2D plot, we need a planar face to plot on. We’ll create one by defining a cut plane—similar to the cut point we used in the pulley model. A cut plane creates a plane from a cross section of a 3D model, and allows you to plot results on it as if it were a 2D solution.

Right-click Results, add a 2D plot group, and add a surface to the plot group. The variable automatically entered in the expression field is the electric field norm—which is what we want to plot. But if you try to plot the surface, you’ll see nothing but empty white.

Take a look at the top of the Surface settings window. Next to the Plot button, a new icon has appeared:

Since we haven’t defined a plane yet, COMSOL is anticipating that we will need to. Click on the new button to create a cut plane. Like a secret shortcut, this button is a doorway to exactly what we need.

We’ll orient the plane using the settings for this new data set, Cut Plane 1, now found under the Results node.

We want to visualize the electric field on different areas of the pyramid. In the settings, change the Plane entry method field to Point and normal instead of Three points. The new plane should be set to contain point (0,0,0) and normal vector (1,0,0). This will create a vertical slice through the center of the pyramid:

If you click Plot, the cut plane will appear in red overlaid on the model geometry in the Graphics window. The vector normal to the plane will appear as a blue arrow.

REDUCING DIMENSION

In the same way that we’ll use a cut plane with the pyramidal absorber model to create a 2D plot, it is also possible to use a cut line or cut point to create 1D plots. These create a data set at a chosen point (over a parameter such as time) or along a line.

Page 21: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

17ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

2D PLOTS

Go back to the Surface node in 2D Plot Group 3, make sure that the data set is set to Cut Plane 1, and click Plot. Now we have results:

This surface plot is based on a chosen elevation angle of θ = 1.48353 (85 degrees), which is the largest elevation angle (that is, the largest angle of incidence of the wave) that applies to this pyramidal unit cell.

By changing the Parameter value (theta) field under the Data tab, we can plot the results for different elevation angles (click Plot each time you change the value):

PERIODIC ARRAYSFrom these plots, we can see how the electric field changes with the elevation angle. But to see this, we had to click Plot each time we changed the parameter value, and could only visualize one surface at a time. What if we want to create a side-by-side comparison? A periodic array offers a way to visualize results with different parameter values.

We’ll demonstrate this with the pyramidal absorber model by creating a parametric

extrusion. A parametric extrusion extends a data set by using a parameter (in this case, elevation angle) as a dimension in the plot.

Right-click the Data Sets node and add a parametric extrusion by choosing More Data Sets > Parametric Extrusion 2D:

This will plot a chosen solution over selected values of θ. COMSOL has automatically chosen Cut Plane 1 as the solution to use:

Click Plot, and you’ll see that a series of slices (the extrusion) has appeared in the Graphics window.

On each slice, we’ll plot the electric field for a different value of θ. Add a 3D plot group to the Results node and choose Parametric Extrusion 2D 1 as the data set. Then add a surface to this plot group, and click Plot (the electric field norm is automatically entered in the expression field).

ORIENTATION

A parametric extrusion will create horizontal layers regardless of the original orientation of the cut plane.

Page 22: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

18

2D PLOTS

COMSOL HANDBOOK SERIES

It's crowded! To really get a feel for what’s going on in the pyramidal unit cell, let’s go back to Parametric Extrusion 2D 1 and reduce the number of values we’re looking at.

In the Parametric Extrusion 2D settings window, set the Parameter selection (theta) value to From list. Hold the Ctrl key when you click to select multiple values. Scroll through the list and choose the following values: 1.134464, 1.308997, and 1.48353 (equivalent to 65, 75, and 85 degrees, respectively). We’ll be looking at the higher elevation angles, where the electric field changes the most. Under the Settings tab, check the Level scale factor box and enter 150.

Now return to 3D Plot Group 4 and click Plot.

We’ve made a parametric extrusion! The different slices show the electric field on the pyramidal unit cell for the selected values of θ.

Now we’ll arrange each of the slices we want to see in a 2D plot, so that we can really see them side by side. Add a 2D plot group to the Results node. From 2D Plot Group 5, navigate to its view (View 2D 5). Expand View 2D 5 and click on the Axis node.

These settings control the range on the x- and y-axes that are shown in the Graphics window. For this array, we’ll need a little more room.

Adjust the y-minimum and y-maximum coordinates to be -150, 150.

Add a surface to 2D Plot Group 5 and change the data set to Cut Plane 1. For this first surface, choose theta to be 1.22173 (70 degrees). Click Plot, and the familiar surface appears.

Duplicate Surface 1. Remove the title by setting the title type to None under the Title tab. (This avoids titles being added for every surface created in the plot group.) This time, set the parameter value to 0. Click Plot.

The second surface plotted right on top of the first one, causing our earlier results to vanish. We need to add a deformation so that we can see these results side by side.

Right-click Surface 2 and choose Deformation. We want to shift the second plot by the width of the unit cell, which is 50 mm. Change the y-component to -50, set the scale factor to 1, and click Plot.

You can see that the unit cell is 50 mm wide by checking its width on the y-axis, or you can see this by browsing through the Geometry node to see the original dimensions the model was created with.

This looks great! We’ll add a few more surfaces to complete the array.

HINT

If you experiment with plotting a different variable and would like to return to the electric field plot, navigate to Replace Expression > Electromagnetic Waves, Frequency Domain > Electric > Electric field norm (emw.normE) or simply type emw.normE into the expression field to plot it again.

HINT

You can also adjust the view by clicking the Zoom Extents button on the Graphics window toolbar. This will cause the Graphics window to snap to a fitted view of the plot.

REFERENCEIf you need a refresher on how to navigate from a plot group to its view, check page 9.

Page 23: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

19ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

2D PLOTS

Duplicate Surface 2 three times. Use the following settings:

Go to the 2D Plot Group 5 node, uncheck Plot data set edges under the Plot Settings tab, and click Plot.

We can now see the evolution of the electric field using the values we selected.

REVOLUTIONS AND MIRRORINGIn certain cases, it isn’t necessary to model the entire geometry of an object. In cases where the geometry is axisymmetric, an axisymmetric model can be used. This involves modeling only half of a cross section, which simplifies geometric and boundary conditions and decreases computational time.

But once the model is solved, it can be helpful to visualize the entire object. Since we really picture things in terms of three-dimensional space, this helps us orient our perspective of the results.

Let’s take the example of an axisymmetric antenna. If you have the RF Module installed, navigate to File > Application Libraries > RF Module > Antennas and open the corrugated circular horn antenna model.

This model studies the transverse electric (TE) and transverse magnetic (TM) modes in a horn antenna. The combination of TE and TM modes generated by the corrugated inner surface of the horn provides linear polarization on the aperture of the antenna. The simulation results show the electric field and radiation patterns around the antenna.

The geometry of the model, as you can see below, was created in two dimensions.

REPEATING PATTERNS

To create good visuals with a repeating pattern, try changing all of the parameter values in a periodic array like this one to the same entry. For example, the image shown below has all of the surfaces set to θ = 1.396236 (75 degrees):

Page 24: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

20

2D PLOTS

COMSOL HANDBOOK SERIES

Several of the existing data sets use 2D revolutions to give a better idea of what’s happening in the 3D device. Under the Data Sets node, browse through the solutions.

Study 1/Solution 1 (1) and Revolution 2D 1 include the entire geometry. The revolutions for Study 1/Solution 1 (2) and (3) include only the waveguide feed and the aperture, respectively, so their plots look like flat circles representing each opening. These will be important later.

Study 1/Solution 1 (4) relies on the geometry of the horn itself. Take a look at Revolution 2D Horn, shown below.

The Axis Data and Revolution Layers sections contain information that determines how far the revolution is and around which axis. In the default revolution, the solution revolves 250 degrees around the z-axis.

Change the start and revolution angles and click Plot to see the changes in the revolution:

This plot group shows the electric field translated into Cartesian coordinates (the model is created in cylindrical coordinates). The norm is plotted on the circular revolutions we saw earlier representing the antenna aperture and feed openings. The arrow plots are shifted upward and downward to be more visible, and show the direction and strength of the electric field.

Create a new solution data set under the Results node, Study 1/Solution 1 (5). Add a selection that includes domains 3, 4, and 6 (the horn, feed, and aperture). Then right-click Data Sets and choose Revolution 2D. Choose Study 1/Solution 1 (5) as the data set and use a start angle of -90 degrees and a revolution angle of 225 degrees.

Now add a new 3D plot group to the Results node and choose None for the data set. Add a

Start Angle: 0 Revolution Angle: 360

Start Angle: -45Revolution Angle: 200

REFERENCEFor information about adding selections to a solution, turn to page 12.

Page 25: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

21ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

1D PLOTS

surface plot that uses the revolution 2D data set that you just created. It will automatically plot the electric field norm:

For more interesting visuals, you might try using surfaces that rely on the Revolution 2D Aperture and Revolution 2D Horn data sets. In the image below, the surface plot on the aperture is shifted upward 0.001 meters.

1D PLOTS

Using 1D plots is a little different than using 2D or 3D plots. Most often, a 1D plot is used in a case where it is more helpful to visualize data using a line graph than a surface, or where the model geometry doesn’t lend itself to 2D plots.

There are a few plot features that are unique to 1D plots. For instance, the line style and coloring take on a different meaning in 1D than in 2D and 3D plots, because the line shape usually indicates a change in the variable, which is accomplished by the surface color gradient in a 2D or 3D plot.

We’ll take a quick look at 1D plot styles. Open the shallow water equations model from File > Application Libraries > COMSOL Multiphysics > Equation Based. This model simulates a wave settling over a bed with an uneven surface (such as a lake or pond bottom) when the water is shallow. The wave shape is modeled as a function of time.

Expand 1D Plot Group 1 under the Results node. Click on Line Graph 1 and Line Graph 2 and take a look at the settings. Go ahead and experiment with the fields in the Coloring and Style tab. The thickness of the line plot may be increased or decreased using these options:

Line Graph 2 contains line plots for all timesteps in the model. In the settings, reduce the number of parameter values in the Selection list. Choose 15 as the only timestep (time is in seconds). Click Plot.

HINT

For certain geometries it is also helpful to mirror the plot data—for instance, in a model of a pipe where only half of the geometry was modeled. A mirror data set can be added by right-clicking the Data Sets node and choosing Mirror 2D or Mirror 3D, depending on whether your geometry is in two or three dimensions.

Page 26: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

22

1D PLOTS

COMSOL HANDBOOK SERIES

The figure below shows Line Graphs 1 and 2 from 1D Plot Group 1, with Line Graph 1 at a width of 3 and Line Graph 2 at a line width of 2.

You can add indicators for evenly-spaced data points at intervals along a line plot by changing the Marker field and choosing settings for the style and number of markers:

The plot below shows Line Graphs 1 and 2, where Line Graph 1 has 12 plus-sign-shaped markers and Line Graph 2 has 14 asterisk-shaped markers.

Another feature that applies only to 1D plot groups is the labeling tools. Expressions for the x- and y-axes can be changed in their respective tabs, and the text in the box legend can be changed under the Legends tab.

To change the location of the legend box, go to the plot group node (e.g., 1D Plot Group 1) and expand the Legend tab. The position can be set to top, middle, and bottom heights in the left, right, and middle sections of the grid.

CYCLING COLORS

The Cycle setting for line color causes the line plots to cycle through the available colors (in this case only blue and green); this makes it easy to differentiate between many different line graphs overlaid in the same plot group.

Page 27: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

23ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

1D PLOTS

Below are examples of a few more combinations for the two line graphs in this plot group, including different colors, styles, and markers. These use color expressions as well:

POLAR PLOTSPolar plots are a specific type of 1D plot. Polar plot groups create graphs using polar coordinates, with radius r and angle Θ. These are particularly useful for visualizing electromagnetic and acoustic applications, such as the distribution of sound emanating from a megaphone or the range of an antenna. Polar plots show quantities based on direction and distance from a specific point of reference.

To demonstrate this, we’ll use a radio-frequency application. If you have the RF Module installed, navigate to File > Application Libraries > RF Module > Antennas and open the conical antenna model. This simulation studies the antenna impedance and the electric field radiation pattern around the antenna as it changes with frequency.

Take a look at Polar Plot Group 6. The line plot it contains uses the expression 10*log10(emw.nPoav). This plots the near-field radiation pattern using a log scale.

Click on Polar Plot Group 6 and change the Parameter selection (freq) field to From list. In the selection list, select the following frequencies: 2e8, 5e8, 10e8, 1.3e9, 1.5e9. Use the scroll bar and hold down the Ctrl key to select multiple values.

Click Plot. The resulting polar plot shows the near-field radiation pattern for the specific operating frequencies we selected, showing the radiation range as well as how it changes depending on the frequency. This model is axisymmetric, so we are only visualizing half of the pattern:

There we go! We’ve created 3D, 2D, and 1D plots and covered quite a range of the plot options the COMSOL® software offers for postprocessing. Hopefully you feel relatively comfortable with the concept of each plot type we’ve discussed so far. If it seems like a lot, don’t worry; we’ll revisit some of these as we explore other techniques. Now let’s dive into some other visualization tools.

Page 28: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

24

USING POSTPROCESSING FOR RESULTS INTERPRETATION

COMSOL HANDBOOK SERIES

Now that we’ve discussed the best ways to arrange a model, let’s briefly explore how postprocessing can help a designer or engineer make good decisions about a design. Beyond creating good, clear graphics, the techniques described in this guide are meant to illuminate ways that postprocessing can support interpretation of the physics happening in a simulation.

Let’s return for a moment to the heat sink. When we plotted the first surface showing the temperature in the heat sink and channel, the heat sink was nearly all white—which made sense, because it would certainly be the hottest part of the geometry. But what if we didn’t want to plot the temperature relative to everything around it? What if we want to see how hot different areas of the heat sink are relative to one another?

Create a 3D plot group for the heat sink that contains the following:

• A line plot that includes only the edges of the heat sink (it’s easiest to clear the selection in the plot settings and then use the Select Box tool to add these).

• A surface plot that includes only the heat sink, not the channel around it; plot the energy flux magnitude by typing ht.tefluxMag into the Expression field or by adding it from Replace Expression > Model > Component 1 > Heat Transfer in Solids > Domain Fluxes.

This new plot shows something that the old surface didn’t: the energy transfer on the pillars of the heat sink nearest to the channel inlet (rotated toward the front in the previous image) is happening at a much higher rate than the transfer near the outlet. In fact, there are some pillars that don’t seem to have much heat transferring at all; it’s possible that these could be removed from the design to save money and material.

At a second look, it also seems that the tops of the pillars aren’t experiencing much heat transfer either; could the pillars be made shorter to save material? These are the sorts of questions that a postprocessing plot can help us answer.

If we want to see the entire geometry again, we can easily combine this plot with the plot we used earlier in the temperature surface, and create an even more interesting visual. The screenshot below shows:

• The line and surface plots we just created

• A surface plot for the channel temperature (containing only the back wall and floor)

• A line plot for the air domain (with all the lines of the channel plotted)

USING POSTPROCESSING FOR RESULTS INTERPRETATION

REFERENCEFor instructions on creating surface and line plots, head to page 8 in the Plot Types chapter.

Page 29: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

25ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

DATA, TABLES, AND MESH

HINT

The physical quantity you export will dictate the precision needed. With such high temperatures, two decimal places would be enough, but if we were exporting, for example, data for the displacement in a MEMS device—with distances measured at the micron level—then six decimal places would be more appropriate. The level of precision can be adjusted to full precision under the Advanced tab in the Data settings window.

One of the final capabilities of the COMSOL® software that we’ll touch on here is exporting your results. This can take the form of reports, plots, tables, graphics, or even animations.

DATA, TABLES, AND MESH

Right-click the Export node in any model (we’ll use the heat sink for this demonstration) and choose Data. In the settings for the new Data 1 node, there are fields to select the data set you want to export from, a table in which to add the expressions (below, we’ve chosen to export the temperature of the heat sink and the air velocity), and output settings such as the filename and format:

Add the expressions you want, then click Export. Navigate to the folder you saved the text file in, open it, and you’ll have your data there. It’s best to view the report in a text editor:

You can also export tables, mesh, plots, and images from the Export node.

Tables can be exported using several file types, including spreadsheets in Microsoft Excel®:

EXPORTING RESULTS

Page 30: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

26

DATA, TABLES, AND MESH

COMSOL HANDBOOK SERIES

A mesh can be exported as a new COMSOL Multiphysics® software binary file, which can be then imported into other models:

Images can also be exported from plot groups. The settings allow you to choose the plot you want to export, the view that will be shown, and which labels will be included from the layout:

If you only want to export the exact image shown in the Graphics window, the easiest way to do this is to click the Image Snapshot button in the Graphics window toolbar. From there, you can choose what to include as well as set the size and file type:

Setting the size to Current exports the exact image shown on the screen. There are also two options for Manual, which allow you to control the dimensions of the image. With these options, you can export an image with resolution intended for print or web viewing.

The rendering settings for images exported from the Graphics window can be adjusted from the menu under File > Preferences. Under the Graphics and Plot Windows section, you can change the visualization options for graphics generation.

Page 31: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

27ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

REPORTS

REPORTS

Exporting reports is a great way to compile all the information in your simulation, making it easy to hand it to a colleague or introduce someone else to using your model.

Right-click the Reports node, and you’ll see options for creating brief reports, intermediate reports, and complete reports, as well as an option for creating a report with your own custom settings.

• Complete reports contain all the information about the model, including details of the physics interfaces and the underlying equations. This is great for troubleshooting.

• Intermediate reports include the physics settings and variables used in the model, as well as information about the study, results, and plots.

• Brief reports give an overview of the model, including the plots and results, but without details of the variables or physics.

• Custom reports allow you to choose what is included in the report.

Choose any report type from the dropdown list shown above to create a node where you can add and remove content in the report. Right-click the new node and choose Section. This node will reveal subnodes for controlling information about the geometry, mesh, solver, study, and results.

The export options allow you to generate a report in HTML or Microsoft® Word software. Click the Preview All button at the top of the settings, and you’ll the see the geometry, mesh, solutions, and plots you created cycle through the Graphics window. Once it’s finished, it will show you a preview of the report document.

Click Write to create the report.

Page 32: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

28

SHORTCUTS

COMSOL HANDBOOK SERIES

Shortcuts

In addition to the plot techniques we’ve explored, there are a few very useful shortcuts that we haven’t mentioned yet. Many of these are found at the top of the Graphics window.

In addition to the buttons for changing the zoom and view orientation, the options in this toolbar control selections, transparency, and scene lighting. We’ve already used several of these shortcuts, such as Zoom Extents. Here’s a rundown of the others:

• Zoom Box: allows you to click and drag the mouse to create a rectangular box, highlighting an area of the geometry to zoom in on

• Zoom Selected: zooms in on a selected geometric component

• Go to Default 3D View: orients the model in the default 3D view

• XY, YZ, and ZX Views: changes the view to the xy-, yz-, or zx-plane

• Selection and Hiding tools: similar to the Hide Geometric Entities feature available for View nodes, these selection tools can be used to select or hide entities when in a subnode of a Component; they create a Hide Geometric Objects node, which does not apply to the Results node

• Scene Light: turns the scene lighting completely on or off

• Transparency: turns the model geometry transparent

• Image Snapshot: opens a dialog box to export the current view in the Graphics window as an image

• Print: opens a dialog box to print the current view

Rearranging the COMSOL Desktop® Environment

The COMSOL Desktop® environment is very flexible and easy to rearrange. Plotting in multiple windows is done under the Window Settings tab in a plot group node. Windows can also be renamed using these settings.

TIPS & TRICKS

HINT

Nodes can be manually renamed by right-clicking the node, choosing Rename, and typing the desired title. This is a good way to organize data sets and plot groups, especially when there are many solutions with selections or multiple plots in the same group.

Page 33: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

29ESSENTIALS OF POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS

SHOWING MESHES ON SURFACE PLOTS

Windows can be shifted to different areas of the desktop and reorganized using the drag-and-drop method, which makes it easy to view and compare multiple plots together.

Release the mouse over the beige and white box indicating the new location of the window (shaded) to drop it.

Showing Meshes on Surface Plots

Showing the mesh on a model is helpful for knowing how fine the resolution is on certain areas when you’re investigating results, for instance, to see if it needs to be refined for higher accuracy in regions where there is a strong gradient.

Let’s return to the original temperature surface that we first plotted on the heat sink. Add a second surface to the plot group, and set the color settings to uniform black. In this case, it doesn’t matter what the expression is, because we’re only plotting elements, not results.

Check the Wireframe box under the Coloring and Style tab, and click Plot.

Now we can see that the mesh is finest around the heat sink and pillars, and less refined on the channel walls. If we were to disable the temperature surface, we would see only the wireframe lines. Like other plot types, wireframe surfaces can be plotted on different data sets, and their coloring and style settings may be adjusted to your liking.

REFINING THE MESH

For cases where the mesh needs to be refined in certain regions for higher accuracy, the COMSOL® software has a feature that will refine it for you, called Adaptive Mesh Refinement.

Page 34: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

30

SLIDING AND INTERACTIVE POSITIONING

COMSOL HANDBOOK SERIES

SLIDING AND INTERACTIVE POSITIONING

For certain plot types, it can be more helpful to use the mouse to position your results than to use coordinates or settings. In some cases, there is an option for interactive positioning.

Open the slice plot you created earlier that shows the velocity of the air flow in the heat sink channel. Under the Plane Data tab, check the Interactive box. This feature lets you shift the slices in the plot by dragging the slider bar (the distance is shown in the Shift field).

In the Graphics window, the slices will move as you move the bar, sometimes even vanishing from the visible boundaries of the geometry when the shifted distance is large enough.

Page 35: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

31

CONCLUDING REMARKS

We’ve covered the basics of what you need to know to do some very savvy postprocessing, including a few of the more advanced tricks used to add a finishing flourish. To recap:

• Start with data sets and evaluations to understand the physics happening in your device; these are great for calculating maxima, minima, and values at specific locations in your model. You can also show an entire object in 3D (if you’ve only modeled a portion of it) using data sets with mirroring and revolutions.

• Think about how you could best display the information you’re working with. Who are you showing it to? Where is it going to be seen? Choose a plot type that fits the physics you want to depict and your audience…

• …and start plotting! We’ve shown how to use surface, arrow, line, slice, contour, streamline, and isosurface plots, as well as some of the fancier techniques such as showing a mesh on top of another surface.

• Export your work so that you can share it with colleagues, collaborators, and customers.

Postprocessing can help you understand and interpret your simulation, make informed design choices, and convey your results to others. Experiment with some of the techniques here and see what you can do! We hope this guide will assist you in making your simulations—and your vision—come alive.

CONCLUDING REMARKS

SUBSTRATE INTEGRATED WAVEGUIDE (SIW)Model of leaky waves from a slot array on the top surface of a surface integrated waveguide (SIW) designed using the RF Module. SIWs are used in antenna applications where leaky waves can be directed in a predetermined direction by changing the operating frequency. Results show the far-field radiation pattern.

Page 36: COMSOL Postprosessing and Visualization Handbook Part-1 · Essentials of Postprocessing and Visualization in . COMSOL Multiphysics. COMSOL, COMSOL Multiphysics, Capture the Concept,

1

CUT POINTS AND EVALUATIONS

COMSOL HANDBOOK SERIES

HEAT EXCHANGERModel of an air-filled shell and tube heat exchanger with water flowing in the inner tubes. Simu-lation results reveal flow velocity, temperature distribution, and pressure within the vessel.