Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

COMSOL Webinar

Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

COMSOL Multiphysics

The Application Builder

Temesgen Markos Kindo, Ph.D.


Applications Engineer

Numerical Simulation with COMSOL Multiphysics


Integrated modeling, simulation,
and application design environment
Multiphysics models
Include and couple all relevant physics

Simulation apps enable crossfunctional product development


Build apps based on COMSOL software
models to deploy analysis capabilities to
collaborators and customers worldwide

All Industries Benefit from Multiphysics Simulation

A Complete Simulation Environment


COMSOL Desktop
Straightforward to
use, the Desktop
gives insight and
full control over the
modeling process

Model Builder
Provides instant
access to any of the
model settings
CAD/Geometry
Materials
Physics
Mesh
Solvers
Results

Graphics Window
Ultrafast graphic presentation,
stunning visualization

Product Suite COMSOL 5.2a

Custom Application Design Tools


Application Builder
Provides all the
tools needed to
build and run
simulation apps
Form Editor
Method Editor

Simulation Application
Any COMSOL model can be turned into an
app with its own interface using the tools
provided in the Application Builder

Run Custom Applications


COMSOL Server
Its the engine for
running COMSOL
apps and the hub for
controlling their
deployment,
distribution, and use

Simulation Apps
They can be run in a COMSOL Client
for Windows and major web browsers
Microsoft and Windows are either registered trademarks or
trademarks of Microsoft Corporation in the United States and/or other
countries.

Agenda
Designing Simulation Applications
Application Builder

Running Simulation Apps


COMSOL Server

Live Demos
Creating Apps
Deploying Apps

Q&A Session

Simulation results from a model


of a thermoelectric cooler.

COMSOL Applications

Application = Physics Model + User Interface


Can be password protected
In COMSOL Multiphysics

Configure double-clicking MPH file for


Editing app
Running app

Or deploy with COMSOL Server

Application Builder

Included in the Windows version of COMSOL Multiphysics


Can run Applications with COMSOL Multiphysics or COMSOL Server
Run with COMSOL Multiphysics in Windows, OS X, and Linux
Run with COMSOL Server in Windows, OS X, Linux, and any platform/OS supporting a browser

Two Editors
The Form Editor
For user interface design

The Method Editor


For programming

The Application Libraries

Creating Apps Requires Collaboration

Creating an application often requires a collaborative effort


by experts within the following areas

Physics
Numerical analysis
Programming
User-interface and graphic design

A well-crafted application

avoids accidental user input errors


keeps the focus on relevant output details

Different Uses for Simulation Apps

Spreading the use of your simulations


Visualizing results
Sophisticated way of parameterizing your model

More powerful than traditional methods


Easy to pick up at a later time

Link to legacy code in C, Java, FORTRAN

COMSOL Server is a cost-effective way to deploy multiphysics


analysis to more users

COMSOL Server

COMSOL Server

COMSOL Server

Deploy COMSOL applications


Throughout your organization
Worldwide access

Administrative tools

Immediate access to application updates


Create user accounts and privileges
Create user groups
Configure for using one dedicated app only
More

Run Applications in Two Ways

COMSOL Client for Windows


Free download: 40MB
Same look-and-feel as the COMSOL Desktop
Run with LiveLink products for CAD

Web Browser
No installation required
No browser extensions required
1D, 2D, and 3D graphics

Interactive 3D graphics using the WebGL standard

License Options COMSOL Server

See www.comsol.com/sla for complete licensing terms.


Trademarks are the property of their respective owners. See www.comsol.com/trademarks.

Getting Started
Application Wizard

New Form Wizard


Quickly Build the Simplest-Possible App
1. Load the model busbar.mph from the Application Library (many
other models would also work)
COMSOL Multiphysics>Multiphysics>busbar.mph

2. Switch to the Application Builder


3. Click the New Form button and create an app with
a) Three input fields: Length, Width, and Applied Voltage
b) One graphics object for the Temperature plot
c) One button for the Compute Study node

4. Click the Test Application button to run and test your app
5. Drag the form objects around and test different layouts

Graphic User Interface


Form Editor

Buttons & Command Sequences


1

1. Insert a GUI object


2. Highlight the object in Form Editor
3. In the settings window, choose
commands to run
4. Provide command arguments, if needed

21

31

41

Buttons & Command Sequences


Add a Plot Geometry Button
1. Insert Objects > Button
2. Drag new Button next to the Compute button
3. In the Settings window of the Button:
a)
b)
c)
d)
e)

