Machine Learning Functionality Comes to COMSOL 6.2

How to build and use surrogate models to predict results orders-of-magnitude faster than running simulations.

The big news from COMSOL 6.2, released this week, is that engineers will be able to replace their complex, 3D finite element simulations with surrogate models based on machine learning technology. This will enable engineers to get results faster to further develop digital twins, simplify simulation apps and better explore the design space of their products.

Results from the Thermal Actuator Surrogate Model app. (Image: COMSOL).

Results from the Thermal Actuator Surrogate Model app. (Image: COMSOL).

COMSOL notes that the release also contains significant improvements for engineers simulating electric motors, and other tertiary improvements and speed boosts throughout the COMSOL product line. Engineering.com sat down with Björn Sjodin, senior vice president of Business Development at COMSOL, to discuss the release.

What Type of Surrogate Models is COMSOL Adding to Its Toolbelt?

Surrogate models accurately approximate results from a full finite element simulation using machine learning technology. When the simulation model might take hours or days to return results, the surrogate model can do it in real-time. Users can then access the surrogate model as a function within the Global Definitions node.

Does this mean that COMSOL surrogate models are powered by AI? “We are very skeptical to [say] AI in this,” says Sjodin. “We call them data driven surrogate models.”

To produce one, an engineer must first run the full simulation model under several different conditions, geometries and inputs to gather raw data. COMSOL recommends that this data be collected using a design of experiments (DOE) controlled by a Latin hypercube sampling (LHS) method—instead of random or uniform grid sampling.

The data from the analysis are then input into the Surrogate Model Training tool, a machine learning training study that builds a model to mimic the results of the full simulation throughout that envelope of input data. In other words, the surrogate models are well-adapted for interpolation, linear and non-linear applications. However, they shouldn’t be used for extrapolation.

Three machine learning techniques can be used to build the surrogate models: Gaussian process (GP) regression, polynomial chaos expansion (PCE) and deep neural networks (DNN). The GP and PCE techniques can offer uncertainty estimates when returning surrogate results. These techniques also have other statistical use cases. However, DNN can handle larger datasets enabling it to better match the surrogate model to the simulation.

Based on the complexity of the simulation model, an engineer can train a surrogate model with as little as two to three dozen simulations. For instance, this amount of data would be enough when modeling a simple battery with non-linear attributes. However, more complex models could need thousands of raw data simulations to accurately mimic the simulation. Consider a micro-electromechanical system (MEMS) that is thermally activated to model the electromagnetics, heat transfer and structural simulations of the full model. To mimic this MEMS device, an engineer would need thousands of raw data simulations. Sjodin notes, however, that these models can still be trained in a few hours using a computer or a few minutes using a cluster.

Training the surrogate model can be done all at once or iteratively. For instance, data to train a surrogate can be generated by a previous surrogate model that fills in the gaps between the raw data simulations. This new surrogate can then replace the older one.

Engineers Can Use Surrogate Models in Simulation Apps and Digital Twins

Surrogate models are closely associated with digital twins. The idea is to feed the twin with data from real world assets so that the surrogate model can make predictions about that asset in real-time.

Sjodin gave the example of how digital twins can listen to real-world data and then autonomously perform actions without user interactions. In his example, he notes how a customer produced an app that can listen to local weather data. The app then helped predict the curing time for a concrete object based on its geometry and the weather. Civil engineers can use this app to better schedule construction projects and ensure construction is done correctly.

Engineers can also add surrogate models to their simulation apps to shrink their file size and speed up their performance. These apps can be updated automatically, via a timer, with a new surrogate model.

Sjodin explains how these newer apps can be much smaller than the apps COMSOL could produce before. He says it’s because surrogate models are good at predicting and recreating unseen data that would typically be under the hood of the app. All that data can be replaced with a simple function call of a surrogate model. “It’s kind of like a compression,” he says. “You compression the solution data by sometimes orders of magnitude. It enables you to have large amount of data in the app, but it’s just the surrogate model.”

To help engineers become familiar with surrogate models, COMSOL offers three example applications in its gallery. They are:

  • Tubular Reactor Surrogate Model
  • Thermal Actuator Surrogate Model
  • Surrogate Model Training of a Battery Rate Capability Model

How COMSOL 6.2 Makes it Easier to Simulate Electric Motors

Sjodin explains that a new time periodic solver is packaged with COMSOL 6.2. This solver makes it easier for engineers to model nonlinear behavior in transformers, electric motors and other electric machinery. This solver is available in the software’s AC/DC Module and is compatible with multiphysics analyses including acoustics, structural mechanics, multibody dynamics, heat transfer and multifactor optimizations.

A challenge when simulating electric motors, according to Sjodin, is that as the stator and rotor move periodically, they generally exhibit nonlinear behavior. An engineer can assume these won’t happen and simplify their simulation models, but it will affect the accuracy of their results. Alternatively, they can attempt to model the nonlinearity with traditional solvers, but that is hard to do and computationally expensive.

The new time periodic solver accounts for the non-linear actions of the motor. According to COMSOL release highlights, it achieves this “by imposing periodicity in the time dimension and solving for all time frames at once with a stationary solver. The approach saves a considerable amount of computation time since the alternative would be to run a time-dependent problem until the periodic steady state has been reached. Furthermore, this approach gives direct access to frequency-domain content (higher-order harmonics), for use in advanced multiphysics contexts.”

COMSOL 6.2 Sees a Lot of Speed Boosts for Engineers Running Various Simulations

The COMSOL 6.2 release notes also boast of speed improvements for various solvers in the software’s toolbelt. Perhaps most impressive is that engineers running a response simulation for room and cabin acoustics can expect those results an order of magnitude faster. Meanwhile, more common turbulent CFD simulations can produce results 40 percent faster. Another speed boost comes for engineers running boundary element method (BEM) analyses, which can now return results up to seven times faster when assessing acoustics and electromagnetics and using a cluster to crunch the numbers.

Other improvements and additions to COMSOL 6.2 include:

  • Over a hundred new model examples to help train and educate users.
  • Seven new turbulence models for high-Mach flows.
  • A library of realistic frequency-dependent materials for acoustics simulations in the time domain.
  • A model for hydrogen embrittlement in solids to assess fuel cells, Electrolyzer and corrosion.
  • Improved models for damage, fracture and contact.
  • Simplified specific absorption computations for RF tissue simulations.
  • Models that assess light propagation through liquid crystals.
  • Location specific weather data import features based on GPS locations.
Written by

Shawn Wasserman

For over 10 years, Shawn Wasserman has informed, inspired and engaged the engineering community through online content. As a senior writer at WTWH media, he produces branded content to help engineers streamline their operations via new tools, technologies and software. While a senior editor at Engineering.com, Shawn wrote stories about CAE, simulation, PLM, CAD, IoT, AI and more. During his time as the blog manager at Ansys, Shawn produced content featuring stories, tips, tricks and interesting use cases for CAE technologies. Shawn holds a master’s degree in Bioengineering from the University of Guelph and an undergraduate degree in Chemical Engineering from the University of Waterloo.