By Scott Evetts
Texas A&M University
During my internship at Pointwise in the summer of 2014, I had my first taste of CFD through hands-on creation of several grids and writing scripts to automate specific meshing processes. One script in particular was not only fun to write but also automates mesh generation for an interesting application. What I hope to achieve through this script is to demonstrate how anyone can easily create a Glyph applet to automate their own mesh generation process.
The script I am describing is used to find the optimum position of wind turbines relative to the local geography. The location of a wind turbine drastically impacts its energy output. Terrain features such as cliffs, hills, and valleys affect the flow of the wind. Gradual hills and areas of flat terrain allow for smooth flow of wind, making them ideal turbine sites. However, cliffs and valleys can create separated, recirculating flow, causing wear and tear on the wind turbine and reducing its operating life.
The Glyph script I wrote imports terrain geometry and then gives the user simple controls for customizing a mesh across that terrain for their specific computational fluid dynamics (CFD) analysis requirements. There are six steps to creating a high quality grid using the Turbine Siting script:
The script can effectively reduce meshing time from a few hours to a few minutes.
A Digital Elevation Model (DEM), a common format for terrain data, is a list of elevations for every point inside the geographic area of interest. Using Glyph, these files are read and converted to a PLOT3D file, which Pointwise can import as a database. Figure 1 depicts what this terrain looks like when it has been imported into Pointwise.
To import the geometry, the user is prompted to browse for the DEM file within the script's custom Tk interface (Figure 2).
Because the area defined by a DEM file can be very large (900 km2), often times the user will not want to mesh the entire geographic area defined by the file. Therefore, the user is given the option to crop the imported region to only the area of interest. The script will represent the selected terrain using a grayscale image based on elevation (Figure 3). This grayscale image is also generated with Glyph. Using the grayscale image, the user can move the red selection rectangle to refine the area of interest.
To create the structured surface domain on the terrain, the user may choose to use either an average spacing between grid points or to specify the number of points on each connector. With either method, the display will update to show what the domain will look like when it is created in Pointwise (Figure 4). This gives users a live preview of their grid, affording them more control.
The next step in the grid generation process is to create the structured volume mesh (block). Vertical connectors are created to provide boundary layer resolution control (with points clustered toward the surface based on user input) and connectors are also created to form the outer boundary of the block. The structured block is formed using the surface domain and the eight newly created connectors. To give the user the necessary control during this step, the script displays a side view of the terrain and the overall size of the block to be created. Additionally, a vertical connector preview is shown that illustrates the distribution of points based on parameters set by the user (Figure 5).
Depending on the complexity of the terrain, it may be necessary to smooth the volume grid to improve its overall quality. When smoothing is necessary, the user specifies a number of iterations for the elliptic PDE solver. The script allows the user to view the maximum and minimum thresholds for several grid quality metrics such as min-included angle, max-included angle, equiangle skew, centroid skew, and volume ratio. When just the maximum and minimum of a given metric is not enough to gauge overall quality, a histogram can be displayed to show the mesh quality distribution.
When the mesh is complete, the Export tab allows the user to export the result to OpenFOAM® and save the Pointwise file for additional work if further refinement is necessary (Figure 7). The boundary conditions for the simulation are automatically specified prior to export.
When I arrived at Pointwise three months ago for a summer internship I had no CFD experience and limited exposure to programming. Even so, I was able to write a script to automate the grid generation for siting wind turbines. This project was particularly exciting for me because it demonstrates the power of Pointwise's Glyph scripting language. Users can create meshing applets exposing the elements necessary to complete a single meshing task. I see this being useful for application specific grid generation where a grid generation expert's knowledge can be encapsulated to automate the meshing process to save time and make consistent quality grids.
Until this script is available on the Glyph Script Exchange you can try writing your own scripts to automate mesh generation by requesting a free trial license of Pointwise.