CFD with OpenFOAM


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:


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


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:


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) !

6 thoughts on “CFD with OpenFOAM”

  1. Hi John,
    The plug is ready and the next step is to make some sturdy glassfiber moulds from it. We will start with the deck-mould, hopefully in the next 2-3 weeks. Realistically we'll have boats on the water next spring.

  2. Just stumbled upon your post, some remarks:
    On your concern (3): your grid should indeed be fine enough such that the solution does not change anymore on further refinement. This increases computing time, but that's the way it is. You probably need a bigger computer or accept the inaccuracy.
    On (4): RANS is your only feasible option. For a case like this DNS is impossible and LES/DES is probably too expensive. Then the choice of turbulence model is important. For this case I think the kOmegaSST model is more appropriate than the kEpsilon model.

  3. I red in Seahorse magazine (September issue) about North sails Japan work in this area. They used a potential based CFD ie no turbulence modelling. I normally work with FEM, but I talked to a colleague who work with CFD and he thought it sound reasonble.

    Have you been thinking about using the pressure distribution in a FEM calculation and then go back to the CFD?

  4. >Then the choice of turbulence model is important. For this case I think the >kOmegaSST model
    >is more appropriate than the kEpsilon model.

    Yes, I have mainly used kOmegaSST. It seems to give much more realistic flow separation prediction than kEpsilon in upwind sails simulation.


  5. >I red in Seahorse magazine (September issue) about North sails Japan >work in this area. They used >a potential based CFD ie no turbulence >modelling. I normally work with FEM, but I talked to a
    >colleague who work with CFD and he thought it sound reasonble.

    I have seen that same article. There is inviscid potential flow model in OpenFOAM, but I have not used it when RANS have been available. Most interesting things in sails aerodynamics will be missed with potential flow model. I think North Sails Flow is a vortex lattice method program,
    technology from 1940's...

    >Have you been thinking about using the pressure distribution in a FEM >calculation and then go back to the CFD?

    Yes, next step would be to learn how to do sails fluid structure
    interaction with OpenFOAM. RANS based sails fluid structure interaction has already been done
    with OpenFOAM by some top level scientist's, so it is possible, but I don't know how much computer horse power or calculation time is required for that. Fluid structure interaction with potential flow will have short calculation time, but it is limited to upwind sails working at small apparent wind angles. Maybe with coarse mesh it would be possible to do RANS based sails fluid structure interaction in reasonable time even with desktop computer.


Comments are closed.