CFD with OpenFOAM

iom_cfd

Some details and text on the Computational Fluid Dynamics simulations that mostly Jari has been doing lately. They are done with the open-source software package OpenFOAM, which is of course free to download and use. We run it under Ubuntu, and use fairly affordable 4-core machines with 8 Gb of RAM.

You start with a CAD model of the geometry you want to simulate. Here the hull-shape has been taken from one program, and the sail shape from another sail-design program. They're imported into a third CAD program and joined into the model we want to simulate.

There are (at least!) two issues at this stage: (1) the meshing-tools that follow do not like infinitely thin surfaces, so in order for meshing to run smoothly the sails have to be drawn as having some finite thickness, about 1-2 mm in this case. We can try to reduce this in the future. (2) This is only a CFD simulation, not a fluid-structure interaction simulation. That means the geometry (sails, mast, etc) is not going to move or flex in any way in response to the fluid pressure. So the trim and shape you draw into the sails is going to stay there...

The geometry is exported as STL-files for each surface. Meshing then follows. It's first done with a simple program called blockMesh, and then refined close to any specified surfaces using a program called snappyHexMesh. The resulting mesh looks like this:

mesh3

And if we zoom in we see the smaller cell-size around the surfaces of the model:

Mesh1

Here's another potential problem with CFD. (3) How do you know what the right mesh-size is? You don't. Decreasing the cell-size obviously leads to a more accurate simulation, but as the size of the mesh goes up the calculation time increases similarly. Some CFD/FEM-packages have adaptive solvers that can increase the mesh-resolution in areas of the simulation where it's most appropriate. I don't know if OpenFOAM has that. One simple approach is to run the same simulation with successively increasing mesh-sizes and see how the end result (e.g. drive force on the model) reaches a plateau, hopefully the correct value.

Then it's time to specify boundary conditions. For a wind-tunnel type of simulation the in-flow velocity on the upwind wall of our simulation-domain is fixed, and the surfaces of the model are specified as no-slip surfaces.

Solving follows. Now you actually have to select the physics model you want to simulate. Well that's easy, in the continuum-limit fluids should behave according to the Navier-Stokes equations. The only problem is that these are nonlinear and difficult to solve. Some people actually do this, but it takes a big big mesh and lot's of computing power. It's called direct numerical simulation. The rest of us with desktop-computers need to solve something simpler than the N-S equations. A lot of different approximations exist, so (4) how do you know which physics model to choose? The Reynolds-averaged N-S equations (RANS) are a popular choice. Our simulations use the simpleFoam solver, which assumes an incompressible fluid, and includes a k-epsilon turbulence model.

OpenFOAM can run the solver on one CPU-core, or the mesh can be split into parts and each part of the mesh run on a separate CPU-core. These simulations usually take around 6-12 hours to complete on a single 2.5 GHz core.

After solving it's time to visualize the results:

FlowAtZ0.75m

OpenFOAM can also integrate the pressure over select parts of the model to obtain the total force on the model. Here we chose a wind-speed and direction for which Lester Gilbert already has some real-world data. The driving and heel-forces seem to roughly agree.

Animations enhance the visual experience:

Add some music and a few camera-angles, and you would think this qualifies as promotional material for any upcoming Americas Cup syndicate...

(To see this in bigger format, click the "YouTube" logo to go their page, and then click "HQ")

That's all for now. If you're a CFD-expert, please be brave and comment below on my open questions (1)-(4) !

Colorful Fluid Dynamics

Jari has put quite a bit of time and effort into learning to use the OpenFOAM open-source CFD package. It's maybe not as polished and pretty as Comsol or Ansys or any of the other 10+ keur costing commercial packages, but it seems OpenFOAM has all the same solvers and physics models and is able to handle complex geometries and meshing - if you spend the time and effort to learn how it all works.

Stay tuned for some "digital wind-tunnel" testing of IOM sails and foils... (bring your 4/8-core machine and 8+ Gb of RAM)