Change Size to Large


Change Picture to geometry_32.png
Change the Text to Update Geometry
In the tree (Choose Commands to Run), double-click
Model>Component 1>Geometry 1
In the Arguments field next to the Plot Geometry command,
type graphics1

4.

Or click the Edit Arguments button below the command sequence table and select
the graphics object from a dialog box

Click Test Application to try it

Data Input
1. Insert a GUI object which can take data input
Input Field, Check Box, Combo Box, Slider
2. Highlight the object in Form Editor. In the settings window,
associate it with a data object (source)
3. Add Data Validation (optional)
4. Add an event which is triggered when data changes (optional)

21

1
31

41

Input Fields & Data Validation


Safe Inputs
1. Double-click the input field for the Length parameter
2. In the Settings window of the input field (inputfield1), locate
the Data Validation section
3. Select the check box for Minimum and change its value to 5
4. Select the check box for Maximum and change its value to 15
5. Type your own Error message
6. Click Test Application to try it, type in a number smaller than 5
or greater than 15
Note: the error message you see when using Test Application will
show additional debugging information as compared to running
with Run Application or COMSOL Server

Tools for Efficient App Building


Editor Tools
Add GUI objects and their most common command sequences in one step
Generate code associated with a node in the editor tree

Model Data Access


Access individual properties of a model tree that have not been parametrized

Record Code
Perform a sequence of operations in the Model Builder and get it as a code!

Language Elements
Pseudocode to code

Editor Tools
Add a Mesh Button
1.
2.
3.
4.
5.
6.

Open the Editor Tools window


Make sure you have form1 open and active
Right click Model>Component 1>Mesh 1 and select Button
Rearrange your buttons as needed
Click Test Application to try it
Optional:
Use Editor Tools to add an Input for the Thickness parameter

Use Editor Tools instead of Insert Objects for common form


objects + command sequences

Buttons, Input Fields, Data Displays, Graphics + some Combo Boxes and Check Boxes

Use Insert Objects for other form objects and custom


command sequences

Data Display Objects


Formatted Output for Max Temperature
1.

2.

3.

In the Model Builder>Results, add a Derived


Values>Maximum>Volume Maximum, for the
temperature T, for All domains.
In the Application Builder, use Editor Tools, rightclick the Volume Maximum node and select Output.
This creates a Data Display object and a Text Label
object.
Drag the Data Display object as needed.

Model Data Access


Adding a Combo Box for Element Size
1.
2.
3.
4.
5.
6.

Switch to the Model Builder


Change the Elements Size to Predefined
Click Model Data Access in the Ribbon
Select the check box next to Predefined
Switch back to the Application Builder
For the Busbar form (form1):
a)

Use Editor Tools and right-click Predefined Size, select


Input, this adds a Combo Box for the Element Size
b) In the Settings window for the Combo Box, change the
Initial value to From data source

7.

Rearrange as needed and test the application

Method Editor

Methods
Play a Sound
1.
2.
3.
4.

Double-click the Compute button


Click the Convert to New Method button
Click the Go to Method button
Add a method playSound(success.wav);
Use the Language Elements window to find all built-in methods that
start with play
Check the built-in sounds under the Libraries>Sounds node

5.

Can this instead be done with a command sequence?

Record Code
1.

Try Record Code to record code for the


operations you perform in the Model Builder
For example, try a few mesh operations

2.

Click Stop Recording and inspect the resulting


code

Check Box
Switch Electromagnetic Heat Source On/Off
1.
2.
3.
4.

5.
6.

In the Model Builder, locate Multiphysics>Electromagnetic Heat Source 1


Record a New Method and disable and enable the Electromagnetic Heat
Source 1 node
Stop Recording and inspect the code, you will soon use parts of this
Declare a Boolean variable emh with Description: Electromagnetic
Heating on/off
Insert a Check Box and use the emh variable as Source
Change the recorded method name to switch_emh, and change code
to:
model.multiphysics("emh1").active(emh);

7.
8.

In the Events section for the Check Box, choose switch_emh


Test the app

Needed: Declarations and Events


What variable do you want to change?
Declarations: Boolean, Double, Integer, String

What choices are available for that variable?


Declarations: Choice List

What do you want to trigger with the change?


Events + Methods

Q&A Session

Product Suite COMSOL 5.2a

Contact Us

Questions and free trial

Download the latest


version

comsol.com/contact

comsol.com/productdownload

www.comsol.com

User Stories
Videos
Application Gallery
Discussion Forum
Blog
Product News

You might also like