Computational fluid dynamics (CFD) uses numeric methods to study any natural phenomenon and solve any engineering problem related to fluid flow. It has been an indispensable tool for many engineers. Mature, powerful CFD products are available nowadays. While these products are very useful tools for engineers, they were not designed for kids to play with. Understandably, the business community lacks the financial incentive to push the agenda of making a product friendly to students for learning science and engineering. With all these years passed while CFD products got better and better, all the wisdom developed for modeling and understanding the natural and man-made systems never got spread to schools in a satisfactory scale.
This tragedy was, in part, caused by the unfortunate fact that few people in the education community had realized the enormous power of CFD for teaching science and engineering. Educators had a very good reason for not seeing it, because the power has never been brought close enough to matter in their professional careers. Most CFD tools are either too complicated to use or do not deliver the needed visual effects and user interfaces to matter. This is an issue that cannot be simply said solved by sending a demonstrator from the CFD community to the education community. Talking and showing are cheap. To bridge the gap, we need actions that will truly make a difference.
Supported by the National Science Foundation with an urgent need for educating young students with energy science and technology, we are developing a versatile CFD package suitable for teaching the scientific and engineering principles related to energy flow, particularly about energy-efficient passive solar buildings. The package consists of two programs called Energy2D and Energy3D, respectively, for the 2D and 3D versions of the CFD simulator.
Energy2D and Energy3D are based on solving the heat equation for modeling thermal conduction, coupled with the Navier-Stokes equation for modeling convection. A ray-tracing method is used to model radiation. The minimum requirement is that the simulation must run fast enough to be interactive so that students can play with it.
After a few weeks of work, I came up with a primitive version of Energy2D. The following two screenshots show that if the obstacle has a small cross section against the flow, turbulence will not occur.
It turned out that writing an unconditionally stable heat solver was not a big deal. After all, it is just a simple diffusion equation that can be easily solved using an implicit method.
Writing a fluid solver is more challenging as it is non-linear (which is where all the fun comes from). I played and tested Jos Stam's fluid solver, which is based on an unconditionally stable Semi-Lagrangian method that is also used in weather prediction. Unfortunately, the solver is covered by a pending patent that we didn't succeed in convincing the current patent owner to license to us in any way--open-source or not. So I had to give up Stam's method and sought to reinvent the wheel.
I implemented the MacCormack method, which turned out to work fine for now. Compared with the Semi-Lagrangian method that achieves its stability by overdamping the fluid, the MacCormack method has no overdamping problem so it has to suffer from the stability problem. As a side note, I also found that after using the vorticity confinement method to re-inject vorticity to the solution of the Semi-Lagrangian method to make it more turbulent, it would also suffer from the stability problem. There seems to be no free lunch in seeking a fast, yet accurate, fluid solver.