0% found this document useful (0 votes)
322 views46 pages

Comsol Postprosessing and Visualization Handbook Part-2

Uploaded by

ruserzzz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
322 views46 pages

Comsol Postprosessing and Visualization Handbook Part-2

Uploaded by

ruserzzz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

COMSOL HANDBOOK SERIES

Specialized Techniques
for Postprocessing and
Visualization in
COMSOL Multiphysics®
Specialized Techniques for Postprocessing and
Visualization in COMSOL Multiphysics
COMSOL, COMSOL Multiphysics, Capture the Concept,
COMSOL Desktop, LiveLink, and Simulation for Everyone 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.
©2015 COMSOL.

Contact Information
Visit 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 at
www.comsol.com/support/case.

Further Resources
Further writing and tutorials on postprocessing in COMSOL®
software are available here:

PREVIOUS HANDBOOK: ESSENTIALS OF POSTPROCESSING


AND VISUALIZATION IN COMSOL MULTIPHYSICS
http://www.comsol.com/offers/Postprocessing-and-Visualization-
Handbook-Part-1

VIDEOS
http://www.comsol.com/videos?workflow=workflowstep-results

BLOG ARTICLES
http://www.comsol.com/blogs/category/all/postprocessing/

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

SUPPORT KNOWLEDGE BASE


www.comsol.com/support/knowledgebase/

ii
TABLE OF CONTENTS
INTRODUCTION 1
PLOT EXPRESSIONS AND RESULTS INTERPRETATION
▪ Creating Your Own Expressions 2
▪ Using Derived Values to Verify Your Model 4
▪ Mesh Plots 5
▪ Deformations, Height Expressions, and Scaling 6
▪ Operations for Results Interpretation 7
VISUALIZATION TOOLS
▪ View and Camera Control 13
▪ Lighting and Scene 20
APPLICATION-SPECIFIC PLOT TYPES
▪ Far-Field Plots 23
▪ Particle Tracing 24
ADVANCED TIPS & TRICKS
▪ Ideas for Powerful Visualization 26
▪ Animations 30
▪ Rendering and Smoothing 31
LOWER-DIMENSION POSTPROCESSING
▪ Terminology Refresher 33
▪ Thin Layer Attributes 34
▪ Discontinuities 36
▪ The Up and Down Operators 36
▪ The Side Operator 37
▪ Comparing Domain and Boundary Plots 38
▪ Summary 40
CONCLUDING REMARKS 41
iii
iv
INTRODUC TION

INTRODUCTION
Welcome back! If you’re reading this, hopefully
that means you found the first part of this
handbook set, Essentials of Postprocessing and
Visualization in COMSOL Multiphysics®, helpful
for understanding the postprocessing and
visualization techniques used in the COMSOL
Multiphysics® software.

In the first handbook, we explored ways to


use data sets, derived values, and different
plot groups. At the very end, we investigated
some tips and tricks such as showing mesh
on surfaces, interactive positioning tools, and
shortcuts that can be used to manipulate the
View node and entity selections.

In this second part, we will forge ahead to a


more in-depth look at the flexible postprocessing
capabilities of COMSOL® software that are
relevant for a more experienced user. In
particular, these techniques are meant to aid the
verification, understanding, and validation of
your model. These include performing operations
on data sets, creating deformations that can be
used to show realistic displacements, defining
your own expressions, and interpreting results.

Lastly, we’ll dive briefly into some application-


specific questions, such as when it might
(or might not) be appropriate to change
the resolution and smoothing on a plot,
demonstrate camera and lighting tools to
augment visualization, showcase some advanced
combinations used to create stunning visuals,
and discuss techniques for postprocessing on
entities with dimensions lower than that of the
model geometry.

We hope that the material that follows will offer


you new insight into your simulations and equip
you to more easily analyze, visualize, and share
your work.
STATIC FIELD MODELING
Simulation of a 4-pole pair Halbach rotor. Results
show the magnetic flux density at a cross section
and as a function of the rotor angle.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 1


CREATING YOUR OWN EXPRESSIONS

PLOT EXPRESSIONS AND RESULTS INTERPRETATION


CREATING YOUR OWN At first glance, there appears to be only a small
amount of resistive losses produced in the
REFERENCE EXPRESSIONS
busbar, localized in the single bolt at the back.
For an introduction to the For every plot type used in the COMSOL
different plot types available software, an expression determines the quantity
in COMSOL Multiphysics® plotted. Before we demonstrate some tools for
software, head to the Plot visualization, we’ll look briefly behind the scenes
Types chapter of Essentials of these plot expressions.
of Postprocessing and
Visualization in COMSOL COMSOL offers a plethora of predefined plot
Multiphysics®. quantities, but sometimes it is necessary to
create your own expressions. As an example
of a user-defined expression, let’s re-create the
formula for Joule heating using a model of a
busbar experiencing 20 mV of electric potential.

Go to the application libraries (under File >


But click anywhere on the busbar, and you’ll
Application Libraries) and open COMSOL
see an Evaluation 3D table appear below
Multiphysics > Multiphysics > busbar. This
the Graphics window. This will show the
simulation shows the heating in the busbar
coordinates clicked, as well as the value of the
caused by an applied electric current.
resistive losses at that point. These will range
from very small—single digits—to thousands of
Mathematically, Joule heating is described by the
watts per cubic meter (W/m3); but since most
power dissipated, , where represents
of the busbar experiences far less heat than the
current density and the electric field.
bolt, the color gradient appears fairly uniform
despite the wide range of values.
This is equivalent to the power dissipation
density, which is represented in COMSOL by the
name ec.Qrh (the ec prefix refers to the Electric
Currents interface in the model, and the quantity
is called “Resistive losses”). These quantities can
be found by clicking Replace Expression in
the plot settings, and then searching in the
Type filter text field:
The expanded scalar product that represents
Joule heating mathematically is
HINT
. The equivalent
expression in COMSOL notation is ec.Jx*ec.Ex +
The keyboard shortcut ec.Jy*ec.Ey + ec.Jz*ec.Ez. If you plot this expression,
CTRL+spacebar functions as it will look the same as the plot of ec.Qrh.
an auto-complete command, We can easily deconstruct this expression and
opening the Replace
Expression menu with a list
of quantities whose names Add a 3D plot group to the Results node of the
contain any terms already busbar model and add a surface plot to it. We will
typed in the Expression field. work within this node to examine several different
quantities. First plot the expression ec.Qrh.

2 COMSOL HANDBOOK SERIES


CREATING YOUR OWN EXPRESSIONS

check the contribution from each term. Change Now disable the electric field norm plot and add
the expression to the product of the current and an arrow volume. The default plot expression is
the electric field in the x-direction (ec.Jx*ec.Ex); the current density. You can use the plot settings
it looks nearly the same as the previous image. shown below or adjust them to your liking.

However, if we change it to ec.Jy*ec.Ey, we’ll


discover that there isn’t as much power
dissipation in the y-direction (shown below,
top); it’s still concentrated around that back
bolt, but is lower than the power dissipation in
the x-direction. It decreases even further in the
z-direction (bottom, below):

Now plot the current density norm, ec.normJ.


You’ll see, once again, that the current is
concentrated in the back bolt.

Disable the node for this surface plot and add


a second surface to the plot group. Plot the
electric field norm, ec.normE. In this case, the
electric field is concentrated in the bolts again.
Since Joule heating is described by the scalar
product of these two quantities, it follows that
this plot would also show the most heat in the
bolt region.

NOTES
Expressions follow the naming pattern of interface.quantity. For example, ec.Jx*ec.Ex is the product of the x-components of
the current density and electric field vectors, as defined in the Electric Currents physics interface. Many other mathematical
operators and functions are built in to the COMSOL® software, and a list is available in the Global and Local Definitions section
of the COMSOL Multiphysics Reference Manual available with the COMSOL documentation. You can also create your own
variables and operators and type them in manually, provided their definitions are accurate on the entity being plotted.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 3


USING DERIVED VALUES TO VERIFY YOUR MODEL

The resulting arrow plot will show the strength them so that we can start from scratch to
of the current at different locations in the demonstrate the process. Then add two global
busbar. Below, the arrow plot is shown with a evaluations using the right-click menu.
color expression based on the strength of the
electric field norm, ec.normE. The first global evaluation will be performed on
the power flowing through the device. In the
settings, navigate to Replace Expression > Model >
Component 1 > Heat Transfer > Global > Net powers
and choose ht.ntefluxInt - Total net energy rate.

The plot confirms that the areas of highest


current are in the bolts, and therefore that these
areas experience the most heat. The arrows also
show, as the Joule heating plots did, that the
majority of the resistive losses happen in the
x-direction.

USING DERIVED VALUES TO


