How to Customize the COMSOL Desktop® and Use Keyboard Shortcuts

Magnus Ringh December 11, 2018
Share this on Facebook Share this on Twitter Share this on LinkedIn

The COMSOL Desktop® is the integrated user environment for creating and managing simulations in the COMSOL Multiphysics® software. It includes the Model Builder window, model tree, Graphics window, as well as menus and toolbars with a multitude of modeling tools. In this blog post, we will show you how to customize the user interface and use a variety of keyboard shortcuts to get the most out of the modeling process.

Customizing the Layout of the COMSOL Desktop®

The COMSOL Multiphysics user interface contains a number of windows, each with its own purpose. The following windows are always present:

  • Model Builder, which provides a model tree with an overview of the contents of your current model
  • Settings, which contains all settings for the selected node in the Model Builder window
  • Graphics, which displays the geometry and mesh and also shows plots of the results
  • Messages, Progress, and Log, which usually appear as a group of three tabbed windows at the bottom of the screen and provide general messages, progress for the solvers, and a log of the model properties and solver activities, respectively

Of these windows, only the Messages window can be closed. There are also a number of other windows that you can open from the Window menu.

 

Maximizing Windows

If you want to increase the size of the Graphics window for displaying a results plot, for example, you can maximize it by double-clicking at the top of the window. The window then becomes maximized and all other windows are hidden. Double-click again and the user interface is restored to the previous layout, before the window was maximized. You can maximize any window in the user interface this way.

Resizing, Floating, Hiding, and Closing Desktop Windows

To resize a window, click and drag the edges of the window to increase or decrease its width or height. You can also make a window “float”, or detach it, in three ways. One option is to drag the window outside of the desktop, or you can right-click the window and choose Float. Or, choose Float from the Window position menu at the upper-right corner of the window (the small downward-pointing arrow). This detaches the window, which “floats” as a separate window on the screen. You can move and resize a floating window as desired.

To dock a floating window, right-click at the top of the window and choose Dock, or choose Dock from the Window position menu. The window is then docked into its previous location. You can also move a floating window on top of the COMSOL Desktop and click it to display a positioning guide. Then, you can move the floating window to the position relative the window that you positioned it above. The floating window is docked into that position (see the next section).

To hide a window in the Linux® operating system or macOS version of the software, right-click the top of the window and choose Toggle hide or click the Toggle hide button at the upper-right corner of the window (the pushpin icon). The window is hidden, but its name appears in the left or right margin. To restore the window, move the mouse to the window’s name in the margin, right-click the top of the window, and choose Toggle hide or click the Toggle hide button.

To hide (minimize) a window in the Windows® version, click the Minimize button in the upper-right corner of the window. It then appears as an icon in the right margin. Click the Restore button to restore the user interface after minimizing the window. You can also right-click the window icon below the Restore button and choose Restore.

Some of the most important windows, listed at the start of this blog post, are not closable. To close any of the other windows, click the Close button (the cross). To open a closed window again, choose it from the Windows menu.

Tiling Plot Windows to Show Multiple Plots and Graphs

Let’s use the flexibility of the user interface to tile several plot windows so that you can view them simultaneously. As mentioned above, the Graphics window is permanent and cannot be closed or renamed, but you can direct your plots to separate Plot windows, a similar type of window that can be renamed and closed. By putting each plot in a separate Plot window with a descriptive name, you can create tiled plots showing different aspects of a model solution. When you make a Plot window float, you can position it on top of another Plot window, acting as the “base window”. Then, click with the mouse and the positioning guide appears. Using the positioning guide, you can tile the floating window to the right of the “base window”, for example, and continue to add more Plot windows. Shown below are four tiled Plot windows.

A screenshot of the COMSOL Desktop® with four tiled plot windows.
Four Plot windows tiled to show four aspects of the model solution (clockwise from the top-left plot: isothermal contours, stress distribution, closeup of the stress at the solder joint, and a convergence plot for the nonlinear solver).

Restoring the COMSOL Desktop® to a Built-In Layout

After adding and rearranging a number of windows, you might want to return to the default layout. To do so, click the Reset Desktop button. This will close any added windows and restore the size and position of the windows discussed previously.

There are two built-in layouts to choose from:

  • Widescreen
    • Designed for larger, widescreen displays
    • The Model Builder, Settings, and Graphics windows appear side by side
  • Regular Screen
    • Designed for smaller, regular screens
    • The Model Builder window is placed on top of the Settings window, with the Graphics window on the side

One of these layouts is always selected, and it’s the selected layout that the Reset Desktop button restores.

A screenshot of a widescreen layout of the COMSOL Desktop®.
A screenshot of a COMSOL Multiphysics® user interface layout after being reset.

The widescreen layout (left) and regular layout (right) for a reset desktop.

