5 OpenFOAM Features We Love

Over the past few years we have been studying the open source solver OpenFOAM and have really been impressed. We thought we would share short list of our favorite features that we believe make it a viable option for many who are searching for a cost effective tool to use for their CFD models.

1. Easy to install and use on Ubuntu

If you are comfortable with the Ubuntu flavor of linux, then you will be happy to hear that there are images available that make it very easy and straight forward to download the most recent stable build of OpenFOAM and start using it with very little effort on your part. That is not to say you can’t use it on other platforms and other versions of linux, but on some of those you might have to compile the code. So, if you are planning on buying hardware to run OpenFOAM on, we would suggest looking at a computer with Ubuntu on it.

2. Ready to use out of the box

Some have a misconception that OpenFOAM requires you to be able to write C++ code to be able to use it for your CFD models. That is not the case. There are a number of solvers that come with the installed files that are compiled and ready to use. Writing C++ code only comes into the picture if and when you reach the point where you need to write a specialized boundary condition or source term. You may find it necessary to write your own solver using the OpenFOAM framework if your problem is very unique and far different from the standard set of problems normally encountered, but chances are you will find that one of the solvers that come with the installation will be suitable for you at the start at least.

3. Comes with a meshing tool

OpenFOAM is not the only open source CFD solver we have come across, but it is the only one we have seen that has taken the extra steps to provide a meshing tool as well. Most open source solvers leave it up to you to find a way to build a mesh, but OpenFOAM comes with blockMesh and snappyHexMesh, two meshing tools that make it possible to build body conforming meshes with boundary layer mesh included. Together these two tools make it possible to build a mesh that is acceptable for a large number of applications.

4. Provides a complete analysis system

In addition to providing a good meshing tool, OpenFOAM provides a way to easily post process your CFD results using ParaView, an open source visualization tool. Once your OpenFOAM case has converged, you can run a simple command to have that case file open in ParaView. This, combined with the meshing tools mentioned above, provides a complete CFD analysis system that is completely open source from start to finish. This is very rare and very impressive.

5. Can be extended to meet your needs

We made the point of stressing at the beginning that there is a misconception that one needs to know C++ in order to use OpenFOAM. Again, this is not the case. Out of the box, one can begin using OpenFOAM as is by using one of the compiled solvers that comes with the installation. One does have to learn how to correctly set up your input files, but this in no way involves writing C++ code. However, having said that, one can extend OpenFOAM to meet your specific modeling needs if your problem requires it. Using a well structured and documented process, you can develop your own boundary conditions and source terms. You can also develop your own solver if needed but this would be more rare then the first case as most problems can be addressed using one of the compiled solvers that come with the installation. Once you learn the process to develop a new boundary condition type or source term, you will find the amount of code required to do so is very reasonable and most would find it something they can handle.

Ten Mistakes ANSYS Fluent Users Make

We have I had the chance to work with a lot of engineers who were new to CFD and were using the ANSYS Fluent CFD solver to solve their problem.  We noticed a number of mistakes that would come up on a regular basis and thought a list of those might prove helpful to someone.

Mistake #1 – Not making use of Workbench.  A lot of users prefer to make use of Fluent as a stand alone tool due to the way their workflow.  This is fine, but what a lot of those users don’t seem to be aware of is that there are features that Workbench provides that are worth including in your workflow.  For example, many users are not aware that if you have Fluent, you also have the ability to make use of ANSYS Meshing through the module provide in the Workbench software tool.  Another useful feature the Workbench tool provides is the ability to set up parametric studies to allow one to quickly run a set of cases, rather than having to manually run one at a time.

Mistake #2 – Forgetting to change the setting from Solid to Fluid when using the Meshing module available in Workbench to build their mesh.  ANSYS offers both FEM and CFD software tools, and the default in their Meshing provided in Workbench defaults to Solid for the case when building a mesh for a FEM type analysis.  If you don’t change this to Fluid, Fluent will only be able to solve the conduction part of your problem, which will be way off from reality.

Mistake #3 – Not adding local mesh size settings to control mesh resolution.  Many users will simply try to the one set of controls that are offered in the Mesh module that control the mesh size uniformly through out the model.  However, the Meshing module in Workbench offers the ability to add things such as Face sizing and Body sizing that allow a user to have local control over the size of the mesh cells in different local regions and on difference surfaces of their model.

Mistake #4 – Failing to add an appropriate boundary layer mesh.  For a lot of users, figuring out how to add a boundary layer mesh can be a bit challenging, and then there are some users who are not even aware they need one.  If your flow is turbulent, you will need to use one of the turbulence models in Fluent and that will require a boundary layer mesh.

Mistake #5 – Failing to adjust the wall spacing and resolution for their boundary layer (inflation layer) if they did add one.  Many users will simply add the inflation layer to represent their boundary layer, but then not appropriately adjust the settings within it to match their flow conditions, but rather simply leave them to the default values.

Mistake #6 – Leaving the Courant number to the default of 200.  Again, this is partly due to some users not being aware it’s there or what it does.  An easy way to think of the Courant number is it is a type of measure of how aggressive the solver is going to be in driving your solution to a converged solution.  On paper it can be shown that a lot of implicit solution schemes like those available in Fluent, theoretically are stable at any Courant value, however when a implicit numerical solution scheme is implemented into actual software, it is introduced to reality and you will find that there are some practical limits.  If you look at the residuals Fluent prints to its console, you will notice it includes information about the sub-iterations it is completing.  You should see a statement that it reached convergence for that iteration.  If it ran the maximum allowed sub-iterations and did not reach convergence before moving on to the next iteration, either your Courant number is set too high or one of your other solver settings needs adjusting.

Mistake #7 – Not adjusting the convergence criteria.  Fluent has a default setting for each of the equations it solves.  That default is 1E-3, meaning that once it sees the residual size for that equation drop below 1E-3, it will consider that equation converged.  This might be ok for your problem, for for some types of data, a more strict convergence criteria of 1E-5 or even 1E-6 might be needed.  This is problem dependent.

Mistake #8 – Not running enough iterations.  Many users are not aware that the above convergence criteria is used by Fluent, by default, to determine when to stop running.  They will enter a number of iterations, assuming Fluent will run them all, and then expect to return and find Fluent has done so.  However, what will actually happen is that once Fluent detects the residuals for the equations it is solving falls below the criteria set as described above in Mistake #6, it will simply stop there and consider itself done.

Mistake #9 – Not selecting the correct solver type for their problem.  Many users are not aware that within Fluent there are two solvers, a pressure based solver for incompressible flows and a density based solver for compressible, high Mach number, flows.

Mistake # 10 – Not archiving their project when done.  A lot of users, even if they do make use of Workbench, will tend to manually pick and choose which files to keep from within the folder structure that represents the project.  They assume the project folder structure itself is simply a convenience and are not away that the project folders along with the files it contains go together to fully define the project.  Due to not knowing this, they will just keep one to files, for example their case and data files, and then not bother to keep the rest. Later when they have problems with their cases they are unable to retrieve some of the information they needed because they did not retain the other files from within the project folders.  To avoid this situation, a user should make use of the archive feature offered in Workbench.  Under the File drop down there is an archive project option.  This will create a zip type file of your project that contains all of the files and sub-folders, and will make it possible to work with the project at a later date.

ANSYS Fluent, ANSYS Workbench, and ANSYS are trademarks of the ANSYS corporation.  We are not affiliated with ANSYS.  The opinions expressed here are our own and are not those of ANSYS.