Hacker News new | ask | show | jobs
by hyperpallium 2957 days ago
I'm doing some fluid simulation (CFD), and the actual code for finite differences is simple. But the analysis (of stability etc) is more mathy, and I don't feel confident reading other needed papers, because they are couched in math.

I mean, I can and have coded it, but can't be sure how it how it will behave in all situations.

So I can understand these papers, I'm going back to study math properly. I'm not fully convinced it's really needed (though how could I tell?), but I'm fully convinced it's needed to understand the papers.

Math is the latin of CFD.

1 comments

I work in Engineering and feel somewhat similar about CFD. There's always some element of doubt lurking in the back of my mind "is it really correct in all circumstances".

The most useful info I learnt at university were a couple of equations: Bernoulli's (for general observation about expected pressure drop), Ergun's (for flow through packed beds) and the general laws of thermodynamics.

Those are mostly enough to be able to sketch out an intuitive 'guess' about expected behavior in a large range of systems and the underlying math is not particularly demanding.

Have you seen the Method of Manufactured Solutions (MMS)?

You guess ("manufacture") a solution to the PDE. Then you plug it into the PDE. It won't be correct, so you just add source terms to make it correct. You now have an analytical solution for this PDE with those source terms. You can now run your simulation (with those source terms) and compare it with the "correct" solution.

Unfortunately, you'll introduce discretization error, because your delta x and delta t aren't infinitessimal. But using the order of accuracy of your discretization method, you know how the error should change with delta x and delta t. So you graph error against delta x, on log-log, and see if the curve matches the order of accuracy. Apparently, it shows up even minor bugs in your code really well.

This approach scares me a little, because how do I know my math is correct? I need better appreciation of how the order of accuracy interacts over time as well as space; the behaviour of error summaries; and how log-log plotting works.