Computational Fluid Dynamics

January 27, 2021 — November 30, 2023

algebra
functional analysis
linear algebra
PDEs

Fluid dynamics is a specialised sub-discipline of partial differential equations. We start by solving some variants of the Navier-Stokes equations, which govern the motion of fluids. Although these equations are idealised, they are already notoriously complicated and analytically challenging.

I know little of this area, but since I work with CFD people on ML, I need to know at least the terminology.

Figure 1

1 Textbooks

2 Tutorials

3 Eulerian methods

3.1 Finite difference method

TBD

3.2 Finite Element method

TBD

3.3 Finite volume method

TBD

4 Lagrangian methods

4.1 Smoothed Particle Hydrodynamics

TBD

5 Other methods

5.1 Lattice Boltzmann methods

6 Tooling

There are many PDE solvers, but some claim special affordances for fluid flow.

Useful (i.e. cheap, free) ones for me are below.

6.1 Mantaflow

mantaflow: an extensible framework for fluid simulation

mantaflow is an open-source framework targeted at fluid simulation research in Computer Graphics and Machine Learning. Its parallelized C++ solver core, python scene definition interface and plugin system allow for quickly prototyping and testing new algorithms. A wide range of Navier-Stokes solver variants are included. It’s very versatile, and allows coupling and import/export with deep learning frameworks (e.g., tensorflow via numpy) or standalone compilation as matlab plugin. Mantaflow also serves as the simulation engine in Blender.

Feature list

The framework can be used with or without GUI on Linux, MacOS and Windows. An incomplete list of features implemented so far:

  • Eulerian simulation using MAC Grids, PCG pressure solver and MacCormack advection
  • Flexible particle systems
  • FLIP simulations for liquids
  • Surface mesh tracking
  • Free surface simulations with levelsets, fast marching
  • Wavelet and surface turbulence
  • K-epsilon turbulence modeling and synthesis
  • Maya and Blender export for rendering

Mantaflow is associated with some projects that examine neural PDE solutions, and also with producing stunning 3d animations as an output.

6.2 Dune/Dumux

A porous flow solver, useful in e.g. hydrology.

6.3 Clawpack

Clawpack documentation

Clawpack is a collection of finite volume methods for linear and nonlinear hyperbolic systems of conservation laws. Clawpack employs high-resolution Godunov-type methods with limiters in a general framework applicable to many kinds of waves. Clawpack is written in Fortran and Python.

There is a python… interface? Port?

6.4 PhiFlow

PhiFlow: A differentiable PDE solving framework for machine learning (Holl et al. 2020).

I use this a lot, so it has its own notebook.

6.5 jax-cfd

Unremarkable name, looks handy though. Implements both projection methods and spectral methods, and different variations of Crank-Nicholson for fluid-dynamical models. Seems to imply periodic boundary conditions?

Figure 2

6.6 DPFEHM

OrchardLANL/DPFEHM.jl: DPFEHM: A Differentiable Subsurface Flow Simulator

DPFEHM is a Julia module that includes differentiable numerical models with a focus on fluid flow and transport in the Earth’s subsurface. Currently it supports the groundwater flow equations (single phase flow), Richards equation (air/water), the advection-dispersion equation, and the 2d wave equation.

Does not seem to support CUDA well but is nifty. Use in e.g. Pachalieva et al. (2022). Inverse solver example. NN example.

6.7 OpenFOAM

OpenFOAM

OpenFOAM (for “Open-source Field Operation And Manipulation”) is a C++ toolbox for the development of customized numerical solvers, and pre-/post-processing utilities for the solution of continuum mechanics problems, most prominently including computational fluid dynamics (CFD).

The adjoint optimisation takes some digging to discover. Keyword: adjointOptimisationFoam (E. Papoutsis-Kiachagias et al. 2021).

6.8 JuliaFEM

Julaifem is an umbrella organisation supporting julia-backed FEM solvers. The documentation is tricksy, but check out the examples, Supported solvers listed here. I assume these are all differentiable, since that is a selling point of the SciML.jl ecosystem they spring from, but I have not checked. The emphasis seems to be upon cluster-distributed solutions at scale.

