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

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

Chinmoy MallickMarch 1, 2016 2:02 amHi,

I’m doing simulations to find a contour or surface having 875 gauss field.I’ve two permanent ring magnets and i want to visualize the 2D field.while doing adaptive mesh confine following error coming during simulations……Pl can anyone tell me where is the error?..Thank you

“Failed to find a solution.

Attempt to evaluate negative power of zero.

Function: ^

Failed to evaluate temporary symbolic derivative variable.

Variable: comp1.mf.normBVDN${realdot7}, Defined as: (((realdot(comp1.mf.Br,comp1.mf.Br)+realdot(comp1.mf.Bz,comp1.mf.Bz))^(-0.5))*0.5)

Failed to evaluate expression.

Expression: d((comp1.mf.normB-0.087499999999999994),{realdot7})

Returned solution is not converged.

– Feature: Stationary Solver 1 (sol3/s1)”

Bridget CunninghamMarch 1, 2016 8:33 amHello Chinmoy,

Thank you for your comment.

For questions specific to your modeling work, please contact our support team.

Online support center: https://www.comsol.com/support

Email: support@comsol.com

Soma Sai Sriram Kumar BysaniApril 7, 2017 4:38 amHello,

My geometry is 3D I am designing a heat exchanger and similations are done in comsol 5.2a multiphysics. In my geometry one is heat domain and other one is fluid domain. The velocity profile in the fluid domain was not accurate, I want increase elements of fluid domain only can someone please help how to proceed it?

Now total elments in fluid domain are 280,000K

I need in that domain like 550,000K

Caty FaircloughMay 3, 2017 8:39 amHi,

Thanks for your comment!

For questions related to your modeling, please contact our Support team.

Online Support Center: https://www.comsol.com/support

Email: support@comsol.com

Joerg RuedigerAugust 3, 2017 7:15 amHi Walter,

I cannot find the Adaptive Mesh Refinement – node under stationary solver. How to enable it?

Joerg

Caty FaircloughAugust 4, 2017 2:59 pmHi Joerg,

Thank you for your question.

I would suggest contacting our Support team for questions related to your modeling.

Online Support Center: https://www.comsol.com/support

Email: support@comsol.com