First, the theory.
So, in this debugging thing ... there's a parameter that determines how quickly the system tries to converge to a solution. Too low, and it takes longer than it needs to, but too high and some errors grow instead of go away, it it becomes a big mess.
Now, theoretically, a value of 1.0 for this parameter should be about the maximum before things go bad. However, in my program, I can't even use 0.25. I decided to try to do something about this. Specifically, I ran the program at 0.25, for just a few steps, to see where the errors were coming from.
So, we have a plot of the flow around this cylinder. In the middle is a very small cylinder, with the appropriate sort of flow developing around it, quite happily. Very pretty, really....
Then, coming in from the outer rim of the simulation is an angry blue-and-red-striped wave from numerical hell, making alternating points go to negatively and positively infinite pressures. This wave sweeps in at a raging speed, tearing up everything in its wake, and before the happy gentle little flow right around the cylinder can settle down like it's trying to do, this terrible wave is upon it and destroying it.
The pictures show the tragedy.
These pictures is an example of one of the moments in the middle. The first picture is just what I want this to look like -- a nice, smooth flow that's got a high pressure in front of the cylinder to slow the flow down there, and a low pressure behind it to make the flow curve back in to fill in the space behind it.
Meanwhile, in the second picture, you can see the onrushing wave, constricting in around the cylinder in the middle -- but, like the shock wave from an explosion (except this time going inwards instead of outwards), almost everything is calm and untouched before it gets there. The well-behaved flow in the middle has no idea what's about to hit it.
The flow around the cylinder, converging to the appropriate solution in a nice gentle manner.
The wave of numerical error from the boundary constricting around the above region.
A mere 40 steps later, and boom, the nice gentle stuff in the first picture is all obliterated.
Sigh. I suspect I'll have to fix this tomorrow; about all I have time for is a bit more investigating why it's happening.
But you see why this looks so tragic? Or is this just me?