Meshes in Motion: Making OpenFOAM Go with the Flow

9 minute read

Published:

Simulating flows with moving boundaries and deforming geometries requires specialized computational techniques, and OpenFOAM offers robust tools to tackle such challenges. Dynamic meshes enable mesh motion and deformation, allowing simulations to accurately capture phenomena like valve operations, moving pistons, or deforming structures. In this blog, we will explore the foundational concepts of dynamic meshes in OpenFOAM, covering the principles of mesh motion and their application in CFD. Whether you are a beginner or looking to deepen your understanding, this article sets the stage for harnessing OpenFOAM’s dynamic meshing capabilities.

In Computational Fluid Dynamics (CFD), dealing with moving boundaries, deforming geometries, or interacting objects can feel like solving a dynamic puzzle. OpenFOAM offers an elegant solution: dynamic meshes. These meshes allow for the simulation of flows involving motion—be it a piston in an engine, a flapping wing, or even fluid-structure interactions. By enabling the computational grid to move or deform alongside physical boundaries, dynamic meshes bring a new level of realism and precision to CFD simulations. In this blog, we’ll discuss the basics of dynamic meshes and mesh motion in OpenFOAM, setting the stage for tackling complex motion-driven problems in your simulations.

Lets begin!!!

The Need for Dynamic Meshes

Image Reference here.

Static meshes are the backbone of many CFD simulations, but they have limitations when it comes to modeling motion. Imagine trying to simulate a piston’s movement in an engine, the rotation of a wind turbine blade, or the flapping of a bird’s wing with a fixed mesh. In such cases, the inability of the mesh to adapt to changing boundaries leads to inaccuracies or even simulation failures. Dynamic meshes bridge this gap by allowing the computational grid to move or deform in tandem with the geometry. This flexibility ensures accurate representation of the physics at play, even in scenarios involving large-scale motion or complex interactions. Without dynamic meshes, critical applications like valve operations, ship hydrodynamics, or fluid-structure interactions would remain computationally prohibitive or imprecise. By enabling the mesh to evolve with the problem, dynamic meshes unlock a new level of realism in CFD simulations, making them an indispensable tool for modern engineering challenges.

Dynamic Meshes in OpenFOAM

Image Reference here.

OpenFOAM’s dynamic mesh framework is a versatile tool designed to handle simulations where the computational domain evolves over time. By allowing the mesh to move, deform, or even change its topology, OpenFOAM ensures accurate representation of physical phenomena involving motion. Whether it’s a rotating wind turbine, an oscillating valve, or fluid-structure interactions, dynamic meshes empower users to model these scenarios with remarkable precision.

At the heart of this capability lies the dynamicMeshDict configuration, where users define how the mesh should behave. OpenFOAM offers various approaches to dynamic meshing, including prescribed motion (like simple translation or rotation), solver-driven motion (governed by physical forces), and more complex techniques like overset meshes or adaptive layering. Each method is tailored to specific types of motion, giving users the flexibility to choose what best suits their simulation needs. Dynamic meshes integrate seamlessly with specialized solvers such as pimpleDyMFoam and icoDyMFoam, enabling simulations that capture both mesh motion and fluid dynamics. With its robust implementation, OpenFOAM provides a powerful platform for tackling real-world engineering problems involving moving boundaries and deforming geometries.

Image Reference here.

Dynamic meshes in OpenFOAM can handle a wide range of motions and deformations, making them highly adaptable for various applications. These motions are categorized based on how the mesh evolves during the simulation. Here’s a brief overview of the most commonly used types of mesh motion:

Prescribed Motion:

  • The motion is predefined and independent of the simulation’s physics.
  • Examples include translating or rotating bodies, such as pistons or propellers.
  • Motion is described using mathematical functions or motion dictionaries (e.g., solidBodyMotion solvers).

Solver-Driven Motion:

  • Here, the mesh motion is governed by physical forces or interactions with the fluid flow.
  • Common in fluid-structure interaction (FSI) problems where structural deformation impacts the fluid domain.
  • Often implemented using solvers like fvMotionSolver.

Arbitrary Mesh Interface (AMI):

  • Used when different regions of the mesh need to slide or rotate relative to one another.
  • AMI is perfect for applications like rotating machinery or turbochargers.

Layer Addition and Removal:

  • This technique modifies the mesh topology by adding or removing cell layers to accommodate large displacements.
  • Widely used in applications like piston-cylinder simulations.

