Creating Solvers

Creating Solvers

While OpenFOAM can be used as a standard simulation package, it offers much more because it is open source and because it is designed to be a flexible, programmable environment for simulation by having top-level code that is a direct representation of the equations being solved, e.g.:

-----+ ∇ ∙ρUU  -  ∇ ∙μ ∇U  =  - ∇p
\relax \special {t4ht=

is represented by the code:

        fvm::ddt(rho, U)
      + fvm::div(phi, U)
      - fvm::laplacian(mu, U)
      - fvc::grad(p)

This makes OpenFOAM an excellent choice for customisation, compared to closed source software:

  • Users have total freedom to create or modify a solver.
  • Users can easily reuse functionality that is pre-compiled into shared libraries.
  • Compiled solvers can be tailored by a user for a specific need rather than ’bolt-on’ subroutines, making OpenFOAM ideal for research and development.
  • All applications, including those for CFD simulation, pre- and post-processing, meshing, etc, are compiled using common functionality in the collection of libraries included in OpenFOAM. This ensures consistency across the whole of the OpenFOAM distribution, rather than having a suite of packages compiled from entirely separate source code.
  • Transparent solution algorithms which can be viewed by the user, encouraging better understanding of the underlying physics.

The use of advanced level C++ as the core programming language brings major benefits to users:

  • Advanced error checking at both complile and run time.
  • Extremely robust solver and utility executables.
  • High speed calculation with efficient memory management and fast linear equation solvers.
  • Parallel processing with linear speed up with number of processors.