VERIFY YOUR MODEL
In Essentials of Postprocessing and Visualization
LIBRARY UPDATE in COMSOL Multiphysics, we briefly touched
on derived values. In addition to, for example,
This handbook assumes investigating the figures of merit for your
that you have updated the application, derived values can tell you a lot
COMSOL Application about the mesh you’re working with. Verifying
Libraries. This can be done that a model is accurate confirms, among other
from File > Help > Update things, that the mesh is fine enough to capture
COMSOL Application the behavior of the system. Global evaluations,
Library. Then click Find one of several derived values available in
Applications and click COMSOL, are a good way to do this.
Uncheck all on the next
screen. Navigate to the Let’s now open to the heat sink model that was
model that you’re looking used in the first handbook. If you have the Heat
for, select it, and click Transfer Module or CFD Module installed, open
Download. the heat sink model from File > Application
Libraries > Heat Transfer Module > Tutorials,
Forced and Natural Convection or from File >
Application Libraries > CFD Module > Non-
Isothermal Flow.

If material properties and boundary conditions


are properly set, verifying how well mass and
energy are conserved is an important measure
of the accuracy of the model. Under Results,
expand the Derived Values node. After you’ve
explored the existing subnodes, delete or disable

4 COMSOL HANDBOOK SERIES


MESH PLOTS

Click Evaluate. A table will open beneath the elements will affect the geometric and numerical
Graphics window showing the value of the total representation of your application. Both result in
REFERENCE
net energy power: 0.99996 W. Since the only heat poor accuracy. We’ve previously discussed using
flux input was set to 1W, we can see that energy is derived values to check whether the mesh is fine For an introduction to global
conserved with a reasonable level of accuracy. enough. Now we’ll focus on its quality. evaluations, turn to the Data
Sets, Derived Values, and
The second global evaluation will be performed One way to determine the quality of the mesh Tables chapter in Essentials
on the mass flow. In the settings for Global or visualize elements on the model geometry is of Postprocessing and
Evaluation 2, navigate to Replace Expression > to create a mesh plot. These don’t even require Visualization in COMSOL
Model 1 > Component 1 > Laminar flow and solving the model in order to plot them. Multiphysics. For more
choose spf.out1.Mflow - Mass flow. information about derived
In the heat sink model under the Component 1 values and interpreting
node, right-click the Mesh node and choose results, turn to the section
Plot. You’ll see something like this: called Operations for Results
Interpretation at the end of
this chapter.

The accompanying color legend ranges from 0


to 1 and describes, by default, the quality of the
elements. The color can also be based on element
size, set to a uniform color, or disabled entirely.

HINT

Sometimes the mesh needs


Click Evaluate. The result is 2.709e-5 kg/s. If we
to be refined in certain
multiply the inlet velocity (5 cm/s), fluid density
regions to improve accuracy,
(1.2754 kg/m3), and area of the inlet (3 cm by
especially where there
1.5 cm), we get a value of 2.8e-5 kg/s and can see
is a large gradient in the
that mass is also well conserved.
solution. This refinement
can be done using a feature
Since these evaluations matched the expected
in COMSOL called Adaptive
results, we know that the mesh is fine enough
Mesh Refinement, which
and the model is accurate given the operating
analyzes errors in the
conditions under investigation.
solution and refines the
The mesh quality is a measure of how isotropic a
mesh accordingly. For details
mesh cell is. An element with equal side lengths,
MESH PLOTS for example a 2D equilateral triangular element,
on how to show the mesh
in a results plot, see the
has the quality 1. A completely flattened triangle
Postprocessing quality, as well as solution Combining Plot Types section
with no area has the quality 0. Similar geometric
accuracy, depends greatly on the size and quality in the Advanced Tips and
formulas are available for 3D tetrahedral elements.
of the elements in a mesh. Too coarse a mesh Tricks chapter.
For other types of elements, like bricks and prisms,
will result in too few data points, and distorted
the quality does not have the same meaning.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 5


DEFORMATIONS, HEIGHT EXPRESSIONS, AND SC ALING

DEFORMATIONS, HEIGHT This plot describes the deformation shown on


different regions of the micromirror. But we’ll
EXPRESSIONS, AND SCALING
make it look a little more physically realistic to
better depict the movement.
There are several ways to create results plots that
visually exaggerate changes such as displacement,
Add a deformation to the surface plot (right-
bending, or shrinking. This helps to visualize
click Surface 1 and choose Deformation). The
deformations, especially in cases where they’re
software automatically enters (u, v, w) to plot the
not obvious when plotted on a 1:1 scale.
components of the displacement field. Change
the scale factor to 1 and click Plot.
To demonstrate this, we’ll use two models, a
piezoacoustic transducer and a micromirror.
Although you may not work with models of
this type yourself, these techniques may be
applied to any model dealing with many kinds of
physics (for example, showing displacement on
a structural mechanics plot is done in the same
way for nonlinear and piezoelectric materials as
it is for elastic materials).

If you have the MEMS Module installed,


navigate to File > Application Libraries > MEMS
Now we can see the deformation, overlaid on
Module > Actuators and open the micromirror
the edges showing the original position of the
model. This model simulates an electrostatically-
micromirror.
controlled micromirror. These optical
semiconductors often serve as reflection devices,
Next, let’s take a look at a piezoacoustic transducer.
such as the optical redirectors used in digital
This model is available under File > Application
cinema production.
Libraries > Acoustics Module > Piezoelectric
Devices if you have the Acoustics Module
A 3D structural analysis determines the
installed.
deformations and stresses necessary to lift the
mirror by the correct amount. The analysis is
Piezoacoustic transducers are used to convert
performed for a device with steel plates and for one
electric currents into acoustic pressure or vice
with aluminum plates, and the results will depict
versa. They’re found in quite a range of devices
the mirror’s response to different levels of prestress.
and applications, such as ultrasound equipment,
HINT
sonar, microphones, and bioimaging.
If you’re following along in the model, add a
You can also play around 3D plot group with a surface plot to the Results
with the x-, y-, and The transducer is represented by a rectangle
node. The expression for displacement is
z-components to see how made of a piezoelectric material and grounded
automatically entered in the expression field, so
the micromirror deforms in on one side. The air domain is represented by
go ahead and click Plot.
each direction. The image one quadrant of a circle. We’ll visualize the
below shows the twisting resulting acoustic pressure in the surrounding
deformation (in the x- and air when 100 V is applied to the transducer.
y-directions only) with the
z-component set to zero. Create a new 2D plot group and add a surface
plot to it. Navigate to Replace Expression > Model
> Component 1 > Pressure Acoustics, Frequency
Domain > Pressure and sound pressure level and
select acpr.p_t - Total acoustic pressure field for the
plot expression.

6 COMSOL HANDBOOK SERIES


OPER ATIONS FOR RESULTS INTERPRETATION

In the image below, the color settings are set to Under the Scale tab, make sure to set the scale
the WaveLight color table with a symmetrized factor to 0.1 or less (you’ll see why this is
color range: necessary if you set it to a larger quantity, like 1).
Then click Plot.

We can see the pressure field across the air


domain, with the field growing weaker farther
away from the transducer. But if we want to
examine those waves a little more closely, we
can add a type of deformation called a height
expression, which will give us an extended 3D
view of the pressure field.
OPERATIONS FOR RESULTS
Height expressions are particularly useful for
cases where the results are wavy in nature or
INTERPRETATION
when a scalar or vector quantity varies mainly
In order to evaluate the accuracy of your model,
along one direction. Unlike other deformations,
understand the physics effects, and validate your
which require more setup, a height expression is
design, it is often necessary to perform operations
an easy way to visualize peaks and troughs.
on a solution. These might take the form of
computing averages, finding local maxima and
Right-click the Surface node and choose Height
minima for a relevant vector quantity, or checking
Expression. The data will automatically be taken
your simulation results against experimental data.
from the parent node plotting the acoustic pressure.
Let’s take a look at some of the available
operations for data sets and derived values.

AVERAGES
Averages can be calculated over a set of domains
for a specific data set. We’ll check out a model
of turbulent flow in a pipe to demonstrate this
(although once again, these techniques are REFERENCE
applicable to many types of models). If you have
the CFD Module installed, open the solved pipe For an introduction to data
elbow model from File > Application Libraries > sets and derived values, turn
CFD Module > Single-Phase Benchmarks. to the Data Sets, Derived
Values, and Tables chapter in
This model simulates the flow in a 90° pipe Essentials of Postprocessing
elbow using a κ-ω turbulence model. It contains and Visualization in
two different components; we will examine the COMSOL Multiphysics.
second one.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 7


OPER ATIONS FOR RESULTS INTERPRETATION

Take a look at the Pressure (spf2) plot group,


