CFD

From CUSF Wiki
Revision as of 19:11, 31 December 2021 by NikLebedenko (talk | contribs) (More installation instructions added)
Jump to navigation Jump to search

This page is currently a work in progress by Nik Lebedenko - if you want to ask questions / see a mistake / request more details to be added to this page, feel free to email me or message me on slack.

Fluid-structure interaction (FSI)

This technique allows complex interactions between flexible structures and fluid flows. This has been used to predict fin flutter at hypersonic speeds for Griffin 1.

Simulations of this kind are achievable with the combination of the following free open-source software packages:

  • OpenFOAM (website, install on Ubuntu) - a C/C++ library for the solution of fluid mechanics problems formulated with the Finite Volume Method (FVM),
    • Important: there are two main versions of OpenFOAM, provided at OpenFOAM.com and OpenFOAM.org. I have only used the .com version, but everything here should also be possible with the .org version.
  • FEniCS (website, install on Ubuntu) - a Python interface to the DOLFIN C++ library for the solution of solid mechanics problems formulated with the Finite Element Method (FEM), and
  • preCICE (website, install on Ubuntu) - a very powerful library which allows the coupling of arbitrary solvers using human-readable syntax.
    • Note: in order to use OpenFOAM and FEniCS with preCICE, it is also necessary to download their respective adapters. See this page and this page from the preCICE website for further information.

Step-by-step instructions

  1. Install Ubuntu. If you are running a Windows machine (Windows 10 or above), I recommend installing Windows Subsystem for Linux (WSL - use WSL1, discussion of WSL2 below) instead of setting up a dual-boot partition.
    • Note: there is a choice between WSL1 and WSL2, with the main difference being that WSL2 has significantly improved read-write speeds compared with WSL1 while staying within the Linux file system, but WSL2 has significantly worse read-write speeds when moving between the Linux and Windows file systems. In practical terms, this means that the Linux-based software (OpenFOAM, FEniCS) will read and write faster, at the expense of Windows-based ParaView installations loading results much slower when post-processing. Since OpenFOAM spends significantly more time solving equations than reading and writing files, and gigabytes of data need to be loaded across file systems for post-processing in Windows, I recommend sticking with WSL1. If you prefer WSL2, you can install ParaView on Ubuntu, installing XMing to view the GUI (see this page and this page for further information)
  2. Install OpenFOAM on Ubuntu. The Ubuntu installation instructions as of 31/12/21 are summarised below for redundancy:
    curl -s https://dl.openfoam.com/add-debian-repo.sh | sudo bash
    sudo apt-get install openfoam2012-default
    • Note: I use OpenFOAMv2012, but later versions should also work.
  3. Install FEniCS on Ubuntu. The Ubuntu installation instructions as of 31/12/21 are summarised below for redundancy:
    sudo apt-get install software-properties-common
    sudo add-apt-repository ppa:fenics-packages/fenics
    sudo apt-get update
    sudo apt-get install fenics
  4. Install preCICE on Ubuntu.