OpenFOAM programming that utilizes the unlimited flexibility of open source software. Developing maintainable CFD tools using OpenFOAM coding standards with C++.

From the leaders of the OpenFOAM project and creator of OpenFOAM. 100% open source.

Programming CFD | OpenFOAM Training | Course Modules (3 days)

Introduction to Programming

  • Getting started with C++: creating a C++ program, compilation, scope, namespace, header files
  • OpenFOAM core classes: introduction, scalar, vector, tensor, List, Field, word
  • Tools and practice: finding classes & functions, code readability, programming style, file editor, scripts

Utility Programming

  • Data construction: Time and fvMesh, fields, dimensioned types, primitives and const
  • Data access and processing: introduction, references, data access in loops, function styles, data output
  • Data input: reading data, keyword lookup, dictionary hierarchy, scalar/label lookup, command line arguments/options
  • Data operations: code verification, compound assignment, reduction operations, case statements, error checking, type conversion, efficiency

Boundary Conditions

  • Class hierarchy: boundary mesh and fields, patch field types, new boundary condition, private data, constructors
  • Generic programming: templates, template boundary condition, pTraits, lookup with default, parameter checking
  • Class functions/data: private functions, “*this” pointer, updateCoeffs(), user interface, documentation

Model/Solver Code Structure

  • Interfaces: library-application interface, model update and delivery, virtual functions, run-time selection
  • Data Initialization: class declaration, member access (public, private, protected), constructor initialization
  • Optional models: autoPtr, memory allocation, pointer de-referencing, pointer validity

Model/Solver Numerical Methods

  • Fields: GeometricField, dimensional units, volume and surface fields, flux, mesh regions, DimensionedField
  • Equations and algorithms: solver code, iterative solution, momentum predictor, pressure equation, fvMatrix
  • Derivatives and algebra: tensors, tensor algebra, interpolation, derivative functions, sources, implicitness

Data Analysis (Post-Processing)

  • Data processing: creating a new function object, reading parameters, data access / calculation, customizing output
  • Data output: output to file, formatting output, output in parallel, extending applicability, default inputs

See the OpenFOAM Training Schedule and Book

… for the Essential CFD, Applied CFD & Programming CFD courses


Who Should Attend

Target Audience

  • CFD users working in R&D, academia and method development
  • Existing users developing in-house CFD capability
  • Programmers required to code to the OpenFOAM standards
  • Users needing to manage robust, maintainable code


  • A science/engineering/mathematics background is beneficial
  • Familiarity with Linux is an advantage
  • Working through the OpenFOAM Linux Guide is strongly encouraged

Greatly enhanced my understanding


The programming course greatly enhanced my understanding of OpenFOAM. The course materials were very carefully developed… I am now in a position to develop my own tailored OpenFOAM applications.

J.P., Caldera USA

An instructor who is also developing OpenFOAM


An instructor who is also developing OpenFOAM. Great and to the point. Understanding the overall OpenFOAM programming structure was a key benefit to me.

N.S., Vrjie Universiteit / Von Karmen Institute, Belgium

Understanding OpenFOAM like never before


Finally, I understand some OpenFOAM features that I never understood before. The primary strength was how to implement boundary conditions properly.

L.K., Xaar plc., UK

Course is very well prepared


A very good course for understanding OpenFOAM. The instructor is very good at this and the course is very well prepared. The printed material is very helpful.

P.G., Universidad de la República, Uruguay

Exposure to classes, templates and functions


The primary strengths of the course were hands-on exercises and exposure to classes, templates and functions and how to use them… and reading Doxygen documentation.


Can confidently develop my own applications


Learning from one of the co-founders of OpenFOAM is invaluable. I now understand the architecture and ethos of OpenFOAM and can confidently develop my own applications, boundary conditions and post-processing tools. The supporting materials and delivery of the course were of a very high standard.

C. W. H., Zyba Ltd., UK

Wonderful training programme


The course content was very good and covered most of the important parts of the software… the instructor helped with all our problems, answering all our questions.

S.I., Australian National University

Further Details

Competence in OpenFOAM Programming

  • This course has been created over several months, drawing on 2000 hours OpenFOAM training experience, by…
  • Chris Greenshields: OpenFOAM project manager and leading trainer, with 1000+ hours of training OpenFOAM programming.
  • Henry Weller: OpenFOAM creator and architect, who pioneered C++ for CFD and created the coding practice used in OpenFOAM.
  • It enables competency: the confidence to program OpenFOAM to a defined standard.
  • Confidence = not freezing at the keyboard.
  • Repeatedly = delivering good software, time and again
  • Defined standard = understand what good software is and delivering it in a timely manner.
  • It addresses the complexity of programming CFD through modular curriculum.

Accelerated Learning

Learning OpenFOAM Programming through Experience

  • The training involves learning through experience.
  • We use customization tasks commonly needed across all a range of scientific disciplines and industries.
  • … e.g. utility programming, model development, boundary condition, solver development and customized post-processing.
  • Programs are written in small, digestible steps with periods of reflection to reinforce new concepts.
  • This reflects real programming practice, where trouble-free, complex programs cannot usually be set up in “one go”.