This Is How I Glyph – Automatic Grid Refinement

Yes, I just made Glyph a verb.

Potsdam Propeller Test Case (PPTC) grid family generated automatically using a Glyph script.

Potsdam Propeller Test Case (PPTC) grid family generated automatically using a Glyph script.

What is Glyph?

For the uninitiated, Glyph is Pointwise’s scripting language which has its roots in Tcl/Tk. Every Pointwise command is accessible through Glyph. This means that anything you can do within the Pointwise user interface can also be scripted. The manual pages are a great place to explore all of the commands and Glyph syntax. You can also enable journaling of commands to the message window in Pointwise to see what Glyph commands are executed when performing specific actions. To enable journaling, right-click in the message window and toggle on Journaling under Preferences. If you are new to Glyph, then a great place to start is our Introduction to Scripting Webcast.

Here at Pointwise we write a lot of scripts for ourselves and our users. Those we can share end up on our script exchange which we maintain on GitHub. Because there are many great scripts already available that not many people know about, we thought we would review them in a new series on our blog titled This Is How I Glyph.

What can Glyph do?

Now that you know what Glyph is, you may be wondering what you can do with it. Glyph scripting enables automation, and the types of scripts that users typically create fall into one of two categories. The first is a utility script or macro. Utility scripts automate a single task that you may find yourself repeating frequently. If you have talked with me before and told me it would be great if Pointwise did X, then I’ve probably followed up with, “You can script that!” The second type of script automates the entire meshing process and can be called a template or app. If you are meshing the same wing-body-tail aircraft configuration repeatedly, then that would be a great candidate for a script.

Glyph can also be used to make Pointwise do something it wasn’t designed to do, or to develop entirely new features. For example, solving a Rubik’s cube, or generating higher order grids for FEA applications.

Automatic Grid Refinement

This article, and the video below, introduce a script I enjoyed working on a few years ago when generating grid families; and ultimately, a billion cell mesh. The script is called GridRefine.glf, and it simply refines structured and unstructured grid systems. Given a baseline coarse mesh, the user specifies a refinement factor, the name of the Pointwise project file containing the coarse mesh, and whether any existing unstructured blocks should be initialized. Each parameter can be changed by editing the Glyph script directly.

The user-defined refinement factor will modify connectors, spacing constraints, domains, and blocks. Connector dimensions are increased and explicitly specified spacing constraints are decreased. Similarly, any min or max triangle edge lengths that were specified on the unstructured domain level are decreased. These operations ensure that the general character of the mesh is retained as the grid resolution is increased. Block attributes are updated as well, including any T-Rex normal wall boundary spacings. This may, or may not, be a desirable change if you are looking to keep a constant y+ value across refined meshes. To get the best results, we recommend explicitly setting most, if not all, the spacing constraints in the coarse reference mesh.

The script can be run interactively or in batch mode. Information regarding the progress of the script is printed to the message window including any block statistics. When the script has finished, the refined surface and volume grids are saved as separate Pointwise projects in the current working directory.

Other than the fact that you can use this script to automatically generate a family of grids, you can also use it to initialize large unstructured and hybrid cases. I’ve often offloaded a large grid and this script to a workstation which contains more memory than my laptop, and by setting the refinement factor = 1 and volMesh = “YES”, I can run the script in batch mode to have it simply initialize a large grid and save the project automatically.

To download this script directly, you can use this link. If you would like to visit the repository on GitHub, then please visit https://github.com/pointwise/GridRefine.

Do you have an idea or a Glyph script you’ve written that you would like to share with us? Let us know in the comments below or on Twitter @Pointwise.

Happy scripting!

About Travis Carrigan

A Pointwise engineer helping other engineers solve their meshing problems.
This entry was posted in Applications, Software and tagged , , , , , , , , . Bookmark the permalink.

1 Response to This Is How I Glyph – Automatic Grid Refinement

  1. Pingback: This Is How I Glyph – Uniform Unstructured Domain Refinement | Another Fine Mesh

Leave a Reply