How to Perform Multimaterial Optimization in COMSOL Multiphysics®
Sweeps are very useful for characterizing a system and learning more about how different input values impact the results. You can perform several different types of sweeps in the COMSOL Multiphysics® software, including function, material, and parametric sweeps. However, precise and innovative simulation results also call for mathematical optimization. In this blog post, learn how to combine sweep studies with the built-in optimization functionality.
Achieving the Ideal Frequency of a Tuning Fork
Tuning forks are made out many different materials, but most of them are calibrated to a standard pitch of 440 Hz for an A note. An article in JOM discusses how the frequency of a tuning fork changes with different materials and a fixed geometry (Ref. 1). This made me think: What if we change the geometry and material of a tuning fork to reach the desired frequency?
A tuning fork.
Performing an Optimization Study for Multiple Materials
The Application Library contains several models featuring a tuning fork geometry, as well as a tuning fork simulation app. You can access the Application Library within the COMSOL® software GUI in the File menu and search the keyword “tuning fork”. For this blog post, we’ll start with the simple Tuning Fork model (and accompanying example app).
This model features a parametric geometry, material properties of steel, the Solid Mechanics interface, and two studies. Both studies perform an eigenfrequency analysis to search for the eigenfrequency around 440 Hz. The first study uses a parametric sweep of the tuning fork’s arm length, set as a parameter L, to find the optimal design for 440 Hz. In contrast, the second study applies a mathematical optimization algorithm that uses L as the control variable and the deviation from the target frequency as the optimization objective for fast, precise, and efficient optimization.
Let’s return to the initial question: How does the tuning fork’s arm length depend on the material for a tune of 440 Hz?
First, we extend the model with a material switch. This option allows us to set and test various materials for the model. Further, this switch is needed to work with the material sweep in the Study node, as described later in this blog post. We can add available materials from the built-in Material Library, including:
- Titanium beta-21S
- Steel AISI 4340
The switch is assigned to the solid domains of the tuning fork.
Setting the material switch for a multimaterial analysis.
Now that we transformed the original model into a multimaterial model, we can adjust the studies. Due to the combination with a material sweep, the studies can now solve the physical model for all chosen materials and it is possible to analyze all of the results together. For example, we can look at the eigenfrequency and confirm that the eigenfrequency changes with different materials and arm lengths.
Various sweeps can be combined easily within a study, such as the extension of Study 1 with a material sweep. In contrast, when we try to add a material sweep to the optimization study for Study 2, we get an error message. The good news is that there is another way of achieving this by using Study References, as explained below.
Setting the material sweep directly in the study is not supported, since it is only possible to use one Sensitivity, Optimization, Parameter Estimation, or Parametric/Material/Function Sweep study step in each study. These study nodes tend to control the same solver settings and are therefore incompatible with each other. To perform a parametric or nested optimization, we can call a study containing an Optimization node from inside another study via a Study Reference node.
Therefore, we add an additional empty study and fill it with a Material Sweep node and a study reference pointing to the optimization study. In the Optimization node, we can define the settings needed for the optimization. This is possible as long as all entries are globally available. For that, we leave Study 2 containing the optimization as is.
Use of an additional study to create nested studies.
Optimizing a Tuning Fork for Various Materials in COMSOL Multiphysics
With all the discussed adjustments, we can now run the multimaterial optimization study by computing Study 3. This study controls the material assignment and runs individual optimization procedures for each by starting Study 2 automatically. Hence, we can extract and postprocess the individual design changes for the different materials. This can be done, for example, by a global evaluation of the parametric data set. Evaluating the tuning fork arm length, set as the control variable L, gives us the needed design changes to tune each tuning fork design to 440 Hz.
Top: Settings of the global evaluation. Bottom: Results table for the different materials identified via the switch index.
Testing Tuning Fork Design Parameters with an App
You can build an app from a tuning fork model that includes a customized user interface and restricted inputs and outputs. Take the Tuning Fork app in the Application Library as an example. This app can be used to quickly compute the frequency of a tuning fork with the prong length as an input or the optimal prong length with the frequency as an input.
The user interface of an example tuning fork app.
The example featured above can be used as inspiration for building apps of your own via the Application Builder tool in COMSOL Multiphysics.
Concluding Thoughts on Multimaterial Optimization
In this blog post, we used material sweeps in combination with an optimization study to find the best geometry for tuning forks made of different materials. Note that the approach discussed here is generic. You might want to combine other study steps that have the same hierarchy.
With this approach, you can combine all of the Sensitivity, Optimization, Parameter Estimation, or Parametric/Material/Function Sweep features into nested studies, thus improving your simulations, results, and products.
Try it yourself: Access the Tuning Fork model and app by clicking the button below, which will take you to the Application Gallery. Then, you can download the MPH-files if you have a COMSOL Access account and valid software license.
Read More on the COMSOL Blog
- T.D. Burleigh and P.A. Fuierer, “Tuning Forks for Vibrant Teaching“, JOM, pp. 26–27, Nov. 2005.
- COMSOL Now
- Today in Science
- COMSOL Now
- Today in Science