Reliable People. Reliable Tools. Reliable CFD Meshing.

# Tips and Tricks for Reading and Writing Files from Pointwise

I/O, I/O, It's Off to Mesh We Go

CAD geometry comes in and a CFD mesh goes out.
If only file management for mesh generation was that simple. But even though file management in practice is more complex than that, it need not be complicated. This article presents the entire scope of files that can be read and written by Pointwise and shares tips and tricks for streamlining your use of them.

## In the Beginning, There is CAD

Most meshing projects begin with the geometry on and around which your mesh will be generated. Pointwise refers to this geometry as the database and supports two general classes of database entities.

1. Analytic Geometry: For most Pointwise customers, the database comes from a computer aided design (CAD) system such as SolidWorks, NX, or CATIA. CAD geometry from these sources typically is represented mathematically (i.e. analytically) as Non-Uniform Rational B-Splines (NURBS).
2. Faceted Geometry: Other customers use mesh-like, faceted geometry representations such as what you get from a 3-D scan of an object or from the files used with 3-D printers.

While this is not an article about working with database geometry it is important to understand that the facets in faceted geometry will be represented in the mesh (Reference 1). If the faceted geometry does not accurately resolve regions of high curvature in the real geometry, neither will your mesh.

Pointwise supports native, standard, and proprietary formats for CAD geometry import as listed alphabetically in Table 1. (See the File, Import, Database command.) It is important to note that Pointwise's CAD import does not use a license of your CAD software; all you need is the file.

Table 1: CAD file types supported by Pointwise.

FormatVersions Supported
ACIS (.sat)All ≤ R21
CATIA V4 (.model)All 4.xx
CATIA V5 (.CATPart, .CATProduct)R10 - R25
IGESV5.1
NX, UG11 - NX 10
Parasolid (.x t)All ≤ 26
Pro/E, Creo (.prt, .asm)13 - Creo 3 M040
Pro/E (.neu)13 - WF5
SolidWorks99 - 2015
STEP203/214/242

The native readers (CATIA, NX, UG, Pro/E, Creo, and SolidWorks), proprietary readers (Parasolid and ACIS), and the STEP standard reader come to Pointwise from CT Core Technologies (http://www.coretechnologie.com/), a leading provider of 3D CAD conversion software. Their readers are updated continually to support the latest formats of the CAD vendors' files. The IGES reader is written and maintained by Pointwise.

#### The Importance of Model Size

If CAD import only had to deal with NURBS surfaces, CAD interoperability might not be the issue it is today. Complications are introduced by the use of topological (as opposed to geometric) entities such as trimmed surfaces and solid models.

Without turning this article into a primer on boundary representation solid models (B-Reps), a trimmed surface is just a surface from which a subsurface is trimmed out by curves around its perimeter. For example, the intersection curves where a wing pierces a fuselage trim out a hole in the fuselage and trim off the portion of the wing that extends inside the fuselage. Those intersection curves are computed relative to a tolerance, a distance below which geometric entities are said to be coincident.

As you can imagine, intersections and related computations are sensitive to the tolerance used.

Figure 1: Your Model Size, from which tolerances are derived, can be set in the File, Properties panel.

Pointwise uses a length scale called Model Size (default = 1,000) to represent the size of your grid. All of Pointwise's tolerances are derived from Model Size. (See the File, Properties command as illustrated in Figure 1.) Therefore, it is critically important that the Model Size be the same order of magnitude as the longest side of a box that fits around your database, excluding any outer boundaries.

After importing your CAD file, compare its extents (see Characteristic Grid/DB Length at the top of the Properties panel in Figure 1) to the Model Size. If there is an order of magnitude difference, you should Undo the database import, change the Model Size, and re-import the CAD file. Setting an appropriate model size prior to import is critical to ensure that small geometric features are kept intact and large geometric features are not held to a tolerance that is too strict.

Because model size is applied across your entire project, you should not change model size after starting your project. If it is changed, features that formerly were within tolerance may become out of tolerance and the ability to generate a mesh will be vastly degraded.

#### Automatic CAD Cleanup During Import

As you are no doubt aware, simply importing CAD data is often insufficient for meshing. Due to many factors (Reference 2) the surfaces that comprise the geometry as imported may not be ready for meshing due to problems such as gaps, overlaps, and more.

You can avoid most, and often all, of these problems by having Pointwise automatically assemble your CAD geometry into a solid model (or models) during import. Simply stated, a solid model is a topological assembly of adjacent trimmed surfaces that is “watertight” and ready for meshing. (Solid models in the CAD file are imported directly.)

The database in Figure 2 shows a CAD geometry imported as 10 solid models that are watertight and ready for meshing.

Figure 2: This CAD model of a football helmet imports as 10 solid models: the helmet, face mask, 4 brackets, and 4 screws. Therefore, the seams shown as black lines on the white helmet are watertight and can be meshed across.

To enable automatic model assembly in Pointwise you only have to set one parameter: the value of the tolerance within which two surfaces are to be considered neighbors, labeled Model Assemble Tolerance in Figure 3, which shows a portion of the File, Import, Database… panel.

Because Pointwise assembles models from trimmed surfaces, checking the box in Figure 3 labeled Build models from free surfaces (i.e. untrimmed surfaces) lets them be included in model assembly. This comes in handy if your CAD geometry is coming from an in-house design tool that does not produce trimmed surfaces.

Figure 3: Automatic solid model assembly on import is enabled with a single parameter, the Model Assemble Tolerance. Automatic quilt assembly only uses the Quilt Assemble Angle.

#### Cleanup is More Than Gaps and Overlaps

Even if your CAD geometry is watertight, more can be done to make it meshable. Another challenge faced by meshing is the rather arbitrary topology of the surfaces coming out of the CAD file. While Pointwise gives you the ability to generate meshes that are independent of the CAD topology, the highly automated methods rely on the CAD topology as a starting point. Therefore, a complex CAD topology leads to a complex mesh topology which is not necessarily good.

This is where Pointwise's quilts help. A quilt is simply a topological collection of trimmed surfaces in the CAD model that are to be meshed with a single mesh (a single domain in Pointwise's vernacular). Because these regions are usually delineated by a feature line (also known as a hard edge) a simple turning angle criterion can be used to designate where Pointwise should join adjacent quilts. In other words, two adjacent surfaces that share an edge across which the relative angle of the surfaces' normal vectors is less than the designated value will be assembled into a quilt. Figure 4 illustrates the vast simplification that results from creating quilts within the solid model.

