Chapter 1
Chapter 1
This chapter explains a range of methods and topics used when building models
in COMSOL Multiphysics®: From working with the Model Builder and
fundamental concepts for building a model to the use of units. For examples of how
to build a complete model and application step by step, see the application libraries
for COMSOL Multiphysics and the add-on modules.
In this chapter:
157
• Numerical Stabilization
• Using Units
The physics feature nodes that are added to physics interfaces are flexible and several sections describe the ways to
identify changes, status updates, and other ways to work with these nodes: The Physics Nodes, Physics Interface
Default Nodes, Physics Feature Nodes by Space Dimension, Physics Interface Node Context Menu Layout, Physics
Exclusive and Contributing Node Types, Physics Node Status, Dynamic Nodes in the Model Builder, and Errors
and Warnings.
A node has its own properties and Settings window that are characteristic to it. Branches and subbranches can also
contain properties and settings. See Branches and Subbranches in the Tree Structure and Settings and Properties
Windows for Feature Nodes for examples.
The Model Builder has many types of nodes to help you create models and visualize the model structure — for
example, the Component node is categorized by space dimension, and nodes are dynamic, which helps you identify
nodes that change status. See Component Nodes by Space Dimension, Physics Interface Default Nodes, and
Dynamic Nodes in the Model Builder for more information.
Also learn about the context menu available when you right-click a node in the Model Builder (Opening Context
Menus and Adding Nodes). In the next section (Working with Nodes in the Model Builder), there is also
information about Going to the Source Node, Copying, Pasting, and Duplicating Nodes, Undoing and Redoing
Operations, Clearing Sequences and Deleting Sequences or Nodes, and Disabling or Enabling Nodes.
Click the cross to the right in the text field or press Escape to clear the filtering, returning the model tree to its
normal state. To the right of the text field there is a Refresh button ( ), which refreshes the filtering by hiding
any nodes that no longer match the filter.
When the focus is in the Model Builder window or the Settings window, press Ctrl+L to move the focus to the text
field for the filter text.
Use the options on the Filter Options menu ( ) to the right in the Model Builder window toolbar to control these
parts of the model tree filtering:
• Select Show Children ( ) to also display the subnodes to the nodes that match the filter.
• Select Contains Word ( ) to change the filter to only match exact words.
• The Show Filter Text Field ( ) option is selected by default. Clear it to hide the text field for the filter text.
For most sequences, you run the sequence by right-clicking the top node of the branch and selecting
Build All (geometry) and Build (mesh), Compute (studies), or Plot (plot groups), or by
pressing F8. These buttons are also in the Settings window and in the respective toolbars.
Some nodes under a physics interface branch can override other nodes higher up in the sequence. How the
COMSOL Multiphysics software treats those nodes depends on whether they are contributing or exclusive nodes
(see Physics Exclusive and Contributing Node Types).
The sequence of operations means that the order of the nodes in the tree is important. In the following branches
of the model tree, the node order makes a difference, and you can move nodes up and down to change the sequence
of operations for these nodes: Geometry, Material, physics interfaces and features, Mesh, and Solver.
Also, the order can have some importance in the plot groups in the Results branch and also for the Perfectly
Matched Layer and Infinite Element Domain nodes in the Definitions branch (those nodes are available with some
of the add-on modules).
To Add Physics and Add Mesh to the Component, from the Home toolbar, or for any operating system,
right-click the Component node. See The Add Physics Window, and Meshing Overview for more
information.
3D
2D axisymmetric
2D
1D axisymmetric
1D
• Right-click the root node (the topmost node) in the Model Builder and select Add Component (see The Root
Settings Windows).
• In The Model Wizard on the Select Space Dimension page, select 3D, 2D axisymmetric, 2D, 1D axisymmetric, or 1D.
Continue defining the model as in Creating a New Model.
It is also possible to insert components from another COMSOL Multiphysics model. To do so, right-click the top
node (root node) and choose Insert Components ( ) or Insert Components From ( ).
• In the first case, an Insert Components dialog box appears where you can browse or type the path and name of
the COMSOL Multiphysics model file from which you want to insert model components in the Model field.
Select one or more of the components in the model from the Components list and then click OK to insert them
into the current model.
• In the last case, a fullscreen Select Model window opens, where you can insert model components from an existing
database, add a new database, or browse for a model to insert components from. See also The Select Model
Window.
• Existing components in the open model may conflict with the inserted ones. In such cases, the inserted
component will be renamed (for example, from comp1 to comp2). Because inserting a component also inserts
many other nodes (geometry, physics, materials, coordinate systems, and so on), these will also be renamed if
there are existing ones in the open model.
• Most of the nodes under a component only requires that the other nodes under the same component is inserted
with them. However, there are some situations when items outside the component must be included. Especially,
the geometry sequence depends on such items. When inserting or pasting a component, the process
automatically includes necessary global parameters, global functions, and geometry parts. It will not include
references to items in other components.
• File references are inserted as is, and no attempt is made to check if the file exists. When inserting or pasting a
component, the process does not include stored files but rely on the original file path to be valid.
• Global parameters, global variables, and global functions in variable expressions (either in other variables or in
physics settings) will not be inserted or pasted automatically.
• Deformed geometries and their associated meshes are not included in the insertion or paste operation. These
geometries and meshes are typically the result of computing a solution and contain binary data that is not
included in the insertion either. They should appear again after re-solving, which you need to do after the
insertion anyway.
Altogether, these aspects may cause an insert or paste operation to be incomplete to some degree. In some cases,
the difference is reported in a message dialog box after the insertion process has finished. Click Cancel in this dialog
box to revert the insertion process.
Figure 3-1: An example of the Model Builder default nodes for the Electric Currents, Heat Transfer in Solids, and
Electromagnetic Heating interfaces.
• Definitions: Contains user-defined variables, selections, views, pairs, functions, probes, nonlocal couplings, and
coordinate systems, which are defined locally for the model. See Global Definitions, Geometry, Mesh, and
Materials for information about using these local Definitions ( ) and Global Definitions ( ). Use Global
Definitions to define Parameters, Variables, Functions, and loads and constraint groups with a global scope — that
is, groups that are not specific to one Component node.
• Geometry ( ): Contains the sequence of geometric objects and operations (or imported CAD data) that defines
the model geometry.
• Materials ( ): Contains the materials and material properties used as sources for material data in the
component. See Materials for detailed information.
• Physics interfaces ( ): Any added physics interface displays as a node under Component (Solid Mechanics in
Figure 3-1 for example).
• Multiphysics ( ): When a multiphysics interface is added to the Model Builder, this node contains all the
relevant multiphysics coupling features for that interface. See Multiphysics Modeling Workflow for more
information.
• Meshes ( ): Contains the sequences of meshing operations that defines the computational meshes for the
model. When there is only one mesh in the model, its Mesh node appears directly under the Component node.
The Settings window has the following sections (also see Figure 3-3):
The label appears on the node as the default node name. The default label is Component 1, but you can change it
in the Label field.
UNIT SYSTEM
The default setting in the Unit system list — Same as global system (SI) if the global unit system is the SI unit system
— is to use the global unit system, which you specify in the root node’s Settings window. The global unit system
appears in parentheses. If you want to use another unit system in a component, select it from this list. The unit
system in the list that is used as the global unit system appears as, for example, SI (global system); that is, the
information that it is the global system is appended to the unit system’s name.
FRAMES
In this section, you can define the coordinates for the frames in a model component if you do not want to keep the
default names. All frames are always defined. See About Frames for more information about frames.
You cannot use the variable for the time, t, as a frame coordinate name.
If you have opened a model originally created in version 5.2 or earlier, click the Permanently Define All
Frames button to, for example, enable the possibility to use a deformed geometry manually.
By default, the software avoids inverted elements by an optimization of the element shapes. To deactivate that
functionality, clear the Avoid inverted elements by curving interior domain elements check box. See Avoiding Inverted
Mesh Elements for more information.
GEOMETRIC MODEL
This section is only available if there is at least one meshing sequence which defines its own geometric model. A
meshing sequence that defines its own geometric model typically includes one or several mesh Import nodes (see
Importing Meshes).
Use the setting Physics defined on to specify on which geometric model the physics is defined. It can be either the
geometry sequence or a meshing sequence which defines its own geometric model. Meshes conforming with the
geometry will not be available in the list. The geometry or meshing sequence selected here will be indicated with
a green or yellow frame around its icon ( or ).
The added node then contains these default nodes: Definitions, Geometry, and Mesh. The settings for the Extra
Dimension node are the same as for the Component node, except it has a unique Name.
The default nodes associated to the Extra Dimension are considered the extra dimension geometry and
extra dimension mesh. The original geometry and mesh are called the base geometry and base mesh.
Before you can use the extra dimensions in physics interfaces, they must be attached on a selection in
the base geometry.
Main Branches
1 Global Define global parameters, and right-click to define global Variables, Functions,
Definitions Load and Constraint Groups, a Materials branch, and optional Geometry Parts.
Mesh Parts, and Extra Dimension branches, which are globally available in all
model components. See The Global Definitions Node.
2 Various Component This branch includes the subbranches Definitions, Geometry, Materials, physics
interfaces, and Mesh. You can also right-click the node to Add Physics and Add
Mesh at this level. See The Component Node.
3 Study This subbranch is where you set up study steps and solver configurations to
solve a model using one or more study types for different analyses. See Studies
and Solvers.
4 Results The features contained in the subbranches for Datasets, Derived Values, Tables,
Export, and Reports are used to present and analyze results. See Results
Analysis and Plots.
Subbranches
8a Multiphysics This is a main branch but is associated directly with the physics interface
branches above it. It contains multiphysics coupling nodes. See The
Multiphysics Branch.
9 Mesh This subbranch collects all meshes defined for a model. If there is only a single
mesh in a model, its Mesh node appears directly under the corresponding
Component node. See Meshing.
10 Datasets Datasets refer to the source of data for creating Plots and Reports. It can be a
Solution, a Mesh, or some transformation or cut plane applied to other
datasets; that is, you can create new datasets from other datasets.
Views If enabled in the Show More Options dialog box, you can add extra views for
postprocessing purposes here. See User-Defined Views.
Derived Used to define evaluations of numerical results — globally, in a point, or
Values integrated quantities. For 2D and 3D plots, you can also get numerical results
directly in a table by clicking the plot. See About Derived Values.
Tables This subbranch displays the results from integral and variable evaluations
defined in Derived Values nodes or by probes and stored in Table nodes. See
The Table Window and Tables Node.
Color Tables Used to define new color tables for use in the model. See Custom Color
Tables.
Various Plot Groups After adding a 3D, 2D, or 1D Plot Group, plots are added and defined under
this subbranch. See Plot Groups and Plots.
Evaluation After adding an Evaluation Group, you can add evaluation features under this
Group subbranch. See About Evaluation Groups.
Export After a model is completed, you can add various components to this and then
generate outputs (animations, data, images, or export), or export the
information to your computer as image, movie, or data files for use in external
documents or for other purposes. See Export Types.
Reports This subbranch opens the Report Generator, which is a tool for reporting and
documenting models created in COMSOL. It creates a record of the entire
model including all the settings made during the modeling process. The report is
an overview of the model and includes model properties, geometry, physics
interfaces and features, mesh, studies, and results and visualization. See Reports
and Presentations.
7
2
5
7a
8a
9
3
4
10
Figure 3-2: An example of the Model Builder tree structure showing the many different types of branches and
subbranches available in a model. Refer to Table 3-2 to learn more about a node. Use the numbers to locate the node in
the table.
SETTINGS WINDOW
For all operating systems, and when any node is clicked in the Model Builder (except a few container nodes such
as Definitions and Datasets), a corresponding Settings window opens with the same name as the node. The Settings
window contains settings for defining operations and properties specific to a node, as shown in Figure 3-3.
Figure 3-3: An example of a node Settings window. In this example, the Settings window for the Component node opens
when the node of the same name is clicked. You can also toggle between the Settings and Properties window from the
context menu.
For most sequences, you can run the sequence by right-clicking the top node of the branch and
selecting Build All (geometry) and Build (mesh), Compute (studies), or Plot (plot
groups), or by pressing F8. These buttons are also in the Settings window and in the respective toolbars.
To select the parts of the model to define in a specific Settings window, select the relevant geometric entities directly
in the displayed model in the Graphics window, from the Selection List window, or as, for example, All domains in
the Settings window.
Some Settings windows have the option to change the Name. These include physics interfaces, components (as in
Figure 3-3), multiphysics couplings, and some Definitions features, where that field in some cases is called Function
name (for functions), Variable name (for probes), Operator name (for nonlocal couplings), or Pair name (for pairs).
The Name is used primarily as a scope prefix for variables defined by the physics interface. Refer to such physics
interface variables in expressions using the pattern <name>.<variable_name>. In order to distinguish between
variables belonging to different physics interfaces, the name string must be unique. Only letters, numbers, and
underscores (_) are permitted in the Name field. The first character must begin with a lowercase or uppercase letter
(a–z or A–Z). All other characters in the Name must be a lowercase or uppercase letter, a number between 0 and
9, or an underscore (_). See Variable Naming Convention and Namespace for more information.
You can choose to display any combination of the Name, Tag, and Type in the Model Builder. See
Displaying Node Names, Tags, and Types in the Model Builder.
In most Settings windows, there is also a Create Shortcut button ( ) next to the Label field. Click it (or press
Ctrl+K) to create a shortcut to that node for use in the Application Builder (see the Application Builder
documentation for more information). If a shortcut already exists, you can click the Rename Shortcut button ( )
(or press Ctrl+K) to rename the shortcut.
Figure 3-4: An example of a node Properties window. In this example, the Properties window for the Component node
opens when you right-click the node and select Properties from the context menu. You can also toggle between the Settings
and Properties window from this context menu.
• The Label can be edited in the Settings window. The default or edited name is displayed here but cannot be
changed in this window.
• The Name is available for Component, functions, and other nodes under Definitions, Material, and physics
interface and multiphysics coupling nodes. You can edit the name in the Settings window for Component nodes,
the main physics interface nodes, and for some functions and other nodes under Definitions, where the name
serves as an identifier in the namespace for variables or as the function name, for example.
• The Tag is unique for each node and is assigned automatically. Tags are primarily used when running COMSOL
models in Java or MATLAB. To display the Tag in the Model Builder, click Model Builder Node Text in the
toolbar and choose Tag. See Displaying Node Names, Tags, and Types in the Model Builder for more
information.
• The Node Properties section includes the following information: Created, Author, Version, and Comments (the root
node is a special case; see The Root Settings Windows). The Created field is automatically assigned by the
software. You can edit the Author, Version, and Comments fields in this window. For the Comments field, you can
add formatting and special characters, including bullet lists and numbered lists at multiple levels, that will appear
in reports and presentations for report nodes whose Comments setting is From referenced node; see Node
Properties for Reports and Presentations.
• A Name is only used in the Model Builder for short names (descriptions) of the nodes. The Name can only be
changed for the top Component, physics interface nodes and multiphysics couplings, and for Definitions nodes.
Some Settings windows have the option to change the Name. See Settings and Properties Windows for Feature
Nodes for information about Label versus Name. The Name and Tag for top level features are often the same.
For Definitions features, the Name is displayed differently for Functions, Probes, Nonlocal Couplings,
and Pairs. See Common Settings for the Definitions Nodes for more information.
• A Tag is unique for each node and is assigned automatically. Tags are primarily used when running COMSOL
models in Java or MATLAB. Select Tag to display each node’s feature name with the predefined tag in curly
braces using an italic font. The Name and Tag can be the same.
• A Type is automatically assigned by the software and cannot be changed. Select Type to display each node’s feature
type (predefined name). This is the most useful if a node Label is renamed or if you use a local language other
than English and want to see the predefined name; otherwise, the type and the label are the same (except that
the label typically includes a number, such as Boundary System 1).
Type
Figure 3-5: Examples of the available combinations on the Model Builder Node Label menu. The second example of a
Type shows how this is useful when the Label is edited in the Settings window and you need to know the original type of
node.
LABELS
Node Settings windows have a Label field where you can change the default node description for all levels (except
the root node, which gets its name from the model filename). The label can also be changed by right-clicking and
choosing Rename or by pressing F2.
The Label can also be displayed in the Model Builder where it is called a Tag. See Settings and Properties
Windows for Feature Nodes.
The context menu is also further divided and categorized for physics interfaces, as in the section Physics Interface
Node Context Menu Layout and Figure 3-7.
To add physics feature nodes to physics interfaces, in general, go to the Physics toolbar, no matter what
operating system you are using. Subnodes are available by clicking the parent node and selecting it
from the galleries that open.
The layout of the context menu (especially for physics interfaces) depends on whether the nodes are
grouped by space dimension. The default is ungrouped nodes. See Grouping Nodes by Space
Dimension and Type for an example comparing the different context menus.
After selecting an option from the list, an associated Settings window opens to the right (by default) of the Model
Builder window. See Figure 3-3 for an example.
Submenus to
additional options
Figure 3-6: A context menu opens when you right-click any node in the Model Builder. In this example, the options
available for the Geometry node are shown.
In addition, you can specify weak form contributions and element types for additional flexibility.
Specifically, the settings are available on the following parts of the geometry:
• Domains
• Boundaries
• Edges
• Points
• Additional properties that are independent of the geometry
Not all of these options are available for all geometry types and physics interfaces.
See Physics Exclusive and Contributing Node Types and Physics Node Status for examples of other
differences to how the nodes display in the Model Builder.
Domain level
Boundary level
Point level —
Edge level — —
• A model equation or material model node, typically on the domain level. This node defines the domain equations
(except optional sources, loads, reactions, and similar contributing domain quantities) and the related material
properties or coefficients.
• A boundary condition node. For multiphysics interfaces there is one boundary condition for each participating
physics.
• For axisymmetric models, the symmetry axis has an Axial Symmetry boundary condition (see Physics Interface
Axial Symmetry Node).
• An Initial Values node for specifying initial values for a time-dependent simulation or an initial guess for the
solution to a nonlinear model (see Specifying Initial Values).
In most cases, the default nodes’ initial selections include all domains or all boundaries (or all instances of another
geometric entity level). Their selection is always every instance that is not overridden by another node on the same
geometric entity level. It is not possible to delete such default nodes, but you can copy and duplicate all default
nodes. Some multiphysics interfaces also add default nodes with no initial selection, which are possible to delete
from the model. Default nodes include a D (for “default”) in the upper-left corner ( ) to indicate their special
status. The copy or duplicate of a default node is a node of the same type but behaves as a normal node with an
initially empty selection.
For example, for a geometry with four boundaries, the default boundary condition’s initial selection includes all
four boundaries. If another exclusive boundary condition for Boundary 3 is added, that boundary becomes
overridden (inactive) in the default boundary condition’s selection. If you disable or remove that boundary
condition, the default boundary condition becomes active for Boundary 3 again. You cannot change a default
node’s selection.
Some physics interfaces also add standard nodes directly when you add them to a model. They
represent functionality that is likely to be useful but that you might want to make only active on a part
of the geometry or delete. Such nodes do not include a D in the upper-left corner.
There can be menu items with the same name but applied at different geometric entity levels.
To add physics feature nodes to physics interfaces, in general, go to the Physics toolbar, no matter what
operating system you are using. Subnodes are available by clicking the parent node and selecting it from
the gallery that opens.
Figure 3-7: An example of a Heat Transfer in Solids interface context menu. The choices are based on the Component
dimension (in this example it is 3D) as well as the physics interface. The menu is further divided by geometric entity level
(domains, boundaries, edges, and points).
As shown in Figure 3-7, the context menu layout is also based on whether the nodes are not grouped (the default)
or if Group by Space Dimension is selected.
The exclusive and contributing nodes maintain the described behavior only in relation to similar types
of nodes within the same physics interface (for example, you can have a temperature constraint and a
pressure constraint for the same boundary in the same model component).
What the node looks like in the Model Builder is based on the space dimension. See Physics Feature
Nodes by Space Dimension.
EXCLUSIVE NODES
The use of an exclusive node means that only one can be active for a given selection. That is, if you add another
exclusive node (for example, an identical node) with the same selection, the first exclusive node is overridden and
thus has no effect.
Typical exclusive nodes include model equations, initial values, and boundary conditions that are constraints, such
as prescribed values for displacements, temperatures, pressures, and so on, or other Dirichlet-type conditions,
including special variants of these such as ground conditions in electromagnetics and fixed constraints in structural
mechanics. Also some boundary conditions that are not constraints but have a definitive meaning are exclusive
nodes — for example, electric insulation, thermal insulation, and no-flow conditions. Depending on the selections
for each node, an exclusive node can override another node partially. Nodes are exclusive only within their specific
physics interface. When a node is selected in the Model Builder tree, nodes that are overridden by the selected node
have a red arrow in the lower-left corner of the icon ( ), and nodes that override the selected node display a red
arrow in the upper-left corner of the icon ( ).
CONTRIBUTING NODES
A contributing node means you can have more than one of these nodes with the same selection and that the
software adds these together when evaluating the model. Typical contributing nodes are loads, fluxes, and source
terms, where you can have more than one of each type that is active on the same domain or boundary, for example.
The total effect is then a sum of each contributing node. When a node is selected in the Model Builder tree, the
tree shows other nodes, which the current node contributes with, indicated using a yellow dot to the left of the
icon (for example, in this boundary level icon ). See also Figure 3-8 for an example.
• The Overridden by list contains the names of the nodes that the selected node is overridden by. The selected node
is then overridden by these nodes at least partially, and the Selection list contains (overridden) for the geometric
entities (boundaries, for example) where it is overridden. The nodes that the selected node is overridden by are
indicated using a red arrow in the lower-left corner of the icon such as in this boundary level icon .
• The Overrides list contains the names of the nodes that the selected node overrides (where the current node is
active). The nodes that the selected node overrides are indicated using a red arrow in the upper-left corner of the
icon such as in this boundary level icon .
• The Contributes with list contains the names of the nodes that the selected node contributes with for at least some
shared selection. The nodes that the selected node contributes with are indicated using a yellow dot to the left
of the icon such as in this boundary level icon .
If a physics node is disabled locally in a study step using the Physics and Variables Selection section in
the study step’s Settings window, the indications of overrides and contributions in the Model Builder
are unchanged (but disabled physics nodes get an asterisk to indicate that their state has been changed
in at least one study step). However, the local variables and physics tree in the study step’s Settings
window displays the overrides and contributions taking the disabled nodes into account.
OVERRIDDEN SELECTIONS
A node can be partially or completely overridden by another node further down in the same branch of the model
tree that is of a similar, exclusive type. For example, if you specify a temperature boundary condition on boundary
1 and boundary 3, and then add another temperature boundary condition for boundary 3, the first temperature
boundary condition is overridden on boundary 3. In the Settings window for the Temperature nodes that define the
temperature boundary condition, the Selection list then shows 3 (overridden) to indicate that the temperature
boundary condition defined on this selection is overridden for boundary 3 but is still active on boundary 1.
Deleting or disabling the other temperature boundary condition on boundary 3 reactivates the original
temperature boundary condition, and then shows 3 (without the (overridden) indication).
EMPTY SELECTIONS
For physics nodes that you add to a model (that is, not for default nodes), a warning appears on the physics node
when the node has no selection. An added source or boundary condition, for example, has no effect on the model,
so leaving an added physics node with an empty selection might be an unintended state, leading to unexpected
simulation results.
Figure 3-9: The warning and tooltip for an added physics node with an empty selection.
The warning for an empty selection does not appear in the following cases:
ICON TYPE NODE EXAMPLE AND LINK TO MORE INFORMATION (WHERE APPLICABLE)
Error For example, on a Material node . See Errors Relating to the Material Nodes.
Current node, not For example, on a Geometry node ( ). This node is also displaying the asterisk
built (yellow frame) indicating the node is being edited. The asterisk also appears on plot nodes when
the plot has not been updated to reflect changes in the data or settings (for
example, after re-solving), See The Current Node in Geometry Sequences.
Current node (green A current node is used for Geometry and Meshing nodes and indicates that the
frame) feature or sequence of steps has been built. It is a green line on the left and upper
edges of the node. For example, on a Geometry node , after building. Also see
The Current Node in Geometry Sequences.
Enabled sequence During solution processing, the particular sequence that is enabled and runs when
selecting Compute has a green border around its icon ( ). See Computing a
Solution.
Harmonic For example, on a boundary level node for the Electric Currents interface, Electric
Perturbation Ground node . See Harmonic Perturbation, Prestressed Analysis, and
Small-Signal Analysis.
Warning For example, on a Mesh node .
Editing, or in process For example, on a Mesh node . This node is also displaying the asterisk
of editing, a node indicating the node is being Edited. Also indicates physics interface nodes that have
been disabled in a study step. See Editing and Building Geometry Nodes for
Geometry nodes for example.
Pairs For example, on a 3D Boundary Level node . See Identity and Contact Pairs.
Pairs — Fallback For example, on a 3D Boundary Level pair node . See Identity and Contact
Features Pairs.
Contributing node For example, on a 3D boundary level node . See Physics Exclusive and
Contributing Node Types and Physics Node Status.
Default node For example, on a 2D boundary level node . See Physics Interface Default
Nodes.
Override For example, on a 3D boundary level node . See Physics Exclusive and
Contributing Node Types.
Overridden For example, on a 3D boundary level node . See Physics Exclusive and
Contributing Node Types
STUDY STEPS ANALYSIS
Solve For For example, a Laminar Flow interface where the green dot in the lower-right
corner indicates that the study solves for the degrees of freedom in this physics
interface. See Physics and Variables Selection.
Disable in Solvers For example, a Laminar Flow interface is enabled (not dimmed), shows that the
study step provides degrees of freedom (the yellow dot in the lower-right corner),
and has a change of state indicated by the asterisk. The yellow dot means that the
study step provides degrees of freedom but does not solve for the physics
interface. See Physics and Variables Selection.
Change of State An asterisk appears in the upper-right corner of nodes for which you change their
(editing) state in the study step’s selection tree compared to their state in the main model
tree in the Model Builder. For example, for the Joule Heating interface .
ICON TYPE NODE EXAMPLE AND LINK TO MORE INFORMATION (WHERE APPLICABLE)
Load Group This is an example of a Boundary Load node with a load group . This is for a 2D
model at the boundary level. See Load Group and Using Load Cases.
Constraint Group This is an example of a Fixed Constraint node with a constraint group . This is
for a 2D model at the boundary level. See Constraint Group and Using Load
Cases.
Physics Symbols
There are physics symbols available with structural mechanics and some other physics features in 2D, 2D
axisymmetric, and 3D components to help you to graphically indicate boundary conditions, loads, and other
physics features:
Once you have turned on the physics symbols for a certain physics interface, you can fine-tune the display. Every
feature that has associated physics symbols now has a Show physics symbols check box, by which you can control the
display of the symbols for that specific feature.
In the Physics Symbols section in the settings for the physics interface, you can click the Select All button, which
displays all symbols in that physics interface by selecting all Show physics symbols check boxes in the Settings
windows for the physics features that include symbols. Similarly, the Clear All button clears all Show physics symbols
check boxes in the individual physics features.
The following symbols are available with the applicable structural mechanics feature nodes and with some other
physics interfaces (this table is a partial list of available symbols).
TABLE 3-5: PHYSICS SYMBOLS.
Antisymmetry1 Antisymmetry
No Rotation1 No Rotation
Pinned1 Pinned
Point Force Point Load Can be displayed together with the Point Moment
symbol, depending on the values given in the node.
Point Mass1 Point Mass
Point Moment1 Point Load Can be displayed together with the Point Force
symbol, depending on the values given in the node.
Prescribed Prescribed Displacement
Displacement
Prescribed Velocity1 Prescribed Velocity
Roller Roller
1
Requires the Structural Mechanics Module
2 Requires the MEMS Module
In both cases, the coordinate directions describe the direction in which a positive value acts. The coordinate
direction symbols do not change with the values actually entered for the data.
In some cases, a single feature can display more than one symbol. An example is the Point Load node in the Beam
interface, which can display either the Point Force symbol ( ), the Point Moment symbol ( ), or both,
depending on the data entered. In those cases, no symbol is shown until nonzero data is entered.
For cases when physics symbol display is dependent on values given in the node, it can be necessary to
move to another node before the display is updated on the screen.
The physics symbols also display for any multiphysics interface that includes Structural Mechanics
feature nodes or other physics feature nodes with symbols.
Figure 3-10: Example of Boundary Load physics symbols as displayed in the COMSOL Multiphysics model
“Deformation of a Feeder Clamp”.
Figure 3-11: Example of Roller and Boundary Load physics symbols as displayed in the COMSOL Multiphysics model
“Tapered Cantilever”.
ERRORS
Errors prevent the program from completing a task. For errors, a COMSOL Error window appears with a brief error
description and, in some cases, an Open Log File button for additional information. Under the node where the error
occurred there is, in most cases, also an Error subnode ( ) that contains an error message that generally provides
LICENSE ERRORS
It is possible to open and postprocess models that include functionality that you have blocked or that your license
does not include. Nodes with functionality that requires a license for a product that is blocked or not available get
a License Error subnode ( ), where you find information about the missing but required product license. Unless
you disable or remove such nodes, it is not possible to re-solve such models.
Some specialized plot types require a license for an add-on product and are then also unavailable if you
postprocess models that include such plots and your license does not include the required product.
It is not possible to open models that require a license for the Material Library, ECAD Import Module,
CAD Import Module, LiveLink™ for MATLAB®, or any of the CAD LiveLink™ products if your license
does not include this required product.
WARNINGS
Warnings are problems that do not prevent the completion of a task but that might affect the accuracy or other
aspects of the model. Warnings typically appear in the Log window ( ). The warning message also appears as a
Warning subnode ( ) under the node from which the warning was sent.
Inconsistent Units
An inconsistent unit can occur by summing terms with units that represent different physical quantities, such as
273[K]+3[ft]. A tooltip displays a message at the corresponding field.
Unknown Unit
This message appears when a unit bracket contains invalid units.
SYNTAX ERRORS
A unit display or other expression that appears underlined with a red squiggly (wavy) line contains a syntax error,
which can be due to, for example, missing or misplaced parentheses or unknown or misspelled variable names,
function names, or units.
After a successful build of a node, a warning message can sometimes display as a Warning subnode ( ). If a
warning message exists, the node’s icon displays with an orange triangle in the lower-right corner.
The Error, Warning, and Information nodes and their subnodes often contain selections that highlight
where the problem is located in the geometry.
A Warnings node ( ) can also appear under a Compile Equations node if some input to the solvers uses inconsistent
units, for example.
• Plotting with the Dataset list set to None or a dataset that cannot be evaluated (for example, because the model
does not contain any solution).
• Plotting without having set any expressions.
If you still have problems, contact technical support from the Support Center page at
[Link]/support.
• Using Units
• Unit Systems
• Dynamic Nodes in the Model Builder
To run a method in the Model Builder, click Run Method ( ) in the Run Methods section and choose the method
to run. The Model Builder tree is updated according to the changes that the method includes. Click Stop ( ) to
stop a running method to debug it, for example. You can open the Debug Log window from the Windows menu to
view debug information. You can also add breakpoints for debugging purposes. You can also click Run Method Call
( ) to run a method call in a Method Call node (see Method Calls below). Method calls support input arguments
for the model methods, so that you, for example, can use two instances of the same model method with different
input values. Model methods with inputs are not available for Run Method. For methods without inputs, running a
method directly or through a method call is equivalent.
Make sure that the model tree is in a state that is compatible with the method that you run. Otherwise,
the method code may not work or may produce unexpected results. Also, there is no undo operation
after running a model method.
See the Introduction to Application Builder for an example of a model method and the Application
Builder Reference Manual for information about the Model Method node and about creating and
debugging methods in general.
At the top of the Settings window, click the Run button ( ) or press F8 to run the model method for this method
call. Click the Stop button ( ) to stop a running model method (this button is unavailable if a model method is
not running).
Click the Edit Method button ( ) to open the model method in a method editor window in the Application
Builder, where you can make changes and additions to the model method.
You can also right-click the Method Call node and choose Run (or press F8) or Edit Method .
The Method Call node’s Settings window includes the following section:
INPUTS
In this section, any inputs that you have defined for the model method appear, using the input’s description as the
label and a text field for entering a value for the input (the text field contains a default value if it has been defined
for that input). If the input is a Boolean, it appears as a check box instead. If the input is a 2D array, Array 1D
Boolean, or Array 1D String, it is shown as a table, where you can add values and add rows and columns as
applicable. Contrary to running model methods directly, method calls can use model methods with inputs defined
in the Settings window for model methods in the Application Builder. That way you can, for example, use multiple
instances of a model method with different input values.
You can also show such forms as modal dialog boxes by choosing them from the Show Dialog list ( in the Forms
section of the Developer toolbar.
Forms that include Graphics objects cannot be used as settings form or dialog boxes. Instead you can
plot in the main Graphics window or in other plots windows using the built-in selectNode method or
the window property for a plot group.
To make use of the latest definition of a form in the Application Builder when it is shown in the Model Builder,
click the Update Forms button ( ) in the Forms section of the Developer toolbar, which updates all settings forms’
features. You can also click the Update button ( ) in the Settings window for a Settings Form node to update that
particular settings form.
Click the Edit Form button ( ) in the Settings window for a Settings Form node to move to its form editor window
in the Application Builder.
See the Application Builder documentation for more information about creating forms and methods.
Creating Add-ins
Add-ins, or add-in programs, are extensions to the COMSOL Multiphysics software and make it possible to share
methods and settings forms between several models. An add-in consists of a regular COMSOL Multiphysics
MPH-file in which you have added forms and methods using the Application Builder to provide a settings window
with some functionality that can simplify or extend the built-in functionality in the COMSOL Multiphysics software
for some application that might be useful for a range of model files. You can collect add-ins into a user-defined
add-in library (see The Add-in Libraries Window below). There is also a default user-defined add-in library located
in C:\Users\Your_Name\.comsol\v62\addins to which valid add-ins will be copied automatically when added
in the Add-in Libraries window. Opening the add-ins that are included in the COMSOL Multiphysics as MPH-files
from the file system makes it possible to study the forms and methods in the Application Builder.
See the Application Builder documentation for more information about how to create an add-in in the Application
Builder and general information about forms and methods.
Using Add-ins
To use an add-in in the current model, choose it from the Add-ins list ( ) in the Developer ribbon toolbar. The
add-in will then be added to the current model under Global Definitions. To add an add-in to the Add-ins list, select
it in the Add-in Libraries window (see below). Once the add-in is available under Global Definitions, it works like any
other node with a Settings window. Depending on its contents, it will affect the model by some functionality
contained in the add-in.
Click the Refresh button ( ) to update the list of add-ins. You can also add separate user-defined add-in libraries
(see below).
It is not possible to add an add-in library identical to, containing, or being contained in, an already
used add-in library.
Optionally, you can replace the standard folder icon ( ) with custom icons of your choice that reflect the content
of your library folders. To use a custom icon for a folder, create a PNG-file with an image size of 16-by-16 pixels
and save it in the folder under the name [Link].
You can enable the Open PDF Document button for a user-library add-in by placing a PDF-file with
the same name (including case, up to the file extension) as the add-in MPH-file in the same folder.
In the Set COMSOL Add-in Libraries Root Directory dialog box, navigate to the new root folder location or click Make
New Folder. Click OK to save the changes and exit, or click Cancel to exit without saving.
• New Comparison ( ), to make a new comparison. A New Comparison dialog box opens, where the default is that
the Use open file check box is selected. Clear it to specify another Local file. Specify a Remote file and then click
OK to perform a new comparison.
• Update ( ), to update the comparison.
• Collapse ( ) and Expand ( ), where you can click to choose Collapse Selected or Expand Selected to collapse
or expand the selected tree branches (or use the divide and multiply keypad keys, respectively), Collapse Other to
collapse all tree branches except the selected ones, or Collapse All or Expand All to collapse or expand all branches
in the comparison tree.
• Show Table View ( ), to toggle between the view with the comparisons in a tree and a view with a list of the
differences.
• Load Comparison from File ( ), to load the results from another comparison from an XML-file.
• Save Comparison to File ( ), to save the results from the current comparison to an XML-file.
• Show Next Difference ( ), to move to the next difference in the tree with nodes that differ under Differences.
• Show Previous Difference ( ), to move to the previous difference in the tree with nodes that differ under
Differences.
Under Comparing files, you find the file paths to the local model and the remote model. The local model is typically
the model open in the COMSOL Desktop, and it can have been modified after the last save. The left column is
called Local file (Saved application) when the local model is the opened model or application. When the local model
is a new model that has not yet been saved, the left column is called Open application. The right column is called
Remote file. Both columns contain a path to the selected files, unless the Local file column contains the file that is
open in the COMSOL Desktop.
If you used the Compare with Saved button to compare the current model with the latest saved version of the same
model, this section is instead called Compare with saved, and the left column and right column are called Opened
and Saved, respectively
If you compare two versions of a model or application in a database, this section is instead called Compare versions,
and the left column and right column are called Older version and Newer version , respectively.
The icons to the left of the local and remote files or older and newer files indicate the type of file. For example,
for a COMSOL MPH-file and for a runnable COMSOL application. Also, for database files in the Model
Manager, information about the time and date when the file was saved and who saved it is displayed.
Under Differences, you can use the Filter results list to control filtering with the options No filter, Exclude all matching
labels (the default), and Include only matching labels. The entries in the Regular expression field define what node
labels to filter. You can make the filtering case sensitive by selecting the Case Sensitive button ( ) box next to the
list. The filter matching is done with regular expressions, and any label that contains a matching text will be either
The tree of nodes with differences has a structure according the structure of the underlying model object, not the
Model Builder or Application Builder trees. This means that the hierarchy can be somewhat different compared to
the hierarchy seen in the Model Builder and Application Builder windows. The comparison includes all nonbinary
differences in the model object that can be saved to disk, with some exceptions. For nodes that correspond to a
node in the Model Builder or Application Builder trees, double-click the node (or right-click and choose Go to
Source) in the tree of nodes with differences to display the corresponding node in one of those trees in the local file.
• The tree can show differences not visible in the Model Builder because they come from inactive settings hidden
by another setting.
• Some settings and nodes in the Model Builder are not saved in the model object and will therefore not show in
a comparison (Mesh Statistics, for example).
• No binary data are compared, so, for example, no differences in the solution will trigger a difference in the
comparison.
Selecting a node in the tree will update the table under Comparing values below the tree. This table shows the
attributes of the selected node, both in the local or older model (Local value or Value in older column) and the
remote or newer model (Remote value or Value in newer column). This table is particularly interesting for the nodes
labeled Properties differ, Variables differ, or Selections differ because they show the settings where there are
differences. Parent nodes can also show the same differences but typically with a larger number of attributes that
have the same local and remote or older and newer values. For differences that contain long entries or large arrays,
there is an option to show a more detailed difference in a separate window for a selected table. Either double-click
the table row or click the Detailed Comparison of Selected Attribute button ( ) below the table to open the Compare
Attribute window. When applicable, you can also right-click a node and choose Go to Remote Source, Go to Older
Version, or Go to Newer Version to display the corresponding node in one of those trees. For nodes where values
differ, right-click and choose Go to Node in Local File, Go to Node in Remote File, Override Difference in Local File, or
Override Difference in Remote File, where you can use the last two options to discard the local changes or to transfer
them to the remote file, respectively.
MERGING DIFFERENCES
There are two ways to merge differences in the Comparison Results window:
• For nodes that correspond to a node in the Model Builder tree, right-click the node and choose Override
Difference in Opened ( ) to overwrite that difference in the open model. After this operation, the open model
The terminology of the menu items differ between comparisons. If you compare two models, there
is a local file and a remote file, while when you compare a saved database version with the open
model there is an opened model and a saved model. The top table in the Comparison Result
window shows the terminology used for the current comparison.
Some differences can be impossible to transfer when the models differ significantly, so a setting is not applicable in
the target. For example, when a material link refers to a material that does not exist in the target. The merge is
typically most successful when there are isolated changes that do not depend on other parts of the model. If there
are large structural differences with a lot of removed and added nodes, the merge will have more difficulties to
achieve a good result. Sometimes it can be necessary to update the comparison result and do several merge
operations. Also, pay attention to cases when merging differences for nodes that are automatically generated, such
as the solver sequence. Many models have an automatically generated solver sequence that depends on settings in
the study steps and physics interfaces.
• Select one node at a time (or by Ctrl-clicking or Shift-clicking to select more than one node at a time), and use
the mouse to drop them in another applicable position in the model tree. A horizontal line indicates where in
the model tree the moved (or copied) nodes get inserted when releasing the mouse.
• Right-click the selected nodes and select Move Up ( ) or Move Down ( ). Nodes that are the first or last of
its kind can only be moved down or up, respectively.
• Use the keyboard shortcuts Ctrl+up arrow or Ctrl+down arrow to move nodes up or down.
• You can also create custom grouping of nodes to organize the nodes in the model tree. See Custom Grouping
of Nodes.
For physics interface nodes it is not possible to move the default nodes (for the default boundary
condition, for example). It is possible to create a copy of a default node, which initially has no selection.
To click-and-drag a default node creates a copy whether or not the Ctrl key is pressed.
The order of the nodes in some of the branches affects the evaluation of the sequence that they define. In the
following branches and subbranches it is possible to move nodes up and down to control the evaluation of the
sequence or the order in which they appear within the branch or subbranch (also see Table 3-2):
• Definitions: nodes can be moved relative to other nodes of the same type (functions, selections, and so on).
• Geometry: The Geometry Nodes.
• Materials: Material nodes.
• Mesh: Mesh nodes (see Meshing).
• Physics interfaces: except for the default nodes, the nodes for physics interfaces (such as material models,
boundary conditions, domains, edges, points, and sources) can be moved within the physics interface branches
(see The Physics Interfaces).
• Study: Study and study step nodes can be moved (see Study and Study Step Types).
• Results: the order of the nodes can be rearranged within each of the subbranches (Derived Values, Tables, Plot
Groups, Export, and Reports). Exceptions under the Export node are the Plot, Mesh, and Table nodes (see
Results Analysis and Plots).
Duplicate ( ) is a convenient way to copy and paste in one step. In other words, it combines the Copy
and Paste functions. When nodes are duplicated, the COMSOL Multiphysics software adds identical
nodes underneath the original nodes on the same branch. You can duplicate most but not all nodes.
• Functions, which are possible to copy from one Definitions or Global Definitions branch to another. Also see
Functions and Global Definitions, Geometry, Mesh, and Materials.
• Parameters, variables, variable utilities, and physics utilities. Also see Predefined and Built-In Variables, Matrices
and Matrix Operations, Variable Utilities, and Physics Utilities.
• Selections. Also see Named Selections.
• Moving Mesh and Deformed Geometry nodes. Also see Deformed Geometry and Moving Mesh.
• Coordinate systems, nonlocal couplings, and mass properties. See also Coordinate Systems and Nonlocal
Couplings and Coupling Operators.
• Probes. Also see Probes.
• Material nodes. Also see Materials.
• Nodes for lighting and hiding in the View branch. Also see User-Defined Views.
• Physics and multiphysics feature nodes, which can be copied within the same physics interface or to another
identical physics interface. You can also copy an entire physics interface to another model, for example. Also see
The Physics Interfaces.
• Geometry sequences, for which there are two ways to copy and paste geometry objects. Using the
Transforms>Copy operation (that keeps the nodes linked to one another), or a standard copy and paste (see
Copying and Pasting Geometry Objects). It is also possible to copy, paste, and duplicate nodes corresponding
to operation features, such as the Union node.
• Study steps, which are possible to copy from one Study branch to another. Also see Studies and Solvers.
• Derived value nodes. Also see Derived Values, Evaluation Groups, and Tables.
• Export nodes. Also see Exporting Data and Images.
• Views. Also see User-Defined Views.
• Pairs. Also see Identity and Contact Pairs.
• Plot nodes, which are possible to copy from one plot group to another, and their attributes (subnodes). Also see
Plot Groups and Plots.
The copied object must be pasted into a model component with the same space dimension. For
example, a Sphere can only be pasted into a 3D model.
Some nodes, typically default nodes in some physics interfaces, are so-called singleton nodes; that is,
there can only be one such node in one and the same physics interface. Such nodes, for example the
Gravity node in fluid flow interfaces, when copied, are not possible to paste into the model.
• In the Quick Access Toolbar (Windows users) or from the main Edit menu (macOS and Linux users), select or
click Undo ( ) or Redo ( ). Clicking the downward-pointing arrow next to the button displays a menu
showing each step in the available undo and redo histories, and you can choose any step to perform multiple
undo or redo steps at once.
• Press Ctrl+Z (undo) or Ctrl+Y (redo).
Nodes where you refer to other nodes include plot groups, datasets, and solvers; in such nodes’ Settings windows,
click the Go to Source button ( ) to move to the node that the selection in the list next to the button refers to.
• In the Mesh toolbar, click Clear Built Mesh ( ) or right-click the Mesh node and select Clear Built Mesh ( ).
This clears the built mesh while it keeps all nodes and settings in the sequence so that the mesh can be rebuilt.
• To delete all operations and attribute nodes in a meshing sequence, in the Mesh toolbar click Clear Sequence ( )
or right-click the Mesh node and select Clear Sequence ( ).
• If you have a component with several meshes, you can clear all built meshes at the same time, right-click the
Meshes node and select Clear Built Meshes. This clears the built meshes of the component while it keeps all nodes
and settings in the sequences so that the meshes can be rebuilt.
• To clear all built meshes in the whole model at the same time, in the Mesh toolbar, click Clear All Built Meshes
( ).This clears the built meshes of the component while it keeps all nodes and settings in the sequences so that
the meshes can be rebuilt.
• To clear a set of solutions under a specific study, from the Study toolbar, click Clear Solutions ( ) or right-click
the Study node and select Clear Solutions ( ). Clicking Clear Solutions also purges imported interpolation file
data, for example.
• To delete all solver nodes, right-click the Solver Configurations node and select Delete Configurations ( ). You
can also choose whether or not to remove the Results nodes (datasets and plots, for example) associated with the
solver configuration.
• If you have a model geometry with several studies, you can clear all solutions in all studies at the same time. From
the Study toolbar, click Clear All Solutions ( ).
DELETING NODES
• To delete selected nodes, right-click the nodes and select Delete ( ) or press Del (the Delete key). Confirm the
deletion of nodes for it to take effect. Also see Clearing or Deleting a Mesh.
• To delete all nodes in a geometry sequence, in the Geometry toolbar click Clear Sequence ( ) or right-click the
Geometry node and select Clear Sequence ( ). You cannot use the Undo command.
• To delete geometry objects or entities, in the Geometry toolbar click Delete ( ) or right-click Geometry and
select Delete ( ). Or select objects in the Graphics window, and click the Delete button ( ) in the Graphics
window toolbar.
If you use the Delete button to delete objects, the software deletes the selected objects that correspond to primitive
features by deleting their nodes from the geometry sequence. If you delete objects that do not correspond to
primitive features or if you delete geometric entities, a Delete Entities node appears in the sequence.
• To disable selected nodes, right-click and select Disable ( ) or press F3. The nodes are unavailable (dimmed)
in the model tree to indicate that they are disabled. For a geometry or meshing sequence, disabled nodes do not
affect the finalized geometry or mesh.
• To enable disabled nodes, right-click and select Enable ( ) or press F4.
If you cannot find a physics interface that matches a given problem, try one of the interfaces for PDEs, which makes
it possible to define a custom model in general mathematical terms using equation-based modeling. Indeed, the
COMSOL Multiphysics software can model virtually any scientific phenomena or engineering problems that
originate from the laws of science.
You can also combine physics interfaces and equation-based modeling for maximum flexibility.
To summarize the proposed strategy for modeling processes that involve several types of physics: Look for physics
interfaces suitable for the phenomena of interest. If you find them among the available physics interfaces, use them;
if not, add one or more interfaces for equation-based modeling.
When coupling multiple physics interfaces in a multiphysics model (without using a predefined multiphysics
interface), the couplings can occur in domains and on boundaries. The COMSOL Multiphysics software recognizes
some common multiphysics couplings, which then appear under the Multiphysics node. The program also
automatically identifies potential model inputs for quickly forming couplings between physics interfaces. For
example, a velocity field from fluid flow is a model input for convective heat transport in heat transfer. In that case,
the model input automatically transfers the velocity field from the fluid to the heat transfer part.
The most important types of symmetries are axial symmetry, symmetry planes or lines, and antisymmetry planes or
lines:
• Axial symmetry is common for cylindrical and similar 3D geometries. If the geometry is axisymmetric, there are
variations in the radial (r) and vertical (z) direction only and not in the angular () direction. You can then solve
a 2D problem in the rz-plane instead of the full 3D model, which can save considerable memory and
computation time. Many physics interfaces are available in axisymmetric versions and take the axial symmetry
into account. During postprocessing, you can revolve the 2D axisymmetric solution to view the results in 3D.
• Symmetry and antisymmetry planes or lines are common in both 2D and 3D models. Symmetry means that a
model is identical on either side of a dividing line or plane. For a scalar field, the normal flux is zero across the
symmetry line. In structural mechanics, the symmetry conditions are different. Antisymmetry means that the
loading of a model is oppositely balanced on either side of a dividing line or plane. For a scalar field, the
dependent variable is 0 along the antisymmetry plane or line. Structural mechanics applications have other
antisymmetry conditions. Many physics interfaces have symmetry conditions directly available as nodes that you
can add to the model tree.
To take advantage of symmetry planes and symmetry lines, all of the geometry, material properties, and boundary
conditions must be symmetric, and any loads or sources must be symmetric or antisymmetric. You can then build
a model of the symmetric portion, which can be half, a quarter, or an eighth of the full geometry, and apply the
appropriate symmetry (or antisymmetry) boundary conditions.
In estimating how much memory it takes to solve a specific model, the following factors are the most important:
The MUMPS and PARDISO out-of-core solvers can make use of available disk space to solve large models that do
not fit in the available memory.
You can monitor the memory use in the lower-right corner of the COMSOL Desktop, where the program displays
the amount of physical memory and total virtual memory used (see Information About Memory Use).
• Avoiding small geometry objects where not needed and using Bé zier curves instead of polygon chains.
• Using linear elements if possible (this is the default setting in some physics interfaces). See Selecting an Element
Type.
• Making sure that the mesh elements are of a high quality. Mesh quality is important for iterative linear system
solvers. Convergence is faster and more robust if the element quality is high.
• Avoiding geometries with sharp, narrow corners. Mesh elements get thin when they approach sharp corners,
leading to poor element quality in the adjacent regions. Sharp corners are also unphysical and can lead to very
large (even infinite, in theory) stress concentrations.
• The Physical memory number is the subset of the virtual address space used by COMSOL Multiphysics that is
physically resident; that is, it is the amount of physical memory (RAM) in “active” use.
• The Virtual memory number is the current size of the virtual address space that the COMSOL Multiphysics
software uses.
If a model has not been verified by other means, a convergence test is useful for determining if the mesh density is
sufficient. Here you refine the mesh and run the study again, and then check if the solution is converging to a stable
value as the mesh is refined. If the solution changes when you refine the mesh, the solution is mesh dependent, so
the model requires a finer mesh. You can use adaptive mesh refinement, which adds mesh elements based on an
error criterion, to resolve those areas where the error is large. See the “Stresses and Strains in a Wrench” model in
the Introduction to COMSOL Multiphysics book for an example of a convergence test.
You can do several things to improve the chances for finding the relevant solutions to difficult nonlinear problems:
• Stabilization Techniques
• Convergence Plots
• Introduction to Solvers and Studies
Unless you want to know the details of the transients, start with initial conditions that lead to a consistent solution
to a stationary problem. Only then turn on the boundary values, sources, or driving fluxes over a time interval that
is realistic for your model.
In most cases, turn on your sources using a smoothed step over a finite time using a Step function node under
Definitions. What you might think of as a step function is, in real-life physics, often a little bit smoothed because of
inertia. The step or switch does not happen instantaneously. Electrical switches take milliseconds, and solid-state
switches take microseconds.
• Step
• Introduction to Solvers and Studies
• Stationary and Time Dependent
• If none of the boundary conditions include the pressure (most outlet conditions do, however), then you should
specify the pressure at some point in the fluid domain. Without a specified pressure, the problem is
underconstrained and it is difficult to get convergence.
• Make sure that the mesh if sufficiently fine, so that it contains at least 4–6 mesh elements across the thickness of
a channel, for example.
STRUCTURAL MECHANICS
The following checks and guidelines primarily apply to modeling of structural mechanics:
• Make sure that the model is fully constrained. At a minimum, you typically need to constrain the model to avoid
all rigid-body movement, which for a 3D solid mechanics model means 6 constraints for three translations and
three rotations. Otherwise, the solution is not well defined and does not converge.
The structural mechanics interfaces include a Rigid Motion Suppression feature, which eliminates all rigid-body
movement. If you do not use that feature, it is not possible to add all 6 constraints in a single point, where you
can constrain at most three translational degrees of freedom. For a 3D solid model you can use a “3–2–1
approach” to constrain 3 degrees of freedom at one point (a fixed constraint), 2 at another point, and 1 at a third
point. To do so, select three convenient points (vertices) that are well separated. Then fix the first point in all
three directions. Constrain the second point in the two directions orthogonal (normal) to the vector from point
one to point two making sure that there is no restriction to deformation along the line from point one to point
two. Finally, constrain the third point in a direction normal to the plane formed by the three points. To test this
approach, the model should expand or contract under temperature loading and have small stresses throughout
with no stress concentrations. The corresponding minimum constraints for a 2D model are a fixed constraint at
one point for the 2 translational degrees of freedom and an additional constraint in one direction at another point
to constrain the single rotational degree of freedom.
• Consider if you can assume that the material is linear elastic and that the deformations are small. If not, consider
using a nonlinear material model.
• Avoid sharp corners in the geometry, which are unphysical and lead to unbounded stress concentrations.
• Numerical noise is a common cause. When the values of the dependent variables approach zero, the numerical
noise can become relatively significant and cause some of the results to be slightly negative even if that is not
physically possible.
• Interpolation and extrapolation of values can cause some values to become unphysical. Take care when using
interpolated data or a piecewise polynomial function to define a temperature-dependent material property, for
example. If you allow extrapolation outside of the defined range of input values, the material property values may
not be valid. Also, results for an elastoplastic material are correct (within some tolerance) at the integration points
(Gauss points) inside the finite elements, but values might become unphysical when extrapolating the data to the
element boundaries.
The Plasticity feature is available as a subnode to a Linear Elastic Material with the Nonlinear
Structural Materials Module.
• Discontinuities in the model is another source of, for example, small negative concentrations due to a
discontinuous initial value. With an initial value that is zero along a boundary for convective transport models,
for example, the physical interpretation is an initially sharp, gradually diffusing front moving away from the
boundary. However, for the default shape function (second-order Lagrange elements), only continuous
functions are admissible as solutions. COMSOL then modifies the discontinuous initial value before the time
stepping can begin. This often results in a small dip in the solution at the start time. In the example model that
the following figure shows, the concentration is locally slightly negative at t 0:
• Lack of mesh resolution is another cause of unphysical values such as negative concentrations. The resulting
convergence problems are often the underlying issue when negative concentrations are observed in high
convection regimes (high Peclet number) and in those with large reaction terms or fast kinetics (high Damkö hler
number).
• Incorrect physics in the model can also cause these types of problems. For mass transfer, for example, the use of
a constant sink in a reaction term is an approximation that only works for large concentrations. When the
concentration reaches zero, the reaction term continues to consume the species, finally resulting in a negative
concentration.
• In some cases it is possible to add a baseline to the dependent variable so that the numerical noise does not affect
the solution in the same way as when the values of the dependent variable approach zero. This scaling is not
possible with, for example, a reaction term that depends on the concentration because then the scale and origin
do matter.
• Avoid discontinuities in the model using, for example, smoothed step functions.
• Formulate logarithmic variables as a way of eliminating mesh resolution problems and negative dips using the
logarithm of the original dependent variable (the concentration, for example) as the dependent variable. The
reason for this is that a linearly varying mesh sometimes does not capture the exponential behavior of the changes
in the dependent variable. Modeling the logarithm of the dependent variable also ensures that the real
concentration, for example, cannot become negative during the solution process.
• Avoid displaying small unphysical values due to numerical noise by clipping the values for the plot. You can do
this by plotting, for example, c*(c>0) instead of c, which evaluates to 0 everywhere where c is smaller than 0.
You can also adjust the range of the plot data and colors to only show nonnegative values. Parts of the plots where
values are outside the range then become empty.
• It can also be useful to check how the mesh affects the solution by refining the mesh and checking if the problem
with unphysical values gets better or worse. If it gets better, then continue to refine the mesh. If it gets worse,
you probably need to check the physics of the model.
Within the COMSOL software you can choose from several ways to work with multiphysics modeling and
coupled-field analysis, including predefined multiphysics interfaces, predefined multiphysics couplings, and setting
up user-defined multiphysics couplings using model inputs or expressions that include dependent variables or other
expressions from another physics interface.
In this section:
You can add physics interfaces when you start creating the model with The Model Wizard or at any
time with The Add Physics Window.
Figure 3-14: When Joule Heating is selected in the Model Wizard, the default physics interfaces and coupling feature
are displayed under Added physics interfaces.
Figure 3-16: An example of when a Multiphysics node is automatically added to the model. The specific multiphysics
features are made available from the context menu (left) or (partially shown here) Physics toolbar, Multiphysics menu
(right) based on the physics interfaces in the model. The difference when the predefined Joule Heating interface is added
is that these features are included under Multiphysics and there are some modified settings automatically applied. In
either case, the available features depend on the COMSOL products that the license includes.
For example, if you add single Electric Currents and Heat Transfer in Solids interfaces to the Model Builder, the
COMSOL Multiphysics software adds an empty Multiphysics node. The applicable multiphysics couplings are then
available as subnodes that you can add. If you instead choose the predefined Joule Heating multiphysics coupling,
for example, which then adds the Electromagnetic Heating node under the Multiphysics node, so that you do not
need to remember which multiphysics coupling nodes to add for a specific type of multiphysics. See The Add
Multiphysics Window.
In general, it is useful to use any type of multiphysics coupling because you can turn multiphysics on and off (that
is, enable and disable features), giving you more flexibility to test and observe multiphysics effects.
Even if you do not start with a predefined coupling, another benefit of this approach is that you are no longer
constrained by the use of specific physics interfaces, nor do these have to be added in any specific order. The order
in which physics interfaces are added does not matter for the end result.
An example of this is if you start modeling by adding a Heat Transfer in Solids interface. As you continue to build
the model, you add an Electric Currents interface. At this stage of the process, you may have defined several
boundary conditions, chosen materials, or experimented with other settings. You may have also solved the model
successfully at this point and now you want to continue building on this design. The COMSOL Multiphysics
software recognizes this and adds a Multiphysics node, which you can right-click to access and add any of the
available predefined multiphysics couplings.
For multiphysics interfaces that consist of participating physics interfaces, the default solver settings use a segregated
solver approach with one segregated step for each physics interface and each of these steps calling an iterative solver.
These solver settings are suitable for large models, but if possible, a fully-coupled solver approach using direct
solvers can be more robust. You can switch to such solver settings by right-clicking the Study node and choosing
Show Default Solver. Then the solver nodes that the predefined multiphysics interface specifies appear under the
Solver Configuration node, and you can right-click the solver node to add a Fully Coupled solver node to replace the
Segregated node, for example.
For some multiphysics interfaces, a side effect of adding physics interfaces one at a time is that two
study types — Frequency-Stationary and Frequency-Transient — are not available for selection until
after at least one coupling feature is added. In this case, it is better to first add an Empty Study, then
add the coupling features to the Multiphysics node, and lastly, right-click the Study node to add the
study steps as needed.
You control which multiphysics couplings that appear using the settings under Select the physics interfaces you want
to couple. You can clear and select all physics interfaces in the current component. By default, all physics interfaces
are selected and appear with a check mark ( ) in the Couple column. The available multiphysics couplings depend
on which COMSOL Multiphysics products your license includes. If no multiphysics coupling is available, No
Coupling Features Available for the Selected Physics Interfaces appears. You must select at least two physics interfaces
for any multiphysics couplings to appear. With more than two physics interfaces in the component, any combination
of two or sometimes more physics interfaces typically results in a different set of available multiphysics couplings,
whereas most combinations of three or more physics interfaces result in no available multiphysics couplings.
The existing Studies are listed under Multiphysics couplings in study. By default, the studies appear with a check
mark ( ) in the Solve column, which indicates that the study solves for the equations that the multiphysics
couplings add. Click in the column to clear the check mark and exclude the equations in the multiphysics coupling
from that study. Some multiphysics couplings do not add any extra equations and are then not affected by this
setting.
Predefined multiphysics interfaces provide you with a quick entry point for common multiphysics applications. You
can create the same multiphysics couplings using any of the other methods for multiphysics modeling, and you can
continue to add, modify, disable, and remove physics features or interfaces in a model when you start using one of
the predefined multiphysics interfaces. If you instead decide to add physics interfaces one by one, you can verify
that each type of physics or equation gives the expected results before adding more complexity to the model by
adding another physics interface, physics feature, or multiphysics coupling.
For links to more information about the add-on modules and the multiphysics interfaces available go
to [Link]/comsol-multiphysics.
For each multiphysics coupling feature (for example, Electromagnetic Heating), there is a section that defines the
physics interfaces involved in the multiphysics coupling. By default, the applicable physics interfaces are selected in
the lists to establish the coupling.
You can also select None from the lists to uncouple the node from a physics interface. If the physics interface is
removed from the Model Builder (for example, if a Heat Transfer in Solids interface is deleted), then the Heat transfer
Figure 3-18: A warning tooltip appears when a multiphysics coupling is turned off.
If a physics interface is deleted and then added to the model again, and in order to reestablish the
coupling, you need to choose the physics interface again from the lists. This is applicable to all
multiphysics coupling nodes that would normally default to the once present physics interface.
For frequently used multiphysics couplings, predefined multiphysics coupling nodes are available under the
Multiphysics node (see The Multiphysics Branch). The following part of this section is mostly useful for cases when
such predefined couplings are not available.
With more than one physics interface in the model, coupling of the fields is easy: all applicable fields that can serve
as inputs in another physics interface automatically appear in the other physics interface’s Settings window’s Model
Inputs section. For example, with a Heat Transfer in Fluids (ht) interface and a Laminar Flow (spf) interface, you
can select Velocity field (spf), which the Fluid Properties 1 {fp1} node in the Laminar Flow branch defines, from the
Velocity field list in the Model Inputs section of the Settings window for the Fluid node under Heat Transfer in Fluids.
The velocity field from the Laminar Flow interface then becomes the velocity field for the convective heat transfer.
You can also choose Common model input to use its value to define the velocity field, or choose User defined to enter
a user-defined velocity field.
When you have selected a model input from one of the lists, click the Go to Source button ( ) next to the list to
move directly to the node in the other physics interface that provides the model input. If more than one node
contribute to the model input, choose which one to go to in the Contributing Entities dialog box. Then click OK to
move to the selected node.
You can also, if you have selected Common model input, click the Create Model Input button ( ) to create a local
Model Input node in the current component (see Model Input) for defining a model input for some or all of the
geometry in the current component, overriding the default model input.
By default, the Model Input section in the Fluid Properties node under the Laminar Flow node is empty. But if you,
for example, add a temperature-dependent material property such as the dynamic viscosity, a Temperature list
appears in the Model Input section where you can explicitly choose the Temperature (ht) field or use a user-defined
temperature or a Common model input like any other model input.
A list in the Model Inputs section becomes unavailable if the physics itself defines the field because it is then
automatically connected to that field. For example, with a Heat Transfer in Fluids (ht) interface the Temperature
list is unavailable in the Fluid node under Heat Transfer in Fluids. This automatic connection selects the
For this type of fluid-thermal coupling, the Multiphysics branch provides a predefined Nonisothermal
Flow node, which provides an easy way to set up this coupling without having to explicitly specify the
model input.
See Joule Heating of a Microactuator for an example of combining the Electric Currents and Heat
Transfer in Solids interfaces through a Joule Heating multiphysics interface (Application Library path
COMSOL_Multiphysics/Multiphysics/thermal_actuator_jh).
Not all physics features allow anisotropic materials or more than one material model. Therefore, these
settings cannot be present.
The default node uses the same material model, and thus the same equations, everywhere. Material properties can
vary between different parts of the feature’s selection, if the property is specified as taken From material. Add
additional nodes to use different material models for different parts of the geometry, or to use different User defined
material property values.
In equation-based modeling, provided by the Mathematics branch interfaces, the form of the equation is fixed for
each particular node type. Each given equation form contains a number of free PDE coefficients, which you can be
specify in the settings to define the specific equation that you want to solve.
Equation-Based Modeling
• Numerical values.
• Units (see Using Units).
• Built-in Mathematical and Numerical Constants.
• Spatial coordinates, time, and the dependent variables in any physics feature in the model as well as the spatial
derivatives and time derivatives. Using such variables makes it possible to create user-defined multiphysics
couplings.
• Physical Constants — built-in universal physical constants.
• User-defined parameters, variables, coupling operators, and functions, including external functions and
MATLAB® functions (requires the COMSOL LiveLink™ for MATLAB®). See Operators, Functions, and
Constants.
• Built-in functions and operators such as d and mean.
You can use these types of variables, constants, functions, and operators in all settings for the physics interfaces;
many types of variables are also available anywhere in the model.
These properties are, in principle, specified in matrix form and defined by their components in the coordinate
system selected in the node settings. At most four components are used in 2D and at most nine components in 3D.
When the material contains symmetries, you can specify only a few coefficients, which are expanded to a matrix
using the following patterns:
c 00
C = 0 c 0
0 0 c
• Diagonal — enter the diagonal components for an anisotropic material with the main axes aligned with the
model’s coordinate system.
c 11 0 0
C = 0 c 22 0
0 0 c 33
• Symmetric — enter a symmetric matrix using the diagonal components and the upper off-diagonal components.
c 11 c 12 c 13
C = c 12 c 22 c 23
c 13 c 23 c 33
• Full — enter the full 2-by-2 (2D) or 3-by-3 (3D) matrix for an anisotropic material:
c 11 c 12 c 13
C = c 21 c 22 c 23
c 31 c 32 c 33
For some physics interfaces you can also enter initial values for the first time derivative of the dependent variables.
These are used when solving time-dependent problems containing second time derivatives (wave-type
applications). Like other default settings, these initial values apply to all domains where no other values are specified.
To use different initial values in different domains, add another Initial Values node from the Physics ribbon toolbar
(Windows users), Physics context menu (macOS or Linux users), or right-click to access the context menu (all
users).
See Dependent Variables for more information about handling and plotting initial values.
Equation View
Equation View ( ) is a subnode available for all physics feature nodes. To display these subnodes, click the Show
More Options button ( ) and select Equation View from the Show More Options dialog box.
The Settings window for Equation View contains detailed information about the implementation of each physics
feature: variables, shape functions, weak-form equation expressions, and constraints.
To update the values in the Settings window for Equation View to reflect the latest changes in a physics feature, click
the Refresh Equations button ( ) in the Settings window’s toolbar.
Editing the predefined expressions for variables, equations, and constraints means that the equations
are altered and that COMSOL Multiphysics solves the model using the new expressions.
You can edit the expressions or values of variables, weak-form expressions, and constraints in the corresponding
tables under Variables, Weak Expressions, and Constraints, respectively. This makes it possible to introduce custom
changes to the equations and variable definitions. If the expression that defines a variable, for example, does not fit
inside of the text field, a tooltip displays the entire expression. Press Ctrl+Space or use the Insert Expression button
( ) below the tables to choose from a number of applicable variables, parameters, functions, operators, and
constants that you can insert into the expression at the position of the cursor. In the table of variables under
Variables, you can click any of the column headers to sort the table contents alphabetically based on the contents
of that column (in ascending order; click again for descending order; click yet again to restore the original order).
For a changed definition of a variable or a change to a weak-form expression or constraint, a warning icon ( )
appears in the leftmost column, and a small padlock is added to the lower-right corner of the icon for the physics
node where you have made modifications in its equation view. To restore only the change in the selected variable,
weak-form expression, or constraint, click the Reset Selected button ( ) under the table in the Variables, Weak
Expression, or Constraints section. To reset all changes in the equation view, click the Reset All button ( ) in the
Settings window’s toolbar. If no changes remain, the padlock disappears from the corresponding physics node. An
orange color for the expression that defines the variable is a warning that the unit of the expression does not match
the expected unit for the variable that it defines. To store all information in the tables under Variables, Shape
Functions, Weak Expressions, or Constraints to a text file, click the corresponding Save to File button ( ).
For information about the Equation displays available, see Physics Nodes — Equation Section.
VARIABLES
This section has a table with the variables that the physics node defines. The table includes these columns:
If you click a single variable, its selection, as indicated in the Selection column, appears in the Graphics
window.
SHAPE FUNCTIONS
This section has a table with the dependent variables that the physics node defines and their shape functions. This
is primarily applicable to equation model nodes; for most physics nodes such as boundary conditions, the table is
empty. The table has these columns:
• Unit: the unit for the variable (in the active unit system).
• Description: a description of the variable.
• Shape frame: the frame type (typically either a spatial or a material frame) for the shape function.
• Selection: the geometric entities (domains, boundaries, edges, or points) where the shape function is defined
(Domain 1, for example).
• Details: This column contains some details about the shape function’s behavior. See About the Details Column
below.
• Weak expression, the equation expressed in a weak formulation. It is possible to modify these expressions, but
you then override the equation as specified by the physics interface, and a warning appears in the leftmost column
of the table.
• Integration order, the order for the integration of the weak expression (see integration order in the Glossary).
Polynomials of at most the given integration order are integrated without systematic errors. For smooth
expressions, a sufficient integration order is typically twice the order of the shape function. For example, the
default integration order for second-order Lagrange elements is 4. You can modify the integration order if
desired. A warning then appears in the leftmost column of the table to indicate that the predefined order has
been changed.
See the following blog post for information about modifying the integration order:
[Link]/blogs/introduction-to-numerical-integration-and-gauss-points/
• Frame, the frame type (typically either a spatial or a material frame) used when integrating the expression.
• Selection: the geometric entities (domains, boundaries, edges, or points) where the weak expression is defined
(Domain 1, for example).
Each equation contribution appears on its own row under Weak expression, but the order is not significant.
The PDE interfaces and the ODEs and DAEs interfaces do not display any weak expressions. They are
either implemented using strong formulations, directly display the weak formulation, or define
equations discretized in the time domain only.
CONSTRAINTS
This section has a table with the constraints that the physics node generates. This is typically the case for boundary
conditions of constraint types, such as prescribed displacements, temperature, or velocities. Many other physics
nodes do not generate any constraints, and the table is then empty. The table consists of the following columns:
• Slit means that the shape function creates a slit for the degree of freedom.
If you do not want to display the Equation section, click the Show More Options button ( ) and clear
the Equation Sections check box in the Show More Options dialog box.
Equation View
The display options available from the lists depend on the study types and other physics-specific factors. See
Figure 3-20 for an example comparing the equations that display for a Stationary or Time Dependent study for a Heat
Transfer in Solids interface. Some Settings windows do not have any options and only display the relevant equation
and other windows have additional sections that become available for the Equation display based on the study type
selected.
Equation Form
When you add physics interfaces to a Component, the supported Study types are listed in the Equation form list.
Study controlled is the default; select another option as needed. When the setting is Study controlled, the study
controls the equation form — stationary or time dependent, for example — for the physics interface. In some cases,
that equation form might not be compatible with the physics covered by the physics interface; the physics interface
For the following options — frequency and mode analysis frequency — you also have the option to use another
frequency than the one used by the solver. This can be necessary if you need two different frequencies for two
physics interfaces.
Frequency
This option is available if Frequency domain is selected as the Equation form. The default uses the frequency From
solver. If User defined is selected, enter another value or expression (SI unit: Hz).
Port Name
This option is available with the RF Module Electromagnetic Waves interface and if Boundary Mode Analysis is selected
as the Equation Form. Enter a value in the field (unitless).
Figure 3-20: An example of the Equation section on a Heat Transfer interface. Selecting the study type updates the
equation accordingly.
All physics interface branches that contain a default model equation node also contain a default boundary condition
node. This boundary condition is active on all exterior boundaries of the physics’ selection, except on the symmetry
axis of axisymmetric 2D models. On interior boundaries, an implicit continuity condition applies, which makes the
physics field (the temperature, for example) continuous across interior boundaries.
In physics interfaces defined on shells, for example, the domain equations are defined on 3D
boundaries, and you define the interface conditions on edges as edge conditions rather than boundary
conditions.
• Flux conditions specify how the surroundings affect and interact with the model at the boundary, often
expressed as an applied force, flux, or current. This type of boundary condition is also called a Neumann
boundary condition.
• Constraints specify the result of the interaction between the model and its surroundings, expressed as prescribed
values of the dependent variables. This type of boundary condition is also called a Dirichlet boundary condition.
The two types are closely related because in a well-posed model, every flux condition results in some unique values
of the dependent variables, and every constraint requires a unique flux to enforce the expected values. Which type
of condition to use depends on what is known about the conditions at the boundary: if the flux is known, the model
computes the dependent variables for you; if the values of the dependent variables are known, the model computes
the flux.
FLUX CONDITIONS
Flux boundary conditions specify the component of a vector or tensor quantity in the direction normal to the
boundary, per unit area of the boundary. Typical examples of flux conditions are the specification of:
• A Boundary Load in a solid model, which prescribes the stress acting on the boundary.
• Heat Flux in a heat transfer model, which prescribes the heat per unit area flowing into (or out of) the model
across the boundary.
• A Normal Current Density in an AC/DC model, which prescribes the electrical current per unit area entering
(or exiting) the model at the boundary.
Convective Heat Flux requires the CFD Module or Heat Transfer Module.
In COMSOL Multiphysics, by convention, the force acting on the model or the flux into the model is
specified. That is, specify how the surroundings affect the model and not how the model affects its
surroundings. You can change the direction by reversing the sign before the numerical value of the force
or flux.
CONSTRAINTS
Constraint boundary conditions specify the value of one or more dependent variables at the boundary, or a
relationship between two or more dependent variables. Typical examples include specifying:
Examples specifying a relation between dependent variables include Roller conditions on solids and Wall conditions
for slip flow.
Because constraint conditions generally specify the value of a dependent variable, they also provide a reference level
for that variable, which a flux condition normally does not. In many types of physics, the model equations together
with only flux boundary conditions uniquely describe the local behavior of the dependent variable, but leave the
global level undefined. From a physical point of view, the absolute value of the dependent variables are often of less
interest, but the existence of a single, unique, solution is essential for some solvers.
Therefore it is often necessary to apply at least one constraint condition in a model, to provide a global reference
value for the dependent variables. For example, it is common to designate one of the electrodes in an AC/DC
model as Ground, which constrains the electric potential there to zero and gives a reference with which to compare
other parts of the model.
In most physics features, the default boundary condition is of a flux type and does not fix a reference
level for the dependent variable. Therefore, when solving certain study types (notably stationary
studies), you must manually add at least one boundary condition of constraint type (or a point
constraint) for the model to be well-defined.
• Exterior boundaries, where most boundary conditions are applicable — see below.
• Interior boundaries, where special interface conditions can be applicable — see below.
• Axial symmetry boundaries, which are artificial boundaries representing the symmetry axis in axisymmetric
models.
If a selection for a boundary condition node, for example, contains boundaries of a type that is not applicable or
supported, the Selection list has (not applicable) next to those boundary numbers.
If an equation or physics interface is deactivated in one domain, the interior boundary between the active and
inactive domain becomes an exterior boundary for its variables because it then borders on the outside of the active
domain for those fields. The boundaries of the inactive domain are then void.
exterior interior
boundary boundary
For variables defined on a higher geometry dimension (domains, typically), evaluating such variables
on a lower dimension (boundaries, typically), the returned value is the mean value, if the values for the
variable differ on the different sides of the boundary (upside and downside of an interior boundary).
Use the up and down operators to evaluate the variable on one side of the boundary.
PAIR SELECTION
Select the pairs where you want to impose continuity across the pair boundaries by clicking the Add button ( )
and choose the pairs to add from the list in the Add dialog box that opens; then click OK.
BOUNDARY SELECTION
The selection list for boundaries is not available because this is a default boundary condition. In the list, boundaries
that are not on the symmetry axis have (not applicable) added after the boundary number.
• The reaction term enforcing a Prescribed Displacement on a solid model is a reaction force, similar to a
Boundary Load boundary condition.
• The reaction term enforcing a Pressure in an acoustics model is a Normal Acceleration.
• The reaction term enforcing a Temperature in a heat transfer model is a Heat Flux.
Weak Constraints
The reaction terms in the model equations can be scaled in different ways, affecting mainly the numerics and
solvers. In a model with more than one dependent variable, it is also possible to distribute the reaction fluxes, or
forces, over the variables in different ways — while still enforcing the original constraint.
u = k Tv (3-1)
If fully symmetric reaction terms are used to enforce this constraint, reaction forces are applied on both
displacement components u and v, as well as a reaction heat flux in the heat transfer equation. Applying symmetric
reaction terms this way, on completely different equations, is usually not meaningful.
In particular, the solid displacement equation and the heat transfer equation have different units. Because you can
choose length and temperature unit independently, the relative scale of the equations is undefined and the
symmetry of the coupled system irrelevant. Further you would not, from a physical point of view, expect a
constraint on the displacement of a solid boundary to directly affect the temperature field in a model.
• The most consistent and general way to avoid spurious reaction terms affecting other physics is to start from the
globally symmetric formulation and remove the terms entering equations belonging to other physics interfaces.
This limits the reaction terms to affecting the current physics as if there were no other physics in the model, so
the reaction terms preserve the symmetry. For Equation 3-1, this means that reaction terms are distributed over
both u and v equations, in proportions 1kT.
• The other alternative is to apply the reaction terms only on certain individual variables. Another way to look at
Equation 3-1 is to read it as prescribing a value for the x-displacement u, rather than prescribing a given relation
between u and v. Accepting that view, it is reasonable to insert reaction terms only acting on u. Such reaction
terms, in general, do not preserve symmetry even for a single physics interface.
Constraint Settings
Most constraint nodes include a Constraint Settings section, which is only available when Advanced Physics Options
is selected in the Show More Options dialog box. This section provides settings controlling how reaction terms are
applied, when applicable, and whether to use pointwise standard constraints or weak constraints.
Several constraint types are available under Constraints. When Pointwise constraints are selected, pointwise standard
constraints are used. A common alternative are Weak constraints (see Weak Constraints below). Note that this
option introduces additional equations and dependent variables.
When Weak constraints or Pointwise constraints are selected, choose to Apply reaction terms on:
• All physics (symmetric) to apply reaction terms symmetrically on all dependent variables taking part in the
constraint.
If you use pointwise constraints, then select a Constraint method for the pointwise constraints: Elemental or Nodal:
• Choose Elemental (the default) to make the software assemble the constraint on each node in each element; that
is, there are usually several constraints at the same global coordinates because elements in the computational
mesh overlap at nodes.
• Choose Nodal to make the software assemble a single constraint for each global node point. The nodal constraint
method provides an averaging of the constraints from adjacent elements, which can be beneficial when the
constraint has discontinuities between mesh elements (for example, due to discontinuities of the boundary
normal). Another case where nodal constraints can be useful is in boundary conditions involving a coupling
operator (such as continuity or periodic conditions). With elemental constraints, locking effects can sometimes
occur because the coupling operator might map to slightly different points in the source boundary when it is
applied to the same node point in different mesh elements.
Not all constraints provide all the above options. Some reaction term methods can be missing and weak
constraints are not allowed. Some constraint nodes can also implement additional options.
• If constitutive properties differ a lot between two adjacent domains, the flux will be sensitive to whether a
Dirichlet condition on a boundary includes the common edge or not.
• When you want to mix weak and pointwise constraints on the same degree of freedom, they cannot coexist on
nodes shared at, for example, a corner.
The Excluded Surfaces, Excluded Edges, and Excluded Points sections contain settings for selecting surfaces (that is,
boundaries in 3D), edges (that is, boundaries in 2D and edges in 3D), and points, respectively. See About Selecting
Geometric Entities for information about selecting geometric entities such as edges.
Weak Constraints
The standard method to enforce constraints in the COMSOL Multiphysics software applies the constraints
pointwise at node points in the mesh. At each node point, only local values of the dependent variables are affected
by the constraint, making the constraints independent of each other. The solvers can therefore eliminate both the
constrained degrees of freedom and the constraint force terms, effectively reducing the system of equations and
decreasing the number of degrees of freedom being solved for.
Weak constraints enforce the constraint in a local average sense, using shape functions as weights. Reaction terms
are explicitly included in the system of equations, which is extended with Lagrange multiplier variables. These
Lagrange multipliers in general have a physical meaning and an interpretation as a constraint force or flux. Whereas
A weak constraint is respected only on average over each Lagrange multiplier shape function, rather than pointwise
at mesh nodes. When it is possible to satisfy the constraint everywhere on each mesh element, standard and weak
constraints in general lead to the same solution. Conversely, when constraints are contradictory or impossible to
satisfy everywhere, standard and weak constraints can distribute the error differently, and therefore lead to slightly
different solutions.
• Standard constraints must never contain time derivatives of the dependent variables. Weak constraints do not
have this limitation because they allow the same variables as any other term in the combined system of equations.
Note that reaction terms cannot be applied symmetrically to time derivatives but must be selectively applied to
individual variables.
• When the reaction force or flux is needed during a solution, because it enters into a coefficient somewhere, the
Lagrange multiplier from a weak constraint can provide an accurate value (see Computing Accurate Fluxes). The
corresponding variables computed from derivatives of the dependent variables are not as accurate and can, if
used, introduce considerable errors in the solution.
• When constraints are strongly nonlinear, weak constraints can allow faster and more robust convergence. For
nonlinear constraints, the true linearized subproblem solved in each solution step depends on the value of the
Lagrange multiplier variables from the previous step. When using standard constraints, this information is
discarded between solution steps. Using weak constraints, the Lagrange multiplier values are instead retained
between steps because they are part of the solution vector.
Compared to standard, eliminated, constraints, weak constraints can also have the following drawbacks:
• Discontinuous constraints result in (theoretically) infinite Lagrange multipliers. In practice, large oscillations
result.
• Pointwise and weak constraints on the same set of variables on adjacent boundaries (that is, boundaries that share
common node points in the mesh) do not work. This means that if all boundaries must be constrained on a solid
and you want to use a weak constraint on one boundary segment (one face), the weak constraint must be used
on the entire boundary of the solid (if the boundary is connected).
• Lagrange multipliers are in some cases difficult to interpret. For example, Lagrange multipliers from Dirichlet
conditions in axial symmetry are not equal to the reaction flux per area but rather per length and full revolution.
For separate Weak Constraints nodes in axial symmetry, the default quadrature settings include a multiplication
by 2 r, making the Lagrange multiplier represent flux per area.
• Because extra unknowns are introduced for the Lagrange multipliers, the size of the problem increases compared
to the standard constraint elimination method.
• The Lagrange multiplier variables added by the weak constraints have a different unit than the main system
variables and can therefore be of a different order of magnitude. This can lead to scaling problems. Usually the
automatic variable scaling in the solvers is sufficient, but there are cases when manual scaling is needed.
• Weak constraints introduce zeros on the main diagonal of the Jacobian matrix of the discretized system, which
therefore cannot be positive definite. This makes certain linear solvers and preconditioners unavailable for solving
problems with weak constraints. In particular, the conjugate gradients iterative solver does not work, and neither
does the SOR class of preconditioners and smoothers. Instead, try another iterative solver and use the Vanka
To add a periodic boundary condition, in the Model Builder, right-click a physics interface node and select Periodic
Condition. The periodic boundary condition typically implements standard periodicity so that ux0 ux1 (that is,
the value of the solution is the same on the periodic boundaries). In most cases you can also choose antiperiodicity
so that the solutions have opposing signs: ux0 ux1. Other options such as Floquet periodicity or cyclic
symmetry may be available. The periodicity is implemented in such a way that fluxes become periodic in the same
way as the solution itself.
For fluid flow physics interfaces, the Periodic Flow Condition provides a similar periodic boundary condition but
without a selection of periodicity. Instead, it allows specifying a pressure difference between the source and
destination boundaries.
Typically, the periodic boundary conditions determine the source and destination boundaries automatically, but
you can also add Destination Selection subnode to manually split the periodic boundary condition’s selection into
source and destination selections.
where R is a rotation matrix encoding the relative orientation of the source and destination boundaries. It is
normally determined automatically from the cross product of the source and destination boundary normal
directions. That is, the rotation is performed about an axis perpendicular to the plane spanned by the normal
directions, which are evaluated at arbitrary points on each boundary.
When the periodic condition is applied on a shell or beam in 3D, the selection is edges or vertices without a
well-defined normal. An automatic mapping from destination point to source point is defined based on the
The automatically computed relative orientation is in most cases the one expected. In particular, it is correct if the
source and destination have unique normal vectors which are parallel but pointing in opposite directions, unless the
geometry is twisted about that direction. But there are a number of situations when the automatic orientation is
not necessarily the one expected:
• The geometry is twisted in such a way that the destination selection cannot be represented as a rotation of the
source about a single axis.
• The source and destination boundaries are not planar, such that their normals are not unique.
• The source and destination selections are edges or points in 3D, and the arc length parameter values are growing
in opposite directions.
For most periodic boundary conditions in the physics interfaces, it is then possible to specify the relative orientation
of the source and destination selections using coordinate systems.
The orientation settings appear in Orientation of Source and Orientation of Destination sections in the Periodic
Condition node. To display the Orientation of Destination settings, first select Advanced Physics Options in the Show
More Options dialog box. It is also not visible when the Transform to intermediate map list in the Orientation of Source
section is set to its default value, Automatic. Other possible values represent coordinate systems, including all
coordinate system nodes defined in the component as well as the canonical Global coordinate system. The latter is
the default choice for the Orientation of Destination section.
The chosen source and destination coordinate systems define transformation matrices, Tsrc and Tdst, whose row
index refers to local coordinate system components, while the column index refers to global coordinates on the
T T –T
R = T src dst
In general, the Nodal constraint method is recommended for periodic conditions. When the Elemental constraint
method is used for periodic conditions, the elementwise mapping for compatible meshes can lead to locking effects.
This problem can be prevented by setting the value of the Elementwise mapping for compatible meshes list to Off
when the Elemental constraint method is used.
There is built-in logic for choosing if the software should try to use the elementwise mapping between the meshes
or not. This corresponds to choosing Automatic from the Elementwise mapping for compatible meshes list.
However, that logic is mainly based on the topology and does not consider the meshing sequence that you choose,
the constraint method you set, or all the shape functions you will apply the condition to. Therefore, you can
overwrite the built-in logic by choosing between the following alternatives from the Elementwise mapping for
compatible meshes list: On, Off, or Require compatible meshes.
• Choose On if you expect compatible meshes and want to use an elementwise mapping but you want to get a
mapping even if source and destination cannot be identified.
• Choose Off if you do not expect compatible meshes or if you want to use elemental constraints for continuous
fields.
• Choose Require compatible meshes if you expect compatible meshes and you rather fail than use noncompatible
meshes.
If you have selected On or Require compatible meshes, a Tolerance for compatible meshes field appears, where you can
specify the relative tolerance, compared to the mesh element size, for when the mesh elements are considered
compatible (default: 0.001).
Acoustics Module
Porous Absorber: Application Library path:
Acoustics_Module/Building_and_Room_Acoustics/porous_absorber
• The first approach involves the reaction force operator (reacf) that makes it possible to compute integrals of
reaction forces or fluxes during results analysis. The reacf operator gives the value of constraint forces per node,
which is a discrete version of the Lagrange multipliers. It can be summed over per node and is the traditional
way of computing reaction forces in FEA. The reacf operator always gives the “exact” reaction force of the
discretized version of the problem.
In a case where you have one type of constraint acting on the same dependent variable (DOF variable) then
Lagrange multipliers (see below) and reacf are more or less the same. In a case where you have several types of
constraints acting on the same dependent variable (DOF variable) — for example, some kind of control system
mechanism — then Lagrange multipliers give you individual control over each constraint force whereas reacf
will only give you control over the sum of all constraint forces.
The reacf operator is a pure postprocessing operation and does not affect the matrix structure or solvers.
See reacf for details.
• Some physics interfaces provide a second way of computing accurate fluxes. Those accurate fluxes are like a
continuous version of the reacf operator and have similar properties: they are pure postprocessing operations
and do not affect the matrix structure or solvers. They reconstruct a, typically continuous, field instead of giving
the “exact” reaction force per node for the discretized problem. So, although these fluxes will be nice and
continuous, as opposed to those computed using reacf, they may sometimes not be as accurate as reacf. They
also have to be integrated using some numerical quadrature rule, which can introduce numerical errors. Also
note that the flux variables are only accurate if the residual is small; a small solution error normally means a small
residual.
Under the Discretization section (if Advanced Physics Options is selected in the Show More Options dialog box),
select the Compute boundary fluxes check box. The solver then computes variables storing an accurate boundary
flux from each boundary into the adjacent domain (in addition to the standard extrapolated value). On interior
boundaries, there are two flux variables corresponding to the flux into the domains on either side of the
boundary. Unlike the other methods, these variables are available also on unconstrained boundaries. This
method is active by default in Coefficient Form PDE, General Form PDE, heat transfer, and mass transport
interfaces. There is also an Apply smoothing to boundary fluxes check box that is selected by default. The
smoothing can provide a more well-behaved flux value close to singularities. See also Boundary Flux Operators:
uflux and dflux.
• The third, more general approach for calculating reaction forces and fluxes is to use Lagrange multipliers (weak
constraints). Use this approach when you need reaction forces or fluxes in other contexts than calculating
integrals of reaction forces or fluxes. Lagrange multipliers give you more precise control over how the constraint
forces are acting and allow for creative ways of applying them. However, using Lagrange multipliers is not a pure
postprocessing operation, and they actually change the problem being solved. Lagrange multipliers can destroy
the matrix structure and may convert a converging or easy-to-solve problem into a problem that is more difficult
to solve. Also, using Lagrange multipliers can lead to conflicting constraints and singular matrices at corners or
Weak Constraints
When using weak constraints in interfaces, the Lagrange multipliers are additional dependent variables in those
physics interfaces. When using the reaction force operator, the reaction force operator of a certain dependent
variable corresponds to the Lagrange multiplier of that dependent variable. The Lagrange multipliers correspond
to the following quantities in the physics interfaces:
TABLE 3-6: INTERPRETATION OF LAGRANGE MULTIPLIERS.
The sign of the Lagrange multiplier is the same as the one used when applying the corresponding quantity
explicitly in a flux condition. As a general rule, the sign corresponds to an action by the surroundings on the
model, rather than the opposite.
The program computes only the part of the boundary flux captured by the Lagrange multiplier. You might have
additional flux coming from boundary sources or nonidentity constraint matrices. This should not happen in the
physics interfaces, though.
Lagrange multipliers in axial symmetry are not equal to the reaction flux per area but rather per length
and full revolution.
MODEL WIZARD
1 Open the Model Wizard (see Open a New Window to Begin Modeling).
2 On the Select Space Dimension page, click the 2D button .
3 In the list of physics interfaces, under Heat Transfer click Heat Transfer in Solids . Click Add.
4 Click the Study button . On the Select Study page under Preset Studies, click Stationary .
5 Click Done.
MATERIALS
1 In the Material toolbar, click Browse Materials .
2 Under Built-in, click Copper then click Add to Component.
3 Click Done .
HEAT TRANSFER
The Heat Transfer in Solids node defines the material properties to be those from the material (copper) and does not
need to be changed, but the default boundary condition is thermal insulation. Instead, add a heat flux to the
bottom boundary and a fixed temperature on the other three boundaries.
ADD A LOAD OR CONSTRAINT GROUP FROM THE GLOBAL DEFINITIONS CONTEXT MENU
Add a Load Group ( ) or Constraint Group ( ) under Global Definitions to create groups to which you can later
assign loads and constraints. If you group the nodes, the load and constraint groups display under the Load and
Constraint Groups node ( ). See Figure 3-22.
Figure 3-22: An example of the node grouping when Group by Type is selected (left) and when Ungroup is selected
(right).
• Active in All Load Groups (or Active in All Constraint Groups). This is the default setting, which you can use for
some boundary conditions or other parts of the physics design that take part in all load cases.
• One of the defined load groups or constraint groups such as Load Group 1, Load Group 2, and so on.
• New Load Group (or New Constraint Group) to create a new group as described earlier in this section.
Figure 3-23: An example of the context menu options when a load or constraint physics node is right-clicked, in this case,
the Fixed Constraint node.
Define as many groups as you need for the load cases that you want to study. Each load or constraint can only
belong to one group. The next step is then to define the actual load cases as combinations of these groups (see
Defining and Evaluating Load Cases).
When the Load Group or Constraint Group is applied to a node under a physics interface, the node indicates this
visually. For example, the Fixed Constraint and Roller nodes have the blue Constraint Group symbol in the upper-right
Figure 3-24: An example of the Load and Constraint Groups defined under Global Definitions with loads and
constraints applied to nodes under Solid Mechanics.
Load Group
Add a Load Group ( ) under the Global Definitions node to create a load group to which you can assign one or
more loads. You can then activate the load group in one or more load cases for efficiently solving a structural
mechanics or heat transfer model to analyze the effects of various loads or sources.
SETTINGS
The Label is the default coordinate system name. The default Parameter name (for the first coordinate system in the
model) is lg. This can be modified if you want to use a more descriptive parameter name (for example, lgGravity).
You can also create load groups from physics nodes for structural mechanics that represent loads and support load
cases: Right-click the physics node and choose Load Group>New Load Group.
Constraint Group
Add a Constraint Group ( ) under the Global Definitions node to create a constraint group to which you can assign
one or more constraints. You can then activate the constraint group in one or more load cases for efficiently solving
a model to analyze the effects of various constraints.
Constraint groups only work for pointwise constraints. If the formulation for a certain constraint
is changed to a weak constraint, it is no longer possible to add it to a constraint group. Conversely,
if a constraint has been assigned to a constraint group, it will no longer be possible so select the
weak formulation.
If you select Group by Type from the context menu, either right-click the Global Definitions node or
the Loads and Constraints Groups node ( ) to add a Load Group or Constraint Group.
1 In the Model Builder under Study, in the Settings window for Stationary ( ), click to expand the Study Extensions
section.
2 Select the Define load cases check box (see Figure 3-25).
3 In the Define load cases area, click the Add ( ) button underneath the table to add a load case.
4 The added load case appears last in the table of load cases. Use the Move Up ( ), Move Down ( ), and
Delete ( ) buttons to rearrange the load cases in the table, and click the Add ( ) button to add more load
cases.
5 For each load case, you can change its name from the default (Load case 2, for example) in the Load case column.
6 Include the load groups and constraint groups for each load case by clicking the in the columns for the
groups to include. The symbol changes to in order to indicate that the group participates in the load case.
7 For load groups, optionally change the weight from its default value of 1.0 in the corresponding Weight column
(the Weight column to the right of the load group that it affects). Use a positive value other than 1 to increase
or decrease the magnitude of the load; a negative value also reverses the load’s direction.
Figure 3-25: An example of the Stationary node’s Study Extensions section. Click in the table of load cases to select or
remove loads and constraints from the load case.
When you have defined all load cases, you can compute the solution. The COMSOL Multiphysics software then
solves for all load cases directly. In the plot groups that are created, a Load case list in the Data section of the Settings
-----
u- + u = c u + F (3-3)
t
where is the convective velocity vector, c is the diffusion coefficient, u is a transported scalar, and F is a source
term. The underlying finite element discretization method in COMSOL Multiphysics is the Galerkin method.
When discretizing Equation 3-3 using the Galerkin method, the resulting numerical problem becomes unstable for
an element Pé clet number (Pe) larger than one (Ref. 1):
h
Pe = ------------ 1 (3-4)
2c
where h is the mesh element size. The Pé clet number is a measure of the relative importance of the convective
effects compared to the diffusive effects; a large Pé clet number indicates that the convective effects dominate over
the diffusive effects.
Oscillations can occur where any of the following conditions exist and the Pé clet number exceeds one:
• A Dirichlet boundary condition can lead to a solution containing a steep gradient near the boundary, forming a
boundary layer. If the mesh cannot resolve the boundary layer, this creates a local disturbance.
• A space-dependent initial condition that the mesh does not resolve can cause a local initial disturbance that
propagates through the computational domain.
• A small initial diffusion term close to a nonconstant source term or a nonconstant Dirichlet boundary condition
can result in a local disturbance.
As long as diffusion is present, there is — at least in theory — a mesh resolution beyond which the discretization
is stable. This means that the spurious oscillations can be removed by refining the mesh. In practice, this method
is seldom feasible because it can require a very dense mesh. Instead, it is common practice to use stabilization
methods — that is, methods that add artificial diffusion. The COMSOL products include several such methods,
some of which are described in An Example of Stabilization.
Several physics interfaces have these settings available, and below you find the common information about the
stabilization settings. Differences not described below are noted for the individual interface documentation.
CONSISTENT STABILIZATION
To enable this section, click the Show More Options button ( ) and select Stabilization in the Show More Options
dialog box.
There are two consistent stabilization methods: Streamline diffusion and Crosswind diffusion. Usually, both check
boxes for these methods are selected by default and should remain selected for optimal performance. Consistent
stabilization methods do not perturb the original transport equation.
Residual
In some cases, and for both consistent stabilization methods, select a Residual (or Equation Residual). Approximate
residual is the default setting and it means that derivatives of the diffusion tensor components are neglected. This
setting is usually accurate enough and is faster to compute. If required, select Full residual instead.
INCONSISTENT STABILIZATION
To enable this section, click the Show More Options button ( ) and select Stabilization in the Show More Options
dialog box.
There is usually just one inconsistent stabilization method — Isotropic diffusion. This method is equivalent to
adding a term to the diffusion coefficient in order to dampen the effect of oscillations by making the system
somewhat less dominated by convection. If possible, minimize the use of the inconsistent stabilization method
because by using it you no longer solve the original problem. By default, the Isotropic diffusion check box is not
selected because this type of stabilization adds artificial diffusion and affects the accuracy of the original problem.
However, this option can be used to get a good initial guess for underresolved problems.
If required, select the Isotropic diffusion check box and enter a Tuning parameter id as a scalar positive value. The
default value is 0.25 (a reasonable value to start with is roughly 0.5 divided by the element order). A higher value
adds more isotropic diffusion.
• An Example of Stabilization
• Stabilization Techniques
An Example of Stabilization
This example uses the Heat Transfer interface. To illustrate the concepts, consider the problem
u u 2u 2u
cos --- ------ + sin --- ------ = 10 – 4 --------- + --------- + 1 (3-5)
3 x 3 y x 2 y 2
solved on the unit square. Equation 3-5 is discretized using 10 times 10 quadratic Lagrange elements. The
boundary conditions are:
• u 1 for x 0
• u 1 for y 0
• u 0 for x 1
• u 0 for y 1
Figure 3-26 shows the mesh and boundary conditions. In general, using uniform meshes for transport problems is
not recommended. Nevertheless, this example uses a uniform mesh to demonstrate the different stabilization
techniques.
The expected solution rises slowly and smoothly from the left and lower boundaries and has sharp boundary layers
along the upper and right boundaries. Figure 3-27 shows a reference solution obtained using 100-by-100 quadratic
Lagrange elements with streamline diffusion and crosswind diffusion (see the next section). The arrows indicate
the direction of .
u1 u0
u1
Figure 3-26: The computation domain, mesh, and boundary condition for Equation 3-5.
Figure 3-27: Reference solution of Equation 3-5. Solved using 100 times 100 quadratic elements with streamline
diffusion and crosswind diffusion.
1 0.1
Pe = ------------------- = 500>>1
2 10 –4
Figure 3-28 displays the solution obtained using the mesh in Figure 3-26 and (unstabilized) Galerkin
discretization. As can be expected with such a high Pé clet number, the unstabilized solution shows little, if any,
resemblance to the reference solution in Figure 3-27. The right plot in Figure 3-28 shows a cross-sectional plot
along the dashed line, y 0.8 and the corresponding reference solution. Notice that the unstabilized solution is
destroyed by oscillations.
The Stabilization Techniques section explores how different stabilization techniques affect the solution of this
example.
Stabilization Techniques
Several techniques for handling numerical instabilities without the need for mesh refinement are available. They all
have in common that they add terms to the transport equation. These terms introduce numerical diffusion (artificial
diffusion, artificial viscosity, or numerical viscosity are other common names) that stabilize the solution. To display
these sections, click the Show More Options button ( ) and select Stabilization in the Show More Options dialog box.
CONSISTENT STABILIZATION
A consistent stabilization method adds numerical diffusion in such a way that if u is an exact solution to
Equation 3-3, then it is also a solution to the problem with numerical diffusion. In other words, a consistent
stabilization method gives less numerical diffusion the closer the numerical solution comes to the exact solution.
INCONSISTENT STABILIZATION
An inconsistent stabilization method adds numerical diffusion in such a way that if u is an exact solution to
Equation 3-3, then it is not necessarily a solution to the problem with numerical diffusion. In other words, an
inconsistent method adds a certain amount of diffusion independently of how close the numerical solution is to the
exact solution.
ISOTROPIC DIFFUSION
Adding isotropic diffusion is equivalent to adding a term,
c art = id h
to the physical diffusion coefficient, c. Here id is a tuning parameter. This means that you do not solve the original
problem, Equation 3-3, but rather the modified O(h)-perturbed problem
u
------ + u = c + c art u + F (3-6)
t
Hence, isotropic diffusion is an inconsistent stabilization method. If id 0.5, the new cell Pé clet number can be
expressed as
Clearly, as approaches infinity, Pe approaches, but never exceeds, one. While a solution obtained with isotropic
diffusion might not be satisfactory in all cases, the added diffusion definitely dampens the effects of oscillations and
impedes their propagation to other parts of the system. It is not always necessary to set id as high as 0.5 to get a
smooth solution, and its value should be smaller if possible. A good rule of thumb is to select 0.5p, where p is
the order of the basis functions. The default value is id 0.25
Figure 3-29 shows the effect of isotropic diffusion on Equation 3-5 with id 0.25. Although the solution is
smooth, the comparison with the reference solution in the right plot reveals that the isotropic diffusion introduces
far too much diffusion.
Figure 3-29: Equation 3-5 solved using isotropic diffusion. The right plot compares the stabilized solution (dashed line)
along y = 0.8 with the reference solution (solid line).
STREAMLINE DIFFUSION
The streamline diffusion method in the COMSOL Multiphysics software is a consistent stabilization method. When
applied to Equation 3-3, it recovers the streamline upwind Petrov–Galerkin (SUPG) method, but it can also
recover functionality from the Galerkin least-squares (GLS) method. Both methods are described below. For
theoretical details, see Ref. 1 and Ref. 2.
Figure 3-30 displays the effect of SUPG on the solution of Equation 3-5. The solution closely follows the reference
solution away from the boundary layers, but at the boundary layers, oscillations occur. This is a typical behavior for
streamline diffusion: the solution becomes smooth and exact in smooth regions but can contain local oscillations
at sharp gradients.
u
------ + u = c u + su + F (3-7)
t
sh
Da = ---------
A new dimensionless number can be formed by combining the Damkö hler number and the Pé clet number:
s h2
2DaPe = ------------ (3-8)
c
The (unstabilized) Galerkin discretization becomes unstable if 2DaPe > 1 (Ref. 4), that is, if the
production/absorption effects dominate over the viscous effects. GLS differs from SUPG in that GLS relaxes this
requirement while SUPG does not.1
CROSSWIND DIFFUSION
Streamline diffusion introduces artificial diffusion in the streamline direction. This is often enough to obtain a
smooth numerical solution if the exact solution of Equation 3-3 (or Equation 3-7) does not contain any
discontinuities. At sharp gradients, however, undershoots and overshoots can occur in the numerical solutions (see
Figure 3-30). Crosswind diffusion addresses these spurious oscillations by adding diffusion orthogonal to the
streamline direction — that is, in the crosswind direction.
Crosswind diffusion methods are consistent, but they are also nonlinear. This means that the discrete equation
system becomes nonlinear even if the original equation (Equation 3-3 or Equation 3-7) is linear, which can increase
the computational cost.
1. The streamline diffusion stabilization in COMSOL Multiphysics is GLS but without any viscous terms in the test operator in the stabilization
term.
c c
– h ------- g ij -------
x i x j
where gij is the covariant metric tensor. The coefficient h is for Navier–Stokes systems a modified version of the
Hughes-Mallet (HM) formulation of Ref. 6. In the scalar case, the modified HM formulation reduces effectively
to the form suggested in Ref. 6. Additionally, Ref. 7 suggests to reduce h for higher-order elements. The
formulation in the COMSOL Multiphysics software multiplies h with a factor
2 1 – N
Figure 3-31 shows the example problem (Equation 3-5) solved using streamline diffusion and crosswind diffusion.
Oscillations at the boundary layers are almost completely removed (compare with Figure 3-30), but it has been
achieved by the introduction of some extra diffusion. In general, crosswind diffusion tries to smear out the
boundary layer so that it becomes just wide enough to be resolved on the mesh (Figure 3-26). To obtain a sharper
solution and remove the last oscillations, the mesh needs to be refined locally at the boundary layers.
Figure 3-31: Equation 3-5 solved using streamline diffusion and crosswind diffusion. The right plot compares the
stabilized solution (dashed line) along y = 0.8 with the reference solution (solid line).
2. R. Codina, “Comparison of Some Finite Element Methods for Solving the Diffusion-Convection-Reaction
Equation”, Comput. Methods Appl. Mech. Engrg., vol. 156, pp. 185–210, 1998.
3. C. Johnson, Numerical Solution of Partial Differential Equations by the Finite Element Method, Student
literature, 1987.
4. G. Hauke, “A Simple Subgrid Scale Stabilized Method for the Advection-Diffusion-Reaction Equation”,
Comput. Methods Appl. Mech. Engrg., vol. 191, pp. 2925–2947, 2002.
5. G. Hauke and T.J.R. Hughes, “A comparative study of different sets of variables for solving compressible and
incompressible flows”, Computer Methods in Applied Mechanics and Engineering, vol. 153, pp. 1–44, 1998.
6. E.G.D. do Carmo and A.C. Galeão, “Feedback Petrov-Galerkin methods for convection-dominated problems”,
Computer Methods in Applied Mechanics and Engineering, vol. 88, pp. 1–16, 1991.
7. E.G.D. do Carmo and G.B. Alvarez, “A new upwind function in stabilized finite element formulations, using
linear and quadratic elements for scalar convection-diffusion problems”, Computer Methods in Applied Mechanics
and Engineering, vol. 193, pp. 2383–2402, 2004.
• Unit Systems
• Indication of Unexpected, Unknown, or Inconsistent Units
• Setting the Unit System for Models
yotta Y 1024
zetta Z 1021
exa E 1018
peta P 1015
tera T 1012
giga G 109
mega M 106
kilo k 103
hecto h 102
deca da 101
deci d 10-1
centi c 10-2
milli m 10-3
micro u 10-6
nano n 10-9
pico p 10-12
femto f 10-15
atto a 10-18
zepto z 10-21
yocto y 10-24
Both the name and the symbol can be used for a unit (but only names that form a single word without spaces or
hyphens are possible to use). For example, 2.4[ampere] and 2.4[A] are both valid to indicate an electric current
in SI units. The SI units can also contain standard prefixes. Appending a unit means that you multiply the constant
or variable to the left of the unit declaration with this unit. This multiplication takes precedence over other
operators so, for example, 1/2[m] evaluates to 0.5 m1 (0.5[1/m]) whereas both (1/2)[m] and 1/2*1[m]
evaluate to 50 cm (0.5[m] or 50[cm]). Also, if L is a variable defined as 2[m], L[1/s] evaluates to 2[m/s].
• Adding two quantities of the same kind that use different units: 0.5[ft]+33[mm]. The COMSOL Multiphysics
software converts the result to the base unit system’s length unit (0.1854 m for SI units, for example). A quantity
without a unit is treated as given in the base unit’s systems unit, so, for example, 0.5+33[mm] evaluates to
0.533 m when using SI units.
• Using multiplication with a unit to get consistent units for two quantities that you want to add, for example,
14[kg]+[Link][m^3], which works if [Link] represents the density for a heat transfer model. You can also
concatenate several units, for example, 3.6[N][m], which is equivalent to typing 3.6[N*m] and evaluates to
3.6 N·m.
For unit names with spaces and hyphens, such as British thermal unit and pound-force, only use the
symbols when declaring units.
It is possible to add constants (without units) to any quantity. The COMSOL Multiphysics software then assumes
that this value has the same unit as that quantity (as indicated in the Settings window).
All data in the material databases and Material Library product use SI units and this unit syntax.
• If user-defined parameters or variables are used in the physics, it is good practice to use the unit syntax to define
them. The Settings windows for parameters and variables display the resulting unit, in the models base unit
system, of user-defined parameters and variables. It is important to verify that the variables have the expected
unit before using them in the physics settings. The unit of parameters and variables is otherwise undefined.
• Most user-defined and built-in functions expect dimensionless inputs and outputs, so it is good practice to use
make inputs, such as time, dimensionless using unit syntax. If the input is not dimensionless, the COMSOL
Multiphysics software marks the expression in an orange color and reports an unexpected unit of input. For
example, to use the time t as input to a Rectangle function rect1, use [1/s] to make the input dimensionless:
rect1(t[1/s]).
• Using properties with undefined units in a model does not affect the numerical results during the analysis, but
undefined units are required in the results and visualization stages — expressions involving such parameters and
variables are also unitless.
• If other units than the base unit system’s units are used or if SI prefixes are included, the conversion to base units
also affects the value (quantity) using a scaling factor (and an offset for temperature units). The Value column in
a Settings window for Parameter displays the quantity and unit in the base unit system so that you can see the
result of the unit conversion. For example, a parameter is defined as 3[ft], the result in the Value column is
0.9144 m if the base unit system is SI.
• Table 3-8 lists the SI units for the seven base quantities.
• Table 3-9 lists the SI derived units supported in COMSOL Multiphysics.
• Table 3-10 lists additional units available in the COMSOL Multiphysics software regardless of the unit system
in the model. If more than one name or symbol is available, use any of them, except when names contain more
than one word or a hyphen. See also the tables with special units for other unit systems than the SI system; special
units that are not listed in Table 3-10 are only available when using such non-SI unit systems.
• Table 3-11 lists other SI derived units without special names or symbols.
TABLE 3-8: BASE SI UNITS.