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)

OpenFOAM 1.5 on Ubuntu 8.10

Although we have a general idea of how low Reynolds number foils, bulbs, and rudders should look like, we thought it would be fun to do some Colorful Fluid Dynamics to test different airfoils and configurations. It's likely that we will pick a well-known airfoil for the first set of foils and bulb for the Pikanto project, but if anything comes out of this computational analysis then cnc-machining new moulds is not a problem.

There are a lot of CFD software packages out there, some expensive and some hugely expensive. The most well known open-source alternative seems to be OpenFOAM. It's not as easy to use as the fancy commercial ones, but it's well supported by both academic and industrial users, and it's free! Some installation notes, mostly for myself, on how I installed Ubuntu 8.10 and OpenFOAM 1.5.

  1. download 64-bit Ubuntu 8.10 iso-file and burn to CD (8.04 did not want to boot on my Q9300 cpu machine, probably a motherboard conflict?)
  2. install Ubuntu as normal, run suggested updates (286 of them actually!)
  3. for OpenFOAM I roughly followed instructions from here: https://help.ubuntu.com/community/OpenFOAM
  4. download all the .gtgz files from here. Rename them to just .tgz so Ubuntu knows how to extract them
  5. run the bashrc magic with '. $HOME/OpenFOAM/OpenFOAM-1.5/etc/bashrc' followed by 'source ~/.bashrc'
  6. now in OpenFOAM-1.5/bin we can try './foamInstallationTest' which errors out because it doesn't find ssh or rsh (these are only needed for remote installations or cluster-calculations or similar I think)
  7. to make foamInstallationTest happy, install ssh: sudo apt-get install ssh
  8. now foamInstallationTest reports that all systems are go.
  9. paraFoam which is used for pre- and post-processing needs QT. I'm not sure which packages exactly are required, but mine started working after installing 'libqtcore4', 'libqt4-assistant', 'libqtgui4' and all of their dependencies. (I did this with the synaptic package manager)
  10. Ready!

Try running the tutorial cases in e.g. ~/OpenFOAM/OpenFOAM-1.5/tutorials/icoFoam/cavity. This tutorial is explained in the docs here. Everything is set up already, so you only have to run blockMesh to generate the mesh, then icoFoam to do the actual calculation, and then visualize with paraFoam.

arrows

IOM sail camera videos

Looks like the mast bends to leeward at the middle, while the top of the mast stays in place. I don't think that's a good thing. Should try lower shroud attachment point and maybe shorter spreaders.

Remember to turn up the sound so you hear the wind, water, and the RMG winch! Also try these in higher quality by going to youtube and clicking "watch in high quality".

Here's how the camera looks on the foredeck:

Prototype finbox for Noux

Although we've already built a number of finboxes, I've forgotten to publish the plan - so here it is. As the Noux Mk2 is still somewhat of a prototype this finbox has a long 27.5 x 5 mm slot for the mast which will allow optimisation of the best mast position and rake angle during testing. So as not to carry a whole lot of extra water in the boat we made the mast-box narrow, 5mm, which means that the lower end of the mast needs to be an aluminium extrusion of 5mm width... A future Noux Mk3 might again have a more traditional mastbox for a round mast when we have found the optimal position.