If you already own and use both a 3D CAD program and a finite element analysis (FEA) or computational fluid dynamics (CFD) analysis package, are there good reasons to also spend another thousand or two on mathematical software such as PTC’s Mathcad Prime 3.0, MathWorks’ MATLAB and Maplesoft’s Maple? The answer from Alan Abul-Haj, principal scientist at ARA Engineering, is a resounding yes. And many other consulting engineers would agree: Each package, with some overlap, offers faster ways to set up, manipulate and document analysis tasks.

“This field is super rich, and it’s going to get richer,” says Abul-Haj, based on his 10 years-plus of experience incorporating both MATLAB and Mathcad in his design workflow. “For example, MATLAB allows you to process large amounts of data in ways you often just can’t do in the FEA and CFD codes themselves, while Mathcad lets you bring in libraries of WYSIWYG formulas for quick calculations, and is awesome for the automatic unit-conversion alone.”

Extending these capabilities even further are PTC’s Windchill, MathWorks’ Simulink, and MapleSim, helping users gain system-level insight, verify numerical calculations and document design processes as part of the complete design cycle.

### A Great Place to Start

Brent Edmonds, senior director, PTC Mathcad, offers a top-level description in terms of his product’s workflow benefits: “First, there’s the calculation engine. Mathcad can consume inputs and, based on the algorithms or formulas the user has put in, will crunch the numbers and produce a solution; from that aspect, it’s a scientific calculator on steroids.

**A Quick MATLAB Example: Refining MEMS Dimensions**

An engineer is using MathWorks’ MATLAB software to design a MEMS device represented as a finite element analysis (FEA) model. Two topics of interest are:

1. computing the maximum stress in the device per a specific design input (a geometric dimension), and

2. calculating that dimension’s optimal value such that it minimizes the maximum stress. For the first requirement, batch FEA results are imported into MATLAB, where the curve-fitting functions produce an analytical curve and identify the maximum stress. An app is also created that lets a non-FEA expert graphically experiment with the design input.

For the second requirement, optimization solvers in MATLAB solve for the optimal value of the targeted dimension.

The ease of writing/entering equations, data, graphs and images, as well as new plotting capabilities, makes Mathcad seem like a magic, mathematical whiteboard, Edmonds says.

Specific to improving engineering simulations, Mathcad also offers optimization and design of experiments (DOE) pre-processing functions that help users cut down on the number of FEA or CFD runs they need to perform, which he points out can offer significant time savings.

By letting users essentially write and draw as if on scrap paper, Mathcad worksheets present a human-readable appearance, he adds. When you purchase the optional targeted e-book libraries (such as Roark’s Formulas for Stress and Strain), you can cut and paste equations without retyping or scripting, and modify them for your own purposes; you can also add notes documenting where your references originated. All these forms of documentation serve, as Edmonds puts it, as a kind of glue to communicate critical design info as the project moves from one team member to another.

Professional mechanical engineer Gerry Dail, president of MCB Engineering Consulting, is another proponent of bringing Mathcad into the design workflow for model verification prior to analysis.

“A lot of times, the boundary conditions that need to be applied to some structural analysis require closed-form calculations to get a handle on either the displacements or the forces under consideration,” Dail explains. “I use Mathcad to document what I was thinking at the time, and to make sure results appear reasonable.”

Other features in Mathcad that Dail says give him an edge include data plotting and statistical analysis (with no need for C or Fortran coding).

Mathcad supports writing application programming interfaces (APIs) that can be used to automatically pass data bi-directionally between itself and an analysis package, saving time and avoiding retyping errors. And Edmonds says current PTC projects will improve Mathcad integration with the company’s Windchill PLM product, exposing more data (i.e., search and pull actual values without opening up the Mathcad file) and allowing a Mathcad worksheet to be stored as a Windchill document. The latter would move right along with other types of data for easier team collaboration.

### Exploring Data with MATLAB

How do you visualize flow-field data that’s in the form of a 1,000-x-1,000 matrix? What if you need to derive or interpolate quantities that aren’t explicitly available from your simulation results file? Can you optimize a performance spec based on hundreds of simulation runs across multiple variables? MATLAB software from MathWorks answers these and other tough, large-scale post-processing analysis questions.

**Wolfram, Mathematica and the Connected Devices Project**

Mathematica V9, a highly flexible computational tool from Wolfram Research, offers the tagline “seamlessly flow ideas to results.” As another well-regarded contender in the math tools arena, it applies intelligent automation to tasks involving numerical computing, data acquisition/analysis, visualization and much more.

But a new application for the software’s underlying Wolfram Data Framework is its use to connect and live-query the growing world of smart devices, from GPS systems to fitness monitors. Bringing a standard way of curating and working with the mind-blowing amounts of data this entails, the Wolfram Connected Devices Project is delivering a common language that could form the basis of “The Internet of Things” now encompassing devices in your car, home and pocket.

