Electric motor design is a complex dance of trade-offs. Engineers strive to create motors that are powerful, efficient, and lightweight, all while adhering to strict thermal and mechanical constraints. Finding the “perfect” design in this vast, multi-dimensional space is a significant challenge. Simulation tools like Ansys Motor-CAD are indispensable, providing high-fidelity multiphysics analysis. However, each simulation is computationally expensive, making a brute-force exploration of the design space impractical.
This article explores a modern, intelligent approach to motor optimization that brings new, AI-driven capabilities to the design process. By leveraging the power of Bayesian Optimization with the Stochos Python library, engineers can find better designs faster and more efficiently than ever before.
Why Traditional Design Space Exploration Falls Short
A common approach to design optimization is to create a simplified “metamodel” of the high-fidelity simulation.
This process generally includes:
Initial Design of Experiments (DoE): The process begins by generating a large number of design points—often hundreds—spread throughout the design space. Each of these points is then evaluated using a full Motor-CAD simulation.
Metamodel Creation: Data from this large DoE is used to build a surrogate model—an approximation of the complex Motor-CAD simulation—that is much faster to evaluate.
Optimization on the Metamodel: An optimization algorithm is then run on this static surrogate model. Because the metamodel is so fast, thousands of potential designs can be evaluated in a short time to identify an optimal solution or set of solutions.
While this method is a cornerstone of engineering design, the initial, large-scale DoE can be computationally expensive. It requires a significant upfront investment of time and resources to simulate many designs, some of which may be in regions that are ultimately not relevant to the final, optimal solution.
What Bayesian Optimization Brings to Motor Design

The conventional approach of mapping an entire design space upfront is often impractical. Bayesian Optimization offers a more dynamic approach, progressively building a model of the design space. This powerful engineering tool intelligently determines the next most promising point to evaluate, creating the map as it explores.
Bayesian Optimization is a sequential, model-based approach to finding the optimum of expensive-to-evaluate functions. Instead of a large, upfront DoE, it follows an intelligent, iterative loop:
Build a Probabilistic Model: It starts with just a few initial data points and builds a surrogate model. This is a probabilistic model, meaning it not only predicts the motor’s performance but also quantifies its uncertainty about that prediction.
Use an Acquisition Function: An “acquisition function” then uses the model’s predictions and uncertainty to decide where to sample next. This function balances exploitation (sampling in areas where the model predicts good performance) with exploration (sampling in areas where the model is most uncertain, offering a chance to discover something new and better).
Sample and Update: The expensive Motor-CAD simulation is run at the new, intelligently chosen point. The result is then used to update the probabilistic model, reducing its uncertainty and improving its accuracy.
This loop repeats, with each step getting progressively smarter, ensuring that computational effort is focused on the most promising regions of the design space.
Stochos and the DIM-GP Surrogate Model

The Stochos Python library is a powerful tool that brings advanced AI and machine learning capabilities to simulation and product development. It provides the framework for implementing Bayesian Optimization, and its key innovation lies in the surrogate model it employs: the Deep Input Mixture of Gaussian Processes (DIM-GP).
At a high level, DIM-GP is a state-of-the-art surrogate model that fuses the power of deep learning with the statistical rigor of Gaussian Processes. This allows it to create highly accurate and robust models of complex physical phenomena, complete with the uncertainty predictions that are essential for driving an efficient Bayesian optimization loop.
PyMotorCAD: Scripting Motor-CAD in Python
PyMotorCAD is part of the PyAnsys ecosystem, which facilitates the use of Motor-CAD within a Python environment, alongside other PyAnsys libraries and external Python libraries. It allows you to programmatically create, interact with, and control a Motor-CAD model, with or without using the Motor-CAD GUI. You can achieve Motor-CAD automation by running scripts, either internally via the Motor-CAD Scripting tab or externally. It’s an integral component of the PyAnsys ecosystem, simplifying the integration of Motor-CAD with a Python environment and enabling its use alongside other PyAnsys and external Python libraries, such as Stochos.
PyMotorCAD can be operated in any IDE or in a Jupyter Notebook, as seen below:

Combining Stochos and Motor-CAD into a Single Workflow
By combining Stochos with Motor-CAD, we can create a highly efficient optimization workflow:
Define the Problem in Stochos: The optimization problem (input parameters, output parameters, objectives, and constraints) is defined in a Python script using the Stochos library.
Create an Evaluator Function: A Python function is created that takes a set of design parameters as input, runs a Motor-CAD simulation, and returns the performance metrics.
Run the Bayesian Optimization: The Stochos bayesian_opt object is used to run the optimization. Stochos will intelligently call the evaluator function, using the dimgp surrogate model and an acquisition function to guide the search for the optimal design

Step-by-Step Iterative Process
The Bayesian optimization process is iterative:
- Initial Samples: A small number of initial points are sampled from the design space.
- Fit the Surrogate Model: The surrogate model is fit to the initial data.
- Optimize the Acquisition Function: The acquisition function is optimized to identify the next-best point to sample.
- Evaluate the Objective Function: Evaluate the objective function (the Motor-CAD simulation) at the new point.
- Update the Surrogate Model: The new data point is added to the set of observations, and the surrogate model is updated.
- Repeat Steps 3-5 until a stopping criterion is met (e.g., a specified number of iterations or convergence to an optimal solution).
Benefits of an Adaptive, AI-Driven Design Approach
This new, AI-driven capability offers significant benefits for motor design:
- Exceptional Efficiency: By intelligently exploring the design space, this method can find optimal solutions with significantly fewer simulations, saving valuable time and computational resources.
- Focused Exploration: The adaptive nature of the search ensures that engineering effort is concentrated on the most promising regions of the design space.
- Faster Innovation: By accelerating the design cycle, engineers can explore more innovative concepts and bring better products to market faster.
Moving Beyond Brute-Force Methods in Electric Motor Design
The integration of Bayesian optimization with powerful simulation tools such as Motor-CAD represents a significant step forward in electric motor design. By moving away from brute-force methods and embracing intelligent, adaptive search strategies, engineers can accelerate the design cycle, reduce costs, and ultimately, create better products.
As the demand for high-performance electric motors continues to grow, the adoption of these advanced optimization techniques will be crucial for staying ahead of the curve. The combination of Motor-CAD’s detailed multiphysics analysis and Stochos’ intelligent search capabilities provides a powerful toolkit for tackling the complex challenges of modern motor design.
Working on electric motor design or exploring AI-driven simulation workflows? SimuTech Group’s electromagnetic simulation consultants work with Ansys Motor-CAD, optiSLang, and advanced design exploration tools. For an overview of Motor-CAD’s core capabilities, see our article on Ansys Motor-CAD: general overview of EMag, Thermal, Lab, and Mechanical. Learn more about Ansys Motor-CAD or contact us to discuss your project.




