Skip to content
Computational Fluid Dynamics (CFD) for FreeCAD based on OpenFOAM solver
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode CFD: Restructured cart mesh and ported to case builder Aug 17, 2017
Gui/Resources/icons Change main icon to SVG Jun 14, 2019
data Make material cards properly backward compatible with 0.18 Jul 11, 2019
testFiles CFD: Add macro scripting Jun 5, 2017
.gitignore CFD: Convert to new case builder May 25, 2017
CfdAnalysis.py Update headers Jun 26, 2019
CfdCaseWriterFoam.py Update headers Jun 26, 2019
CfdConsoleProcess.py Update headers Jun 26, 2019
CfdFaceSelectWidget.py Update headers Jun 26, 2019
CfdFluidBoundary.py Update headers Jun 26, 2019
CfdFluidMaterial.py Update headers Jun 26, 2019
CfdInitialiseFlowField.py Update headers Jun 26, 2019
CfdMesh.py Update headers Jun 26, 2019
CfdMeshRefinement.py Update headers Jun 26, 2019
CfdMeshTools.py Speed up writing mesh refinement objects Jul 9, 2019
CfdPhysicsSelection.py Update headers Jun 26, 2019
CfdPreferencePage.py Add path normalisations Jul 17, 2019
CfdPreferencePage.ui CFD: Allow output folder to be set for system and case Aug 28, 2018
CfdResidualPlot.py Update headers Jun 26, 2019
CfdRunnableFoam.py Update headers Jun 26, 2019
CfdSolverFoam.py Update headers Jun 26, 2019
CfdTools.py Add path normalisations Jul 17, 2019
CfdZone.py Update headers Jun 26, 2019
Init.py CFD: Changed default bc to slip and increase nonorth corr Feb 23, 2017
InitGui.py Update headers Jun 26, 2019
README.md Rename Readme so that it is picked up by Addon manager Jun 28, 2019
TaskPanelCfdFluidBoundary.ui CFD: Add support for HiSA solver Aug 21, 2018
TaskPanelCfdFluidProperties.ui CFD: Add support for HiSA solver Aug 21, 2018
TaskPanelCfdInitialiseInternalField.ui Refactor and simplify codebase Jun 25, 2019
TaskPanelCfdListOfFaces.ui CFD: Add reusable face/geometry selection widget Jan 1, 2018
TaskPanelCfdMesh.ui Refactor and simplify codebase Jun 25, 2019
TaskPanelCfdMeshRefinement.ui Add arbitrary internal mesh refinement regions Jun 25, 2019
TaskPanelCfdSolverControl.ui CFD: Allow output folder to be set for system and case Aug 28, 2018
TaskPanelCfdZone.ui Refactor and simplify codebase Jun 25, 2019
TaskPanelPhysics.ui Refactor and simplify codebase Jun 25, 2019
TemplateBuilder.py Update headers Jun 26, 2019
TestCfd.py Update headers Jun 26, 2019
WindowsRunWrapper.py Update headers Jun 26, 2019
_TaskPanelCfdFluidBoundary.py Update headers Jun 26, 2019
_TaskPanelCfdFluidProperties.py Update headers Jun 26, 2019
_TaskPanelCfdInitialiseInternalFlowField.py Update headers Jun 26, 2019
_TaskPanelCfdMesh.py Update headers Jun 26, 2019
_TaskPanelCfdMeshRefinement.py Update headers Jun 26, 2019
_TaskPanelCfdPhysicsSelection.py Update headers Jun 26, 2019
_TaskPanelCfdSolverControl.py Update headers Jun 26, 2019
_TaskPanelCfdZone.py Update headers Jun 26, 2019
metadata.txt Use new mat card reader Jul 9, 2019

README.md

CfdOF: A Computational fluid dynamics (CFD) workbench for FreeCAD

This workbench aims to help users set up and run CFD analyses within the FreeCAD modeller. It guides the user in selecting the relevant physics, specifying the material properties, generating a mesh, assigning boundary conditions and setting the solver settings before running the simulation. Best practices are chosen to maximise the stability of the solvers.

screenshot

The workbench serves as a front-end to the popular OpenFOAM® CFD toolkit (www.openfoam.org, www.openfoam.com).

Disclaimer: This offering is not approved or endorsed by OpenCFD Limited, producer and distributor of the OpenFOAM software via www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® trade marks

Features

Current:

  • Incompressible, laminar flow (simpleFoam, pimpleFoam)
  • Incompressible free-surface flow (interFoam, multiphaseInterFoam)
  • High-speed compressible flow (HiSA)
  • Basic material database
  • Flow initialisation with a potential solver
  • Cut-cell Cartesian meshing with boundary layers (cfMesh)
  • Cut-cell Cartesian meshing with porous media (snappyHexMesh)
  • Tetrahedral meshing using GMSH
  • Postprocessing using paraview
  • Porous regions and porous baffles
  • Runs on Windows 7-10 and Linux
  • Unit testing
  • Extension to turbulent flow using RANS (k-w SST)
  • New case builder using an extensible template structure
  • Macro scripting

Planned:

  • Conjugate heat transfer.

Platforms supported

Linux

Any system on which FreeCAD and the prerequisites listed below can be installed.

Windows

Windows 7-10; 64-bit version is required.

MacOSX

Not widely tested, but possible.

