Home » Dynamic mesh with OpenFOAM, Part 5: Setting up an overset mesh case in OpenFOAM

Dynamic mesh with OpenFOAM, Part 5: Setting up an overset mesh case in OpenFOAM

by thawtar

Overset mesh is a very versatile technique for many CFD applications due to its capability to handle complex mesh motions and large motion amplitudes impossible for most of the other dynamic meshing methods available. However, setting up an overset mesh can be intimidating and actually difficult for many OpenFOAM beginners because of several detail steps necessary when creating an overset mesh in OpenFOAM.

In this detailed tutorial, we will explain how to setup dynamic mesh with overset mesh technique in OpenFOAM. For this tutorial, we will focus on prescribed mesh motion. If you want to know the general overview of dynamic meshing in OpenFOAM, you can check our previous post here. You can also learn about deformed mesh approaches in this post and this post.

Test case

We will be using the square body for our tutorial due to its very simple shape and easy mesh generation using blockMesh. We will be running an oscillating square cylinder in a flow field with prescribed oscillation frequency.

The case files can be downloaded here. OpenFOAM-v2312 and Ubuntu 22.04LTS are used to run the tutorial but both older and newer ESI versions should work, too. In order to use overset mesh, you will need OpenFOAM ESI versions because the foundation version does not support overset mesh technology.

Flow solver and numerical schemes

For the flow solver, we chose overPimpleFoam for its simplicity. overPimpleFoam is a single phase transient incompressible solver with overset mesh capabilities and it is based on the classical pimpleFoam solver. 

Moreover, since there is no highly complex physical phenomena such as free-surfaces, species transport or heat transfer, overPimpleDyMFoam is simple enough to setup and run the simulation easily while extremely useful to learn. Again, you can generalize this knowledge to other overset solvers currently available in OpenFOAM such as overInterDyMFoam or overRhoPimpleDyMFoam.

Second order finite volume discretizations are used for accurate simulation practice although this tutorial is not designed for verification and validation purposes.

Requirements for an overset mesh

In order to use dynamic mesh, we need the following:

  1. TWO case directories
  2. A topoSetDict file
  3. A dynamicMeshDict file
  4. A motion boundary conditions file (pointDisplacement)
  5. A zoneID boundary conditions file
  6. An overset boundary condition 
  7. A pointDisplacement boundary condition file

As I mentioned, it involves several small details you need to care about. So, lets try our best to deal with this long list of requirements. But you do not need to worry! It is not that difficult and I have your back covered. OK, lets start with the case directories..

TWO case directories

To run overset simulations, we basically need two case directories. One to generate background mesh and the other to generate the foreground (overset) mesh. In our example, we have the background directory and square directory, each containing separate controlDict, fvScheme and fvSolution files.

However, the foreground directory contains only the foreground mesh. Only the background directory is the main simulation directory and almost all the setting files and boundary conditions are are located inside background directory. These directories can be controlled from the outside through the Allrun script file.

First, we need to generate each mesh. So, we run blockMesh inside square and background directories.

cd square
blockMesh
cd ../background
blockMesh

Background mesh and overset mesh from separate directories

So, we created both background and foreground meshes. After that, we can combine the two meshes by running the mergeMesh command from the background directory as follows:

mergeMeshes . ../square -overwrite

This will merge the mesh from square directory into the background directory and overwrite current mesh.

Merged mesh

The topoSetDict file

After combining the two meshes, we need to define the cell zones and in order to separate background and overset mesh regions. To do this, we create a cellSet inside topoSetDict as follows:

The first action creates cellSet c0 which is the inside of the overset zone. The next two actions create the cellSet c1 which belongs to background mesh. You may notice the action invert. It means that all cells that do not belong to c0 are c1. 

topoSet

Now we have c0 and c1 cell sets. We need to give IDs to both sets to indicate that these cells belong to different parts of overset mesh. This can be done by creating a zoneID field inside 0 directory and filling this field with ID numbers using setFields utility. 

setFields

As we can see below, zoneID 0 is assigned to cell set c0 while 1 is assigned to c1. Overset mesh in OpenFOAM will take care of the rest easily.

topoSetDict file to create cellSets c0 and c1
We can visualize the zoneID and ensure the right values are assigned

The dynamicMeshDict file

In the next step, we will define motion properties inside the dynamicMeshDict file. First, the type of dynamicFvMesh is set to dynamicOversetFvMesh. This tells OpenFOAM overset solvers to use the overset mesh library.

After that, we have solver defined to be multiSolidBodyMotionSolver because we want a prescribed motion. Then we can define oscillatingLinearMotion and its amplitude in each direction and frequency values.

dynamicMeshDict file for overset mesh with prescribed solidbody motion

But we need to define the region “movingZone” since the motion will be applied to this zone only. It means we need to define another region, again! However, this is easy since we already have c1 cellSet. To create a cellZone from a cellSet, we need to run topoSet again with a different topoSetDict file. This following file wll create our cell zone.

We need another topoSetDict file to generate movingZone from cellSet c1

An overset boundary condition

In order to setup the information exchange between background and overset meshes, we need an overset boundary condition on the boundary of the overset zone. You can easily name this boundary as overset and give the type overset for all flow variables inside 0 directory, such as U, p, k, omega, etc.

The following is the overset boundary condition for 0/U file. You may also notice the square patch which is the moving patch is assigned movingWallVelocity boundary condition.

The pointDisplacement boundary condition file

Another detail you need to be careful of is the pointDisplacement boundary condition file. You need to define boundary conditions for overset patch and your moving patch. For the overset patch, the patchType is overset and type is zeroGradient. While the type was defined as overset for all other boundary condition files, you need zeroGradient for pointDisplacement.

For the moving patch, calculated boundary condition is assigned.

The rest should be fixedValue because these are not in motion.

Only pointDisplacement file has different boundary condition type for overset patch

oversetInterpolation

Finally, you need an oversetInterpolation scheme inside fvSchemes file. There are 4 methods to choose from: 1. cellVolumeWeight 2. inverseDistance 3. leastSquares 4. trackingInverseDistance. Here, I chose inverseDistance because of its stability and fast calculation speed.

Runnign the simulation

Now, you can run the simulation 

overPimpleDyMFoam

As we can see here, inverseDistance method is being used to interpolate between zone 0 and zone 1 while calculated, interpolated and hole type cells are being defined.

Snap shot of overPimpleDyMFoam

Summary

We provided the detail requirements to setup a dynamic mesh simulation in OpenFOAM using overset mesh and prescribed motion. This kind of simulation can be used to model several aerodynamics phenomena such as wing flapping or forced oscillations of structures or various offshore and marine hydrodynamics applications. 

Download case

You can download the case files here.

🌟 Elevate Your Cloud Experience with CloudHPC 🌟
CloudHPC

Related Posts

Leave a Comment

🌟 Elevate Your Cloud Experience with CloudHPC 🌟

Step into a world of limitless possibilities with CloudHPC. Our state-of-the-art cloud computing platform offers unparalleled performance and scalability for your projects.

🚀 Supercharge Your Workflows: Harness the power of high-performance computing to accelerate your simulations, modeling, and data analysis tasks. 💡 Seamless Integration: Integrate seamlessly with popular tools and frameworks, ensuring a smooth transition for your projects.

🔒 Robust Security: Rest easy knowing your data is protected by industry-leading security measures, keeping your work safe and secure.

Explore the future of computing with CloudHPC. Sign up today and elevate your cloud experience to new heights!