The desktop appears in your modified layout until you select the Reset Desktop button. You can use this ability to keep two custom layouts with a Widescreen Layout for one purpose and a Regular Screen Layout for another purpose. For example, if your desktop computer setup includes dual monitors, you can configure the Regular Screen Layout so that the COMSOL Desktop® appears in one monitor with the Model Builder and Settings windows (and perhaps other windows of interest). You can then have a floating and maximized Graphics window fill the second window. Such a configuration can be useful for postprocessing and visualization of results. The Widescreen Layout could then keep its basic integrated environment and perhaps be used for preprocessing and setting up the geometry and physics. You can then quickly switch between the custom layouts by choosing Widescreen Layout or Regular Screen Layout.

Customizing the COMSOL Desktop® for the Linux® Operating System and macOS

The previous examples use the Windows® version of the COMSOL Desktop®. The Linux® operating system and macOS version of the COMSOL Desktop® are slightly different. The following differences are the most important:

  • The Reset Desktop, Widescreen Layout, and Regular Screen Layout options are on the Desktop Layout submenu of the Windows menu
  • There is no Quick Access Toolbar
  • You can maximize a window by clicking the Maximize button in the upper-right corner of the window
  • The Minimize (left) and Maximize (right) buttons are in the upper-right corner of windows in the user interface for Linux® and macOS
  • There are no Float or Dock commands, but windows can be dragged outside of the COMSOL Desktop to make them float and can be moved to new positions
  • There is no positioning guide

 

Helpful Keyboard Shortcuts for Modeling in COMSOL Multiphysics®

Once you have learned and memorized the following keyboard shortcuts for frequently used commands and actions, they can help increase your productivity, replacing the need to use the mouse to access the corresponding functionality.

Navigating the Model Builder Tree

You can move up and down through the nodes in the Model Builder tree that represent the model in the Model Builder window by using the up and down arrow keys. In addition, you can use the following key combinations to navigate the model tree:

  • The right arrow key expands a node to show its subnodes
  • The left arrow key collapses a node to hide its subnodes
  • Alt+left arrow key (Ctrl+left arrow key on macOS) moves to the previously selected node in the Model Builder
  • Alt+right arrow key (Ctrl+right arrow key on macOS) moves to the next selected node in the Model Builder

You can also use the Collapse All and Expand All buttons on the Model Builder window toolbar. The following images show the same model tree fully collapsed and fully expanded (the fully expanded image does not show the entire expanded tree).

A screenshot of the model tree when fully collapsed.
A screenshot of the model tree when expanded.

The same model tree fully collapsed (left) and fully expanded (right).

Going to the Source

Another way to move around in the model tree is to use the Go to Source button. This button appears next to lists where you can select, for example:

  • The data set to use in a plot group
  • The solution to use in a data set
  • The study step that defines the settings for a solver
  • A common model input used as the value for a material property in a physics interface

Clicking the Go to Source button moves the focus from the node with that button to the node that contains the source selected in the list that the Go to Source button belongs to. For example, as shown in the following images, when you click the Go to Source button next to the Data set list in the Settings window for the Stress (solid) plot group, the focus moves to the Study 1/Solution1 (1) data set node under Data Sets above the plot group in the model tree.

 

When you click the Go to Source button for the data set, the focus moves to the Study 1/Solution 1 (1) data set, which is the data source for the plot.

The Quick Access Toolbar

The Quick Access toolbar appears at the very top of the COMSOL Desktop and contains a customizable set of buttons for common operations, such as New, Open, Save, Undo, Redo, Copy, Paste, and more. To customize the set of buttons on the Quick Access toolbar, click the down arrow to the right of the toolbar to open the Customize Quick Access Toolbar menu. You can then right-click the Quick Access toolbar; choose Show Quick Access Toolbar Below the Ribbon, for example, from a set of standard buttons; and add more commands.

When you choose More Commands, the Quick Access Toolbar dialog box appears. In the dialog box, you can choose commands to add or remove from the Quick Access toolbar using the Add>> and <<Remove buttons, respectively. When you select a command button in the set of active commands to the right, you can use the up and down arrow keys to change the order of the buttons.


The Quick Access Toolbar dialog box for adding, moving, and rearranging the buttons in the Quick Access toolbar.

Although most of the buttons in the Quick Access toolbar have predefined keyboard shortcuts, such as Ctrl+S for Save or Ctrl+Z for Undo, you can also activate numerical keyboard shortcuts for the Quick Access toolbar. To do so, press the Alt key. Numbers representing each button then appear (see the following image). Press the corresponding number keys to activate the command for that button.

A screenshot of the keyboard shortcuts for the Quick Access toolbar.
Press the Alt key to display the keyboard shortcuts for the Quick Access toolbar. Then, for example, press 2 to open a new model file.