Getting started

Prerequisites

The CfdOF workbench depends on the following external software, some of which can be automatically installed (see below for instructions).

Setting up the CfdOF workbench

Windows

The latest release or development FreeCAD build can be obtained (64 bit version) and the latest CfdOF workbench can be installed into it using the Addon manager:

  • After running the installer or extracting the .7z archive to a directory , run FreeCAD in place (<FreeCAD-directory\bin\FreeCAD.exe).
  • Select Tools | Addon manager ...
  • Select CfdOF in the list of workbenches, and click "Install/update"
  • Restart FreeCAD
  • For installation of dependencies, see below.

Note: The CFD workbench can be updated at any time through the Addon manager.

Dependency installation

Dependencies can be checked and installed conveniently from the CFD Preferences panel in FreeCAD. In the FreeCAD window, select Edit | Preferences ... and choose "CFD".

The OpenFOAM installation is via the blueCFD-Core package (version 2017-2), with which Paraview comes bundled. This can be installed manually using the above link, or by clicking the relevant button in the Preferences panel described above.

Please note that User Access Control in Windows 10 can restrict write access to the Program Files directory, which interferes with the installation of cfMesh and HiSA in blueCFD-Core. It is therefore recommended that blueCFD-Core be installed outside the Program Files folder.

Set the OpenFOAM install directory in the preferences panel to <blueCFD install directory>\OpenFOAM-5.x (It will be automatically detected in the default install location.)

Likewise, cfMesh and HiSA can be installed from the Preferences panel. They are automatically built from source inside the OpenFOAM environment if installed from the Preferences panel. Note that this is a lengthy process.

Choosing the "Check dependencies" option will verify that all prerequisites have been successfully installed.

Linux

AppImages of the latest release or development versions of FreeCAD can be downloaded and run directly without installation. Note that you will have to enable execution permission on the downloaded file to run it. The Ubuntu PPA daily build packages are an alternative binary option. Otherwise, FreeCAD can be built from the source code at https://github.com/FreeCAD/FreeCAD .

Before installing CfdOF, the Plot workbench must first be installed into FreeCAD using the Addon manager:

  • Run FreeCAD
  • Select Tools | Addon manager ...
  • Select Plot in the list of workbenches, and click "Install/update"
  • Restart FreeCAD
  • Repeat the above for the "CfdOF" workbench
  • For installation of dependencies, see below
Dependency installation

Dependencies can be checked and some of them installed conveniently from the CFD Preferences panel in FreeCAD. In the FreeCAD window, select Edit | Preferences ... and choose "CFD".

However, in Linux, manual installation is required for OpenFOAM, Paraview and GMSH (optional). They should be installed using your distribution's package manager or the links above.

Set the OpenFOAM install directory in the preferences panel - typical install locations are /opt/openfoam6 or /home/user/OpenFOAM/OpenFOAM-6.x (It will be automatically detected in common default install locations.)

cfMesh and HiSA can be installed using the Preferences panel described above, and can be downloaded and built from the source code inside your OpenFOAM installation if you have not already done so yourself. Note that this is a lengthy process.

Choosing the "Check dependencies" option will verify that all prerequisites have been successfully installed.

Feedback

Reporting Bugs

Please discuss issues on the CfdOF dedicated FreeCAD forum. Bugs can be reported on the github project site.

Please first read the guidelines for reporting bugs in order to provide sufficient information.

Development

It is asked that developers should only add functionality or code that is working and can be tested. Dead code, even portions included for possible future functionality, reduces function clarity and increases the maintenance overhead. Our philosophy is 'Do the basics well' and therefore robust operation takes precedence over extended functionality.

Testing

Unit testing is currently under development. Where possible, it is asked that all new functionality should be included in the unit test framework.

Style guide

For consistency please follow PEP8

  1. Use 4 spaces per indentation level (spaces are preferred over tabs).

  2. Limit all lines to a maximum of 120 characters.

  3. Break lines before binary operators.

  4. Blank lines

    • Surround top-level function and class definitions with two lines.

    • Definitions inside a class are surrounded by a single line.

  5. Imports should usually be on separate lines.

  6. Comments

    • Docstrings always use """triple double-quotes"""

    • Block comment starts with a # and a single space and are indented to the same level as that code

    • Use inline comments sparingly. They are on the same line as a statement and should be separated by at least two spaces from the statement.

  7. Avoid trailing whitespaces

  8. Naming convention

    • ClassNames (Camel)
    • variable_names_without_capitals (Underscore)
    • CONSTANTS_USE_CAPITALS (Uppercase)
    • functions_without_capitals (underscore, preferred as it follows PEP8)
    • functionsWithoutCapitals (Camel instead of underscore is accepted as it is widely used within FreeCAD)
    • __class_attribute (Double leading underscore)

Acknowledgements

Funding

This development was made possible through funding from Eskom Holdings SOC Ltd and the Council for Scientific and Industrial Research (South Africa).

Lead developers

The code is maintained by

Contributors

We acknowledge significant contributions from

  • Qingfeng Xia (2015) - Original framework
  • Michael Hindley (2016) - Initial concept
  • Klaus Sembritzki (2017) - Multiphase extension
  • Thomas Schrader (2017-2018) info@schraderundschrader.de - Testing and user assistance
You can’t perform that action at this time.