Extending the Number of Characters Stored in the Log with COMSOL Version 6.1

In some cases, the information in the log file of a simulation is lost when the maximum number of characters in the log file is exceeded. In this video tip, we show how to increase the maximum number of characters to provide access to important data.

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.

COMSOL 6.1 Extending the Number of Characters Stored in the Log Transcription:

The following video will show you how to extend the number of characters stored in the log. And the demonstration model with a natural convection is just an example model showing one case where you might want to do this. I am showing here an example of a natural convection model that is difficult to converge in COMSOL. In fact, using the default physics-controlled mesh and the default solver settings it does not converge without some help. And this is a common problem or issue that you could run into in solving nonlinear Multiphysics analyses. And I want to show one tip for being able to help troubleshoot models like this.

So, I’m going to display the model here that’s built with the appropriate physics and boundary conditions and the default physics control mesh with the normal element size. If you have tried to compute a solution, you’ll see that it fails to provide a converged result. You can track the progress down here in the green bar and eventually you’ll get an error message that says “return solution is not converged.” You could look at the convergence plot here and see that the error in the system does not drop below the pre-specified relative tolerance of 10^-3 and so after 150 iterations the solver returns an error message that it’s not converged. The one thing that you might note is that you might try to allow the solver to iterate further because we’re trending in the right direction and reducing error with each iteration so you might try to do that on the fully coupled feature:  change the maximum number of iterations to 1,000 and try solving again and see what happens and hopefully this might give you a converged result.

We can track the convergence plot information here. We can also track in the log the convergence information, the solution-based on the residual-based error are these second and third columns. But you’ll see eventually that still the computation does not converge. If you have ever tried to react to these non-convergence issues and if you are iterating for a lot of iterations past about 150 to 200, you can see if you scroll up you lose the header information because eventually as COMSOL prints the log data there’s a limit on the amount of data that’s stored in the log and so you can’t see the headers of each of these columns. You also lose the printout of the number of degrees of freedom and the scaling of the dependent variables. That can be kind of frustrating and so I want to show you a tip for how to adjust the preferences in COMSOL Version 6.1 in order to avoid that. And the way you do that is by clicking “File,” “Preferences,” and then going under the “User Interface” section “Log and Messages” section and you’ll see this edit field here “Log Window Size Characters” set to 30,000 by default whenever you install the software. I like to increase this by a couple orders of magnitude and click “OK.” And now the next time that you run an analysis we can clear out the log and I’ll show you this. The next time you run an analysis you won’t lose that header information.

So, I’m now going to recompute, and I can check the log here with the better settings. Now it’s still not going to converge, unfortunately, but the idea here is that at least we’re able to scroll back up to the top after this fails to converge after 500 or so iterations. You can scroll all the way back up and you haven’t lost the initial print out information – COMSOL hasn’t truncated this original header information where we can look at the scales and make sure our scalings are appropriate. Maybe that was the issue that was causing the non-convergence where our scalings were wildly off. We can also now double check and see the number of degrees of freedom and ensure that the non-linear solver was engaged properly, etc.

So hopefully that tip has been helpful to you, and you might also note that in previous versions before Version 6.1 it was in a different location. You click “File,” “Preferences,” “General,” “30,000” for the log window size. This is where it was before but now in Version 6.1 they’ve changed the location here so it’s under “User Interface,” “Log and Messages” and then the setting is here.