## Using Adaptive Meshing for Local Solution Improvement

##### Walter Frei | December 27, 2013

One of the perennial questions in finite element modeling is how to choose a mesh. We want a fine enough mesh to give accurate answers, but not too fine, as that would lead to an impractical solution time. As we’ve discussed previously, adaptive mesh refinement lets the software improve the mesh, and by default it will minimize the overall error in the model. However, we often are only interested in accurate results over some subset of the entire model space. Today we will introduce a technique to refine the mesh based on a local metric.

### A Model with Global Mesh Refinement

Let’s take a look at a simple mechanical problem — a bracket that is fixed at the bottom and has a load applied at the top. Two different fillet radii are applied and, as a consequence, it is difficult to predict where the peak stresses will be. Let’s first solve the problem on an extremely coarse mesh, using the default second order elements, and observe the results.

*Stresses and deformations solved on a coarse mesh with
26 elements. The peak stress is 135 MPa.*

We can see that the peak stresses are at the larger radius fillet, and that the mesh appears to quite poorly resolve the solution. We can use *Adaptive Mesh Refinement* with the *Mesh Initialization* refinement method to refine (and coarsen) the mesh as needed in order to minimize the *L2 norm Error Estimate*, which is a global metric. The mesh will be refined three times, using the settings as shown below, and will improve the accuracy of the solution everywhere in the model.

*Adaptive mesh refinement settings to reduce the global error in the model.*

*The globally refined mesh has 483 elements, and
a peak stress of 167 MPa.*

### Local Solution-Based Adaptive Mesh Refinement

Let’s now set up the same problem, but use a different metric for the adaptive mesh refinement. From the coarse mesh we can probably already see that the highest stresses are at the larger radius fillet. So how about we tell the adaptive mesh refinement algorithm to address the stresses in this location. We will switch to a *Functional Error Estimate*, which requires that we enter a functional with respect to which the mesh will be improved. The functional can be any differentiable scalar output based upon the solution. The functional we will use is the integral, along the boundary, of the von Mises Stress. An *Integration Coupling Operator* is defined at the boundary defining the larger fillet.

*Adaptive mesh refinement settings to reduce the local error at one location in the model.*

*The Integration Coupling Operator defines a boundary where we will evaluate the stress.*

When we look at the results of this approach, we should notice two features of the refined mesh. First, it has preferentially inserted smaller elements around the fillet boundary that we selected. This is as expected, since we are trying to get more accurate results in this region. However, we also observe that the mesh has been refined in other regions of the model, not just at the fillet. The adaptive mesh refinement algorithm will globally adjust the mesh to better resolve the local stresses, and these stresses do depend on the solution everywhere else in the model.

We can also see that using manual mesh refinement to predict the peak stress may be very difficult, because we usually cannot easily determine what other parts of the model may affect our solution.

*The refined mesh based upon a local criterion has
457 elements and a peak stress of 168 MPa. *

### Conclusions on Adaptive Meshing

We have seen that you can specify a local quantity over which to perform adaptive mesh refinement, and the software will refine the mesh to give better results locally, but also refine the mesh in other regions of the model that you may not immediately realize affect the local quantity you are interested in. The technique shown here is a powerful way to refine the mesh with confidence.

- Applications 5
- Certified Consultants 30
- Chemical 52
- COMSOL Now 139
- Conference 105
- Core Functionality 70
- Electrical 127
- AC/DC 43
- MEMS 15
- Plasma 5
- Ray Optics 5
- RF 30
- Semiconductor 3
- Wave Optics 6

- Fluid 90
- CFD 41
- Microfluidics 8
- Mixer 3
- Molecular Flow 9
- Pipe Flow 8
- Subsurface Flow 10

- Interfacing 40
- Mechanical 149
- Multipurpose 16
- Tips & Tricks 16
- Trending Topics 47
- User Perspectives 82
- Video 67

## Comments

Here I am wondering how to set the parameters to get the accurate results? Thanks

Thank you Marvin, When reading this article, keep it in the larger context of solving multiphysics problems:

http://www.comsol.com/blogs/learning-solve-multiphysics-problems-effectively/

In particular, meshing considerations are a topic we’ve addressed before:

http://www.comsol.com/blogs/how-to-implement-mesh-refinement-study/

http://www.comsol.com/blogs/meshing-considerations-linear-static-problems/