This website uses cookies to function and to improve your experience. By continuing to use our site, you agree to our use of cookies.

**Discussion Closed** This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

## What is convergence?

Posted Mar 10, 2013, 11:37 AM EDT Studies & Solvers Version 4.3a, Version 4.3b, Version 4.4, Version 5.0, Version 5.2 30 Replies

Please login with a confirmed email address before reporting spam

Please login with a confirmed email address before reporting spam

Convergence = arriving at a solution that is close to the exact solution within some pre-specified error tolerance or other convergence criterion

This is important in COMSOL when you right-click on Study and select Compute.

Best regards,

Josh Thomas

AltaSim Technologies

Please login with a confirmed email address before reporting spam

Please login with a confirmed email address before reporting spam

The point is that you don't know the exact solution. But you can estimate the (relative) error of your numerical solution, which is always an approximation. For example you can plug the numerical values back into the equations and see how well it matches. If it matches within an acceptable range (relative tolerance, e.g. 0.1% error) your numerical solution has satisfied the numerical convergence criterion.

Please find attached a convergence plot of a nonlinear model computation (created automatically in COMSOL). One image uses log-axis for the relative error, while the other uses a linear axis scale. Here the convergence criterion is set to 1e-6 (=0.0001% relative error / tolerance) and it took 16 iterations to reach convergence.

Another important topic is "mesh convergence". Your solution is mesh convergent if a global/local mesh refinement doesn't significantly change the results. For efficient modeling your goal is to create a mesh that just fulfills mesh convergence but is not finer than necessary in order to keep computational expense as low as possible.

I hope this gives you a clearer picture.

Best regards,

Zoran

Please login with a confirmed email address before reporting spam

Thanks for the detailed response, Zoran. That is some good information.

This might help to paint the picture even more. When you talk about convergence you are in the realm of some iterative process to arrive at a solution. This is why direct solvers (which don't require iterations) don't have convergence criteria (only round-off error checks).

Iterations are necessary in three main contexts in COMSOL analyses:

1) Iterative linear system solvers: Arriving at a solution [x] that satisfies [A][x]=[b] by guessing at [x] and iterating until convergence. Do an internet search on Gauss-Seidel iterative method for more information.

2) Non-linear system solvers: Arriving at a solution [x] that satisfies [A][x]=[b] when [A] or [b] are themselves function of [x]. Like in a system that has a spring which has a stiffness that depends on the displacement. Do an internet search on Newton's method for more information. This is the type of "convergence" that Zoran showed in the two plots of his post.

3) Segregated solution approach: Here you don't have just one system of equations [A][x]=[b] but multiple systems that depend on eachother but that are solved for separately in segregated steps. After each segregated step the results are passed back and forth untill all the systems are converged. This method is particularly useful for multiphysics systems where there are multiple dependent variables being solved for -- hence you see this method come up a lot in COMSOL. Compare this method with the Fully Coupled solution approach which solves all variables together in one huge linear system (no iterations required).

What's really interesting is that in any given problem you could have multiple "iterative levels" going on (for example, a non-linear, segregated, iterative linear system solver solution method). Iterative loops within iterative loops. To arrive at a solution, all the loops need to satisfy their respective convergence criteria.

Best regards,

Josh Thomas

AltaSim Technologies

Please login with a confirmed email address before reporting spam

You should perhaps add that the convergence "efficiency" (or time to converge) of segregated solver cases will often depend of the order of the variables in the different segregated steps, and that COMSOL uses (from my understanding) a rule also based on the order of appearance of the different physics.

But sometimes it's worth to reorder the variables as listed in the different steps, because there are also other criteria that decides in which order you line up the physics nodes (up/down) i.e. frames mixing ALE and solid ....

Or are I wrong about this ?

--

Good luck

Ivar

Please login with a confirmed email address before reporting spam

My understanding is the same as yours on that point Ivar.

Just to confirm the usefulness -- I have been able to gain convergence on an otherwise non-convergent problem by simply re-ordering the segregated steps. Good point.

-Josh

Please login with a confirmed email address before reporting spam

well for me too ;)

So it just means one cannot forget to think "physics" first, then apply the math ...

--

Have fun Comsoling