which contains plots for the fluid velocity and the
pressure inside the pipe. In the figure below, we
can see streamlines showing the velocity of the
water. This plot shows the separation zone after
the bend and vortices caused by centripetal force.

But suppose we want to determine the size of


the pump necessary for a desired flow rate, or
the contribution of the bend to the total pressure
drop. Or suppose we need to measure the
pressure on a specific plane in order to compare
our results to an engineering correlation.

To this aim we can create a cut plane in the pipe


bend to measure, for example, the pressure drop
from the inlet to the bend and compute results
using a surface average.

Although some of the data sets and evaluations


already exist, we’ll start from scratch to
demonstrate the process.

Right-click the Data Sets node and choose Cut


Plane. The plane’s position should be defined by
the length of the inlet pipe, L, plus the radius
of the bend, Rc. In order to orient the plane Right-click the Derived Values node and choose
perpendicular to the pipe walls and at the Average> Surface Average. For the data set,
halfway point in the bend, set the normal vector choose the cut plane solution you just created.
to (1,1,0). In the Expression field, type p2 (the expression
for pressure used for the second component of
this model).

8 COMSOL HANDBOOK SERIES


OPER ATIONS FOR RESULTS INTERPRETATION

Click Evaluate. The table that appears will show We’ll test this on the pulley model we used in the
the pressure, approximately 1970 Pa. Essentials of Postprocessing and Visualization
in COMSOL Multiphysics handbook, where we
introduced readers to solutions, cut points, and
tables. Open the model from File > Application
Libraries > COMSOL Multiphysics > Structural
Mechanics > stresses in pulley.

Under the Results node is a list of 2D and 1D


We’ll find the pressure at the inlet using another plots. Add another 2D plot group and add a
surface average. Add the second surface average contour plot to it. By default, the expression
and use Study 2/Solution 2 (3) for the data set, will describe the displacement experienced by
which contains the solution from Component 2. the pulley at 9000 rpms. Change the expression
to solid.mises in order to see the stress instead.
Then select the inlet boundary (boundary 1) and Under the Coloring and Style tab, set the
evaluate it using the expression p2 again. contour type to Filled.

Between these two evaluations, we’ve shown that


the pressure drop from the inlet to the middle
of the bend is quite high—almost 1500 Pa. If we
plot the velocity magnitude on the cut plane,
we’ll also see that the velocity changes rapidly
from the outer radius of the pipe bend to the
inner radius. This explains the pressure drop.

VON MISES STRESS

CONTOUR VALUES The plot expression solid.mises


Contour plots are one of the quickest and for von Mises stress is found
most useful ways to tell if a device will hold under Replace Expression >
up to the intended operating conditions—for Model 1 > Component 1 >
instance, whether an area of it will experience Solid Mechanics > Stress.
a temperature above the limit or stress greater
than a material’s yield strength.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 9


OPER ATIONS FOR RESULTS INTERPRETATION

The contour colors show clear distinction The new plot shows the value of each contour,
between the areas of high and low stress; with the highest stress appearing at the thinnest
the contour of highest stress can be used to area of the joint (around 63 MPa). These labels
determine whether the pulley will fail. are very helpful for an at-a-glance look at the
data; if the stress is too high in one area, you’ll
know immediately.

JOINING
The Join function combines solutions from two
data sets, allowing you to compare them. This
is helpful for visualizing the difference between
two solutions, creating sums that contain
multiple solutions, or seeing how two different
meshes affect the results.

We’ll use the heat sink model again. In the


model shown below, we’ve added a parametric
To see the exact value more clearly at each sweep that evaluates the study over the mean
contour boundary, duplicate this plot. In the inlet velocities ranging from 0.05 m/s to 0.5 m/s
new plot, set the contour type to Lines and check in steps of 0.05 m. (These values are purely for
the Level labels box. demonstration purposes and not necessarily
realistic for most standard cooling fans.)

Join solutions can be added under the Data Sets


node. We’ll use the new parametric study and
compare data from two different velocities. The
first will be data for U0 = 0.05 (where U0 is the
mean inlet velocity of the air blowing across the
heat sink). For the second, we’ll use the same data
set, but with data from U0 = 0.5. The combination
method should be set to Difference.

Then click Plot.

10 COMSOL HANDBOOK SERIES


OPER ATIONS FOR RESULTS INTERPRETATION

If we create a new 3D plot group using a surface The Explicit combination method allows you
based on Join 1, we’ll find that the slowest air to implement operations while still preserving
HINT
flow (U0 = 0.05 m/s) results in temperatures individual data sets within the join function—
around 64 K hotter than the fastest air flow. they remain usable, for example, in the As demonstrated here, joining
expression of a plot that uses a Join solution. doesn’t actually require two
COMSOL creates two new operators that access solvers—you can also use a
the quantities from the data sets; therefore a Join data set to examine one
function f(u)-g(v) could be implemented using solution evaluated at two
the Explicit method, as long as u is a valid different parameter values.
variable available in f and v is available in g.

FILTERS
Sometimes, an entire plot area will actually
block your view of the inside of a model. But
COMSOL makes it easy to “peel” the plot so that
you can see better. This function is called a filter
and can be added to 2D and 3D plots (except the
streamline type).

Simpler and less computationally heavy than


adding multiple data sets with selections,
filtering allows you to limit the plot expression
by specifying a range. For the purposes of
interpreting your results, it can be a very
effective way of seeing physics effects up close
This means that, as expected, the fan speed has a and without obstruction.
pretty large effect on the cooling, and simulation
can help in accurately quantifying such an effect. In the heat sink model, the 3D plot group
For a device like this, these results can be used Isothermal Contours (ht) contains an isosurface
to determine the optimal air flow velocity from plot to show the temperature. In the isosurface
the fan by studying the temperature results for plot settings under the Level tab, the number of
different flow speeds. levels is set to 10.

A final note: although there are many


combination methods for the Join operator, two
call for a deliberate mention, General and Explicit.
Most combination methods are a variation on the
General combination. Like mixing ingredients,
the Join solution will not recognize the individual
parts once joined; these cases limit the user to the
same variable for each solution. To draw a parallel
to simple functions, we could perform f(v)-g(v) or
f(u)-g(u), but not f(u)-g(v).
This plot shows temperature isosurfaces. But we
can’t see the heat sink itself.

REFERENCE

For a brief introduction to isosurfaces, see the Plot Types chapter in Essentials of
Postprocessing and Visualization in COMSOL Multiphysics.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 11


OPER ATIONS FOR RESULTS INTERPRETATION

In this case, adding a solution that contains only We can now see the temperature surfaces
half the geometry would require creating a cut everywhere that y>0.
plane and a lot of careful selecting. We’ll use a
filter instead. Change the Element nodes to fulfill expression
field to At least one but not all.
Right-click the isosurface plot node and choose
Filter. The filter settings allow you to choose a
logical expression to designate an area of the
plot surface to include. For instance, setting
the expression to y>0 will exclude areas of the
isosurfaces that lie in the -y quadrants of the
coordinate system.

The Element nodes to fulfill expression dropdown


list offers choices for which individual elements
of the mesh to include; by default, it is set to All.
The other options are: This option will plot a zone around the logical
expression—in this case, plotting elements that
• At least one, which will include overlap with the line y=0 so that some nodes
elements for which the logical do not satisfy the y>0 condition. This can be
expression applies to at least one node, especially useful for plotting around lines or
and may apply to every node boundaries where there is a sudden change in
• At least one but not all, which will values.
include elements for which the logical
expression applies to at least one node This concludes the demonstration of some
but does not apply to every node different ways postprocessing can help you
interpret results by isolating or selecting specific
portions of a solution, evaluating variables at
specific points, and joining data sets together.
Read on for an introduction to using the camera
and viewing tools in the COMSOL environment.

Leave the expression as All for now, and click Plot.

12 COMSOL HANDBOOK SERIES


VIEW AND C AMER A CONTROL

VISUALIZATION TOOLS
VIEW AND CAMERA CONTROL The cards in this chapter will demonstrate
shortcuts using the busbar model (File >
The View node is one of the most powerful Application Libraries > COMSOL Multiphysics >
tools available for orienting your object in the Multiphysics > busbar), but we encourage you to
Graphics window. Found under the Definitions try these out on one of your own simulations.
node, views can help you set up the exact Here’s what the Camera settings look like:
perspective and scene style that you want. This
is where lights are added, angled, and dimmed,
where color and position are arranged, and
where regions of a model can be hidden or
revealed. To draw a parallel to the world of
theater, the View node lets you set the stage
before the curtain rises and the show begins.

To reach the View node that applies to a