Here are a few ways MATLAB could make you more productive in using FEA/CFD software:

- Automate FEA/CFD simulations. Set up and simulate multiphysics (MP) models for various conditions (material properties, geometries, boundary conditions, mesh/solver options) rather than manually step through those conditions in the analysis software interface.
- Extend FEA/CFD analysis. Use MATLAB domain-specific tools for data acquisition, signal processing, statistics and more, and develop custom pre- and post-processing routines.
- Optimize MP designs. Use the add-on Optimization Toolbox with MATLAB to optimize design parameters based on custom objective/constraint functions.
- Share FEA/CFD models with non-experts. Create interactive MATLAB apps that let others try varying the input data and conditions (with a graphical “slider,” for example) and visualize results.

Abul-Haj says MATLAB allows him to process large amounts of data in ways he simply can’t do in his high-end analysis software.

“I can write a script file to read CFD data and much more exactly extract variables of interest, such as what the flow at a specific region is,” he explains, noting that without MATLAB, he would have had to anticipate ahead of time the sub-region where he was most interested and build a flow boundary there, to be able to display that kind of data. Abul-Haj also uses the MATLAB Dynamic Data Exchange (DDE) Toolbox to operate the optical/illumination design package Zemax from within MATLAB, in real time.

MathWorks also offers Simulink, a multidomain simulation environment tightly integrated with MATLAB, and Simscape for modeling physical systems. Assemblies from CAD software such as SolidWorks can be imported into this environment, integrated with control algorithms, electrical motors, hydraulic actuators, and logic to perform dynamic simulations. This lets engineers study the impact of mechanical design on system-level performance.

A good example of the use of MATLAB, Simulink and Simscape to design a dual-clutch transmission can be seen in this video. It includes physical models, state machines, and control systems.

### Bringing Maple into the Mix

More choices for creating analytical models based on mathematical formulations come from Maplesoft, with its Maple 17 and MapleSim products (see “MapleSim 6 Goes Social,” Desktop Engineering, October 2013). At its simplest, Maple lets you do in-depth math and write software solutions, while MapleSim gives insight on how an entire system will interact — even for multibody and multi-domain systems. Both offer extensive documentation and collaboration tools.

“Mathematics don’t lie, numerical calculations do” is a distinction sometimes easy to forget but wisely offered by Amir Khajepour, the Canada Research Chair in mechatronic vehicle systems and a professor of mechanical and mechatronic engineering at Ontario’s University of Waterloo. As an analyst and Maple user designing suspension and control systems, he sees the value of using more than one type of software to support the trend of building fewer prototypes.

“The only way to do this is to make sure that what the FEA simulation software is telling you is absolutely correct, or at least within a 10% to 15% margin,” he says. “Getting a second view with Maple’s mathematical approach is much stronger than only a numerical analysis.”

Laurent Bernardin, executive vice president and chief scientist at Maplesoft, similarly points out the synergy between his company’s MapleSim and traditional simulation software: “MapleSim is a bit different from finite elements, where you look at one part, or one aspect of a system, and look at details. It’s about taking a system-level view.”

Bernardin offers as an example a simulation model for an entire vehicle, including the drivetrain, the control systems, etc. — and if it were a hybrid vehicle, “the battery system would be in there as well.” MapleSim models are assembled by putting together a block diagram, using library-based or custom components ranging from simple gears and hydraulic valves to electric motors, drivetrains and exhaust systems, and can include hardware-in-the-loop (HIL). The resulting view is not as detailed as an FE or CAD model, but the simulation provides an idea of how the entire system will behave and interact.

Users define the physical connections in terms of inputs and outputs, and the software simulates the operational system behavior. Results could include graphs of the torque in a shaft or the speed of a wheel, or even a 3D animation — for example, how a robot arm moves in space.

Once you’ve done the simulation, you can use Maple to do more in-depth analysis, working at the equation level.

“Maple is an interactive environment for doing mathematical and engineering calculations,” Bernardin says. “When you connect Maple and MapleSim, you’re able to get the entire set of system equations that represent the behavior of the system-level model.”

Maple users could do a Monte Carlo analysis, looking at the uncertainty of a given parameter and how variations in that parameter would affect the system behavior, or perform an optimization on a set of parameters to maximize, say, fuel efficiency.

Math tools are all worth a closer look. Any time you can work faster, reduce errors, squeeze more insight out of a simulation and create a better “paper trail,” you’ve improved your company’s bottom line. As Khajepour puts it, using mathematical tools gives you another dimension to analyze the behavior and stability of complex systems in ways that just don’t exist in numerical packages.

**More Info**