6.9 FEniCS

Also seems to be a friendly PDE solver, lacking in GPU support. However, it does have an interface to pytorch, barkm/torch-fenics on the CPU to provide differentiability with respect to parameters.

6.10 dolfin+ dolfin-adjoint

dolfin-adjoint (Mitusch, Funke, and Dokken 2019):

The dolfin-adjoint project automatically derives the discrete adjoint and tangent linear models from a forward model written in the Python interface to FEniCS and Firedrake

These adjoint and tangent linear models are key ingredients in many important algorithms, such as data assimilation, optimal control, sensitivity analysis, design optimisation, and error estimation. Such models have made an enormous impact in fields such as meteorology and oceanography, but their use in other scientific fields has been hampered by the great practical difficulty of their derivation and implementation. In his recent book Naumann (2011) states that

[T]he automatic generation of optimal (in terms of robustness and efficiency) adjoint versions of large-scale simulation code is one of the great open challenges in the field of High-Performance Scientific Computing.

The dolfin-adjoint project aims to solve this problem for the case where the model is implemented in the Python interface to FEniCS/Firedrake.

This provides the AD backend to barkm/torch-fenics which integrates with pytorch.

6.11 Engys Helyx

HELYX is a unified, off-the-shelf CFD software product compatible with most Linux and Windows platforms, including high-performance computing systems. In addition to the base software components delivered for installation (HELYX-GUI and HELYX-Core), the package also incorporates an extensive set of ancillary services to facilitate the deployment and usage of the software in any working environment.

HELYX features an advanced hex-dominant automatic mesh algorithm with polyhedra support which can run in parallel to generate large computational grids. The solver technology is based on the standard finite-volume approach, covering a wide range of physical models: single- and multi-phase turbulent flows (RANS, URANS, DES, LES), thermal flows with natural/forced convection, thermal/solar radiation, incompressible and compressible flow solutions, etc. In addition to these, we have developed a Generalised Internal Boundaries (GIB) method to support complex boundary motions inside the finite-volume mesh. The standard capabilities of HELYX can also be expanded with the HELYX-ADD-ONS extension modules to cover more specialised applications.

7 References

