Component
Use the Component node () to collect nodes that define something specific that are needed in several places, or to group nodes together to avoid long lists of nodes under a feature or property.
To add a Component:
In the Home toolbar click the Component button ().
Under Building Blocks, right-click Components and add it from the context menu.
To add a wide variety of features, right-click the Component node or click the buttons on the Component, Model, or Physics Interface toolbars. The available features are described throughout this chapter.
The Settings window has a section to specify parameters.
For information about the Dependencies window’s information about dependencies, see Dependencies.
Parameters
Specify parameters by filling in the columns Name, Description, and Default expression. Select the Read only checkbox to prevent Component Link nodes from altering the expression entered in the Default expression field. This is useful when a complicated parameter expression is needed by the component, but the expression is not something that the Component Link should change. Otherwise, a parameter expression can be changed for each component link that uses this component.
Press Ctrl+Space in the Default expression field underneath the table or click the Insert Expression button () in the toolbar above to open an insert expression menu of available expressions to insert. To help with distinguishing between normal parameters and target parameters in Component Link nodes, there are two submenus in the insert expression menu: the Arguments and Target Arguments submenus list both parameter name spaces with their respective prefixes. For Components nodes, only the Target Argument submenu is available for the Default expression column. In all other nodes, you only find the Arguments submenu.
There is also a warning in the Expression and Default expression columns when the COMSOL software detects obvious mistakes in accessing parameters (for example, missing parameters, missing target parameters, and incorrect use of the arg prefix when it probably refers to a target parameter).
Click the Correct target parameters... button () a conversion tool that can do the following:
In Component Link nodes it finds all use of arg.XXX where XXX is not available in the parent’s parameters and is available in the target’s parameters. It replaces all those names with targ.XXX.
In Component nodes it finds all use of arg.XXX in the default expressions where XXX is available in the component’s parameters. Except for a few exceptions it will replace those cases with targ.XXX. The exceptions are:
-
-
The replacement cause an obvious circular dependency (for example, AA = arg.BB, BB = str.append(targ.AA, '_suffix').
For all read-only expressions that only contain targ.XXX (after above replacement) and loop.XXX it moves the parameter definition to a new Local Parameters node. Note that it is enough that the default expression contains one arg.XXX that will not be replaced to skip the move.
You can also do this conversion while you compile an archive in the Physics Builder Manager.
Settings
From the Loop list, select None (the default), Parameter, Selection, or Pair.
Select Parameter to activate looping over the elements of a dependent variable. Enter the Name, Description, and Default expression in the corresponding columns of the table.
Select Selection to activate looping over the selections that was defined by the Component Link. Enter a name for the selection in the Name field.
Select Pair to loop over all pairs with this component. This is equivalent to the parameter syntax par.pairs that also does a loop of all pairs. The Pair option is a specialized options for this parameter syntax.
Scope
In this section you can define a local scope for the scope prefix. Use the Add ()and Delete () buttons to add or remove the row for the scope prefix to the table, which is equivalent to activating and deactivating the possibility to use this prefix. In the Description column, you can enter a text explaining what the scope prefix is used for. Inside the component, the scope prefix can be used as any other scope prefix in, for example, the settings for a Variable Declaration node.