Physics Builder Tools > Components > Usage Condition

Usage Condition
The Usage Condition () node puts a condition that enables or disables its children. You can use the condition in a variety of contexts — for example, for variable definitions under a feature or for solver and mesh defaults. The kind of conditions you can use differ between contexts because some conditions cannot be evaluated in all contexts.
In general, to add a Usage Condition right-click a node and add it from the context menu.
Component Link nodes can exist under a Usage Condition node with the limitation that the target Component node adds no user inputs, sections, or other user input groups. If it does, error message appears.
The Settings window has one section. The description covers all possible conditions, but some are not visible based on the context.
Usage Condition
Select a Condition: Explicit, And condition, or Or condition. For And condition and Or condition define a usage condition that evaluates as a Boolean operation (and or or) between other usage conditions. Add usage conditions to the Input condition list. For any choice, select the Invert condition check box to invert the entire condition.
The following settings are for an Explicit Condition.
Restrict to Space Dimensions
Select the Restrict to space dimension check box to enable a condition on the geometry dimension used by the model in the Model Builder. Add any of the following: 0D, 3D, 2D, Axial symmetry (2D), 1D, and Axial symmetry (1D).
Restrict to Geometric Entity Levels
Select the Restrict to geometric entity levels check box to enable a condition on the geometric entity level of the context, which can be the entity level of a feature. The allowed levels are Global, Domain, Boundary, Edge, and Point.
For results and mesh defaults, the check box is called Restrict to entity dimensions and has the options Volume, Surface, Line, Point, and Global.
Restrict to Study Types
Select the Restrict to study types check box to enable a condition on the study type currently solved for. This is applicable for usage conditions under Features, Properties, Study and Solver Defaults, and Result Defaults. A common example is when you want to define the result of a time derivative such as:
timeDerivative(A)
in time-dependent study types but
iomega*A
in frequency-domain study types. The most important study types are Stationary, Time Dependent, Frequency Domain, Eigenfrequency, and Eigenvalue. There are also other alternatives, but some of these require additional licenses or modules.
Study and Study Step Types in the COMSOL Multiphysics Reference Manual
User Input
This section depends on user inputs in the parent feature, parent property, or some property. Select the User input check box to enter the following.
Choose an option from the Specify user input list: By reference, By name, or In expression.
If the usage condition is under a feature or property, which might contain other user inputs, choose By reference to directly refer to any of those user inputs by in the list. Then choose the User input and the User input condition. The options available depend on the user input referred to, but the condition can either check if the User input is active, or if the User input has any of certain values, in which case enter these in the Values table.
Select By name to enter a name in the User input text field. Choose an option from the User input from list: Containing feature or property (the default), Parent feature, Study step, or Another property. For Another property enter the Property that contains the user input in the field. Also choose the User input condition as described above.
For usage conditions under Study and Solver Defaults, Result Defaults, and Mesh Defaults, the By name option is the only way to refer to a user input. Furthermore, they can only refer to user input under a property, so there is no such choice either. Instead, there is an option to choose the type of condition in the Condition on list. The option User input in property enables the usage condition on a user input under a property. With the option Feature is active, the usage condition is true if there exists an active feature of a certain type. You specify the type in the Feature type field. Select the Condition is not fulfilled for undefined references check box to if you want the condition to be treated as not fulfilled instead of throwing an error if the property is undefined.
Select In expression as a general tool that can evaluate an expression of relations and Boolean operators that are entered in the Condition text field. It also supports some special functions and names, summarized in the following table:
Logical and between conditions.
Logical or between conditions.
Logical not of a condition.
There are some special rules for these expressions that differ from ordinary tensor expressions:
The par prefix is the default prefix and can be omitted in some situations. An input named par have to be accessed with par.par.
The operator isActive is only allowed in Usage Condition nodes. Using the operator in another context results in an error.
The only allowed prefixes are par, arg, and entity. All other prefixes are not recognized and most likely cause an unknown input error.
The Require input is active check box is selected by default. It is only applicable when specifying a user input to check by reference or by name, not for expressions. When selected, the activation condition is only true if the checked user input is also active as decided by its activation conditions. For expressions, you can achieve the equivalent logic using the isActive operator.
Select the Invert condition check box to invert (negate) the defined condition.