Anderson, John. 1995. Computational Fluid Dynamics. UK ed. edition. New York: Mhe Us.
Barba, Lorena A., and Gilbert F. Forsyth. 2018. CFD Python: The 12 Steps to Navier-Stokes Equations.” Journal of Open Source Education 2 (16): 21.
Bezgin, Deniz A., Aaron B. Buhendwa, and Nikolaus A. Adams. 2022. JAX-FLUIDS: A Fully-Differentiable High-Order Computational Fluid Dynamics Solver for Compressible Two-Phase Flows.” arXiv:2203.13760 [Physics], March.
Brenner, M. P., J. D. Eldredge, and J. B. Freund. 2019. Perspective on Machine Learning for Advancing Fluid Mechanics.” Physical Review Fluids 4 (10): 100501.
Bridson, Robert. 2016. Fluid Simulation for Computer Graphics. Second edition. Boca Raton: CRC Press, Taylor & Francis Group, CRC Press is an imprint of the Taylor & Francis Group, an informa Business.
Brunton, Steven L., Bernd R. Noack, and Petros Koumoutsakos. 2020. Machine Learning for Fluid Mechanics.” Annual Review of Fluid Mechanics 52 (1): 477–508.
Chu, Mengyu, Nils Thuerey, Hans-Peter Seidel, Christian Theobalt, and Rhaleb Zayer. 2021. Learning Meaningful Controls for Fluids.” ACM Transactions on Graphics 40 (4): 1–13.
Duraisamy, Karthik, Gianluca Iaccarino, and Heng Xiao. 2019. Turbulence Modeling in the Age of Data.” Annual Review of Fluid Mechanics 51 (1): 357–77.
Ferziger, Joel H., Milovan Perić, and Robert L. Street. 2019. Computational Methods for Fluid Dynamics. 4th ed. 2020 edition. Cham: Springer.
Holl, Philipp, Vladlen Koltun, Kiwon Um, and Nils Thuerey. 2020. Phiflow: A Differentiable PDE Solving Framework for Deep Learning via Physical Simulations.” In NeurIPS Workshop.
Hu, Yuanming, Luke Anderson, Tzu-Mao Li, Qi Sun, Nathan Carr, Jonathan Ragan-Kelley, and Frédo Durand. 2020. DiffTaichi: Differentiable Programming for Physical Simulation.” In ICLR.
Kim, Doyub. 2017. Fluid Engine Development. Boca Raton: Taylor & Francis, a CRC Press,Taylor & Francis Group.
Kitsios, V., J. S. Frederiksen, and T. J. O’Kane. 2023. Subgrid Parameterization of Eddy, Meanfield and Topographic Interactions in Simulations of an Idealized Antarctic Circumpolar Current.” Journal of Advances in Modeling Earth Systems 15 (5): e2022MS003412.
Kochkov, Dmitrii, Jamie A. Smith, Ayya Alieva, Qing Wang, Michael P. Brenner, and Stephan Hoyer. 2021. Machine Learning–Accelerated Computational Fluid Dynamics.” Proceedings of the National Academy of Sciences 118 (21).
Kuzmin, Dmitri. 2010. A Guide to Numerical Methods for Transport Equations.
Malosso, Cesare, Linfeng Zhang, Roberto Car, Stefano Baroni, and Davide Tisi. 2022. Viscosity in Water from First-Principles and Deep-Neural-Network Simulations.” Npj Computational Materials 8 (1): 1–10.
Mitusch, Sebastian K., Simon W. Funke, and Jørgen S. Dokken. 2019. Dolfin-Adjoint 2018.1: Automated Adjoints for FEniCS and Firedrake.” Journal of Open Source Software 4 (38): 1292.
Naumann, Uwe. 2011. The Art of Differentiating Computer Programs: An Introduction to Algorithmic Differentiation. Society for Industrial and Applied Mathematics.
Pachalieva, Aleksandra, Daniel O’Malley, Dylan Robert Harp, and Hari Viswanathan. 2022. Physics-Informed Machine Learning with Differentiable Programming for Heterogeneous Underground Reservoir Pressure Management.” arXiv.
Papoutsis-Kiachagias, E. M., and K. C. Giannakoglou. 2016. Continuous Adjoint Methods for Turbulent Flows, Applied to Shape and Topology Optimization: Industrial Applications.” Archives of Computational Methods in Engineering 23 (2): 255–99.
Papoutsis-Kiachagias, Evangelos, Konstantinos Gkaragkounis, Andreas-Stefanos Margetis, Themis Skamagkis, Varvara Asouti, and Kyriakos Giannakoglou. 2021. adjointOptimisationFoam: An Openfoam-Based Framework for Adjoint-Assisted Optimisation.” In 14th International Conference on Evolutionary and Deterministic Methods for Design, Optimization and Control, 191–206. Athens, Greece: Institute of Structural Analysis and Antiseismic Research National Technical University of Athens.
Pawar, Suraj, and Omer San. 2019. CFD Julia: A Learning Module Structuring an Introductory Course on Computational Fluid Dynamics.” Fluids 4 (3): 159.
Peshkov, Ilya, and Evgeniy Romenski. 2016. A Hyperbolic Model for Viscous Newtonian Flows.” Continuum Mechanics and Thermodynamics 28 (1): 85–104.
Sharma, Atul. 2022. Introduction to Computational Fluid Dynamics: Development, Application and Analysis. Cham: Springer International Publishing.
Tu, Jiyuan, Guan Heng Yeoh, and Chaoqun Liu. 2018. Computational Fluid Dynamics: A Practical Approach. Third edition. Oxford ; Cambridge, MA: Butterworth-Heinemann.
Um, Kiwon, Robert Brand, Yun Fei, Philipp Holl, and Nils Thuerey. 2021. Solver-in-the-Loop: Learning from Differentiable Physics to Interact with Iterative PDE-Solvers.” arXiv:2007.00016 [Physics], January.