Figure 4: Despite being a closed solid model, the CAD surface topology is rather arbitrary (top). By assembling surfaces into quilts during import, a meshable topology is recovered. This figure illustrates the simplification of surface topology that is possible with quilts for the DrivAer geometry (Reference 8).

Automatic quilt assembly during CAD import is triggered by a single parameter: Quilt Assemble Angle as shown in Figure 3.

Note that quilts and models can also be assembled manually after CAD file import using the Create, Assemble, Quilts and Create, Assemble, Models commands. These manual versions let you select subsets of the overall geometry to work with.

### Faceted Geometry Import

From the discussion above you can see that many of the issues associated with meshing analytic CAD geometry are related to topology. For this reason and others, many people prefer to work with faceted geometry such as can be imported from stereolithography (STL) files (Reference 5) or from existing grids. In Pointwise, these entities are called shells.

Shells can be imported using File, Import, Database from the file types listed below.

• NASTRAN
• PLOT3D
• STL
• UCD
• VRML
• XPATCH

Note that you can use both shells (faceted geometry) and NURBS (analytic geometry) in the same database within Pointwise.

#### Recovering Topology from Faceted Geometry

Faceted geometry is basically mesh data and, therefore, perceived to be simpler to use. This simplicity comes at a price. Because an entire 3-D object can be imported as a single shell comprised of tens or hundreds of thousands of facets, there is no explicit representation of feature lines to which you want your mesh to conform.

Consider the shell geometry shown in Figure 5. The pink image at the top shows that this entire geometry imports as a single shell. It is likely that you will want to resolve the edges of the spiral teeth with a grid line but that will difficult for the pink surface because there is not a boundary edge in the shell to use.

Figure 5: A faceted geometry model is imported as a single surface (above) but by automatically extracting features during import the meshable geometry is recovered (bottom).

However, during import you can split a shell into smaller shells along feature lines by specifying a turning angle as shown in Figure 6.

Figure 6: Faceted geometry can be split along feature lines during import by specifying a turning angle criterion called Shell Split Angle.

If the turning angle between adjacent facets is greater than what you specify, the edge is used to split the shell into smaller shells. In the bottom of Figure 5 you see the results of feature extraction; the different colors represent the smaller shells that have been extracted from the single shell in the top of the figure. Now the boundaries between shells (the feature lines) are easily meshable.

Feature extraction can be applied manually after CAD import using the Edit, Extract command. When applied manually you can select the shells to which it should be applied and you can choose whether to create curves on the feature lines, split the shells into subshells, or both.

### Quilts and Shells and Topology

When you consider what has to be done with both analytic and faceted CAD geometry to make it meshable you discover a symmetry in dealing with topology.

• Analytic CAD has complex topology that is simplified with quilts.
• Faceted CAD has simplistic topology that is made realistic with feature extraction.

