Sometimes All Your Grid Needs Is a Little Tweak

It's a small feature with a funny name, but sometimes Tweak can make the difference between a grid and a bunch of points on which you can't compute an accurate or converged CFD solution. The dictionary defines tweak as “to adjust; fine-tune” and that's exactly what it's used for. Introduced in Pointwise Version 16.04, Tweak is similar to the Nudge command in Microsoft PowerPoint®. With Nudge, you can arrange any element in your presentation by moving it up, down, left, or right. With Tweak, you can do the same thing with any grid point by moving it in the x, y, or z direction.

It seems illogical that meshing techniques founded on serious mathematics would sometimes produce a grid that needs tweaking. But in the real world of mesh generation, that's often the case. Situations that can use some help from tweaking are

  • Projection onto convoluted surface shapes
  • Floating boundaries in the solvers
  • Extrusions
  • Importing a grid from another program
  • Pyramid insertion

Rather than reapply these techniques, sometimes it's easier just to grab a point or two and move them yourself.

Tweaking Surface Meshes

Tweaking is as simple as clicking on a point and dragging it to a new location using the point placement tools you're already familiar with in Pointwise. When tweaking a grid point on a surface grid (Figure 1), the cell edges connected to that point are highlighted so you can see the shape of the new cells relative to the old.

Hilighted edges illustrate the relative shapes of the old and tweaked cells.
Figure 1: Highlighted edges illustrate the relative shapes of the old and tweaked cells.

Improve Grid Quality

In this structured grid, tweaking can provide a slight improvement to the cells' minimum included angle property over what you get automatically from the solver's orthogonality boundary condition (Figure 2).

Comparing cell skewness before and after tweaking.
Figure 2: You can make subtle improvements to grid quality using Tweak, such as the cell to cell variation of minimum included angle shown above (original grid on left, tweaked grid on right).

Eliminate Tent Cells

Tweak also is handy for getting rid of "tent" cells that cause the Jacobian metric to indicate skewing. Tent cells most frequently occur along the connector shared between two adjacent and co-planar faces of a block. By tweaking a few points, you can make those cells non-planar and thereby improve the Jacobian metric.

And in case you're wondering, you can keep domain points database-constrained during tweaking or you can unconstrain them for complete freedom of movement.

Volume Grids Can be Tweaked Too

The same ideas apply to tweaking volume grid points, with the only complication being how you select a point. Here, the cutting plane tool from Examine is used to provide cuts through the mesh on which you choose the point to be tweaked. Figure 3 illustrates the display of volume cells for both structured and unstructured meshes.

Tweak's cell highlighting in both structured and unstructured grids.
Figure 3: You use cutting planes to help select volume grid points to tweak. The structured grid (left) is using a constant J cutting plane whereas the unstructured grid (right) is using a constant Y cutting plane.

Tweaking One or Two Cells Fixes a Big Grid

Block point tweaking comes in handy for improving the cell quality of literally one or two cells in a structured grid with hundreds of thousands of points. Running the solver is overkill in this case and with a few tweaks you can repair show-stopping grid quality issues. This is doubly true for unstructured blocks because of the nature of the Delaunay algorithm for point insertion: it's a bit less predictable than solving Poisson's equation on a structured grid.

Tweaking Connector Grid Points

When it comes to connector grid points, you have even more interesting options for tweaking points, even though the basic concepts are the same as for domains and blocks. By default, Tweak constrains the points to the connector's shape and limits movement to the region between the adjacent grid points so the connector doesn't wrap back on itself (Figure 4). But you can turn off that constraint and move the points anywhere you'd like. Tweaking connector grid points can be very handy when the points are generated automatically, such as by importing a grid or extrusion.

Options for tweaking connector grid points.
Figure 4: A connector's grid points can be tweaked while retaining the connector shape or completely unconstrained from the connector and database shape.

Tweak Makes Many Things Possible in Scripts

There is another almost hidden benefit of the Tweak command and you'll find it in the Glyph script implementation. If you journal while tweaking and look at the resulting script, you'll find commands like this for setting the coordinate location of the Nth grid point:

$con setPoint {N} {X Y Z}

With the ability to set procedurally the grid point location, you can write a script that implements your own distribution function. You'll find such a script on the Glyph Script Exchange at Look for the script called myDistribution. Imagine the possibilities for domains and blocks.

Example of scripting your own distribution function.
Figure 5: Using the setPoint Glyph command that was added for Tweak, you can add all sorts of functionality to Pointwise. Shown above is a connector (bottom) with its distribution of points changed to follow a cubic function that clusters on the interior.

With Tweak Comes Great Responsibility

Tweak is a handy command that you'll find is a nice part of your toolkit. It's not something you're likely to use every day, but it'll be there when you need it. But be warned - Tweak can be addicting and you may find yourself tweaking every point in your grid. And because Tweak gives you the ultimate control over each and every grid point, it's easy to take things a bit too far.

Resist the temptation to tweak every grid point.
Figure 6: Tweak makes it so easy to edit your grid that you must resist the temptation to tweak every grid point.

What Would You Tweak?

We have some cool ideas for the next upgrade to Tweak. For example, wouldn't it be nice if you could insert or delete a point in an unstructured mesh? What would you like to see it do?

Try it For Yourself

Find out how many minutes it takes to generate your mesh using a demo license of Pointwise. Start the process today.

Free Trial

Search Articles

Share This