In this month’s blog we describe the usage of Python to drive a process of mesh adaption with Caelus and Pointwise. Mesh Adaption can be beneficial in reducing the effort in meshing, whilst increasing coupling between the mesh resolution and CFD solution.
Motivation for Mesh Adaption
You might be aware that mesh adaption is one of NASA CFD 2030 goals. It seeks to achieve vast reduction in time to perform CFD. The NASA 2030 goals state that meshing and mesh adaption is still a bottleneck. These goals also state that as HPC improves with higher mesh resolution demands – mesh generation and adaptivity will become more problematic.
Therefore Applied CCM sets about trying to address these aspects by developing a mesh adaption tool that works with Python, Pointwise and Caelus to adapt meshes based on CFD solution data.
How meshAdaption tool works
On initial setup, a Pointwise mesh with the appropriate surface mesh, boundary conditions types and locations, and is exported in an OpenFOAM format. The interior isotropic part of the mesh can be coarse, and the objective is to use little or no refinement zones. For example, where the flow is expected to have higher vorticity.
Initial Caelus Case
An initial Caelus case needs setting up, with the associated Pointwise polyMesh exported. The user should check that it runs and is somewhat stable. The Pointwise file is kept locally, which will be used as a template for re-meshing.
Python is the main scripting language used to control the cycling between mesh updates with Pointwise and simulation with Caelus. The Python script executes the entire process of mesh/CFD cycling. This includes the re-meshing, CFD simulations, point cloud creation for further cycles.
Point cloud Creation
To obtain a point cloud, Caelus uses a functionObject code written for Caelus to output the point cloud based on user defined variables such as vorticity, velocity gradient. In fact, any other result which could be post-processed can be combined into a “refinement metric”. The point cloud carries the local element sizes used by Pointwise for refining the mesh.
In any given cycle, the point cloud is used for influencing the refinement of the mesh with Pointwise. Note that the point cloud is imported to Pointwise via a Glyph tcl script, which Pointwise supports.
Let’s look at a few examples to demonstrate the re-meshing/solver cycling. The mesh adaption tool starts with a coarse mesh and refines the mesh – for example in the wake region of flow around bluff bodies. This process could be applied to OpenFOAM or other CFD solvers.
The 3 spheres example (Figure 1), shows the vorticity and mesh before and after 10 cycles of mesh adaption. Figure 2 shows an animation of the mesh adaption through the 10 cycles. Ultimately the mesh stops refining the wake in the extent of the point cloud and refinement zone.
Another way to look at the 3 spheres case is by plotting the number of points in the point cloud versus cycle number. The number of points in the point cloud for a given cycle, settles out to a certain number of points (around 1400) after peaking i.e. it converges toward an adapted mesh.
This example relates to the flow through a city. Figure 4 shows an animation of the mesh adaption process. In Figure 5, a comparison of the two different flow directions for the same initial mesh is shown, indicating the mesh is able to adapt the mesh regardless of the direction of flow
The final example relates to the flow past a glider. Figure 6 shows animated images of the streamlines and evolution of the mesh through the Pointwise/Caelus cycles. This indicates the mesh is able to adapt the wake generated past the wings and downstream. The number of points in the point cloud (Figure 7) rises to a peak and eventually starts falling towards a steady number and distribution of points. It appears further cycles of mesh adaptation may be need for this case to reach a stable number of points in the point cloud.
There is a webcast video describing Mesh Adaption with Caelus and Pointwise and is available on the Applied CCM YouTube channel.
Thanks for reading, the next edition will be later in December. Until then, happy meshing!
- 1.Cricket bat meshing
- 2.Twin box bridge deck meshing
- 3.Golf Driver Meshing
- 4.Frigate Helipad Pointwise unstructured mesh
- 5.Frigate Helipad – Structured O-H mesh
- 6.Horizontal wind turbine near a bridge
- 7.Meshing a Raspberry Pi
- 8.Scripting Pointwise Meshing
- 9.2D meshing with sources in Pointwise
- 10.Pointwise as a Pre-processor for CFD
- 11.Mesh Adaption with Caelus and Pointwise