Once you have imported, cleaned-up, added to (with Pointwise's geometry modeling capabilities), and otherwise made your CAD model ready for meshing, you can export it (see the File, Export, Database command). Exporting the database is usually done for one of two reasons.

1. You want to save it for future use.
2. You want to use it in another application.

Exported analytic geometry uses the IGES format. Exported faceted geometry uses any of the formats that supports shell entities (e.g. STL).

## The End Game: Export to Your Flow Solver

Of course, the end result of your meshing effort will be a mesh to be run in your flow solver. You select your flow solver at the beginning of the meshing process from the menu of 60 (as of the time of this writing) using the CAE, Select Solver command.

Flow solver compatibility also includes the computational fluid dynamics (CFD) boundary and volume conditions (e.g. no-slip wall, farfield boundary, porous media) and other parameters you have set in Pointwise for your analysis.

The boundary conditions (BCs) and volume conditions (VCs) are the main difference between grid export (see below) and exporting your CAE data. The former only writes the grid; the latter writes the grid, BCs, VCs and other flow solver attributes.

The most interesting part of File, Export, CAE is the ability to have your mesh automatically mirrored about a plane during export. This lets you generate half of the mesh using a symmetry plane and have the other half created automatically for you.

Look for CAE, Set Mirror Plane and then during File, CAE, Export look for the checkbox that enables the mirroring.

### CAE Export Plugins

If your flow solver is not one of the 60 currently built-in to Pointwise, that does not mean you cannot generate and export a grid for it. Pointwise includes CAE Export Plugins, a tool with which you can customize Pointwise for your solver and add native support for it. (Think of a plugin like a user defined function, UDF, in your flow solver.)

Writing a plugin is straight-forward.

1. Use the extensively documented plugin application programming interface (API, Reference 6) and write C or C++ code that defines the capabilities of your flow solver and how all its data should be exported to a file or files.
2. Compile the plugin (also documented) into a dynamic link library (DLL) or shared object (SO).
3. Place the DLL or SO in a designated folder where Pointwise is installed.

The next time you start Pointwise, it will load your plugin and your solver will appear in the CAE, Select Solver menu, its boundary and volume conditions will be available for you to apply to your mesh, and all that data will be exported to its native file(s) when you use File, Export CAE.

But plugins solve more than just your export problem. Once you have written a plugin you can share it with your colleagues whether they are down the hall or across the globe.

### CGNS: The CFD Data Standard

If you are thinking about writing a new flow solver or doing anything that would involve creating a new file format, we recommend that you consider adopting the CFD General Notation System (CGNS, Reference 4), an open, standard format for mesh and CFD solver data.

Not only will using CGNS decrease your workload but it will allow your files to be read and written by a wide variety of CFD software.

## Grid Export & Import

### Grid Export

There are occasions when you really only want to export the grid and nothing but the grid. That is when Pointwise's grid export capabilities come in handy (see the File, Export, Grid command). Common uses of grid export are:

• You have not yet written a CAE export plugin and need to get your mesh to your analysis code.
• You want to modify portions of the mesh using your own proprietary technique.
• For a mesh without an accompanying database (i.e. geometry model) you want to export the surface meshes and re-import them as faceted geometry.

### Grid Import

Moving grid around works from the import side too (see File, Import, Grid). Perhaps you have an old mesh or a mesh from another source that you would like to use as the starting point for a new mesh. Or maybe you have a design tool that generates initial meshes for you automatically and you need to add to them.

## Overset Export and Import

Pointwise's overset grid assembly (OGA) capabilities included the reading and writing of files for use in 3rd party OGA software. We have written a lot about OGA in other articles so it will not be repeated here.

## Other Files You Can Read and Write

### Scripts

Pointwise's scripting language, Glyph, is a great tool for automating all or portions of your meshing process with templates and macros. You can easily start writing a script by journaling what you do in the GUI to a file. (See Script, Begin Journal as shown in Figure 7).

Figure 7: The script version of the commands you execute in the GUI will be written to a file when you enable journaling.

Turn off journaling with Script, End Journaling and you will have a Glyph script file (.glf) that you can start customizing.

Within journaling you also have the ability to insert a comment into the script file as a reminder of what you were doing in the GUI and you can append commands to an existing script file.

### Screen Captures

Saving an image of Pointwise's Display window is as easy as pressing Ctrl+P. Pointwise's File, Print To File command will save a screen capture of the Display window to a file in either PNG, BMP, or TIFF format.

But did you know you can export an image in a resolution higher than your computer's screen? This comes in really handy when you are creating an image for a conference publication that has to print at a certain size at a certain resolution (for example, 8 inches wide at 600 dpi). In the related File, Print to File Setup command (Figure 8) you can define the printing resolution (dots per inch) and desired image size in inches. That defines the resolution of the image that will be saved by Print to File.

Figure 8: Among the options for saving a screen image to a file is the ability to set a resolution higher than your screen's.

### Messages

You can save the contents of the Messages window to a file and there are two main reasons why you would do so.

1. Glyph script commands can be echoed here (an alternative to journaling). Saving them to a file gives you a place to start editing.
2. Warning and error messages are written here. There may be instances when you want to share them with us.

As you can see in Figure 9, saving Messages window text to a file is as simple as selecting it, clicking the right mouse button, and choosing Save To File.

Figure 9: Save text in the Messages window to a file by selecting it and clicking the Right Mouse Button to invoke this menu.

### Gridgen

If you are a Gridgen user, it is possible to move data between Gridgen and Pointwise. However, you should do so with caution. Due to differences in some of the core algorithms (for example, the geometry kernel in Pointwise has evolved well past the one in Gridgen) some of the data translation between the two programs is lossy. One particular example is the representation of revolved or cylindrical geometry. “Round tripping,” the moving of data back and forth between the two programs will only accumulate these types of problems.

But there are instances where you have an old Gridgen (.gg) file that you want to bring in to Pointwise and that is easily done with File, Import, Grid.

When you want to go from Pointwise to Gridgen, use the File, Export to Gridgen command.

## The Pointwise Project File

The Pointwise project file (.pw) contains everything about your mesh project including the geometry it was generated on and around (i.e. the database), all the meshes, and the settings of the various methods and techniques you have applied.

### Save

For small meshes or those that you have scripted it is possible to go from CAD geometry to CFD solver formatted mesh without saving a project file. However, for the vast majority of your work you are going to save a project file.

To save a Pointwise Project file just press Ctrl+S or use File, Save. If you want to save the project to a new file name, use File, Save As.

### Open

When you come back and continue working on your mesh, use File, Open to load your Pointwise Project and continue working.

You may have noticed that the Pointwise Project file name appears in the window's title bar (Figure 10). An asterisk after the name indicates that something has been changed and exiting Pointwise without saving a new project file will lose some data.

Figure 10: Your Pointwise Project file name appears in the title bar.

Another feature of working with Pointwise Project files is that you can append several of them together. If you and a colleague split a grid in half and each work on your own half, you can bring them together by opening the two files and appending them using the Open command (Figure 11).

Figure 11: You can bring together two projects by opening both and using this dialog to append them.

### Save Just a Portion of your Project

As mentioned above, the Pointwise Project file contains everything related to your mesh.

But there are times when you want to save just a portion of it. For example, you could be working on a mesh that shares some baseline components with other meshes you will need to make later.

You can select those baseline or common entities (usually the volume grids) and the File, Save Selection As command will export those entities and everything on which they depend to a Pointwise Project file.

### Save the Environment

When it comes to meshing, saving the environment has nothing to do with recycling and riding your bike to work. Instead it means that once you have setup Pointwise the way you like to use it, those settings (i.e. your meshing environment) can be saved to a PW file.

The Pointwise Project file written by Save Environment contains neither database nor grid entities. But it does contain the following information.

• Model size and tolerances
• All settings from the Defaults panel
• Layer numbers and descriptions
• Current and saved views, view type, light source type and position, settings for Show Type
• Saved cuts and rules from Examine
• Default grid type
• T-Rex boundary conditions
• Current CAE solver, dimension, and attributes
• CAE boundary and volume conditions

Instead of starting from a blank screen and having to recreate all your favorite settings, just use Open Environment to start a new grid with everything setup exactly how you like it.

## There Are Two More

There is one other command in Pointwise where data can be exported to two different types of files. If you know what that command is or what those files are, be the first to identify it in the comments below and we will send you a special prize for being a Pointwise I/O expert.

## Try All This Reading and Writing Yourself

If you are ready to import your CAD file and export a CFD-ready mesh, now is the time to request a no-obligation evaluation license for Pointwise. Simply complete a brief form and one of our engineers will follow-up to get the evaluation started.

## References

1. Analytic vs. Discrete Geometry, The Connector, Sep/Oct 2012, http://ptwi.se/1fKK68p.
2. Nigel Taylor, Industrial Perspectives on Geometry Handling for Aerodynamics, AIAA paper no. 2015-3408.
3. Technische Universitat Munchen, DrivAer Model, http://www.aer.mw.tum.de/en/research-groups/automotive/drivaer/.
4. CFD General Notation System, http://cgns.github.io/.
5. STL File Format, https://en.wikipedia.org/wiki/STL_(file_format).
6. Pointwise CAE Plugin SDK, http://www.pointwise.com/plugins/html/index.html.
7. Interface with the World Using CAE Plugins, The Connector, Sep/Oct 2012 Issue, http://ptwi.se/1UksDBt.