Ivar

Please login with a confirmed email address before reporting spam

Nagi Elabbasi

Veryst Engineering

Please login with a confirmed email address before reporting spam

Sometimes you will see COMSOL report that the solution has not converged, even though the problem is is stationary, linear and uses a direct solver. For this case there should really not be any such concept as convergence. So what happened?

The problem was numerically ill-conditioned, and the solver reported large round-off errors through the same mechanism which is used for all analysis types.

In most cases, you can then just increase the relative tolerance value in the stationary solver, and a solution will be obtained. You must however check the results carefully, since the bad.conditioning of the system of equations can have corrupted the solution. Check for example that reaction forces or fluxes correspond to the given loads within a reasonable accuracy.

Regards,

Henrik

Please login with a confirmed email address before reporting spam

at the moment I'm experiencing problems with convergence in a model with a very difficult geometry because it has very thin layers.

I computed the study more than 5 times without changing anything in the model or the meshes. The iterative solver sometimes converge and sometimes it does not. The values of the Iterations are different in every computation.

What causes this odd behaviour and what can i do to improve the model so that it returns stable solutions ?

Please login with a confirmed email address before reporting spam

the convergence criteria is based on the quality of the mesh to resolve the local variations of your dependent variables (and those linked to ...) A large model taking time to calculate can even converge slower by a local default bringing an important part of the error criteria, but the full model must be solved for the local criteria to converge.

When I get partial results I like to look at the mesh grid/wire-frame, without any post smoothing, all sharp transitions requires local mesh improvements. high gradients (spatial and time) requires local fine mesh to be correctly resolved ...

If you have thin flexures its worth to split these in the thickness to have at least 2 elements in the depth

--

Good luck

Ivar

Please login with a confirmed email address before reporting spam

Please login with a confirmed email address before reporting spam

thank you very much for the interesting and detailed discussion here! Can anyone think of a reason why the nonlinear solver in COMSOL does not stop until the maximum number of iterations although the relative error is smaller than the relative tolerance (factor in error estimate set to 1)? That is a problem I am facing right now. Is there any further criterium that I am missing?

Thank for your help in advance

Jason

Please login with a confirmed email address before reporting spam

One cause could be this:

In addition to having reached the convergence criterion, it is required that the damping factor in the Newton solver is 1 before the solution is accepted. Check in the solver log if the damping factor is still reduced, which would indicate that something is problematic.

Regards,

Henrik

Please login with a confirmed email address before reporting spam

thank you very much for your reply.

You are right, the damping factor is still reduced to about 0.01. I will check the documentation what this might imply. I hope I'll find what is wrong with my model then.

Best regards

Jason

Please login with a confirmed email address before reporting spam

How can I change the setting from the linear-axis to log-axis?

Best wishes,

Ken

Please login with a confirmed email address before reporting spam

When you say:

[...] The point is that you don't know the exact solution. But you can estimate the (relative) error of your numerical solution, which is always an approximation. For example you can plug the numerical values back into the equations and see how well it matches. If it matches within an acceptable range (relative tolerance, e.g. 0.1% error) your numerical solution has satisfied the numerical convergence criterion. [...]

you are actually talking about the residual rather than the error, correct? At least that follows from your reasoning. I am asking this since I have trouble interpreting what exactly is represented by the Error value in the convergence plots given by COMSOL. It seems logical to me that it is some mesh-averaged equation-averaged residual norm, but I have trouble finding its description in the user guides.

Any insights are appreciated.

Kind regards,

Thomas van der Meer

Please login with a confirmed email address before reporting spam

then what makes A converged and B not?

this model was made in order to understand why a slice of an PMSM wont works. I some cases error is increasing. i'm still wondering why can error rising? wrong solver?

thanks for the detailed explanation

regards

akmal

Please login with a confirmed email address before reporting spam

As Zoran explained above, the exact error is not known because the exact error depends on knowing the exact solution which of course we don't know. (If we did then no need to solve using a numerical method!)

When COMSOL defines "error" it is some approximation of the error. From my understanding COMSOL uses two definitions of approximate error:

