When modeling large, industry-scale acoustics problems, it can be challenging to solve them efficiently with the hardware at hand. This can happen even after optimizing the mesh, utilizing symmetries, and performing other modeling tricks. One important and sometimes overseen technique is to use the automatically generated iterative solver suggestions. These suggestions are often more memory efficient and even faster than the default solver. Here, we explore the use of solver suggestions and how they work for acoustics models.

### Introducing the Solver Suggestions

When setting up and solving models using any of the physics from the Acoustics Module, an add-on to the COMSOL Multiphysics® software, we generate so-called *solver suggestions*. These are predefined solvers (typically iterative solvers) where we have made all necessary settings such that they apply to the selected single-physics or multiphysics modeling scenario.

The default solver used in most physics interfaces is a direct solver, which is efficient and robust for all medium problems that fit into the memory available on your machine. However, when the models become large, you may run out of memory. In these cases, one of the suggested solvers may help you out.

Typically, when you increase the frequency in an acoustics model and need to refine the mesh accordingly, you will need one of the solver suggestions. This also happens if you decide to use a more detailed model, like thermoviscous acoustics, for certain small narrow acoustic regions in order to model losses in greater detail.

*Example of how the solver suggestions look in the Model Builder.*

How do you select and enable the solver suggestions? There are a few important steps:

- Right-click the study of interest, and select
*Show Default Solver* - Expand the
*Solver Configurations*and*Stationary Solver nodes*(for transient models, this would be the*Time-Dependent Solver*node)- Here, you will see the solver in use (enabled and typically called
*Suggested Direct Solver (tag)*) - You will also see the
*Suggested Iterative Solver (description) (tag)*that is disabled (there may be more than one)

- Here, you will see the solver in use (enabled and typically called
- Right-click and select
*Enable*(or press F4) to enable an iterative solver

In the above list, *tag* is the tag (or short-hand name) of the physics or multiphysics coupling that generates the solver suggestion. For example, pressure acoustics will have the tag `acpr`

. If you are solving an acoustic-structure interaction (ASI) problem, the tag will be ` asb1`

from the *Acoustic-Structure Boundary* coupling feature.

Tags are seen next to the physics or multiphysics coupling in the Model Builder tree. The suggestion also include a short-hand description of the solver setup used; for example, *GMRES with GMG* (see the image above) means the GMRES iterative solver with the (geometric) multigrid preconditioner. Details of the various solvers can be seen in the “Modeling with…” sections of the *Acoustic Modules User’s Guide*. In this blog post, we will not describe all the solver suggestions in detail, but point to the documentation instead.

When the *Show Default Solver* command is selected, the physics interfaces and multiphysics couplings in the model are analyzed. Solver suggestions are based on the physics interfaces, and there will be one suggestion for each interface, as shown by the tags. If a multiphysics coupling is used, then a suggestion is generated for the coupled problem instead (the coupling feature tag is shown). This also means that if you make changes to a model (like adding an extra physics and coupling it using a multiphysics coupling), the solver has to be regenerated. This step is important, and best done by right-clicking the *Solution* node (for example, *Solution 1*) and selecting *Reset Solver to Default*. You may also choose to set up a new study and generate the default solver at this point.

There are special cases where you need to pay extra attention and perform some manual setup, such as if you couple different physics manually or combine lumped circuit models with finite element models. Several tutorial models for transducer modeling use this strategy:

- Lumped Loudspeaker Driver
- Lumped Receiver with Full Vibroacoustic Coupling
- Lumped Receiver Connected to Test Setup with a 0.4-cc Coupler

For cases in which the physics interfaces are coupled manually, the COMSOL® software will use a segregated solver approach by default. This strategy will work in certain cases, but not if the model is strongly coupled. In this case, you have to switch to a *Fully Coupled* solver, as demonstrated in the three examples listed above.

*The Solver Configuration expanded in the Lumped Receiver with Full Vibroacoustic Coupling model.*

Updates to the suggested solvers in the Acoustics Module are done for each new release of COMSOL Multiphysics, which incorporates the latest solver technology, when applicable, and improves on the way in which single-physics and multiphysics problems are analyzed. COMSOL tries to make the suggested solvers as robust and efficient as possible.

Even though this blog post is specifically written for acoustics applications, solver suggestions are generated on other physics areas as well, including structural mechanics, heat transfer, and CFD.

The most important lesson learned here is that whenever changes are made to a model (by adding physics or introducing new couplings), the solver typically has to be updated or regenerated. In the next section, we demonstrate two examples of models where the solver suggestions are used in acoustic applications.

### 2 Acoustics Models Using the Solver Suggestions

In the first example, we look at an acoustic-structure interaction problem, the Loudspeaker Driver in a Vented Enclosure tutorial model. The video below shows how to select the suggested iterative solver for this model.

*Activating the iterative solver suggestion in the Loudspeaker Driver in a Vented Enclosure tutorial model.*

What is the speedup and memory saved when switching from the default direct solver to the suggested iterative solver? This, of course, depends on the hardware at your disposal and the model size. In this instance, the models are solved on a three-year-old desktop with an Intel® Core™ i7-4790 CPU running on 3.6 GHz (4 cores) with 32 GB of RAM.

Solving the loudspeaker model at 3500 Hz (with an appropriate mesh) requires 8 GB of RAM and takes 64 s for the default direct solver. Using the suggested iterative solver, it requires 4.7 GB of RAM and takes 63 s (solving for 3.8e5 DOFs). Increasing the frequency to 5000 Hz (by changing the mesh parameter `lambda_min`

in the model from `343[m/s]/3500[Hz]`

to ` 343[m/s]/5000[Hz]`

) requires 18.8 GB of RAM and takes 243 s for the default direct solver, while using the suggested iterative solver, it requires 6.8 GB of RAM and takes 87 s (solving for 8.3e5 DOFs). Thus the speedup and memory saving increases relatively with the model size.

In the second example, we solve a larger thermoviscous acoustics problem: a variant of the Transfer Impedance of a Perforate tutorial. In the Application Gallery, the model includes two versions: one analyzes a quarter of a perforation (using symmetries, called `transfer_impedance_perforate.mph`

) and the other models the whole perforation (called ` transfer_impedance_perforate_withDD.mph`

). The performance and a short description of the different solver suggestions is given in the PDF documentation.

*The iterative solver suggestion is activated in the Transfer Impedance of a Perforate tutorial model.*

### Next Steps

Want to learn more about how the Acoustics Module can fit your analysis needs? Contact us to learn more about the software.

#### Additional Resources

- Read a blog post about using the Domain Decomposition solver for thermoviscous acoustics
- Try a tutorial model of the acoustics in a test bench car interior

## Comments (2)

## Niels Burghoorn

December 11, 2019Is it possible to obtain the Jacobian matrix data (for exporting and analysing) from a “Stationairy Solver” node using newton raphson iterations?

## Mads Herring Jensen

January 6, 2020 COMSOL EmployeeHi Niels, This is possible by using an Assemble (Solution Utility) Node. After having selected which Jacobian matrices you want to assemble/extract (and execute the node) you can access these through the Java API or through the Derived Values -> System Matrix result node. For larger matrices (2D and 3D) you will need to extend the number of table rows allowed (in Preferences) or used the Table on file functionality. Please also have a look in the documentation. Best regards, Mads