Utilizing Keyboard Shortcuts
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
- The / or + key on the keyboard number pad collapses and expands a branch in the model tree or application tree
- 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).
The same model tree fully collapsed (left) and fully expanded (right).
Useful Keyboard Shortcuts for COMSOL Multiphysics®
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:
|Open a COMSOL file, such as an MPH-file (.mph)
|Test application; launch application for testing
|Clear the selection of all domains, boundaries, edges, or points in the Model Builder; clear all selections in form editor windows
|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
|Undo the last operation
|Redo the last undone operation
|Opens the autofill drop down for variables. You can see an example of this in the Find and Autocomplete section of a previous article in this course.
|Ctrl+Mouse Scroll Wheel
|Zoom in and out in the Graphics window
|On Windows®, you can hold Alt and type ASCII numbers into text fields with the number pad
|Open the Help window to display context help and access the user documentation
|Rename the selected node, file, or folder
|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
|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:
|Check the syntax in the method; problems appear in an Error and Warnings window.
|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).
|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 = ,
where you can use the locally declared variable
pg4 throughout the method.
|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 “
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
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.
|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.
Here, we have just scratched the surface of how you can use keyboard shortcuts to become more productive during your COMSOL Multiphysics® modeling sessions. Explore these 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. The Appendix B — Keyboard and Mouse Shortcuts section in the Introduction to COMSOL Multiphysics documentation lists all available shortcuts. In the COMSOL Multiphysics Reference Manual, you will find additional information about how to customize your modeling environment.