1) Residual-based error: error = the relative norm of the residual, where the residual vector is defined as [Residual vector] = [A][x]-[b]. In other words, you plug your current approximate solution, [x], back into the equations and "see how well it matches" by looking at how big the residual is. This is the main way that I've seen that COMSOL defines error.

2) Solution-based error -- This method is new in v4.3b from what I've noticed. I'm not 100% positive (documentation is a little vague), but I believe this definition of error comes from comparing the current approximate solution [x_current] with the previous approximate solution [x_previous] and normalizing it. So, here you are defining error as, error = the relative norm of the solution vector minus previous solution vector. This definition of error is available for Newton's non-linear iterations. You can also select "Solution or Residual" to have COMSOL terminate on the minimum of the 2 definitions of error.

So, these are the "errors" that are checked against whatever relative and absolute tolerances that you specify. In some contexts, these tolerances are scaled by various factors (for example, search for "Factor in error estimate" and "Residual factor" in the documentation). Regardless, the basic idea is that once your approximate error (as defined above) drops below the tolerance you have a "converged" solution. In other words, you have solved the problem (or step) and are ready for the next step or post-processing, etc.

Best regards,

Josh Thomas

AltaSim Technologies

Please login with a confirmed email address before reporting spam

Say I have a network of 50 chemical species reacting/diffusing/convecting in a volume. Say I split them into 5 segregated groups: species 1-10, species 11-20, 21-30, 31-40, 41-50.

Does it help to group species that react with each other in the same group? Or is randomly assigning species to segregated groups just as good.

Also, to Josh's point, is there a strategy in picking the order that the segregated steps are in? Or do I just pick random orders until one of them gives me convergence.

Thanks!

Travis

Please login with a confirmed email address before reporting spam

my question descripted as follows:

In the Solid Mechanics Modules ,I want to put the the model A's result "pressure" to the model B as a boundary load ,the pressure comes from a certain line of the model A in the 2D model for the time-dependent study.why not the resluts convergence? The pressure field in the model B should be same to the model A. Please give me some suggestions ,thanks!

Please login with a confirmed email address before reporting spam

Please login with a confirmed email address before reporting spam

Comsol reduces the spatially discretized problem into a matrix. For example, consider electromechanics. Each node in dielectric media has a scalar electrostatic potential, which is the result of solving strictly linear equations. If all I wanted to do was to solve the electrostatic problem then I could write a linear matrix problem which described it, I could solve that problem, and I'd have my solution. This is because it's a linear problem. If I have a voltage of 1 volt on a boundary and 0 volts on another, and I get a solution, if I double the volts on the boundaries (2 and 0) I now double the volts at every dielectric node and have a new solution. This matrix may be solved in various ways but viewing the matrix problem as atomic it's a one step solution (not iterative).

Now I introduce nonlinearities. For example, I want to solve the electrostatic problem self-consistently with mechanics. Now I calculate from the electrostatic solution a Maxwell's stress tensor which allows calculation of the force on various structural nodes or boundaries. I then need to calculate the structural degrees of freedom (3 coordinates of displacement, 3 coordinates of velocity... orientation has 3 degrees of freedom with 3 degrees of freedom for angular velocity but maybe these are implicit).

Structural mechanics can be linear (for example stress/strain problems with a fixed stiffness tensor) but since the force on a surface is proportional to the square of an electric field rather than the magnitude of the field the coupled electrostatic-mechanical problem will always be non-linear. If I use my prior example and double my voltages I can't simply double my displacements. It gets worse if the deformation caused by the electrostatic force results in a change in the boundary conditions for the electrostatic potential -- you end up with positive feedback loops which can result in things like cantilever pull-in. So the matrix will only work for small-scale perturbations about a solution point: to approach a global solution I need to iterate, changing the matrix problem with each iteration. And I need to do that carefully because if I deviate too far from a solution in the wrong direction I can find myself in a solution black hole, for example with the electromechanical bistability of the cantilever.

If I segregate the problem into two components: one electrostatic, the other mechanical, it doesn't seem that the solution order should matter much assuming no intrinsic stresses. If I solve the mechanical problem first, there's no applied force, and that becomes trivial. If I calculate the electrostatics next I'll get the same result as if I'd calculated electrostatics first. So if I iterate I'd get something like this:

