Centre d'apprentissage

Course:

Getting Started with Building Simulation Apps

Modifying Command Sequences and Creating Methods to Customize App Operation


When developing a simulation app using the Application Builder in COMSOL Multiphysics, it is likely to include buttons to perform various actions in your app. You can customize the actions that are triggered by any button in your simulation app through modifying the command sequences and creating Java methods using the Method Editor. Examples include a button that updates the graphical display to show the geometry (such as when a user has changed dimensions of the design) or a button that computes the model then plays a sound to alert that the computation has finished. Learn how to make such further customizations here.

Tutorial: Command Sequences and Methods

The simplified thermal microactuator tutorial model is used for the model example, which a simulation app was developed for previously. Here, the simulation app is customized by making changes to the Compute button so that upon the computation finishing both a sound is played as well as a plot of the stress and deformation is displayed by default. This involves adding to a linear sequence of commands. For more flexibility the command sequence can be converted into a java method and then continue to be edited by writing code. Making changes to the app using the Method Editor is shown. Topics covered in the tutorial video include the following:

  • Overview of command sequences
    • Choose Commands to Run section
    • Modifying the command sequence
  • Converting a command sequence into a method
  • Overview of the Method Editor
    • Writing code in the Method Editor
    • Using Ctrl+Space for code completion in the Method Editor
  • Referencing features from the model tree in methods
    • Enabling tags to display in the Model Builder window

Further Learning


Submit feedback about this page or contact support here.