## 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.

#### Post Tags

Technical Content### Get new posts by email

### Categories

- Applications (39)
- Certified Consultants (33)
- Chemical (69)
- Batteries & Fuel Cells (18)
- Chemical Reaction Engineering (28)
- Corrosion (14)
- Electrochemistry (10)
- Electrodeposition (5)

- COMSOL Now (152)
- Conference (116)
- Core Functionality (122)
- Equation-Based Modeling (16)
- Geometry (6)
- HPC (12)
- Meshing (22)
- Postprocessing (30)
- Solvers (17)
- UI (4)

- Electrical (182)
- AC/DC (55)
- MEMS (25)
- Plasma (7)
- Ray Optics (11)
- RF (50)
- Semiconductor (6)
- Wave Optics (15)

- Fluid (124)
- CFD (60)
- Microfluidics (16)
- Mixer (5)
- Molecular Flow (11)
- Pipe Flow (10)
- Subsurface Flow (10)

- Interfacing (44)
- Mechanical (226)
- Acoustics (40)
- Fatigue (12)
- Geomechanics (5)
- Heat Transfer (108)
- Multibody Dynamics (13)
- Nonlinear Structural Materials (9)
- Structural Mechanics (73)

- Multipurpose (24)
- Optimization (11)
- Particle Tracing (15)

- Tips & Tricks (13)
- Trending Topics (63)
- User Perspectives (98)
- Video (73)

## Comments

Marvin FarrellAugust 25, 2014 6:29 amHere I am wondering how to set the parameters to get the accurate results? Thanks

Walter FreiAugust 25, 2014 9:00 amThank 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/

Roberto GaddiDecember 21, 2015 10:50 amI have a question about the functional: does it need to be a function that converges to zero as the mesh quality improves? Does the adaptive mesh algorithm try to minimize this quantity? Or is the error calculated as the delta of the functional in between steps, so the algorithm is looking for a stable value of the functional? In my case the functional is a quantity that would converge to a non-zero value. Is this going to work?

A second question is about the use of “Longest” vs. “Mesh Initialization” as refinement method: I cannot find an explanation on what the difference is an I cannot chose the best for my model.

Thanks,

Roberto

Walter FreiDecember 21, 2015 11:22 amHello Roberto,

The functional you choose does not need to converge to zero, no. In the case shown here, for example, it does not converge to zero. The algorithm is improving the accuracy of this functional by adjusting the mesh.

Regarding “Longest” vs. “Mesh Initialization”. The “longest” or “regular” methods will always work, but will only refine the mesh. The “mesh initialization” can both refine and coarsen the mesh but may, in rare circumstances, fail. There is no one method which will always be best for every case, you may want to try both.