1. structural problem: trivial

2. electrostatic problem: results in surface forces

3. structural problem: deflect the cantilever, which is attracted to electric field magnitudes

4. electrostatic problem: the electric fields increase because the gap across which a voltage is applied is now smaller

5. structural problem: deflect the cantilever a bit more

6. electrostatic problem: the electric fields increase a bit more

etc

As long as I proceed in this segregated manner (Gummel iterations) there's not much risk here of over-shooting the desired solution and ending up in a bad place like pull-in (where the cantilever snaps into the opposite electrode), at least unless I increase the applied voltage beyond (or very close to) the true pull-in voltage.

Anyway, the intimidating aspect of iterative solutions is there's so many possible tuning options. Damping, for example, is relatively intuitive but even here it's hard to know how to proceed. There's many more. Then there's many different methods, like ILU vs multigrid. So many options... Some of these are an obvious tradeoff between memory and solution power but in other cases one may converge better than the other. I personally spent several days trying to cajole a simple 2-D electromechanical problem into convergence but had no luck.

Dan

Please login with a confirmed email address before reporting spam

I am working with COMSOL 5.2. The issue I am facing is that my convergence plot is a semi-log plot showing reciprocal of time-step v/s time step, even though I have fixed the time step. I am not able to infer from this graph whether my solution has converged or not. I am attaching a picture of the same. Please suggest a solution.

Thanks,

Mahvash

Attachments:

Please login with a confirmed email address before reporting spam

It doesn't quite look like your time step is fixed if it is jumping up and down. Perhaps you've fixed the time range output request steps?

Secondly, you can always check your error estimate(s) by looking at the log window.

--

Best regards,

Josh Thomas

AltaSim Technologies

Please login with a confirmed email address before reporting spam

Thanks for your response. I haven't been able to figure out why my graph is oscillating . However, I did check the log and it shows

Linear error = 1.8*10^-13

Linear residual= 1.5*10^-15

Tfail=0

NLfail=21

Can you please tell me what is the significance of NLfail. In the reference manual it says that it is the failures in non-linear iterations.

Also, even though my problem involves non-linear equations also, why does my log show data pertaining to time dependent linear solver?

Thanks once again

Mahvash

Please login with a confirmed email address before reporting spam

Unless you are manually overriding the default time dependent solver, the time steps will oscillate over the course of a time dependent solution. This is because the step is selected by the solver in order to take the largest step possible but still satisfy the absolute and relative error tolerances that are pre-specified. There is also some manual limit on the step size you can provide by selecting Time stepping method: Strict or intermediate (instead of Free which is the default).

All finite element problems will solve a linear (or linearized) system of equations at the deepest level -- even if non-linear Newton iterations need to be performed because of the non-linearity of the problem.

NLfail means that the non-linear iterations (typically Newton iterations) are failing to converge.

--

Best regards,

Josh Thomas

AltaSim Technologies

Please login with a confirmed email address before reporting spam

In that case, how can I tell from the convergence plot whether or not my solution is converging? Please correct me if I am wrong, is it that a smaller reciprocal of step size with increasing time step would imply convergence, as the solver does not need small steps for the solution to converge?

Also NLfail=21, is that a very bad figure. I don't know how to interpret it with regards to convergence.

Thanks,

Mahvash

Please login with a confirmed email address before reporting spam

A problem can fail to converge in the time domain or in the spatial domain. TFail implies temporal failure and NLFail means spatial failure. In either case, COMSOL will attempt to cutback the time step to achieve convergence. If the time steps become too small things will become painfully slow or eventually an error will be returned. Obviously, you'd prefer 0 (zero) failures in the solver, but sometimes non-linear systems of equations (especially multi-physics ones) are inherently highly non-linear.

There are a plethora of techniques for addressing non-convergence and speeding up run times, etc. Check documentation on solver settings, blog posts on addressing non-convergence, or consider signing up for training regarding solver settings in COMSOL.

--

Best regards,

Josh Thomas

AltaSim Technologies

Please login with a confirmed email address before reporting spam

Thanks a lot.

Best,

Mahvash

Note that while COMSOL employees may participate in the discussion forum, COMSOL^{®} software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.