Introduction to COMSOL Multiphysics 4: Building a model

Parameters, Functions, Variables, and Model Couplings

This section will help you explore working with Parameters, Functions, Variables, and Model Couplings. For this purpose you can continue working with the same model from the preceding section. Locate and open the file busbar.mph if you do not already have it on the COMSOL Desktop.

Global Definitions and the Definitions contain functionality that assists you in preparing model inputs and model couplings and in organizing simulations. You have already used the functionality for adding Parameters to organize model inputs in Global Definitions.

Functions, available as both Global Definitions and Definitions, contain a set of predefined functions that can be useful when you set up multiphysics simulations. For example, the Step function can create a smooth step function for defining different types of switches. To illustrate using functions, assume that you want to add a time-dependent study to the busbar model by applying an electric potential across the busbar that goes from 0 V to 20 mV in 0.5 seconds. For this purpose, you could use a step function to be multiplied with the parameter Vtot. Add a function that goes smoothly from 0 to 1 in 0.5 seconds to find out how functions can be defined and verified.

Defining Functions

Right-click the Global Definitions node and select Functions>Step.

In the Settings window, enter 0.25 in the Location edit field to set the location of the middle of the step, where it has the value of 0.5.

Expand the Smoothing section. In the Size of the Transition zone, set the width of the smoothing interval. Enter 0.5 in this edit field.

Click the Plot button .

The plot verifies that you have defined the function correctly.

You can also add comments and rename the function to make it more descriptive.

Right-click the Step 1 node in the Model Builder and select Properties.

In the Properties window you can enter the desired information.

Global Definitions and Definitions can contain Variables, which are expressions of the dependent variables—the variables that are solved for in a simulation. You can define global variables that can be used in several models.

For the sake of describing this procedure, assume that you want to introduce a second model to represent an electric device connected to the busbar through the titanium bolts.

A first step would be to specify that Model 1 represents the busbar by renaming it.

Renaming Nodes

Right-click the Model 1 node and select Rename.

In the Rename Model dialog box, type Busbar.

When you have renamed the Model 1 node to Busbar, save the model.

Defining Model Couplings

The next steps are only demonstrated here and you do not need to reproduce them. In the Definitions under Busbar (mod1), you could introduce a Model Coupling that integrates any Busbar (mod1) variable at the bolt boundaries facing the electric device. You could then use this coupling to define a Variable—in Global Definitions—that calculates the total current. This variable would then be globally accessible and could, for example, form a boundary condition for the current that is fed to the electric device in the Electric Device (mod2) node.

The Model Couplings in Definitions have a wide range of use. The Average, Maximum, and Minimum Model Couplings have applications in generating results as well as in boundary conditions, sources, sinks, properties, or any other contribution to the model equations. The Probes are meant for monitoring the solution progress. For instance, you can follow the solution in a critical point during a time-dependent simulation or at parameter value in a parametric study.

You can also use the Model Couplings to map variables from one face in a model to another (called extrusion couplings) and also to integrate a variable along curves and map from one entity to another (called projection couplings).

To learn more about working with Definitions, in the Model Builder select a Definitions or Global Definitions node and press F1 or go to the Help menu and select Dynamic Help. The Dynamic Help displays help on the selected item in the Desktop and provides links to the documentation. Please allow up to a minute for the Dynamic Help to load the very first time it is activated. (The next time it will be quicker).

You will find an example of using the average operator in “Parameter Sweeps, Parallel Computing” on page 70.

In “Built-in Functions” on page 109, you will find a list of available COMSOL functions.

Next Page