particular plot group, click the plot group node
(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 its view by clicking the Go to Source
button next to the drop-down list .

THE CAMERA AND ITS SHORTCUTS


Camera controls are located under the View node.
Just like in photography or film, positioning the
camera correctly can help you highlight certain
features to get the look you want. COMSOL
provides mouse and keyboard shortcuts that
control the camera, and these are some of the
most efficient ways to set up a good shot.

Open up any model and click on the Camera


node under View 1. Camera settings control the
angle, position, zooming, and perspective of the
camera. One way to imagine the camera is to
picture a physical camera sitting in front of the
Graphics window; when you look at the object,
you’re looking straight through the camera’s
viewfinder at the scene.

This means that when you move something in INFORMATION


the Graphics window, you’re actually moving
the camera, not the geometry itself, unless you For Mac users: the third and
are performing a geometry operation like a rigid sixth shortcuts will only work
transformation. on a two-button mouse or
a mouse with a center scroll
The pages that follow show some common wheel.
shortcuts used for orienting the camera.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 13


VIEW AND C AMER A CONTROL

Right-click and drag. This first shortcut moves the visible frame left, right, up, or down on the
camera’s viewfinder plane (the plane of the Graphics window). This changes the View Offset.

14 COMSOL HANDBOOK SERIES


VIEW AND C AMER A CONTROL

Left-click and drag while holding the Alt key. This shortcut rotates the camera around an axis
perpendicular to the plane of the Graphics window:

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 15


VIEW AND C AMER A CONTROL

Center-click and drag. Another very simple action is zooming in on the area where the mouse
is located. While the zoom buttons in the Graphics tools are quick and easy, they zoom in on the
center of the visible window by specific increments and are not affected by the location of the mouse.
This action gives you more precise control over the zoom angle:

16 COMSOL HANDBOOK SERIES


VIEW AND C AMER A CONTROL

Left-click and drag while holding the CTRL key. The following shortcut changes the pan and tilt of
the camera. This effect changes the position and angle from which the camera sees the component
geometry (in contrast to the first shortcut, where the visible frame moves within the camera’s
viewfinder plane). The orange icon indicates the direction of the camera. Since this shortcut moves
and rotates the camera with respect to the component geometry, the model will appear to move in
the opposite direction of the mouse.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 17


VIEW AND C AMER A CONTROL

Right-click and drag while holding the CTRL key. This shortcut moves the camera up, down, left,
and right, but keeps it facing the same direction. The camera moves with respect to the component’s
geometry, so the geometry will appear to move in the opposite direction as the camera (but the same
direction as the mouse).

18 COMSOL HANDBOOK SERIES


VIEW AND C AMER A CONTROL

Center-click and drag while holding the Alt key. This last shortcut keeps the component geometry
in the center of the camera view and dollies the camera in and out (forward and back). Unlike
zooming, it is not affected by the location of the mouse, nor does this action change the zoom angle
of the lens.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 19


LIGHTING AND SCENE

LIGHTING AND SCENE To create good lighting for this engine, we’ll
need to use several lights aimed in different
HINT
Lighting can help to illuminate regions of a directions.
The reciprocating engine model where it’s hard to tell what’s going on,
has a great geometry for putting new perspective on a results plot. These Expand the Displacement plot group under
experimenting with multiple finishing touches can cast a device in a whole Results. This plot shows the displacement of the
surfaces, deformations, and new light. different components after the engine has begun
different lighting approaches. running. If you expand the Surface 1 subnode,
For hints on creating the To experiment with the lighting and scene tools you’ll see a deformation. This deformation
image below, turn to page in COMSOL, we’ll use the Reciprocating Engine moves the visible geometry to the engine’s
29 in the Advanced Tips and model. If you have the Multibody Dynamics position at 0.16 seconds, but keeps the outline of
Tricks chapter. Module installed, this model is found under File the original position.
> Application Libraries > Multibody Dynamics
Module > Automotive and Aerospace. (If you Navigate to the View node for the Displacement
don’t have the already-solved model in your plot group. Once you’ve explored the existing
libraries, download it from File > Help > Update lights and the Hide Geometric Entities 1 node
COMSOL Application Library.) The techniques (which hides the middle engine piston), delete
shown here are applicable to any geometry, but Directional Lights 1, 2, and 3.
we’ll use the engine because it has curves, nooks,
and crannies that make the effects easy to see. If we go back to the displacement plot we’ll see
the dark engine with all the lights off, as shown
This example analyzes the multibody below. In the View node, the geometry should
dynamics of a three-cylinder engine and appear in plain gray.
the thermodynamics of the air-fuel mixture
in the cylinders. The simulation results are
used to determine the pressure variation in
the combustion chamber, rotational speed
(rpm), the motion of different components of
the assembly, and the power output from the
cylinders. The geometry contains a flywheel,
crankshaft, journal, and crank and piston for
each of the three cylinders.

There are two components in this model;


we will work within the second component,
called Multibody Analysis, which analyzes the
multibody dynamics.

Right-click View 2 and choose Directional Light.


The new light that appears in the Graphics
window, indicated by an arrow inside of a
tetrahedral box, is automatically aimed close to
(0,0,0).

The position of directional lights is defined


by their direction; they behave like rays of
sunlight, falling on every part of the geometry
in their path, and can be blocked by walls and
protrusions. Unlike spotlights (which will be

20 COMSOL HANDBOOK SERIES


LIGHTING AND SCENE

mentioned later), the position of a directional


light cannot be changed.
HINT
Try playing around with some different When editing lighting after setting up a model, it can be especially helpful to keep only
coordinates by changing the entries under the one light enabled at a time. This lets you see exactly which effect is caused by which
Direction tab in the light’s settings. Once you’ve light as you add each one into the scene. You can also expand the Light tab in the main
got a feel for how the lighting changes with the View node settings to change the ambient lighting and the overall scene light intensity.
coordinates, create another directional light. We’ll When you’re working in the View node, arrows are displayed for each light, but only
illuminate some different areas of the engine. the light being edited is surrounded by a box.
We’ll need one light to make a nice splash that
brightens the overall scene. Later, we’ll add a
third light for the top and sides, and one to For the second directional light, test what
create emphasis on the curved surfaces. happens when you shift the coordinates—try
highlighting the top, the bottom, or the side of
the engine. The coordinates used to create the
scene below are (-0.5,1,-1).

For the first light, try setting the direction


coordinates to (3,3,0) and the light intensity to
0.75. This will illuminate most of the geometry.
When you’ve found the exact position that you’re
happy with, create the third directional light. This
is the light we’ll use for the curved surfaces. The
coordinates of the third light in the figure below
are (1,1,1), but see what you like best:

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 21


LIGHTING AND SCENE

Directional lights like the ones we’ve added here A headlight points from the camera position; it
are the most commonly used lights, but there is locked to the camera’s coordinate system, and
are several other types of lights available in its position and direction cannot be changed.
COMSOL. If you right-click View 2 again, you
can add a point light, a spotlight, or a headlight.

A point light is like a lightbulb; it emits light in


all directions, and its settings control its position.
This point light is positioned at (-0.25, -0.5, -0.25):

This concludes our explanation of the camera


and lighting tools available in COMSOL. With
these in your hands, you’ll be able to emphasize
the most important region of your results plots,
clearly see what’s happening in your model, and
produce powerful visual reports.

A spotlight is like a flashlight, with both


direction and position specified by the user. This
spotlight is positioned at (-0.28, -0.33, 0) and
aimed at (1,1,-0.75):

22 COMSOL HANDBOOK SERIES


FAR-FIELD PLOTS

APPLICATION-SPECIFIC PLOT TYPES


There are certain plots that make most sense to the far-field of electromagnetic or acoustic pressure
use with certain physics and for this reason are fields, so the plot tools we’ll use for the SIW are
most frequently used with add-on products to applicable to many RF and acoustics applications.
the COMSOL software that are specific to the
application area. Let’s detour for a moment to In a far-field plot, the variable is plotted for a
cover a few of these application-specific plot types. specified range of angles (Θ and ϕ in the settings
below), and the surface is created by radially
FAR-FIELD PLOTS deforming a specified sphere from the location
of evaluation points lying on it.
Radio-frequency (RF) applications deal with
electromagnetic waves being radiated and One benefit to using far-field plots is that
absorbed at radio frequencies. Simulation can the deformed sphere is not part of the model
be used to design a multitude of RF devices, geometry, and so the number of directions
and one of the most common figures of merit plotted is not affected by the discretization of
considered by engineers is the radiation pattern. the solution domain. The shape of the deformed
RF and microwave applications include devices sphere depends on the specified expression for
such as antennas. the evaluation points.

We’ll now take a look at an example of an The settings for a far-field plot in the SIW model
RF device where you might want to know its are shown below.
radiation pattern.

The model shown below is a substrate-integrated


waveguide (SIW) used in antenna applications.
Leaky waves escape through slots on the top
surface to generate a beam that can be steered by
changing the operating frequency.

This model, available from File > Application


Libraries > RF Module > Antennas if you
have the RF Module installed, is one where a
far-field calculation is used to determine the
electromagnetic field distribution at distances far
from the SIW.
Far-field plots are used to plot global variables for

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 23


PARTICLE TR ACING

For this SIW, we can plot the far-field norm cells in small microfluidic systems. We’ll now
variable, emw.normEfar. The plot below is scaled demonstrate some options for postprocessing using
ACOUSTICS MODELING
up to make details more visible and depicts the Particle Tracing Module in a simulation of a
You might use a similar the far-field norm of the electric field for an static mixer.
process in an acoustic operating frequency of 12.25 GHz.
simulation, to visualize If you have the Particle Tracing Module
the acoustic pressure field installed, open the tutorial from Application
at distances far away from Libraries > Particle Tracing Module > Fluid
the object you’re modeling. Flow > laminar mixer particle. The geometry is a
The example below shows flow channel containing a series of static blades
the far-field sound pressure that are twisted in alternating directions. In this
levels around a tonpilz piezo example, the mixing performance is evaluated
transducer. Such devices by computing the trajectories of solid particles
are used, for example, in carried by water through the mixing blades.
sonar systems where high-
power, low-frequency sound We will start from some of the plots that are
generation is needed. included in this tutorial. Click on the 3D plot
group named Particle Trajectories (fpt). This
plot displays the particle trajectories up to a
Increasing the angle resolutions will give a selected time, with a color expression indicating
smoother and clearer depiction of the far-field. the shear rate at the particles’ current positions.
In the image below, a rigid translation is used
to move the waveguide down so that the entire This plot can be adjusted easily to visualize the
far-field radiation pattern is visible. particles’ progression at different times. The
sequence below shows trajectories for three
different times, t=1 s (left), t=1.6 s (center), and
t=3 s (right), with the color expression changed
to spf.U to indicate the magnitude of the particle
velocities. To control the color range manually,
expand the Range tab in the settings for the
Color Expression 1 subnode.

The maximum resolution for Θ and ϕ is 180


(shown above). As might be expected, the higher
the resolution, the more computationally heavy
the postprocessing operations.

PARTICLE TRACING
The Particle Tracing Module is used to solve a set
of ordinary differential equations for the motion of
distinct particles. As the particles move, they can
be affected by external fields through a wide variety
of forces, such as electric, magnetic, drag, and
dielectrophoretic forces. There are many options for
including particle-boundary, particle-particle, and
particle-field interactions. The physics interfaces
are usable for a range of simulation topics, such as
ion transport in electromagnetic fields, large-scale
planetary movement, and separation of biological

24 COMSOL HANDBOOK SERIES


PARTICLE TR ACING

The Particle Trajectories plot provides a more The main drawback of the phase portrait is that
realistic depiction of the mixing performance than it plots all particle positions in phase space at the
a streamline plot would. Streamline plots are used same time, not at the same position along the
to visualize vector quantities using curves tangent length of the mixer. A better way to evaluate the
to an instantaneous vector field. (See the Plot mixing performance at specific locations in the
Types chapter of the Essentials of Postprocessing mixer geometry is to use a Poincaré Map. This type
and Visualization in COMSOL Multiphysics of plot shows the locations where particles intersect
handbook for an introduction to streamline with one or more surfaces defined using a Cut
plots.) The Particle Tracing for Fluid Flow physics Plane data set.
interface, on the other hand, treats the particles
as distinct entities instead of a continuous field, Click on 3D Plot Group 4. In this plot we can see
and solves a distinct set of ordinary differential the particle groups on different planes in space after
equations for each particle so that it correctly mixing has begun, and can tell that they are not
accounts for the inertia of the particles. fully mixed by the time they reach the outlet. This
Poincaré Map uses planes located at 0.006, 0.016,
Another useful way to visualize how particles 0.026, 0.036, and 0.042 meters along the y-axis.
are mixed is to use a Phase Portrait plot. In a
Phase Portrait, each particle is depicted as a
colored dot at some location in a user-defined
phase space. For example, the two coordinate
axes can be two different components of the
particle position; alternatively you can plot
particle position along one axis and particle
speed along the other.

Click on 2D Plot Group 5, which includes a plot


called Phase Portrait 1. In this example, the two
coordinate axes of the phase portrait are the two
transverse components of the particle position.

The time value can be adjusted in the Data tab


of the Phase Portrait settings window. Shown
below are phase portraits at t=0 s (left), t=1 s
(center), and t=4.2 s (right). A Color Expression
indicates the initial position of each particle. This concludes the application-specific plot section
At the final time, some pockets consisting of this handbook.
entirely of red or blue particles can still be seen,
indicating that the mixing performance could
still be improved. CUT PLANES

For plots on cut planes, we use


Cut Plane data sets, which are
created on 3D data sets and can
be visualized in either 2D or
3D plot groups. A cut plane can
be used to create many parallel
planes. Use the Additional parallel
planes checkbox and choose an
appropriate distance or range to
specify the offsets of extra planes,
as shown in the image to the right.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 25


IDEAS FOR POWERFUL VISUALIZATION

ADVANCED TIPS AND TRICKS


IDEAS FOR POWERFUL We can also add an arrow plot alongside the
deformed lines, to show the velocity field. The
VISUALIZATION
arrow color in the following plot is based on the
velocity magnitude, spf.U.
This section is meant to help you brainstorm
by showcasing different ways to create some
unique graphics. We will show examples of
a few techniques that can help you create
new perspectives on your results, such as
deformations, cut planes, different plot
combinations, and advanced camera control.

CUT PLANES AND CUT LINES


In Essentials of Postprocessing and Visualization
in COMSOL Multiphysics, we briefly touched
on using cut planes (and analogously, cut lines)
to visualize results on planes (or lines) that cut
But it may be hard to see what’s going on right
through a model geometry. COMSOL offers the
around the heat sink pillars because there are so
ability to combine these, which can considerably
many lines in the way. Let’s create some new data
improve and simplify a results plot.
sets to show a sliced view—a cross-section of the
heat sink and channel so that the region nearest
Last time, we saw a line plot that ran through
the heat sink is easier to see.
the heat sink model along its x-axis, showing
the air temperature and flow velocity in the
Right-click the Data Sets node and add a cut
channel. The line plot shown below is deformed
plane. Under the Plane Data tab, set the Plane
according to the velocity field (u,v,w), whose
field to xz-planes. Click Plot. Based on the default
magnitude also controls the radius expression
coordinates, this will create a plane running down
for the tubes.
the center of the channel and the heat sink.

Now right-click the Data Sets node and choose


REFERENCE Cut Line 2D. For the data set, choose the cut plane
you just created (Cut Plane 1). Set the location
See the Data Sets, Derived Values, and Tables chapter in Essentials of Postprocessing of Point 2 to (1,0). Then check the Additional
and Visualization in COMSOL Multiphysics for an introduction to cut points and, parallel lines box.
by extension, cut lines and cut planes.

26 COMSOL HANDBOOK SERIES


IDEAS FOR POWERFUL VISUALIZATION

We’ll add a range to this, so that we create a Add a deformation to this line plot, with the
series of vertical cut lines in the new plane. Click x-component set to u and the y-component set
ARROW PLOTS
the Range button next to the Distances field to v (the components of the velocity field).
to open a dialogue box for the range. Enter the In the same way that an arrow
following settings: For the arrow line plot, set the data set to Cut Line surface plot uses arrows on
2D 1 and the scale factor to 0.025; the velocity field a planar surface to depict a
• Start: 0.01 should automatically be entered for the expression. vector quantity, an arrow line
• Step: 0.006 (this will create a line every plot depicts a quantity using
6 millimeters from the start point) Click Plot. Now we have a 2D cross-sectional arrows on lines.
view equivalent to the 3D plot we saw earlier.
• Stop: 0.04

Click Add, and the range will be added to the


Distances field.

Although the 3D plot is more useful for


visualizing certain aspects of the solution, this
plot makes it much easier to see how the air flow
develops on a specified plane as the air moves
past the heat sink.

USING DEFORMATIONS TO STACK YOUR


RESULTS
One way to use deformations that we haven’t
touched on yet is to compare results within the
same plot. This is a great way to see different
quantities at the same time. This involves using
several different plots showing multiple quantities.

We’ll demonstrate using a 3D example. If


you have the Heat Transfer Module installed,
open the heating circuit model under File >
Application Libraries > Heat Transfer Module >
Power Electronics and Electronic Cooling.
Click Plot to show the cut lines on the slice
created by the cut plane. Heating circuits find their way into many
applications, especially in manufacturing.
This particular device includes an electrically
resistive layer on a glass plate, which experiences
Joule heating when a voltage is applied. The
solved model contains results plots showing
Now add a new 2D plot group to the Results stress, isothermal contours, temperature, electric
node using Cut Plane 1 as the data set. Add both potential, and surface losses in the circuit.
a line plot and an arrow line plot.
Suppose we want to visualize many of these at
For the line plot use the Cut Line 2D 1 data set once, to take the bulk of our results and array them
(the cut line solution you just created) and the all together. We can use the existing plot groups to
plot expression spf.U (the velocity magnitude). create our stack.
Set the line type to Tube and set the tube radius
expression to spf.U as well.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 27


IDEAS FOR POWERFUL VISUALIZATION

The new plot group will contain surfaces from The array will initially look blurry:
the Stress (solid), Temperature (ht), Electric
Potential (ecs), and Surface Losses plot groups,
spaced 50 mm apart along the z-axis:

We’ll add a line plot to the temperature surface


to distinguish the different areas of the device.
Go to the Data Sets node and duplicate Study 1/
Solution 1 (1). This will create a data set called
Study 1/Solution 1 (3). Add a selection that
includes all of the plot edges (choose Edge for
the geometric entity level, then select All edges in
the selection field).

Now add a line plot to your 3D plot group and


choose Study 1/Solution 1 (3) as the data set. Set the
expression to 1 and the coloring to uniform black.
To start, expand the Stress (solid) node and take
a look at the existing deformation—it bends the You won’t see anything change. This is because
geometry according to the displacement field. your line plot doesn’t contain the deformation that
you added to the temperature plot, so it’s located
Create a new 3D plot group. Right-click the right on top of the lines for the stress surface.
surface plot in Stress (solid) and choose Copy.
(The deformation will also be copied, since it is Copy the deformation node from your
a subnode of the surface.) Right-click your new temperature surface and paste it into the line
plot group and choose Paste Surface. plot to shift the plot edges. Click Plot.

Also copy the surface under the Temperature (ht) There are several ways to finish the array, but
TRANSLATIONS node. After you’ve pasted it into your plot group, it is often easier to duplicate the surfaces that
do a few things before adding a new deformation: already exist in a plot group than copy and paste
You can only add a single under the Title tab set the title type to None, and everything from the other plot groups. Create
deformation to each surface under the Coloring and Style tab uncheck the two more surface plots: one showing the electric
plot. Therefore, the plot Color Legend box (this will ensure that when potential and another showing the surface losses.
containing the deformation you duplicate this surface, you won’t end up with The following table includes the expressions and
that shows displacement in multiple titles and color legends, which can really deformations we’ve used for each, but adjust the
the circuit cannot also be crowd up the Graphics window.) deformation settings to your liking:
translated in the z-direction.
Each of the other surfaces Now add a deformation to the temperature plot.
uses a deformation to In the image shown below it is shifted down by
translate them in the -50 mm in the z-direction. Set the scale factor to
z-direction. 1 and the x- and y-components to zero.

28 COMSOL HANDBOOK SERIES


IDEAS FOR POWERFUL VISUALIZATION

COMBINING PLOT TYPES • A surface plot based on a data set


In Essentials of Postprocessing and Visualization containing only the leftmost crank,
in COMSOL Multiphysics, we explored examples WIREFRAME RENDERING
journal, and end of the connecting rod,
of plotting several surfaces on a model at the with wireframe rendering turned on To show mesh elements in a
same time. For powerful visuals, sometimes and the color set to black to show the plot, add a new surface to a
you might want three, four, five surfaces on edges of the mesh elements. plot group and set the color to
your geometry. How do you do this without
uniform black. In the surface
overcrowding the look and feel of the graphic?
EXAMPLES OF ADVANCED CAMERA settings, check the Wireframe
CONTROL box under the Coloring and
The image of the reciprocating engine that
One trick that the camera can help you with is Style tab. This is usually used
we saw in the Visualization Tools chapter is
showing interesting perspectives on a model. in combination with a surface
a combination of surface plots, line plots,
Whether you’re looking for a close-up of the of another color, so that the
deformations, wireframe rendering, and
mesh, to see how different surfaces intersect, or to mesh is overlaid on top of the
different color styles.
examine a boundary in detail, these shots can give first surface.
a new perspective to your visualization and let you
look at the model from the inside of the geometry.

Created through various combinations of


rotations and zooming, the following examples
show some different views.

The colored surface in this image is limited to


just one of the engine’s connecting rods. Most
remaining regions of the engine are simple gray,
with one area meshed.

This results plot contains:

• A surface plot with a geometric


The images above depict a simulation of a
selection that excludes the middle
Helmholtz coil with streamlines showing the
piston and cylinder and the left
magnetic field. These effects were created using
cylinder. The coloring is a uniform
a combination of panning and tilting, dollying,
light metallic gray. This surface has
zooming, and moving the camera up, down,
a deformation of (u, v, w), which is
left, and right (camera shortcuts 3-6 in the
repeated for most of the following plots
Visualization Tools chapter).
to show the position at t=0.16 seconds.
• A surface plot based on a data set
containing only the center connecting rod.
This surface plots the von Mises stress.
• A line plot showing all of the data set
edges. This plot does not contain the
deformation, so it shows the outline of
the engine’s starting position.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 29


ANIMATIONS

ANIMATIONS
One of the final capabilities of COMSOL that
we’ll touch on here is exporting results. This can
take the form of plots, tables, animations, and
reports. Some techniques for exporting data and
generating results are discussed in the Exporting
Results chapter in Essentials of Postprocessing
and Visualization in COMSOL Multiphysics. In
this section, we will focus on animations.

We’ll use the laminar mixer model, but you can


do this with many different applications featuring
Above is a shell-and-tube heat exchanger with fluid
a time-dependent study. Right-click the Export
flow streamlines. This plot includes streamline,
node under the Results node, below all of your
surface, arrow, and wireframe mesh plots. The
plot groups, and choose Animation > Play. The
perspective on the right was created using
Player creates interactive animations directly in the
combinations of rotating and zooming movements.
COMSOL Desktop® environment. Under the Scene
tab, set the subject to Particle Trajectories (fpt).

When you click the Play button that appears in


the Graphics window toolbar, you should see the
particle trajectory lines appear at the inlet and
trace across the mixer until they reach the outlet.
In the Player settings, you can also control the
number of frames and the speed of the animation.

Above is a view looking through the columns


of the heat sink plot containing surfaces, and
streamlines. The perspective required moving
the camera down to the height of the base of the
pillars, dollying, and using center-click zooming.

Shown above are reacting pillars in a biosensor


where fluid velocity is depicted. This plot required
shifting the camera angle, zooming, and dollying.

30 COMSOL HANDBOOK SERIES


RENDERING AND SMOOTHING

Here’s an in-progress shot: demonstration used a fine mesh to achieve that


level of smoothness, but also included a certain
amount of quality refinement.

By default, the resolution settings in a plot are set


to Normal. A resolution higher than No refinement,
an option in the drop-down list, means that
elements can be split into smaller patches during
rendering.

Take a look at the difference between the contours


with no refinement (left) and high refinement
(right), below:

Right-click the Export node again and choose


Animation > File. This is where you can export a
video or series of images to save as a file—great
for presentations or websites where you want to
show your results in just a few seconds.

Set the subject to Particle Trajectories (fpt) again,


choose a name in the Filename field under the
Output tab, and change the frame and layout
settings to your liking. Then click Export at the
top of the settings window to make a video. If
you open the new file in a browser or player that Increasing the resolution works well when a finer
supports GIFs, you’ll be able to watch it. mesh is not needed to improve the accuracy
of a solution that is expected to be continuous.
RENDERING AND SMOOTHING With higher refinement, the field being plotted
is rendered sampling a larger number of points
If you click a node for any of the individual within each element, which improves visualization
plot types we’ve used in this guide, you’ll see for smooth fields.
a Quality section toward the bottom of the
Settings window, underneath the Coloring and For cases such as this conjugate heat transfer
Style tab. The Quality tab lets you select a plot example, high refinement is a good choice; refining
resolution, enforce continuity with smoothing the visualization of the continuous temperature
operations, and specify the use of accurate distribution doesn’t affect the correct rendering of
derivative recovery. the results.

If, however, the quantity plotted has a strong


variation or even a discontinuity within an
element, the refinement process is likely to
produce overshoots or oscillations. Hence, it
is important to examine the rendering of your
solution as you increase the refinement, and to
find a setting that enables better visualization
without altering the behavior of the quantity
REFINEMENT you’re investigating.
When we explored the heat sink model in the
Essentials of Postprocessing and Visualization For example, many structural mechanics
in COMSOL Multiphysics handbook, we analyses require examining stress levels with
added a contour plot showing the temperature high accuracy; in such cases, refinement could
change on the back wall of the air domain. That actually render the data incorrectly and might

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 31


RENDERING AND SMOOTHING

disguise important information, such as an area


where stress or strain in a mechanical component
RECOVERY
passes the yield limit or changes abruptly.
Recovery is a polynomial-
preserving process that Refinement may also be unsuitable when a plotted
recovers fields with expression contains a combination of different
derivatives (such as fluxes fields. The fields may have different sources
or stresses) of known and different representations, and a high-order
quantities, and has a higher sampling may cause artificial oscillations. If
theoretical convergence you see continuities where you would expect
than smoothing. For discontinuities that you want to study—such as
more information about when rendering a phase transition occurring in
the Recovery settings, see a material—this means that the visualization is
the Results and Analysis hiding important information. In such cases, set the
chapter of the COMSOL refinement to None.
Multiphysics Reference
Manual available with your SMOOTHING
COMSOL documentation. The options in the Smoothing dropdown list
enforce continuity on discontinuous data—like
refinement, this is helpful when you know that
your solution is smooth but due to a chosen
discretization, mesh settings, or modeling
approach, simulation results appear discontinuous.

The default option smooths the quantity


everywhere except across borders between
domains, where there is often a sharp transition
from one material to another, or between different
types of physics.

32 COMSOL HANDBOOK SERIES


TERMINOLOGY

LOWER-DIMENSION POSTPROCESSING
When postprocessing a simulation that contains However, the internal surface jutting out from
thin walls modeled as surfaces or layers with an two of the walls is also considered a boundary
assigned mathematical thickness (rather than even though it does not act as a divider between
a geometric thickness), you will occasionally domains.
see different results when plotting on different
types of entities. This means it’s important to be
careful in cases that we refer to as lower-dimension
postprocessing.

TERMINOLOGY REFRESHER
First let’s do a quick refresher of some
terminology. The COMSOL software uses
the following conventions when referring to
geometric entities:

• Edges refer to curves (including straight When performing postprocessing operations


lines) in the geometry. under the Results node, the following facts apply:
• Points refer to the intersections of two or • Volume plots will plot results on domains
more edges, with one point created for
every intersection. Cut points, i.e. points • Surface plots will plot results on
not originally present in the geometry, boundaries
can also be created for postprocessing • Line plots will plot results on edges
purposes.
• Boundaries refer to surfaces that are With certain plot types it may be wise to take note
completely enclosed by edges. While of which type of entity they plot on. For instance,
these surfaces often enclose entire arrow plots come in three styles—line, surface,
domains, internal surfaces are also and volume—with each corresponding to the
referred to as boundaries. appropriate geometric entity. Streamline plots may
• Domains refer to volumes enclosed by apply to both 3D and 2D plot groups, but they
boundaries. plot results on domains in 3D and on boundaries
in 2D. Meanwhile, mesh plots are very general
(applicable to any plot group except polar plots),
For instance, in the cube geometry below, all of while 1D plots contain options for plot types that
the external walls are boundaries: are not applicable to other dimensions.

This terminology will be particularly relevant to


this final section of the handbook.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 33


THIN L AYER AT TRIBUTES

THIN LAYER ATTRIBUTES When plotting domain quantities for a thin layer,
COMSOL treats the results slightly differently
In the COMSOL software, a “thin layer” refers depending on the type of plot being used:
to a surface where physics will be solved by
mathematically accounting for the real thickness • When using a surface plot to represent
of a wall instead of meshing it. These layers are results on a boundary, the software will
treated as boundaries, while the surrounding area usually display the average of the results
or areas are treated as domains. from both domains using information
from the solver about the boundary
The benefit of using thin layer modeling— layer close to the wall, if any.
especially in multiphysics scenarios—is that it • When using a domain plot that falls on
reduces computational time by circumventing the the location of the boundary, the software
need to mesh a thin 3D layer. chooses results from one domain to
display based on the location of the plot,
Lower-dimension postprocessing is a powerful i.e., which domain it falls inside of.
tool that enables you to analyze results on one or
both sides of a thin layer and is used for modeling
The latter are treated differently because the
electrical, mechanical, fluid, and chemical
domain plot—for example, a 3D slice plot—will
applications. In this section, we’ll discuss different
by definition fall on either side of the thin layer’s
operations that can be used in COMSOL to
geometry. Even plots located “exactly” on the
correctly postprocess such scenarios and avoid
interface between two domains will fall on one
falling into traps.
side, since plotting on the exact intersection
is not numerically possible. This means that
In modeling a three-dimensional wall as a two-
domain plots will show values from one domain
dimensional layer, COMSOL treats the thin
or the other, but not a combination.
layer as a boundary that is adjacent to as many
domains as touch the wall.
The implications of this functionality are that
results may look slightly different depending on
the plot type used.

In the case of boundaries that do not divide a


domain, a boundary can be adjacent to the same
domain on both sides:

Such a boundary touched by two domains can


have results plotted for either domain, or a
function of results from both.

34 COMSOL HANDBOOK SERIES


THIN L AYER AT TRIBUTES

EXAMPLE: HEAT EXCHANGER The temperatures in each domain are represented


Let’s look at a model of a heat exchanger that by T1 and T2 in the image below.
contains walls defined as thin layers and interior REFERENCE
walls for thermal and fluid problems. The shell
For further information about
and tube heat exchanger can be found under File
the temperature variables and
> Application Libraries > Heat Transfer Module
boundary calculations, see the
> Heat Exchangers if you have the Heat Transfer
Boundary Wall Temperature
Module installed.
section in the Heat Transfer
Modeling chapter of the Heat
The geometry consists of a series of tubes through
Transfer Module User’s Guide
which water flows, and a shell section where air
available with your COMSOL
circulates. They have different inlet temperatures, but
documentation.
as they flow past each other the two fluids exchange
heat and reach an equilibrium temperature. This type
of heat exchanger is often used in chemical processes
and other industrial applications. Boundary layers, where there is a high temperature
gradient, are accounted for mathematically using
thermal wall functions.

The physics setup in the Model Builder contains


physics interfaces for heat transfer and turbulent
flow, and a multiphysics coupling for non-
isothermal flow. The expression for the wall’s surface temperature
is ht.Twall. Temperature distribution from one
In the heat transfer problem, a thin layer side of the wall to the other is considered constant
condition is used to define the thermal and since in this application the wall is considered
geometric properties of every wall, where a conductive and so thin that the gradient is assumed
thickness of 5 mm is assigned mathematically to be negligible compared to the gradient in the
and the walls are considered thermally surrounding domain.
conductive.
A thin layer boundary condition called an “interior
For walls adjacent to two domains, the software wall” is used when fluids are involved. This makes it
will solve within each domain; within the possible to model a thin region with large gradients
boundary layers close to the wall; and at in the results near a solid wall, across which the
the interface between the domains and the flow properties can change dramatically.
boundary layers.
In this model, an interior wall is applied to
the turbulent flow settings in order to allow
discontinuities in velocity, pressure, and turbulence
variables across the thin layer. The software will
solve for the fluid velocity within each domain and
use a wall function to account for the boundary
layer forming close to the interior wall, as it did in
the thermal problem.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 35


DISCONTINUITIES & THE UP AND DOWN OPER ATORS

DISCONTINUITIES THE UP AND DOWN


OPERATORS
We can easily see apparent discontinuities if we
plot the temperature on all the boundaries of As mentioned previously COMSOL can evaluate
the heat exchanger’s geometry, which is a default quantities on one side of a geometric boundary.
plot in the solved model. The temperature For thin layers, you may sometimes want to
appears to change abruptly at the interfaces explicitly plot results from one domain or the
between certain walls, and the inlet and outlet other depending on which side you want to
areas where the hot water enters appear to render.
have noticeably higher temperatures than the
adjacent boundaries near the airflow. When using a boundary plot (such as a surface
plot) rather than a domain plot, the up and
down operators are helpful here.

These expressions take the form of


up(expression) and down(expression): up(T),
for example, will plot the temperature from the
boundary layer on the “upside” of the wall.

As long as a boundary has an upside,


up(expression) can be evaluated. If there is no
upside—for instance, as in a case where the wall
touches only one domain—the operator returns
a value of zero.
Such discontinuities are expected because there
is no physical thickness in the geometry of the Suppose we want to plot the fluid flow velocity,
conductive wall bridging the temperature difference which will be different on each side of a wall.
from one side to the other, and therefore no visible The expressions up(spf.U) and down(spf.U)
gradient when plotting on the boundaries. will plot on the upside and the downside of a
wall, respectively. Plots of up(spf.U) (top) and
To see similar discontinuities occurring on adjacent down(spf.U) (bottom) are shown below:
domains, we can create a 3D line plot showing the
temperature along the edges of the geometry:

At the intersection of certain edges, it is clear


that different temperatures are being plotted. If
we zoom in at certain locations, it is easy to see
the distinct change from edge to edge:

36 COMSOL HANDBOOK SERIES


THE SIDE OPER ATOR

The up and down operators are available on The interior baffles, on the other hand, face
geometric entities of dimension one lower domain 2 on both sides:
ENTITY INDICES
than the model itself. For instance, in a
three-dimensional model, up(expression) and COMSOL can also plot
down(expression) can only be plotted on two- entity indices such as
dimensional entities—boundaries. domains. In the figure below,
the expression dom has been
This means, for instance, that COMSOL will plot plotted on a 3D volume,
up(spf.U) on a surface plot, but will return an showing the two different
error if the expression is attempted on a domain domains in red and blue.
plot such as a 3D slice plot, which has the same
dimension as the model.

THE SIDE OPERATOR


Another expression that may be used in a
similar fashion to the up and down evaluations
is the side operator. The side operator is more
flexible and precise, and can be applied to
entities many dimensions lower than the model.
For example, you can extract values from two
adjacent domains for a point that lies at the
intersection of four domains. This is helpful, Something interesting happens if the selection in the
for instance, if you want to integrate surface data set includes a combination of boundaries that
currents on a boundary in 3D. are adjacent to different domains. If we try to plot
the fluid velocity on every baffle using side(2, spf.U)
Variations on side(m, expression) will render on a selection that contains all six baffles, we’ll see all
results from an entity of dimension n adjacent of the baffles as expected.
to domain m, plotting on an entity of dimension
n-1. Hence, at times using the side operator Below are the results for the velocity on the air
effectively may require knowing the entity labels momentum boundary layer:
of the domains. For instance, in the case where a
boundary is adjacent to domain 2 but not domain
1, the quantity side(2,expression) will plot results
in domain 2 near the selected boundary, while
side(1,expression) will return an error.

For example, creating a surface plot to render


side(1,T) on a boundary will plot the temperature
from the side of the boundary adjacent to domain
1. If the boundary is not adjacent to domain 1, However, if we try to plot side(1, spf.U), we will see
side(1,T) will return an error. only the baffles that are actually adjacent to domain
1. Below is a plot showing velocity for the water
For a surface adjacent to the domain on both momentum boundary layer using side(1, spf.U):
sides, plots operate the same way; however, the
operation will then compute the average results
from the two physical sides—the upside and
downside.

We can demonstrate this using plots of the end


baffles in the shell and tube heat exchanger. The
end baffles touch both domain 1 and domain 2.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 37


COMPARING DOMAIN AND BOUNDARY PLOTS

Since the interior baffles are adjacent only But we have to be careful here. The plot showing
to domain 2, they disappear in this plot. The the temperature from domain 1 appears to
outer baffles are the only ones adjacent to both be monochromatic—this is not an error, but
domain 1 and domain 2, and so they are the occurs because the color is saturated with
only ones with data available for domain 1. values very close together, while the other plots
contain values that are much farther apart. If we
You may notice a similar effect if you plot variations disable the other plots to view the left plot alone
on side(m,expression) on 3D line plots containing (showing results from domain 1), we can see
only certain selections of the geometry’s edges— clearly that there is a gradient:
depending on which results you plot on which
edges, certain lines may disappear, or you may see
an error message when you try to plot on edges that
do not have data for that domain.

We might also expect to see differences between


the temperature results on two sides of a boundary,
depending on what’s happening on each side. For
a very conductive layer—as in the case of these
walls—the gradient would be almost nonexistent
since the layer is thin and the heat can diffuse
quickly. For a layer made of a resistive material,
however, there will be a noticeable difference in the
temperatures from one side to the other.

These boundary conditions are chosen in the


Settings window for the Thin Layer node:
COMPARING DOMAIN AND
BOUNDARY PLOTS
The side, up, and down operators are all
powerful expressions that, when used correctly,
can reveal important physical behavior in a
system. We’ve discussed the differences between
these two methods; now we’ll briefly compare
EXAMPLE: BAFFLE PLOTS
them side by side.
The image below depicts the temperature on
one of the end baffles—boundary 334, if you’re
Let’s return to the surface plot of a single baffle
following along in the model—using surface plots
where T is plotted to show the temperature
showing the temperature of the side adjacent
average of both sides.
to domain 1 (left); the average, plotted using
the expression T (center); and the temperature
Suppose we add a yz-slice plot—note that a
of the side adjacent to domain 2 (right). Style
slice plot is a 3D domain plot—located at the
inheritance ensures that continuity in the color
x-coordinate of the baffle, x=0.5.
range is forced across all of the plots. (Note that
the wall temperature, ht.Twall is not plotted here.)

38 COMSOL HANDBOOK SERIES


COMPARING DOMAIN AND BOUNDARY PLOTS

As we discussed before, the software still has you’re following along, change the x-coordinates
to choose one domain to plot in. Using style of its plane to be slightly farther than x=0.5.
inheritance will once again force a common color
range between the plots, so that we can see if the
slice plot looks different than the surface plot:

Then change the surface plot to show results


evaluated for side(1,T) on the boundary instead,
It does; the domain plot is displaying results and you’ll see two new similar plots:
from one side, while the surface plot is showing
an average.

We cannot use up and down on the slice plot


since it’s a domain plot; however, if we change
the expression in the surface plot from T to
side(2,T), we’ll see results very similar to those
shown in the slice plot, but without the tube
cross-sections:

The slice plot once again matches the data from the
surface plot, but we’re now examining the other
side of the wall.

This tells us that the slice plot is showing results


from the side of the baffle touching domain 2. REFERENCE
Since the domain includes not only the baffle
but also the tubes, we can see the temperature in The slice plot (right) has been translated using a rigid deformation so that we
the tube cross-sections where they intersect the can see both plots at once. For information on using deformations, turn to
baffle (shown as the saturated red areas that are the Deformations, Height Expressions, and Scaling section. For information on
much hotter than the baffle itself). creating a slice plot, see the Plot Types chapter in Essentials of Postprocessing
and Visualization in COMSOL Multiphysics.
What if we now shift the slice plot just slightly
so that it plots the other side of the domain? If

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 39


SUMMARY

SUMMARY
We have now discussed several different uses of Also recall that unexpected discontinuities may
thin-layer modeling and distinguished between appear in a plot for several reasons when using
operators that can be used when postprocessing lower-dimension postprocessing:
results on a single side. To recap:
• The average of the temperatures from
• The up and down operators can be each side of a boundary may not
applied to show results on one side of a smoothly transition from one boundary
geometric entity, provided that the entity to the next; therefore adjacent boundaries
is of dimension one lower than the model may appear to have discontinuities
itself and has an upside/downside. between them.
• The side operator can be applied to • Since domain plots “choose” results from
entities of many dimensions lower than one side or the other to display, adjacent
that of the model. This expression plots domains may also appear to have
on entities of dimension n using results discontinuities when transitioning from
from the specified adjacent entity of one to the next if they are not showing
dimension n+1. results from the same side.
• When viewing results with a combination
of domain plots and surface plots, there
may be apparent differences between
them—since the default surface plot
shows an average, it is unlikely to have the
same values as the results shown on the
domain plot.

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

40 COMSOL HANDBOOK SERIES


CONCLUDING REMARKS

CONCLUDING REMARKS
This concludes our guide to the advanced
postprocessing tools in COMSOL. This was by no
means an exhaustive walk-through, nor did we
name every operation or type of plot available.
However, we hope that this guide was a good read
for you and will enable you to better comprehend,
refine, and share your results.
HELMHOLTZ COIL
Being able to easily verify, interpret, validate, Simulation results show
and implement design changes from your the uniform magnetic field
model makes the engineering process more between an identical pair of
straightforward and also more enjoyable. circular coils where current
Ultimately these tools are meant to aid you flows in the same direction
in making design decisions, showcasing your in each coil.
findings, and addressing changes to your product.
As you delve further into the flexible and powerful
postprocessing tools of COMSOL Multiphysics,
we hope you will find that your device designs,
your research, and your ability to meet customers’
needs reach new horizons.

SPECIALIZED TECHNIQUES FOR POSTPROCESSING AND VISUALIZATION IN COMSOL MULTIPHYSICS 41


POWER SUPPLY COOLING
Simulation of the thermal
behavior of an enclosed
computer power supply
unit. An extracting fan and a
perforated grille induce an air
flow in the enclosure to abate
internal heating.

You might also like