COMSOL Tips & Tricks - App Builder

Published: Tue, 07/07/15

Since the COMSOL Application Builder has been added to COMSOL release v5.0 last year (with improvements in v5.1 earlier this year) we have developed a collection of customer specific applications and are in the process of developing a few generally available applications for public use.  Even though we’ve been using COMSOL Multiphysics for many years the Application Builder functionality is a new venture for us and has caused us to think on a higher level – on a software developer level.  And, of course, we’re learning the hard way how to become good application developers – making mistakes and overcoming those mistakes as a team.  To help you get over the learning curve a little faster than we have, we wanted to pass along one tip that we’ve found particularly helpful along the way. 

Let us quickly introduce the process of building an application in COMSOL to give a context for the tip:


Developing a COMSOL Application amounts to taking a functioning COMSOL model file and putting a wrapper around it with an eminently simple interface that is designed to be easily used and understood by a general user with a non-technical background.  The programming required to develop this interface can be as simple as using the Application Wizard to add predefined buttons, input fields, and plots.  This method is quick and simple but, in practice, we’ve found that taking advantage of the advanced programming capabilities of the Application Builder is necessary for developing commercially viable applications up to AltaSim standards.

If you need to use the Method editor advanced programming capabilities, we’d like to recommend three “helper commands” that we’ve found extremely helpful for debugging your code:  message(), debugLog(), and alert().  Say, for example, we needed to read a post-processing value into a method editor variable named, tot_layers.  To confirm this value has been read in properly as an integer, we recommend using one of the three commands with a red star (see screen shot below taken from the Method editor):

The command, message(), will output the value to the Messages tab during runtime of your application.  The command, debugLog(), will output to the debug log within the Application Builder environment.  And, the alert() command will output the value in a separate pop-up window that can be closed.  More than once we’ve been surprised by the value and have been able to quickly debug the error in our code development using these commands!  All of our applications developers have used these commands more than once so we thought we’d pass the tip along to you! Happy app building!


More to come...


Jeff & Kyle
Principals


PS. Remember to check out the COMSOL Midwest Meeting coming July 22, 2015

Phone: 614-861-7015
www.AltaSimTechnologies.com