Using COMSOL Version 6.1 to Plot Non-Converged Results During Compute Attempts

As an engineer have you ever found yourself in a situation where you’re trying to track non-converged results by plotting solution variables that you would expect to behave in a certain way, but you’re not sure how to modify the initial values?
In our latest Tips & Tricks video, I take you through a scenario that will help you create a strategy for getting a converged solution.
To help you follow along, we have included the video transcription below.

AltaSim’s upcoming training offerings will support you, the COMSOL user, in utilizing best practices with many of the COMSOL modules. Please click here to visit our training calendar and find the course that is best for you.


Plotting Non-Converged Results During Compute Attempts Transcription:

Welcome to this tips and tricks video! In our previous video we talked about this natural convection problem that is difficult to converge in COMSOL. In fact, it doesn’t converge with the default settings – both the physics and the mesh, and it requires some troubleshooting. And, one of the things we talked about was extending the size of the log under preferences so that COMSOL wouldn’t truncate the header information.

And, I want to show another tip for troubleshooting this model today that will aid in determining the cause of the non-convergence and help you to come up with a strategy for getting a converged solution. And that is plotting results while solving the unconverged results. Finding the unconverged results that is, tracking the current guess at the solution and visualizing that within the graphics window. That you may be familiar that COMSOL on the “step” level under “results while solving,” you can turn on a plot group so that updates, when converged results are available, that is if you’re doing a parametric sweep and an auxiliary sweep or a transient analysis, you could post solution variables to the graphics window as they become available as they’re converged. But what you may not know is that on the fully coupled feature or the segregated feature depending, on whether you’re which one you’re using, there’s a similar section that behaves differently. It’s still called “results while solving” as you see here, however when you turn on “results while solving” here whatever plot group you reference, in this case 2D Plot Group 1, will refresh with the current guess at the nonlinear solver. So, you’re enabled to look under the hood and see how the COMSOL solver is behaving in solver space.

And now I’m going to be showing you how to track the temperature solution, so right now I have a plot group here for the velocity field with an arrow surface plot and the velocity that’s 2D Plot Group 3. So, on fully coupled I’ll change this to 2D Plot Group 3 and again this is on the fully coupled feature. When I tried to get this to converge oh you know try to compute the solution, what we’re seeing here we’re tracking the non-converged results. So this is COMSOL search for the solution to the natural convection problem. You can see the arrows plotting in the direction of velocity and the color representing the magnitude of velocity. Now we’re starting to blow up the solution here you can see 1000 meters per second for this relatively benign thermal gradients; it’s obviously an incorrect solution. So please don’t interpret these results as physically meaningful except insofar as once they start to become extremely out of bounds then you may want to stop the solver and start over or come up with a new strategy. Basically, that’s the tip that I’d like to show is that you can, again I’ll just show it one more time: put compute and starting from initial values this is the Newton’s nonlinear method is searching for the converged result and it can’t find the solution and the plots like this may help an experienced engineer to modify initial values, or tweak boundary conditions to become more stable. Gives you some clue of how the nonlinear solver is searching for a solution and it may help you get insight into coming up with the correct answer. Now in this case, this natural convection isn’t converging. I’m seeing the flow fields flipping downward, pointing downward as an initial guess, and so I would expect that to be incorrect. This is eventually the flow field that we’re looking for here with a vertical flow with heat being applied to these two surfaces you would expect the density to go down on those surfaces and therefore the buoyancy effect to have the flow being upward. And so, what this caused me to do in terms of troubleshooting, by tracking the non-converged results, was to initialize my flow values here with some initial flow in the Y direction. You might start with the value of 1 in the positive Y direction and we could try solving again. And watching the flow field so there you see the flow starts up but then it flips down. We’ll try that again. Watch very closely as the non-convergence happens pretty quickly. But I’ll restart again from initial values of 1 meter per second in the positive Y but then you’ll see the solver flip. You see those arrows flip down and at that point I know that it’s probably not gonna converge because it’s searching for a pretty nonsensical answer at this point. And so what I do is push it even further so instead of an initial value of 1 meter per second in that direction we’ll push it up to 6 and try to compute again. And here the arrows will start vertical, they’ll stay vertical and eventually converges without an error message success yay we’re happy you can see the air and the nonlinear solver drops below the pre-specified tolerance of 10 to the power minus 3.

So again, the point of this tips and tricks video was to show you that you can track the non-converged results here and if you’re plotting solution variables that you would expect to behave in a certain way it may give you some clue as to how to modify the initial values or maybe boundary condition to help troubleshoot the non-convergence of your nonlinear solver. Hope this has been helpful to you and thank you so much.