Double-Clicking to Quickly Add Features

In many situations where you are adding something to a model, such as a physics interface, study, or material, simply double-click the item that you want to add. It is then added directly to the model tree without the need to click the Add to Component button, for example. In the Model Wizard, double-clicking a physics interface on the Select Physics page adds it to the list under Added physics interfaces without the need to click the Add button. On the Select Study page, double-clicking a study adds it under Added study and exits the Model Wizard without the need to click the Done button.

List of Useful Keyboard Shortcuts

There are many keyboard shortcuts available when using COMSOL Multiphysics. You are probably familiar with some of them from other software programs, such as Ctrl+S for Save; Ctrl+A for Select All; Ctrl+C and Ctrl+V for Copy and Paste, respectively; and the Del key for Delete.

Note: On macOS, Command+S, Command+A, and so on replace the commands using the Ctrl key on the Windows® and Linux® operating systems.

The following table includes some of the most useful keyboard shortcuts:

Keyboard Shortcut Description
Ctrl+O Open a COMSOL file, such as an MPH-file (*.mph)
Ctrl+F8 Test application; launch application for testing
Ctrl+D Clear the selection of all domains, boundaries, edges, or points in the Model Builder; clear all selections in form editor windows
Ctrl+F Open the Find tool for finding a search string in a model or application method and searching for specific strings in settings, descriptions, tags, and labels for nodes in the Model Builder and Application Builder trees
Ctrl+Z Undo the last operation
Ctrl+Y Redo the last undone operation
F1 Open the Help window to display context help and access the user documentation
F2 Rename the selected node, file, or folder
F7 Build the selected node in the geometry and mesh branches, compute the selected study step, compute to the selected node in the solver sequence, or plot a time-dependent, eigenfrequency, or eigenvalue solution; in Windows®, step into the method editor’s debugging tool in the Application Builder
F8 Build the geometry or mesh, compute the entire solver sequence, update results data, update the plot, or run the model method in a method call

F1, F2, and so on are function keys, typically located above the standard alphanumeric keypad on your keyboard.

Keyboard Shortcuts for the Application Builder

When you create methods in the Application Builder, you work with the code for the methods in a Method Editor window. In this environment, the following keyboard shortcuts can be especially useful:

Keyboard Shortcut Description
F8 Check the syntax in the method; problems appear in an Error and Warnings window.
F11 Go to the model node.

For example, if you highlight “pg4" in model.result("pg4").run();, the corresponding plot group node is highlighted in the Editor Tools window. In that window, click the Edit Node button to move to the corresponding node in the Model Builder window (to edit its settings, for example).

Ctrl+1 Create local variable declarations, which can simplify the code.

For example, the code model.result("pg4").run(); is then transformed to the following two lines: ResultFeature pg4 = model.result("pg4"); pg4.run;, where you can use the locally declared variable pg4 throughout the method.

Ctrl+K Create a shortcut to an object or menu; similar to Ctrl+1 but useful when you want to refer to an object, such as a plot group, by the same variable (shortcut) name in multiple methods.

For example, when you press Ctrl+K when highlighting “pg4” in model.result("pg4").run();, a Use Shortcut dialog box appears where you can provide a name for the shortcut and, as an option, update all methods. The shortcut pg4, representing Results/result/pg4, then appears under List of Shortcuts in the Settings window for the Declarations>Shortcuts node and can be used throughout all methods in the application to simplify the code.

Ctrl+R Record code; start recording the corresponding code for all subsequent modeling steps. The COMSOL Desktop® windows get a red frame to indicate that recording is in progress. Press Ctrl+R again to stop the recording. The recorded code is inserted in the active method used for the recording.

Using these keyboard shortcuts can help you to develop and debug methods for your simulation applications faster.

Key Takeaways

Here, we have just scratched the surface of how you can customize the COMSOL Desktop® and use keyboard shortcuts to become more productive during your COMSOL Multiphysics® modeling sessions. Explore these options to make the user interface fit your modeling needs, and try some of the keyboard shortcuts to see if they, once memorized, make some tasks faster and easier to perform.

There are many additional keyboard shortcuts and mouse shortcuts. “Appendix B — Keyboard and Mouse Shortcuts” in Introduction to COMSOL Multiphysics lists all available shortcuts. In the COMSOL Multiphysics Reference Manual, you will find additional information about how to customize your modeling environment.

Learn the Modeling Workflow at Your Own Pace

Learn how to use the COMSOL® software, including all of the steps of the COMSOL Multiphysics modeling workflow, with this growing series of self-paced tutorial videos and exercise files:

 

Linux is a registered trademark of Linus Torvalds in the U.S. and other countries. macOS is a trademark of Apple Inc., in the U.S. and other countries. Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.


Loading Comments...

Catégories


Tags