Solver Improvement for Modeling of Chaotic Systems

COMSOL has made some solver improvements to Version 6.2 of repeatability in chaotic simulations, which has been helpful for a particular project we’re working on for a customer.

In this month’s tips and tricks video, we share an example of how this solver improvement helps us get the same answer with the same initial input more stably.

Click below to watch as I walk you through the process. To help you follow along, we have included the video transcription below.

 

There’s no reason to learn software programs through trial and error, so in addition to our tips and tricks, our upcoming training classes will support you, the COMSOL user, in utilizing best practices with many of the COMSOL modules. Please visit our training calendar and find the course that is best for you.


Solver Improvement for Modeling of Chaotic Systems Transcription

This video is about a Version 6.2 solver improvement that we found to be helpful and useful when modeling chaotic systems. This setting is found under the study node, under solver configurations on the advanced feature here and if this doesn’t show up for you, you can always right-click “Study 1” and select “Show Default Solver” if you haven’t solved the model yet you won’t see this option.  You’ll click on the Advanced feature and scroll down under the Assembly Settings and there’s this checkbox option here to use ‘Static distribution of assembly blocks’. This is new in version 6.2, and I’d like to let you know about the use case for this particular setting that we found to be pretty useful.

It’s mainly meant to be used for, improving the stability and repeatability when modeling chaotic systems. Now you might say what’s a chaotic system? I can show you an example. So, this is a double pendulum animation that I picked up off of Wikipedia, and so what this video is showing is 3 double pendulums that fall. And they have nearly identical initial conditions. And the key here is nearly. They don’t start exactly at the same height and position. And although visually it looks like they are just very slight offset in initial conditions, with time as these double pendulums drop you can see that effect magnified. And so that’s one way of defining a chaotic system, and these exist in the real world and the real effect where models or where systems are very sensitive to initial conditions. In other words, with given enough time very slight changes to the initial values mean very different final position results.

Okay so that’s what a chaotic system is, and so from an FEA solver perspective when you have these finite precision solvers where you’re trying to model this, and here’s an example in COMSOL of implementing this double pendulum I put a magnet here at the bottom too. And so COMSOL can solve this double pendulum problem, but it is a chaotic system and so the simulation of it is not always repeatable. And so, what do we mean by that? Well from a solver perspective, if you have finite precision values being solved for, which we do in any computer simulation, there’s going to be some amount of precision loss with each division operation. Millions and millions of these floating-point operations happening under the hood, you can imagine that changing the order of the division operations within the fundamental linear system solver would give slightly different answers each time. If you were changing the order of the division operations each time even while still satisfying the strictest of convergence criteria and error checks you’re going to get different answers. In other words, the answer is still correct within the solver tolerances but out to enough significant digits there’s going be some variation. For 99% of scenarios this effect is not noticeable. You’re typically not plotting solution variables to 10, 20, 30 significant digits and it wouldn’t make sense to make any engineering judgments to that amount of precision in a model where you often have a few percent uncertainty built into the properties, other unknowns, other amount of uncertainty in the geometric assumptions, right? So, you’re not going to be typically expecting results out to 10, 20 significant digits in your solution variables. And so, the solver issue that I just mentioned, 99% of the time or more it’s not noticeable and/or significant. The interesting and noticeable behavior comes in when we’re trying to model these chaotic systems. Like I just showed here, this double pendulum is one example because in these systems you expect to see a large amount of scatter in the final result. You expect to see very large differences in the final prediction with very slight changes to initial conditions. So, in other words if your model is good, you will be capturing this effect that can cascade differently with very slight changes out to 10, 20, 30 significant digits within the initial values or within the initial portion of the simulation. And so, what ends up happening when you model these types of systems, what I’m showing here, are three drop simulations and in fact even with the exact same initial conditions and tracking the displacement of the end of the double pendulum as it swings down and around here and curves around. You’ll see there are three curves:  blue, red and green. Each one of them starts at the exact same initial values with exact same precision input but the model eventually, because of the change in the underlying linear system solver order of operations, will each solve, the way that COMSOL is set up in Version 6.1 you can see the divergence in the simulation, where the final position is slightly different between the blue curve the red curve and the green curve and the different positions.  You can see the scatter.

Here’s another example of a different system that we modeled and what I’m showing here on the right on the blue curve, are 30 different simulations with the same initial conditions. And this is a final displacement prediction of the point on the bottom of this cylinder here. You can see the scatter. So, each time you run this, exact same initial conditions, you just restart the simulation again, you can do it with the parametric sweep as well which is a dummy parameter sweep, and that’s what I’m showing here, is standard deviation of .004 millimeters the final position of this chaotic system. And so, the idea is you’re not going to be able to repeat the same simulation, you might expect you click compute you get an answer and later that day, if you click compute again on the same problem, you get the same answer.

But in a chaotic system, typically you’re not going to see that.  So, what COMSOL has done in version 6.2, this is a long explanation for this one setting, and showing in orange here, the new scatter with that setting that I showed. Right, so if you use a static distribution of the assembly blocks, which 6.2 COMSOL supports, this option rather than the dynamic assembly of blocks under the hood within the solver, this adds stability, removing some of the order of operation variation that would happen. And so it doesn’t remove all of the scattered in the final prediction, but you can see the standard deviation of this particular example has dropped by an order of magnitude.

We wanted to thank COMSOL for that improvement. It’s helpful for a particular project that we’re working on right now for a customer that’s trying to model a system with some chaos. So now we’ve improved, COMSOL has improved the repeatability of these simulations so we can get the same answer with the same initial input in a more stable way. Now, if we do want to try to capture some of the chaos and scattering in the physical system. We would then be able to put in a certain amount of delta to the initial conditions and then recapture that physical scatter. So, in other words, the scatter with the new setting is quantifiable based on the variation in the initial conditions.  We can compare that to the magnitude of the variation in the final prediction, in a more stable way, in a more trustworthy way, using this new setting.

So, thank you for your time. Hopefully this tip has been helpful to you. Bye now.