Overset Meshes (Chimera Grid):

  • Combines a background mesh with overlapping movable grids.
  • Suitable for cases like multiple interacting objects (e.g., aircraft in formation).

Deforming Meshes:

  • The mesh adapts to deformation in the geometry, commonly achieved using displacement equations like Laplace smoothing.
  • Ideal for problems involving small to moderate structural changes.

Core Components of a Dynamic Mesh Setup

Setting up a dynamic mesh in OpenFOAM revolves around configuring key files and parameters that dictate how the mesh evolves during the simulation. At the center of this configuration is the dynamicMeshDict, a dictionary file where users define the motion model, associated parameters, and boundary conditions for the mesh. This file specifies how the mesh should behave—whether it should translate, rotate, deform, or adapt to the motion of the geometry. Selecting the appropriate motion solver here is crucial, as it determines how the mesh adapts to the problem’s requirements.

Another critical aspect is the interaction between the mesh motion and the solver. OpenFOAM provides solvers like pimpleDyMFoam and icoDyMFoam, which are designed to handle dynamic meshes while solving the fluid flow equations. These solvers ensure that the mesh deformation or movement is accounted for in the numerical calculations, maintaining accuracy in capturing the physics. Integrating mesh motion seamlessly with fluid dynamics requires careful attention to time-stepping and mesh quality to avoid numerical instability.

Boundary conditions for dynamic meshes are just as important. For example, specifying fixed or moving boundaries, applying constraints, or allowing free motion at specific faces of the mesh are all defined in the case setup. Common types include movingWall, slip, and custom boundary conditions for rotating or deforming walls. This ensures that the mesh behaves appropriately at the interfaces and boundaries, accurately reflecting the physical motion of the system.

Finally, mesh quality plays a vital role in the success of a dynamic mesh simulation. As the mesh moves or deforms, ensuring that cells remain well-shaped and properly resolved is essential to avoid errors or inaccuracies. Tools within OpenFOAM, such as mesh smoothing or cell layering, help maintain mesh quality during the simulation. By understanding and configuring these core components, users can unlock the full potential of dynamic meshes for complex CFD applications.

A Look Ahead

While this blog covered the basics of dynamic meshes in OpenFOAM, the world of mesh motion and deformation offers a wealth of advanced techniques and possibilities. Moving forward, I will explore more sophisticated topics that build on the foundation laid here. These include:

  1. Prescribed Motion : These tutorials are excellent starting points to understand how to set up simple motion scenarios and apply predefined motions to objects like fans, blades, or pistons. By diving into these tutorials, you’ll get hands-on experience with the solidBodyMotionSolver and related boundary conditions, which are the foundation for many dynamic simulations.
  2. Overset Mesh : Overset meshes, also known as Chimera grids, are a powerful technique for simulating multiple moving objects within a fluid flow. OpenFOAM supports overset meshes, which allow for the overlapping of meshes that move independently of each other. These meshes are particularly useful in complex simulations such as aircraft maneuvers or moving vehicles in a dynamic environment. These tutorials on overset meshes will guide you through the process of setting up multiple grids, managing mesh interfaces, and solving complex interactions between moving bodies.
  3. Adaptive Mesh Refinement (AMR): Adaptive Mesh Refinement (AMR) is a technique used to improve mesh resolution in regions of interest while maintaining computational efficiency. This is especially useful when simulating dynamic flows with sharp gradients or localized phenomena like turbulence or shock waves. AMR enables OpenFOAM to refine the mesh dynamically during the simulation, focusing resources where they are needed most. Tutorials on AMR will teach you how to implement adaptive mesh strategies and balance refinement levels with simulation performance.
  4. Fluid-Structure Interaction (FSI): Fluid-Structure Interaction (FSI) is a complex simulation method that deals with the interaction between fluids and deformable solids. OpenFOAM integrates FSI through solvers like solidDisplacementFoam and coupling with external solvers such as solids4Foam and preCICE. Tutorials on FSI in OpenFOAM will help you simulate cases where fluid forces cause structural deformation, like in wind turbines, flexible membranes, or vessels under pressure. Learning FSI will allow you to explore the dynamics of both fluid and structural systems together, expanding your simulation toolkit significantly.

By diving into these advanced topics, we’ll unlock even more powerful simulation capabilities in OpenFOAM, enabling you to tackle a wider range of engineering problems involving dynamic meshes, motion, and complex interactions.